서예진

final commit

Showing 1000 changed files with 4526 additions and 1149 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

app.js 100644 → 100755
...@@ -10,6 +10,8 @@ require('dotenv').config(); ...@@ -10,6 +10,8 @@ require('dotenv').config();
10 const indexRouter = require('./routes/index'); 10 const indexRouter = require('./routes/index');
11 const authRouter = require('./routes/auth'); 11 const authRouter = require('./routes/auth');
12 const { sequelize } = require('./models'); 12 const { sequelize } = require('./models');
13 +
14 +//checkAuction서버에 연결
13 const passportConfig = require('./passport'); 15 const passportConfig = require('./passport');
14 const sse = require('./sse'); 16 const sse = require('./sse');
15 const webSocket = require('./socket'); 17 const webSocket = require('./socket');
......
1 +//node-schedulr 패키지는 스케줄링이 노드 기반으로 작동하므로 노드가 종료되면 스케줄 예약도 같이 종료됨
2 +//이를 보완하기 위하여, 서버가 시작될 때 경매 시작 후 24시간이 지났지만 낙찰자는 없는 경매를 찾아서 낙찰자를 지정
3 +
1 const { Good, Auction, User, sequelize } = require('./models'); 4 const { Good, Auction, User, sequelize } = require('./models');
2 5
3 module.exports = async () => { 6 module.exports = async () => {
...@@ -6,10 +9,18 @@ module.exports = async () => { ...@@ -6,10 +9,18 @@ module.exports = async () => {
6 yesterday.setDate(yesterday.getDate() - 1); 9 yesterday.setDate(yesterday.getDate() - 1);
7 const targets = await Good.findAll({ 10 const targets = await Good.findAll({
8 where: { 11 where: {
9 - soldId: null, 12 + [sequelize.Op.and]:[
10 - createdAt: { $lte: yesterday }, 13 + {
14 + soldId: {
15 + [sequelize.Op.eq]:null
16 + }
17 + },
18 + {
19 + createdAt: { [sequelize.Op.lte]: yesterday }
20 + }]
11 }, 21 },
12 }); 22 });
23 + console.log(targets)
13 targets.forEach(async (target) => { 24 targets.forEach(async (target) => {
14 const success = await Auction.find({ 25 const success = await Auction.find({
15 where: { goodId: target.id }, 26 where: { goodId: target.id },
......
1 { 1 {
2 "development": { 2 "development": {
3 "username": "root", 3 "username": "root",
4 - "password": "sorkdPwlsdlek98!", 4 + "password": "1234",
5 - "database": "nodeauction", 5 + "database": "mydb",
6 "host": "127.0.0.1", 6 "host": "127.0.0.1",
7 "dialect": "mysql", 7 "dialect": "mysql",
8 "operatorsAliases": false 8 "operatorsAliases": false
......
File mode changed
File mode changed
1 +//사용자가 입찰을 여러 번 할 수 있으므로 사용자 모델과 경매 모델은 일대다 관계
2 +//한 상품에 여러 명이 입찰하므로 상품 모델과 경매 모델도 일대다 관계
3 +//사용자 모델과 상품 모델 간에는 일대다 관계가 두 번 적용됨
4 +//두 관계를 구별하기 위해 as 속성에 owner, sold으로 관계명 적어줌
5 +
1 const Sequelize = require('sequelize'); 6 const Sequelize = require('sequelize');
2 7
3 const env = process.env.NODE_ENV || 'development'; 8 const env = process.env.NODE_ENV || 'development';
......
File mode changed
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../acorn/bin/acorn" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../acorn/bin/acorn
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\acorn\bin\acorn" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../acorn/bin/acorn" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../atob/bin/atob.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../atob/bin/atob.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../atob/bin/atob.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\atob\bin\atob.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../atob/bin/atob.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../atob/bin/atob.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../babylon/bin/babylon.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../babylon/bin/babylon.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../babylon/bin/babylon.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\babylon\bin\babylon.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../babylon/bin/babylon.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../babylon/bin/babylon.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../detect-libc/bin/detect-libc.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../detect-libc/bin/detect-libc.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../detect-libc/bin/detect-libc.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\detect-libc\bin\detect-libc.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../detect-libc/bin/detect-libc.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../detect-libc/bin/detect-libc.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../electron-rebuild/lib/src/cli.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../electron-rebuild/lib/src/cli.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../is-ci/bin.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../is-ci/bin.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../is-ci/bin.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\is-ci\bin.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../is-ci/bin.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../is-ci/bin.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../mime/cli.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../mime/cli.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../mime/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\mime\cli.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../mime/cli.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../mime/cli.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../mkdirp/bin/cmd.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../mkdirp/bin/cmd.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../needle/bin/needle" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../needle/bin/needle" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../needle/bin/needle
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\needle\bin\needle" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../needle/bin/needle" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../needle/bin/needle" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../node-pre-gyp/bin/node-pre-gyp" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../node-pre-gyp/bin/node-pre-gyp" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../node-pre-gyp/bin/node-pre-gyp
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\node-pre-gyp\bin\node-pre-gyp" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../node-pre-gyp/bin/node-pre-gyp" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../node-pre-gyp/bin/node-pre-gyp" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../nodemon/bin/nodemon.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../nodemon/bin/nodemon.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../nodemon/bin/nodemon.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\nodemon\bin\nodemon.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../touch/bin/nodetouch.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../touch/bin/nodetouch.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../touch/bin/nodetouch.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\touch\bin\nodetouch.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../nopt/bin/nopt.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../nopt/bin/nopt.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\nopt\bin\nopt.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../nopt/bin/nopt.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../rc/cli.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../rc/cli.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../rc/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\rc\cli.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../rc/cli.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../rc/cli.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../rimraf/bin.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../rimraf/bin.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../rimraf/bin.js
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\rimraf\bin.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../rimraf/bin.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../semver/bin/semver" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../semver/bin/semver" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../semver/bin/semver
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\semver\bin\semver" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../semver/bin/semver" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-conv" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../sshpk/bin/sshpk-conv" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-sign" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../sshpk/bin/sshpk-sign" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-verify" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../sshpk/bin/sshpk-verify" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../uglify-js/bin/uglifyjs" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../uglify-js/bin/uglifyjs" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../uglify-js/bin/uglifyjs
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\uglify-js\bin\uglifyjs" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../uglify-js/bin/uglifyjs" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../uuid/bin/uuid" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../uuid/bin/uuid" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../uuid/bin/uuid
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\uuid\bin\uuid" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../uuid/bin/uuid" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../uuid/bin/uuid" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../which/bin/which" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../which/bin/which" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../which/bin/which
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\which\bin\which" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../which/bin/which" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../which/bin/which" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
File mode changed
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
2 > `npm install --save @types/node` 2 > `npm install --save @types/node`
3 3
4 # Summary 4 # Summary
5 -This package contains type definitions for Node.js ( http://nodejs.org/ ). 5 +This package contains type definitions for Node.js (http://nodejs.org/).
6 6
7 # Details 7 # Details
8 -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node 8 +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9 9
10 -Additional Details 10 +### Additional Details
11 - * Last updated: Tue, 26 Mar 2019 20:23:36 GMT 11 + * Last updated: Mon, 25 Nov 2019 22:58:16 GMT
12 * Dependencies: none 12 * Dependencies: none
13 - * Global values: Buffer, NodeJS, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, queueMicrotask, require, setImmediate, setInterval, setTimeout 13 + * Global values: `Buffer`, `NodeJS`, `Symbol`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14 14
15 # Credits 15 # Credits
16 -These definitions were written by Microsoft TypeScript <https://github.com/Microsoft>, DefinitelyTyped <https://github.com/DefinitelyTyped>, Alberto Schiabel <https://github.com/jkomyno>, Alexander T. <https://github.com/a-tarasyuk>, Alvis HT Tang <https://github.com/alvis>, Andrew Makarov <https://github.com/r3nya>, Benjamin Toueg <https://github.com/btoueg>, Bruno Scheufler <https://github.com/brunoscheufler>, Chigozirim C. <https://github.com/smac89>, Christian Vaagland Tellnes <https://github.com/tellnes>, David Junger <https://github.com/touffy>, Deividas Bakanas <https://github.com/DeividasBakanas>, Eugene Y. Q. Shen <https://github.com/eyqs>, Flarna <https://github.com/Flarna>, Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>, Hoàng Văn Khải <https://github.com/KSXGitHub>, 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>, Matthieu Sieben <https://github.com/matthieusieben>, Mohsen Azimi <https://github.com/mohsen1>, Nicolas Even <https://github.com/n-e>, Nicolas Voigt <https://github.com/octo-sniffle>, Parambir Singh <https://github.com/parambirs>, Sebastian Silbermann <https://github.com/eps1lon>, Simon Schick <https://github.com/SimonSchick>, Thomas den Hollander <https://github.com/ThomasdenH>, Wilco Bakker <https://github.com/WilcoBakker>, wwwy3y3 <https://github.com/wwwy3y3>, Zane Hannan AU <https://github.com/ZaneHannanAU>, Jeremie Rodriguez <https://github.com/jeremiergz>, Samuel Ainsworth <https://github.com/samuela>, Kyle Uehlein <https://github.com/kuehlein>, Jordi Oliveras Rovira <https://github.com/j-oliveras>, Thanik Bhongbhibhat <https://github.com/bhongy>. 16 +These definitions were written by Microsoft TypeScript (https://github.com/Microsoft), DefinitelyTyped (https://github.com/DefinitelyTyped), Alberto Schiabel (https://github.com/jkomyno), Alexander T. (https://github.com/a-tarasyuk), Alvis HT Tang (https://github.com/alvis), Andrew Makarov (https://github.com/r3nya), Benjamin Toueg (https://github.com/btoueg), Bruno Scheufler (https://github.com/brunoscheufler), Chigozirim C. (https://github.com/smac89), Christian Vaagland Tellnes (https://github.com/tellnes), David Junger (https://github.com/touffy), Deividas Bakanas (https://github.com/DeividasBakanas), Eugene Y. Q. Shen (https://github.com/eyqs), Flarna (https://github.com/Flarna), Hannes Magnusson (https://github.com/Hannes-Magnusson-CK), Hoàng Văn Khải (https://github.com/KSXGitHub), 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), Nicolas Voigt (https://github.com/octo-sniffle), Nikita Galkin (https://github.com/galkin), Parambir Singh (https://github.com/parambirs), Sebastian Silbermann (https://github.com/eps1lon), Simon Schick (https://github.com/SimonSchick), Thomas den Hollander (https://github.com/ThomasdenH), Wilco Bakker (https://github.com/WilcoBakker), wwwy3y3 (https://github.com/wwwy3y3), Zane Hannan AU (https://github.com/ZaneHannanAU), Samuel Ainsworth (https://github.com/samuela), Kyle Uehlein (https://github.com/kuehlein), Jordi Oliveras Rovira (https://github.com/j-oliveras), Thanik Bhongbhibhat (https://github.com/bhongy), Marcin Kopacz (https://github.com/chyzwar), Trivikram Kamat (https://github.com/trivikr), Minh Son Nguyen (https://github.com/nguymin4), Junxiao Shi (https://github.com/yoursunny), and Ilia Baryshnikov (https://github.com/qwelias).
......
...@@ -20,13 +20,9 @@ declare module "assert" { ...@@ -20,13 +20,9 @@ declare module "assert" {
20 /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ 20 /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
21 function fail(actual: any, expected: any, message?: string | Error, operator?: string, stackStartFn?: Function): never; 21 function fail(actual: any, expected: any, message?: string | Error, operator?: string, stackStartFn?: Function): never;
22 function ok(value: any, message?: string | Error): void; 22 function ok(value: any, message?: string | Error): void;
23 - /** @deprecated since v9.9.0 - use strictEqual() instead. */
24 function equal(actual: any, expected: any, message?: string | Error): void; 23 function equal(actual: any, expected: any, message?: string | Error): void;
25 - /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
26 function notEqual(actual: any, expected: any, message?: string | Error): void; 24 function notEqual(actual: any, expected: any, message?: string | Error): void;
27 - /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
28 function deepEqual(actual: any, expected: any, message?: string | Error): void; 25 function deepEqual(actual: any, expected: any, message?: string | Error): void;
29 - /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
30 function notDeepEqual(actual: any, expected: any, message?: string | Error): void; 26 function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
31 function strictEqual(actual: any, expected: any, message?: string | Error): void; 27 function strictEqual(actual: any, expected: any, message?: string | Error): void;
32 function notStrictEqual(actual: any, expected: any, message?: string | Error): void; 28 function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
......
...@@ -102,18 +102,6 @@ declare module "async_hooks" { ...@@ -102,18 +102,6 @@ declare module "async_hooks" {
102 constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions); 102 constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
103 103
104 /** 104 /**
105 - * Call AsyncHooks before callbacks.
106 - * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
107 - */
108 - emitBefore(): void;
109 -
110 - /**
111 - * Call AsyncHooks after callbacks.
112 - * @deprecated since 9.6 - Use asyncResource.runInAsyncScope() instead.
113 - */
114 - emitAfter(): void;
115 -
116 - /**
117 * Call the provided function with the provided arguments in the 105 * Call the provided function with the provided arguments in the
118 * execution context of the async resource. This will establish the 106 * execution context of the async resource. This will establish the
119 * context, trigger the AsyncHooks before callbacks, call the function, 107 * context, trigger the AsyncHooks before callbacks, call the function,
......
1 declare module "buffer" { 1 declare module "buffer" {
2 export const INSPECT_MAX_BYTES: number; 2 export const INSPECT_MAX_BYTES: number;
3 + export const kMaxLength: number;
4 + export const kStringMaxLength: number;
5 + export const constants: {
6 + MAX_LENGTH: number;
7 + MAX_STRING_LENGTH: number;
8 + };
3 const BuffType: typeof Buffer; 9 const BuffType: typeof Buffer;
4 10
5 export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary"; 11 export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
6 12
7 - export function transcode(source: Buffer | Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; 13 + export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
8 14
9 export const SlowBuffer: { 15 export const SlowBuffer: {
10 /** @deprecated since v6.0.0, use Buffer.allocUnsafeSlow() */ 16 /** @deprecated since v6.0.0, use Buffer.allocUnsafeSlow() */
......
...@@ -18,10 +18,10 @@ declare module "child_process" { ...@@ -18,10 +18,10 @@ declare module "child_process" {
18 readonly killed: boolean; 18 readonly killed: boolean;
19 readonly pid: number; 19 readonly pid: number;
20 readonly connected: boolean; 20 readonly connected: boolean;
21 - kill(signal?: string): void; 21 + kill(signal?: NodeJS.Signals | number): void;
22 - send(message: any, callback?: (error: Error) => void): boolean; 22 + send(message: any, callback?: (error: Error | null) => void): boolean;
23 - send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error) => void): boolean; 23 + send(message: any, sendHandle?: net.Socket | net.Server, callback?: (error: Error | null) => void): boolean;
24 - send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error) => void): boolean; 24 + send(message: any, sendHandle?: net.Socket | net.Server, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
25 disconnect(): void; 25 disconnect(): void;
26 unref(): void; 26 unref(): void;
27 ref(): void; 27 ref(): void;
...@@ -36,48 +36,80 @@ declare module "child_process" { ...@@ -36,48 +36,80 @@ declare module "child_process" {
36 */ 36 */
37 37
38 addListener(event: string, listener: (...args: any[]) => void): this; 38 addListener(event: string, listener: (...args: any[]) => void): this;
39 - addListener(event: "close", listener: (code: number, signal: string) => void): this; 39 + addListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
40 addListener(event: "disconnect", listener: () => void): this; 40 addListener(event: "disconnect", listener: () => void): this;
41 addListener(event: "error", listener: (err: Error) => void): this; 41 addListener(event: "error", listener: (err: Error) => void): this;
42 - addListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this; 42 + addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
43 addListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; 43 addListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
44 44
45 emit(event: string | symbol, ...args: any[]): boolean; 45 emit(event: string | symbol, ...args: any[]): boolean;
46 - emit(event: "close", code: number, signal: string): boolean; 46 + emit(event: "close", code: number, signal: NodeJS.Signals): boolean;
47 emit(event: "disconnect"): boolean; 47 emit(event: "disconnect"): boolean;
48 emit(event: "error", err: Error): boolean; 48 emit(event: "error", err: Error): boolean;
49 - emit(event: "exit", code: number | null, signal: string | null): boolean; 49 + emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
50 emit(event: "message", message: any, sendHandle: net.Socket | net.Server): boolean; 50 emit(event: "message", message: any, sendHandle: net.Socket | net.Server): boolean;
51 51
52 on(event: string, listener: (...args: any[]) => void): this; 52 on(event: string, listener: (...args: any[]) => void): this;
53 - on(event: "close", listener: (code: number, signal: string) => void): this; 53 + on(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
54 on(event: "disconnect", listener: () => void): this; 54 on(event: "disconnect", listener: () => void): this;
55 on(event: "error", listener: (err: Error) => void): this; 55 on(event: "error", listener: (err: Error) => void): this;
56 - on(event: "exit", listener: (code: number | null, signal: string | null) => void): this; 56 + on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
57 on(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; 57 on(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
58 58
59 once(event: string, listener: (...args: any[]) => void): this; 59 once(event: string, listener: (...args: any[]) => void): this;
60 - once(event: "close", listener: (code: number, signal: string) => void): this; 60 + once(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
61 once(event: "disconnect", listener: () => void): this; 61 once(event: "disconnect", listener: () => void): this;
62 once(event: "error", listener: (err: Error) => void): this; 62 once(event: "error", listener: (err: Error) => void): this;
63 - once(event: "exit", listener: (code: number | null, signal: string | null) => void): this; 63 + once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
64 once(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; 64 once(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
65 65
66 prependListener(event: string, listener: (...args: any[]) => void): this; 66 prependListener(event: string, listener: (...args: any[]) => void): this;
67 - prependListener(event: "close", listener: (code: number, signal: string) => void): this; 67 + prependListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
68 prependListener(event: "disconnect", listener: () => void): this; 68 prependListener(event: "disconnect", listener: () => void): this;
69 prependListener(event: "error", listener: (err: Error) => void): this; 69 prependListener(event: "error", listener: (err: Error) => void): this;
70 - prependListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this; 70 + prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
71 prependListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; 71 prependListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
72 72
73 prependOnceListener(event: string, listener: (...args: any[]) => void): this; 73 prependOnceListener(event: string, listener: (...args: any[]) => void): this;
74 - prependOnceListener(event: "close", listener: (code: number, signal: string) => void): this; 74 + prependOnceListener(event: "close", listener: (code: number, signal: NodeJS.Signals) => void): this;
75 prependOnceListener(event: "disconnect", listener: () => void): this; 75 prependOnceListener(event: "disconnect", listener: () => void): this;
76 prependOnceListener(event: "error", listener: (err: Error) => void): this; 76 prependOnceListener(event: "error", listener: (err: Error) => void): this;
77 - prependOnceListener(event: "exit", listener: (code: number | null, signal: string | null) => void): this; 77 + prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
78 prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this; 78 prependOnceListener(event: "message", listener: (message: any, sendHandle: net.Socket | net.Server) => void): this;
79 } 79 }
80 80
81 + // return this object when stdio option is undefined or not specified
82 + interface ChildProcessWithoutNullStreams extends ChildProcess {
83 + stdin: Writable;
84 + stdout: Readable;
85 + stderr: Readable;
86 + readonly stdio: [
87 + Writable, // stdin
88 + Readable, // stdout
89 + Readable, // stderr
90 + Readable | Writable | null | undefined, // extra, no modification
91 + Readable | Writable | null | undefined // extra, no modification
92 + ];
93 + }
94 +
95 + // return this object when stdio option is a tuple of 3
96 + interface ChildProcessByStdio<
97 + I extends null | Writable,
98 + O extends null | Readable,
99 + E extends null | Readable,
100 + > extends ChildProcess {
101 + stdin: I;
102 + stdout: O;
103 + stderr: E;
104 + readonly stdio: [
105 + I,
106 + O,
107 + E,
108 + Readable | Writable | null | undefined, // extra, no modification
109 + Readable | Writable | null | undefined // extra, no modification
110 + ];
111 + }
112 +
81 interface MessageOptions { 113 interface MessageOptions {
82 keepOpen?: boolean; 114 keepOpen?: boolean;
83 } 115 }
...@@ -110,13 +142,109 @@ declare module "child_process" { ...@@ -110,13 +142,109 @@ declare module "child_process" {
110 windowsVerbatimArguments?: boolean; 142 windowsVerbatimArguments?: boolean;
111 } 143 }
112 144
113 - function spawn(command: string, options?: SpawnOptions): ChildProcess; 145 + interface SpawnOptionsWithoutStdio extends SpawnOptions {
114 - function spawn(command: string, args?: ReadonlyArray<string>, options?: SpawnOptions): ChildProcess; 146 + stdio?: 'pipe' | Array<null | undefined | 'pipe'>;
147 + }
148 +
149 + type StdioNull = 'inherit' | 'ignore' | Stream;
150 + type StdioPipe = undefined | null | 'pipe';
151 +
152 + interface SpawnOptionsWithStdioTuple<
153 + Stdin extends StdioNull | StdioPipe,
154 + Stdout extends StdioNull | StdioPipe,
155 + Stderr extends StdioNull | StdioPipe,
156 + > extends SpawnOptions {
157 + stdio: [Stdin, Stdout, Stderr];
158 + }
159 +
160 + // overloads of spawn without 'args'
161 + function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
162 +
163 + function spawn(
164 + command: string,
165 + options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
166 + ): ChildProcessByStdio<Writable, Readable, Readable>;
167 + function spawn(
168 + command: string,
169 + options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
170 + ): ChildProcessByStdio<Writable, Readable, null>;
171 + function spawn(
172 + command: string,
173 + options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
174 + ): ChildProcessByStdio<Writable, null, Readable>;
175 + function spawn(
176 + command: string,
177 + options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
178 + ): ChildProcessByStdio<null, Readable, Readable>;
179 + function spawn(
180 + command: string,
181 + options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
182 + ): ChildProcessByStdio<Writable, null, null>;
183 + function spawn(
184 + command: string,
185 + options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
186 + ): ChildProcessByStdio<null, Readable, null>;
187 + function spawn(
188 + command: string,
189 + options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
190 + ): ChildProcessByStdio<null, null, Readable>;
191 + function spawn(
192 + command: string,
193 + options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
194 + ): ChildProcessByStdio<null, null, null>;
195 +
196 + function spawn(command: string, options: SpawnOptions): ChildProcess;
197 +
198 + // overloads of spawn with 'args'
199 + function spawn(command: string, args?: ReadonlyArray<string>, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
200 +
201 + function spawn(
202 + command: string,
203 + args: ReadonlyArray<string>,
204 + options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
205 + ): ChildProcessByStdio<Writable, Readable, Readable>;
206 + function spawn(
207 + command: string,
208 + args: ReadonlyArray<string>,
209 + options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
210 + ): ChildProcessByStdio<Writable, Readable, null>;
211 + function spawn(
212 + command: string,
213 + args: ReadonlyArray<string>,
214 + options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
215 + ): ChildProcessByStdio<Writable, null, Readable>;
216 + function spawn(
217 + command: string,
218 + args: ReadonlyArray<string>,
219 + options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
220 + ): ChildProcessByStdio<null, Readable, Readable>;
221 + function spawn(
222 + command: string,
223 + args: ReadonlyArray<string>,
224 + options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
225 + ): ChildProcessByStdio<Writable, null, null>;
226 + function spawn(
227 + command: string,
228 + args: ReadonlyArray<string>,
229 + options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
230 + ): ChildProcessByStdio<null, Readable, null>;
231 + function spawn(
232 + command: string,
233 + args: ReadonlyArray<string>,
234 + options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
235 + ): ChildProcessByStdio<null, null, Readable>;
236 + function spawn(
237 + command: string,
238 + args: ReadonlyArray<string>,
239 + options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
240 + ): ChildProcessByStdio<null, null, null>;
241 +
242 + function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
115 243
116 interface ExecOptions extends CommonOptions { 244 interface ExecOptions extends CommonOptions {
117 shell?: string; 245 shell?: string;
118 maxBuffer?: number; 246 maxBuffer?: number;
119 - killSignal?: string; 247 + killSignal?: NodeJS.Signals | number;
120 } 248 }
121 249
122 interface ExecOptionsWithStringEncoding extends ExecOptions { 250 interface ExecOptionsWithStringEncoding extends ExecOptions {
...@@ -131,7 +259,7 @@ declare module "child_process" { ...@@ -131,7 +259,7 @@ declare module "child_process" {
131 cmd?: string; 259 cmd?: string;
132 killed?: boolean; 260 killed?: boolean;
133 code?: number; 261 code?: number;
134 - signal?: string; 262 + signal?: NodeJS.Signals;
135 } 263 }
136 264
137 // no `options` definitely means stdout/stderr are `string`. 265 // no `options` definitely means stdout/stderr are `string`.
...@@ -157,19 +285,24 @@ declare module "child_process" { ...@@ -157,19 +285,24 @@ declare module "child_process" {
157 callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, 285 callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
158 ): ChildProcess; 286 ): ChildProcess;
159 287
288 + interface PromiseWithChild<T> extends Promise<T> {
289 + child: ChildProcess;
290 + }
291 +
160 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 292 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
161 namespace exec { 293 namespace exec {
162 - function __promisify__(command: string): Promise<{ stdout: string, stderr: string }>; 294 + function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>;
163 - function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): Promise<{ stdout: Buffer, stderr: Buffer }>; 295 + function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
164 - function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<{ stdout: string, stderr: string }>; 296 + function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
165 - function __promisify__(command: string, options: ExecOptions): Promise<{ stdout: string, stderr: string }>; 297 + function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
166 - function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>; 298 + function __promisify__(command: string, options?: ({ encoding?: string | null } & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
167 } 299 }
168 300
169 interface ExecFileOptions extends CommonOptions { 301 interface ExecFileOptions extends CommonOptions {
170 maxBuffer?: number; 302 maxBuffer?: number;
171 - killSignal?: string; 303 + killSignal?: NodeJS.Signals | number;
172 windowsVerbatimArguments?: boolean; 304 windowsVerbatimArguments?: boolean;
305 + shell?: boolean | string;
173 } 306 }
174 interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { 307 interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
175 encoding: BufferEncoding; 308 encoding: BufferEncoding;
...@@ -241,22 +374,22 @@ declare module "child_process" { ...@@ -241,22 +374,22 @@ declare module "child_process" {
241 374
242 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 375 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
243 namespace execFile { 376 namespace execFile {
244 - function __promisify__(file: string): Promise<{ stdout: string, stderr: string }>; 377 + function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
245 - function __promisify__(file: string, args: string[] | undefined | null): Promise<{ stdout: string, stderr: string }>; 378 + function __promisify__(file: string, args: string[] | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
246 - function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): Promise<{ stdout: Buffer, stderr: Buffer }>; 379 + function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
247 - function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): Promise<{ stdout: Buffer, stderr: Buffer }>; 380 + function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
248 - function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): Promise<{ stdout: string, stderr: string }>; 381 + function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
249 - function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): Promise<{ stdout: string, stderr: string }>; 382 + function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
250 - function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>; 383 + function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
251 - function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>; 384 + function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
252 - function __promisify__(file: string, options: ExecFileOptions): Promise<{ stdout: string, stderr: string }>; 385 + function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
253 - function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): Promise<{ stdout: string, stderr: string }>; 386 + function __promisify__(file: string, args: string[] | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
254 - function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>; 387 + function __promisify__(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
255 function __promisify__( 388 function __promisify__(
256 file: string, 389 file: string,
257 args: string[] | undefined | null, 390 args: string[] | undefined | null,
258 options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, 391 options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null,
259 - ): Promise<{ stdout: string | Buffer, stderr: string | Buffer }>; 392 + ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
260 } 393 }
261 394
262 interface ForkOptions extends ProcessEnvOptions { 395 interface ForkOptions extends ProcessEnvOptions {
...@@ -271,9 +404,9 @@ declare module "child_process" { ...@@ -271,9 +404,9 @@ declare module "child_process" {
271 404
272 interface SpawnSyncOptions extends CommonOptions { 405 interface SpawnSyncOptions extends CommonOptions {
273 argv0?: string; // Not specified in the docs 406 argv0?: string; // Not specified in the docs
274 - input?: string | Buffer | NodeJS.TypedArray | DataView; 407 + input?: string | NodeJS.ArrayBufferView;
275 stdio?: StdioOptions; 408 stdio?: StdioOptions;
276 - killSignal?: string | number; 409 + killSignal?: NodeJS.Signals | number;
277 maxBuffer?: number; 410 maxBuffer?: number;
278 encoding?: string; 411 encoding?: string;
279 shell?: boolean | string; 412 shell?: boolean | string;
...@@ -290,8 +423,8 @@ declare module "child_process" { ...@@ -290,8 +423,8 @@ declare module "child_process" {
290 output: string[]; 423 output: string[];
291 stdout: T; 424 stdout: T;
292 stderr: T; 425 stderr: T;
293 - status: number; 426 + status: number | null;
294 - signal: string; 427 + signal: NodeJS.Signals | null;
295 error?: Error; 428 error?: Error;
296 } 429 }
297 function spawnSync(command: string): SpawnSyncReturns<Buffer>; 430 function spawnSync(command: string): SpawnSyncReturns<Buffer>;
...@@ -303,10 +436,10 @@ declare module "child_process" { ...@@ -303,10 +436,10 @@ declare module "child_process" {
303 function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>; 436 function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
304 437
305 interface ExecSyncOptions extends CommonOptions { 438 interface ExecSyncOptions extends CommonOptions {
306 - input?: string | Buffer | Uint8Array; 439 + input?: string | Uint8Array;
307 stdio?: StdioOptions; 440 stdio?: StdioOptions;
308 shell?: string; 441 shell?: string;
309 - killSignal?: string | number; 442 + killSignal?: NodeJS.Signals | number;
310 maxBuffer?: number; 443 maxBuffer?: number;
311 encoding?: string; 444 encoding?: string;
312 } 445 }
...@@ -322,9 +455,9 @@ declare module "child_process" { ...@@ -322,9 +455,9 @@ declare module "child_process" {
322 function execSync(command: string, options?: ExecSyncOptions): Buffer; 455 function execSync(command: string, options?: ExecSyncOptions): Buffer;
323 456
324 interface ExecFileSyncOptions extends CommonOptions { 457 interface ExecFileSyncOptions extends CommonOptions {
325 - input?: string | Buffer | NodeJS.TypedArray | DataView; 458 + input?: string | NodeJS.ArrayBufferView;
326 stdio?: StdioOptions; 459 stdio?: StdioOptions;
327 - killSignal?: string | number; 460 + killSignal?: NodeJS.Signals | number;
328 maxBuffer?: number; 461 maxBuffer?: number;
329 encoding?: string; 462 encoding?: string;
330 shell?: boolean | string; 463 shell?: boolean | string;
......
...@@ -24,7 +24,7 @@ declare module "cluster" { ...@@ -24,7 +24,7 @@ declare module "cluster" {
24 class Worker extends events.EventEmitter { 24 class Worker extends events.EventEmitter {
25 id: number; 25 id: number;
26 process: child.ChildProcess; 26 process: child.ChildProcess;
27 - send(message: any, sendHandle?: any, callback?: (error: Error) => void): boolean; 27 + send(message: any, sendHandle?: any, callback?: (error: Error | null) => void): boolean;
28 kill(signal?: string): void; 28 kill(signal?: string): void;
29 destroy(signal?: string): void; 29 destroy(signal?: string): void;
30 disconnect(): void; 30 disconnect(): void;
......
1 +/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
1 declare module "constants" { 2 declare module "constants" {
3 + /** @deprecated since v6.3.0 - use `os.constants.errno.E2BIG` instead. */
2 const E2BIG: number; 4 const E2BIG: number;
5 + /** @deprecated since v6.3.0 - use `os.constants.errno.EACCES` instead. */
3 const EACCES: number; 6 const EACCES: number;
7 + /** @deprecated since v6.3.0 - use `os.constants.errno.EADDRINUSE` instead. */
4 const EADDRINUSE: number; 8 const EADDRINUSE: number;
9 + /** @deprecated since v6.3.0 - use `os.constants.errno.EADDRNOTAVAIL` instead. */
5 const EADDRNOTAVAIL: number; 10 const EADDRNOTAVAIL: number;
11 + /** @deprecated since v6.3.0 - use `os.constants.errno.EAFNOSUPPORT` instead. */
6 const EAFNOSUPPORT: number; 12 const EAFNOSUPPORT: number;
13 + /** @deprecated since v6.3.0 - use `os.constants.errno.EAGAIN` instead. */
7 const EAGAIN: number; 14 const EAGAIN: number;
15 + /** @deprecated since v6.3.0 - use `os.constants.errno.EALREADY` instead. */
8 const EALREADY: number; 16 const EALREADY: number;
17 + /** @deprecated since v6.3.0 - use `os.constants.errno.EBADF` instead. */
9 const EBADF: number; 18 const EBADF: number;
19 + /** @deprecated since v6.3.0 - use `os.constants.errno.EBADMSG` instead. */
10 const EBADMSG: number; 20 const EBADMSG: number;
21 + /** @deprecated since v6.3.0 - use `os.constants.errno.EBUSY` instead. */
11 const EBUSY: number; 22 const EBUSY: number;
23 + /** @deprecated since v6.3.0 - use `os.constants.errno.ECANCELED` instead. */
12 const ECANCELED: number; 24 const ECANCELED: number;
25 + /** @deprecated since v6.3.0 - use `os.constants.errno.ECHILD` instead. */
13 const ECHILD: number; 26 const ECHILD: number;
27 + /** @deprecated since v6.3.0 - use `os.constants.errno.ECONNABORTED` instead. */
14 const ECONNABORTED: number; 28 const ECONNABORTED: number;
29 + /** @deprecated since v6.3.0 - use `os.constants.errno.ECONNREFUSED` instead. */
15 const ECONNREFUSED: number; 30 const ECONNREFUSED: number;
31 + /** @deprecated since v6.3.0 - use `os.constants.errno.ECONNRESET` instead. */
16 const ECONNRESET: number; 32 const ECONNRESET: number;
33 + /** @deprecated since v6.3.0 - use `os.constants.errno.EDEADLK` instead. */
17 const EDEADLK: number; 34 const EDEADLK: number;
35 + /** @deprecated since v6.3.0 - use `os.constants.errno.EDESTADDRREQ` instead. */
18 const EDESTADDRREQ: number; 36 const EDESTADDRREQ: number;
37 + /** @deprecated since v6.3.0 - use `os.constants.errno.EDOM` instead. */
19 const EDOM: number; 38 const EDOM: number;
39 + /** @deprecated since v6.3.0 - use `os.constants.errno.EEXIST` instead. */
20 const EEXIST: number; 40 const EEXIST: number;
41 + /** @deprecated since v6.3.0 - use `os.constants.errno.EFAULT` instead. */
21 const EFAULT: number; 42 const EFAULT: number;
43 + /** @deprecated since v6.3.0 - use `os.constants.errno.EFBIG` instead. */
22 const EFBIG: number; 44 const EFBIG: number;
45 + /** @deprecated since v6.3.0 - use `os.constants.errno.EHOSTUNREACH` instead. */
23 const EHOSTUNREACH: number; 46 const EHOSTUNREACH: number;
47 + /** @deprecated since v6.3.0 - use `os.constants.errno.EIDRM` instead. */
24 const EIDRM: number; 48 const EIDRM: number;
49 + /** @deprecated since v6.3.0 - use `os.constants.errno.EILSEQ` instead. */
25 const EILSEQ: number; 50 const EILSEQ: number;
51 + /** @deprecated since v6.3.0 - use `os.constants.errno.EINPROGRESS` instead. */
26 const EINPROGRESS: number; 52 const EINPROGRESS: number;
53 + /** @deprecated since v6.3.0 - use `os.constants.errno.EINTR` instead. */
27 const EINTR: number; 54 const EINTR: number;
55 + /** @deprecated since v6.3.0 - use `os.constants.errno.EINVAL` instead. */
28 const EINVAL: number; 56 const EINVAL: number;
57 + /** @deprecated since v6.3.0 - use `os.constants.errno.EIO` instead. */
29 const EIO: number; 58 const EIO: number;
59 + /** @deprecated since v6.3.0 - use `os.constants.errno.EISCONN` instead. */
30 const EISCONN: number; 60 const EISCONN: number;
61 + /** @deprecated since v6.3.0 - use `os.constants.errno.EISDIR` instead. */
31 const EISDIR: number; 62 const EISDIR: number;
63 + /** @deprecated since v6.3.0 - use `os.constants.errno.ELOOP` instead. */
32 const ELOOP: number; 64 const ELOOP: number;
65 + /** @deprecated since v6.3.0 - use `os.constants.errno.EMFILE` instead. */
33 const EMFILE: number; 66 const EMFILE: number;
67 + /** @deprecated since v6.3.0 - use `os.constants.errno.EMLINK` instead. */
34 const EMLINK: number; 68 const EMLINK: number;
69 + /** @deprecated since v6.3.0 - use `os.constants.errno.EMSGSIZE` instead. */
35 const EMSGSIZE: number; 70 const EMSGSIZE: number;
71 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENAMETOOLONG` instead. */
36 const ENAMETOOLONG: number; 72 const ENAMETOOLONG: number;
73 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENETDOWN` instead. */
37 const ENETDOWN: number; 74 const ENETDOWN: number;
75 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENETRESET` instead. */
38 const ENETRESET: number; 76 const ENETRESET: number;
77 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENETUNREACH` instead. */
39 const ENETUNREACH: number; 78 const ENETUNREACH: number;
79 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENFILE` instead. */
40 const ENFILE: number; 80 const ENFILE: number;
81 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOBUFS` instead. */
41 const ENOBUFS: number; 82 const ENOBUFS: number;
83 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENODATA` instead. */
42 const ENODATA: number; 84 const ENODATA: number;
85 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENODEV` instead. */
43 const ENODEV: number; 86 const ENODEV: number;
87 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOENT` instead. */
44 const ENOENT: number; 88 const ENOENT: number;
89 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOEXEC` instead. */
45 const ENOEXEC: number; 90 const ENOEXEC: number;
91 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOLCK` instead. */
46 const ENOLCK: number; 92 const ENOLCK: number;
93 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOLINK` instead. */
47 const ENOLINK: number; 94 const ENOLINK: number;
95 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOMEM` instead. */
48 const ENOMEM: number; 96 const ENOMEM: number;
97 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOMSG` instead. */
49 const ENOMSG: number; 98 const ENOMSG: number;
99 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOPROTOOPT` instead. */
50 const ENOPROTOOPT: number; 100 const ENOPROTOOPT: number;
101 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSPC` instead. */
51 const ENOSPC: number; 102 const ENOSPC: number;
103 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSR` instead. */
52 const ENOSR: number; 104 const ENOSR: number;
105 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSTR` instead. */
53 const ENOSTR: number; 106 const ENOSTR: number;
107 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOSYS` instead. */
54 const ENOSYS: number; 108 const ENOSYS: number;
109 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTCONN` instead. */
55 const ENOTCONN: number; 110 const ENOTCONN: number;
111 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTDIR` instead. */
56 const ENOTDIR: number; 112 const ENOTDIR: number;
113 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTEMPTY` instead. */
57 const ENOTEMPTY: number; 114 const ENOTEMPTY: number;
115 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTSOCK` instead. */
58 const ENOTSOCK: number; 116 const ENOTSOCK: number;
117 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTSUP` instead. */
59 const ENOTSUP: number; 118 const ENOTSUP: number;
119 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENOTTY` instead. */
60 const ENOTTY: number; 120 const ENOTTY: number;
121 + /** @deprecated since v6.3.0 - use `os.constants.errno.ENXIO` instead. */
61 const ENXIO: number; 122 const ENXIO: number;
123 + /** @deprecated since v6.3.0 - use `os.constants.errno.EOPNOTSUPP` instead. */
62 const EOPNOTSUPP: number; 124 const EOPNOTSUPP: number;
125 + /** @deprecated since v6.3.0 - use `os.constants.errno.EOVERFLOW` instead. */
63 const EOVERFLOW: number; 126 const EOVERFLOW: number;
127 + /** @deprecated since v6.3.0 - use `os.constants.errno.EPERM` instead. */
64 const EPERM: number; 128 const EPERM: number;
129 + /** @deprecated since v6.3.0 - use `os.constants.errno.EPIPE` instead. */
65 const EPIPE: number; 130 const EPIPE: number;
131 + /** @deprecated since v6.3.0 - use `os.constants.errno.EPROTO` instead. */
66 const EPROTO: number; 132 const EPROTO: number;
133 + /** @deprecated since v6.3.0 - use `os.constants.errno.EPROTONOSUPPORT` instead. */
67 const EPROTONOSUPPORT: number; 134 const EPROTONOSUPPORT: number;
135 + /** @deprecated since v6.3.0 - use `os.constants.errno.EPROTOTYPE` instead. */
68 const EPROTOTYPE: number; 136 const EPROTOTYPE: number;
137 + /** @deprecated since v6.3.0 - use `os.constants.errno.ERANGE` instead. */
69 const ERANGE: number; 138 const ERANGE: number;
139 + /** @deprecated since v6.3.0 - use `os.constants.errno.EROFS` instead. */
70 const EROFS: number; 140 const EROFS: number;
141 + /** @deprecated since v6.3.0 - use `os.constants.errno.ESPIPE` instead. */
71 const ESPIPE: number; 142 const ESPIPE: number;
143 + /** @deprecated since v6.3.0 - use `os.constants.errno.ESRCH` instead. */
72 const ESRCH: number; 144 const ESRCH: number;
145 + /** @deprecated since v6.3.0 - use `os.constants.errno.ETIME` instead. */
73 const ETIME: number; 146 const ETIME: number;
147 + /** @deprecated since v6.3.0 - use `os.constants.errno.ETIMEDOUT` instead. */
74 const ETIMEDOUT: number; 148 const ETIMEDOUT: number;
149 + /** @deprecated since v6.3.0 - use `os.constants.errno.ETXTBSY` instead. */
75 const ETXTBSY: number; 150 const ETXTBSY: number;
151 + /** @deprecated since v6.3.0 - use `os.constants.errno.EWOULDBLOCK` instead. */
76 const EWOULDBLOCK: number; 152 const EWOULDBLOCK: number;
153 + /** @deprecated since v6.3.0 - use `os.constants.errno.EXDEV` instead. */
77 const EXDEV: number; 154 const EXDEV: number;
155 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINTR` instead. */
78 const WSAEINTR: number; 156 const WSAEINTR: number;
157 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEBADF` instead. */
79 const WSAEBADF: number; 158 const WSAEBADF: number;
159 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEACCES` instead. */
80 const WSAEACCES: number; 160 const WSAEACCES: number;
161 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEFAULT` instead. */
81 const WSAEFAULT: number; 162 const WSAEFAULT: number;
163 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINVAL` instead. */
82 const WSAEINVAL: number; 164 const WSAEINVAL: number;
165 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEMFILE` instead. */
83 const WSAEMFILE: number; 166 const WSAEMFILE: number;
167 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEWOULDBLOCK` instead. */
84 const WSAEWOULDBLOCK: number; 168 const WSAEWOULDBLOCK: number;
169 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINPROGRESS` instead. */
85 const WSAEINPROGRESS: number; 170 const WSAEINPROGRESS: number;
171 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEALREADY` instead. */
86 const WSAEALREADY: number; 172 const WSAEALREADY: number;
173 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOTSOCK` instead. */
87 const WSAENOTSOCK: number; 174 const WSAENOTSOCK: number;
175 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEDESTADDRREQ` instead. */
88 const WSAEDESTADDRREQ: number; 176 const WSAEDESTADDRREQ: number;
177 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEMSGSIZE` instead. */
89 const WSAEMSGSIZE: number; 178 const WSAEMSGSIZE: number;
179 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROTOTYPE` instead. */
90 const WSAEPROTOTYPE: number; 180 const WSAEPROTOTYPE: number;
181 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOPROTOOPT` instead. */
91 const WSAENOPROTOOPT: number; 182 const WSAENOPROTOOPT: number;
183 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROTONOSUPPORT` instead. */
92 const WSAEPROTONOSUPPORT: number; 184 const WSAEPROTONOSUPPORT: number;
185 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAESOCKTNOSUPPORT` instead. */
93 const WSAESOCKTNOSUPPORT: number; 186 const WSAESOCKTNOSUPPORT: number;
187 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEOPNOTSUPP` instead. */
94 const WSAEOPNOTSUPP: number; 188 const WSAEOPNOTSUPP: number;
189 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPFNOSUPPORT` instead. */
95 const WSAEPFNOSUPPORT: number; 190 const WSAEPFNOSUPPORT: number;
191 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEAFNOSUPPORT` instead. */
96 const WSAEAFNOSUPPORT: number; 192 const WSAEAFNOSUPPORT: number;
193 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEADDRINUSE` instead. */
97 const WSAEADDRINUSE: number; 194 const WSAEADDRINUSE: number;
195 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEADDRNOTAVAIL` instead. */
98 const WSAEADDRNOTAVAIL: number; 196 const WSAEADDRNOTAVAIL: number;
197 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENETDOWN` instead. */
99 const WSAENETDOWN: number; 198 const WSAENETDOWN: number;
199 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENETUNREACH` instead. */
100 const WSAENETUNREACH: number; 200 const WSAENETUNREACH: number;
201 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENETRESET` instead. */
101 const WSAENETRESET: number; 202 const WSAENETRESET: number;
203 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECONNABORTED` instead. */
102 const WSAECONNABORTED: number; 204 const WSAECONNABORTED: number;
205 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECONNRESET` instead. */
103 const WSAECONNRESET: number; 206 const WSAECONNRESET: number;
207 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOBUFS` instead. */
104 const WSAENOBUFS: number; 208 const WSAENOBUFS: number;
209 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEISCONN` instead. */
105 const WSAEISCONN: number; 210 const WSAEISCONN: number;
211 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOTCONN` instead. */
106 const WSAENOTCONN: number; 212 const WSAENOTCONN: number;
213 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAESHUTDOWN` instead. */
107 const WSAESHUTDOWN: number; 214 const WSAESHUTDOWN: number;
215 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAETOOMANYREFS` instead. */
108 const WSAETOOMANYREFS: number; 216 const WSAETOOMANYREFS: number;
217 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAETIMEDOUT` instead. */
109 const WSAETIMEDOUT: number; 218 const WSAETIMEDOUT: number;
219 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECONNREFUSED` instead. */
110 const WSAECONNREFUSED: number; 220 const WSAECONNREFUSED: number;
221 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAELOOP` instead. */
111 const WSAELOOP: number; 222 const WSAELOOP: number;
223 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENAMETOOLONG` instead. */
112 const WSAENAMETOOLONG: number; 224 const WSAENAMETOOLONG: number;
225 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEHOSTDOWN` instead. */
113 const WSAEHOSTDOWN: number; 226 const WSAEHOSTDOWN: number;
227 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEHOSTUNREACH` instead. */
114 const WSAEHOSTUNREACH: number; 228 const WSAEHOSTUNREACH: number;
229 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOTEMPTY` instead. */
115 const WSAENOTEMPTY: number; 230 const WSAENOTEMPTY: number;
231 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROCLIM` instead. */
116 const WSAEPROCLIM: number; 232 const WSAEPROCLIM: number;
233 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEUSERS` instead. */
117 const WSAEUSERS: number; 234 const WSAEUSERS: number;
235 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEDQUOT` instead. */
118 const WSAEDQUOT: number; 236 const WSAEDQUOT: number;
237 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAESTALE` instead. */
119 const WSAESTALE: number; 238 const WSAESTALE: number;
239 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEREMOTE` instead. */
120 const WSAEREMOTE: number; 240 const WSAEREMOTE: number;
241 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSASYSNOTREADY` instead. */
121 const WSASYSNOTREADY: number; 242 const WSASYSNOTREADY: number;
243 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAVERNOTSUPPORTED` instead. */
122 const WSAVERNOTSUPPORTED: number; 244 const WSAVERNOTSUPPORTED: number;
245 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSANOTINITIALISED` instead. */
123 const WSANOTINITIALISED: number; 246 const WSANOTINITIALISED: number;
247 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEDISCON` instead. */
124 const WSAEDISCON: number; 248 const WSAEDISCON: number;
249 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAENOMORE` instead. */
125 const WSAENOMORE: number; 250 const WSAENOMORE: number;
251 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAECANCELLED` instead. */
126 const WSAECANCELLED: number; 252 const WSAECANCELLED: number;
253 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINVALIDPROCTABLE` instead. */
127 const WSAEINVALIDPROCTABLE: number; 254 const WSAEINVALIDPROCTABLE: number;
255 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEINVALIDPROVIDER` instead. */
128 const WSAEINVALIDPROVIDER: number; 256 const WSAEINVALIDPROVIDER: number;
257 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEPROVIDERFAILEDINIT` instead. */
129 const WSAEPROVIDERFAILEDINIT: number; 258 const WSAEPROVIDERFAILEDINIT: number;
259 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSASYSCALLFAILURE` instead. */
130 const WSASYSCALLFAILURE: number; 260 const WSASYSCALLFAILURE: number;
261 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSASERVICE_NOT_FOUND` instead. */
131 const WSASERVICE_NOT_FOUND: number; 262 const WSASERVICE_NOT_FOUND: number;
263 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSATYPE_NOT_FOUND` instead. */
132 const WSATYPE_NOT_FOUND: number; 264 const WSATYPE_NOT_FOUND: number;
265 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSA_E_NO_MORE` instead. */
133 const WSA_E_NO_MORE: number; 266 const WSA_E_NO_MORE: number;
267 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSA_E_CANCELLED` instead. */
134 const WSA_E_CANCELLED: number; 268 const WSA_E_CANCELLED: number;
269 + /** @deprecated since v6.3.0 - use `os.constants.errno.WSAEREFUSED` instead. */
135 const WSAEREFUSED: number; 270 const WSAEREFUSED: number;
271 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGHUP` instead. */
136 const SIGHUP: number; 272 const SIGHUP: number;
273 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGINT` instead. */
137 const SIGINT: number; 274 const SIGINT: number;
275 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGILL` instead. */
138 const SIGILL: number; 276 const SIGILL: number;
277 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGABRT` instead. */
139 const SIGABRT: number; 278 const SIGABRT: number;
279 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGFPE` instead. */
140 const SIGFPE: number; 280 const SIGFPE: number;
281 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGKILL` instead. */
141 const SIGKILL: number; 282 const SIGKILL: number;
283 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSEGV` instead. */
142 const SIGSEGV: number; 284 const SIGSEGV: number;
285 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTERM` instead. */
143 const SIGTERM: number; 286 const SIGTERM: number;
287 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGBREAK` instead. */
144 const SIGBREAK: number; 288 const SIGBREAK: number;
289 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGWINCH` instead. */
145 const SIGWINCH: number; 290 const SIGWINCH: number;
146 const SSL_OP_ALL: number; 291 const SSL_OP_ALL: number;
147 const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; 292 const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
...@@ -193,7 +338,6 @@ declare module "constants" { ...@@ -193,7 +338,6 @@ declare module "constants" {
193 const DH_CHECK_P_NOT_PRIME: number; 338 const DH_CHECK_P_NOT_PRIME: number;
194 const DH_UNABLE_TO_CHECK_GENERATOR: number; 339 const DH_UNABLE_TO_CHECK_GENERATOR: number;
195 const DH_NOT_SUITABLE_GENERATOR: number; 340 const DH_NOT_SUITABLE_GENERATOR: number;
196 - const NPN_ENABLED: number;
197 const RSA_PKCS1_PADDING: number; 341 const RSA_PKCS1_PADDING: number;
198 const RSA_SSLV23_PADDING: number; 342 const RSA_SSLV23_PADDING: number;
199 const RSA_NO_PADDING: number; 343 const RSA_NO_PADDING: number;
...@@ -247,30 +391,55 @@ declare module "constants" { ...@@ -247,30 +391,55 @@ declare module "constants" {
247 const COPYFILE_FICLONE: number; 391 const COPYFILE_FICLONE: number;
248 const COPYFILE_FICLONE_FORCE: number; 392 const COPYFILE_FICLONE_FORCE: number;
249 const UV_UDP_REUSEADDR: number; 393 const UV_UDP_REUSEADDR: number;
394 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGQUIT` instead. */
250 const SIGQUIT: number; 395 const SIGQUIT: number;
396 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTRAP` instead. */
251 const SIGTRAP: number; 397 const SIGTRAP: number;
398 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGIOT` instead. */
252 const SIGIOT: number; 399 const SIGIOT: number;
400 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGBUS` instead. */
253 const SIGBUS: number; 401 const SIGBUS: number;
402 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGUSR1` instead. */
254 const SIGUSR1: number; 403 const SIGUSR1: number;
404 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGUSR2` instead. */
255 const SIGUSR2: number; 405 const SIGUSR2: number;
406 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPIPE` instead. */
256 const SIGPIPE: number; 407 const SIGPIPE: number;
408 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGALRM` instead. */
257 const SIGALRM: number; 409 const SIGALRM: number;
410 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGCHLD` instead. */
258 const SIGCHLD: number; 411 const SIGCHLD: number;
412 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSTKFLT` instead. */
259 const SIGSTKFLT: number; 413 const SIGSTKFLT: number;
414 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGCONT` instead. */
260 const SIGCONT: number; 415 const SIGCONT: number;
416 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSTOP` instead. */
261 const SIGSTOP: number; 417 const SIGSTOP: number;
418 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTSTP` instead. */
262 const SIGTSTP: number; 419 const SIGTSTP: number;
420 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTTIN` instead. */
263 const SIGTTIN: number; 421 const SIGTTIN: number;
422 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGTTOU` instead. */
264 const SIGTTOU: number; 423 const SIGTTOU: number;
424 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGURG` instead. */
265 const SIGURG: number; 425 const SIGURG: number;
426 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGXCPU` instead. */
266 const SIGXCPU: number; 427 const SIGXCPU: number;
428 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGXFSZ` instead. */
267 const SIGXFSZ: number; 429 const SIGXFSZ: number;
430 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGVTALRM` instead. */
268 const SIGVTALRM: number; 431 const SIGVTALRM: number;
432 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPROF` instead. */
269 const SIGPROF: number; 433 const SIGPROF: number;
434 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGIO` instead. */
270 const SIGIO: number; 435 const SIGIO: number;
436 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPOLL` instead. */
271 const SIGPOLL: number; 437 const SIGPOLL: number;
438 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGPWR` instead. */
272 const SIGPWR: number; 439 const SIGPWR: number;
440 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGSYS` instead. */
273 const SIGSYS: number; 441 const SIGSYS: number;
442 + /** @deprecated since v6.3.0 - use `os.constants.signals.SIGUNUSED` instead. */
274 const SIGUNUSED: number; 443 const SIGUNUSED: number;
275 const defaultCoreCipherList: string; 444 const defaultCoreCipherList: string;
276 const defaultCipherList: string; 445 const defaultCipherList: string;
......
...@@ -4,7 +4,7 @@ declare module "crypto" { ...@@ -4,7 +4,7 @@ declare module "crypto" {
4 interface Certificate { 4 interface Certificate {
5 exportChallenge(spkac: BinaryLike): Buffer; 5 exportChallenge(spkac: BinaryLike): Buffer;
6 exportPublicKey(spkac: BinaryLike): Buffer; 6 exportPublicKey(spkac: BinaryLike): Buffer;
7 - verifySpkac(spkac: Binary): boolean; 7 + verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
8 } 8 }
9 const Certificate: { 9 const Certificate: {
10 new(): Certificate; 10 new(): Certificate;
...@@ -106,10 +106,18 @@ declare module "crypto" { ...@@ -106,10 +106,18 @@ declare module "crypto" {
106 const defaultCipherList: string; 106 const defaultCipherList: string;
107 } 107 }
108 108
109 + interface HashOptions extends stream.TransformOptions {
110 + /**
111 + * For XOF hash functions such as `shake256`, the
112 + * outputLength option can be used to specify the desired output length in bytes.
113 + */
114 + outputLength?: number;
115 + }
116 +
109 /** @deprecated since v10.0.0 */ 117 /** @deprecated since v10.0.0 */
110 const fips: boolean; 118 const fips: boolean;
111 119
112 - function createHash(algorithm: string, options?: stream.TransformOptions): Hash; 120 + function createHash(algorithm: string, options?: HashOptions): Hash;
113 function createHmac(algorithm: string, key: BinaryLike, options?: stream.TransformOptions): Hmac; 121 function createHmac(algorithm: string, key: BinaryLike, options?: stream.TransformOptions): Hmac;
114 122
115 type Utf8AsciiLatin1Encoding = "utf8" | "ascii" | "latin1"; 123 type Utf8AsciiLatin1Encoding = "utf8" | "ascii" | "latin1";
...@@ -118,14 +126,14 @@ declare module "crypto" { ...@@ -118,14 +126,14 @@ declare module "crypto" {
118 type HexBase64BinaryEncoding = "binary" | "base64" | "hex"; 126 type HexBase64BinaryEncoding = "binary" | "base64" | "hex";
119 type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid"; 127 type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
120 128
121 - class Hash extends stream.Duplex { 129 + class Hash extends stream.Transform {
122 private constructor(); 130 private constructor();
123 update(data: BinaryLike): Hash; 131 update(data: BinaryLike): Hash;
124 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hash; 132 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hash;
125 digest(): Buffer; 133 digest(): Buffer;
126 digest(encoding: HexBase64Latin1Encoding): string; 134 digest(encoding: HexBase64Latin1Encoding): string;
127 } 135 }
128 - class Hmac extends stream.Duplex { 136 + class Hmac extends stream.Transform {
129 private constructor(); 137 private constructor();
130 update(data: BinaryLike): Hmac; 138 update(data: BinaryLike): Hmac;
131 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hmac; 139 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hmac;
...@@ -133,17 +141,25 @@ declare module "crypto" { ...@@ -133,17 +141,25 @@ declare module "crypto" {
133 digest(encoding: HexBase64Latin1Encoding): string; 141 digest(encoding: HexBase64Latin1Encoding): string;
134 } 142 }
135 143
136 - export type KeyObjectType = 'secret' | 'public' | 'private'; 144 + type KeyObjectType = 'secret' | 'public' | 'private';
145 +
146 + interface KeyExportOptions<T extends KeyFormat> {
147 + type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
148 + format: T;
149 + cipher?: string;
150 + passphrase?: string | Buffer;
151 + }
137 152
138 class KeyObject { 153 class KeyObject {
139 private constructor(); 154 private constructor();
140 asymmetricKeyType?: KeyType; 155 asymmetricKeyType?: KeyType;
141 - export(options?: { 156 + /**
142 - type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1', 157 + * For asymmetric keys, this property represents the size of the embedded key in
143 - format: KeyFormat, 158 + * bytes. This property is `undefined` for symmetric keys.
144 - cipher?: string, 159 + */
145 - passphrase?: string | Buffer 160 + asymmetricKeySize?: number;
146 - }): string | Buffer; 161 + export(options: KeyExportOptions<'pem'>): string | Buffer;
162 + export(options?: KeyExportOptions<'der'>): Buffer;
147 symmetricSize?: number; 163 symmetricSize?: number;
148 type: KeyObjectType; 164 type: KeyObjectType;
149 } 165 }
...@@ -151,8 +167,7 @@ declare module "crypto" { ...@@ -151,8 +167,7 @@ declare module "crypto" {
151 type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm'; 167 type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm';
152 type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm'; 168 type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
153 169
154 - type Binary = Buffer | NodeJS.TypedArray | DataView; 170 + type BinaryLike = string | NodeJS.ArrayBufferView;
155 - type BinaryLike = string | Binary;
156 171
157 type CipherKey = BinaryLike | KeyObject; 172 type CipherKey = BinaryLike | KeyObject;
158 173
...@@ -185,11 +200,11 @@ declare module "crypto" { ...@@ -185,11 +200,11 @@ declare module "crypto" {
185 algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions 200 algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions
186 ): Cipher; 201 ): Cipher;
187 202
188 - class Cipher extends stream.Duplex { 203 + class Cipher extends stream.Transform {
189 private constructor(); 204 private constructor();
190 update(data: BinaryLike): Buffer; 205 update(data: BinaryLike): Buffer;
191 update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer; 206 update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer;
192 - update(data: Binary, input_encoding: undefined, output_encoding: HexBase64BinaryEncoding): string; 207 + update(data: NodeJS.ArrayBufferView, input_encoding: undefined, output_encoding: HexBase64BinaryEncoding): string;
193 update(data: string, input_encoding: Utf8AsciiBinaryEncoding | undefined, output_encoding: HexBase64BinaryEncoding): string; 208 update(data: string, input_encoding: Utf8AsciiBinaryEncoding | undefined, output_encoding: HexBase64BinaryEncoding): string;
194 final(): Buffer; 209 final(): Buffer;
195 final(output_encoding: string): string; 210 final(output_encoding: string): string;
...@@ -205,11 +220,11 @@ declare module "crypto" { ...@@ -205,11 +220,11 @@ declare module "crypto" {
205 setAAD(buffer: Buffer, options?: { plaintextLength: number }): this; 220 setAAD(buffer: Buffer, options?: { plaintextLength: number }): this;
206 getAuthTag(): Buffer; 221 getAuthTag(): Buffer;
207 } 222 }
208 - /** @deprecated since v10.0.0 use createCipheriv() */ 223 + /** @deprecated since v10.0.0 use createDecipheriv() */
209 function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM; 224 function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM;
210 - /** @deprecated since v10.0.0 use createCipheriv() */ 225 + /** @deprecated since v10.0.0 use createDecipheriv() */
211 function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM; 226 function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
212 - /** @deprecated since v10.0.0 use createCipheriv() */ 227 + /** @deprecated since v10.0.0 use createDecipheriv() */
213 function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher; 228 function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher;
214 229
215 function createDecipheriv( 230 function createDecipheriv(
...@@ -226,25 +241,25 @@ declare module "crypto" { ...@@ -226,25 +241,25 @@ declare module "crypto" {
226 ): DecipherGCM; 241 ): DecipherGCM;
227 function createDecipheriv(algorithm: string, key: BinaryLike, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher; 242 function createDecipheriv(algorithm: string, key: BinaryLike, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher;
228 243
229 - class Decipher extends stream.Duplex { 244 + class Decipher extends stream.Transform {
230 private constructor(); 245 private constructor();
231 - update(data: Binary): Buffer; 246 + update(data: NodeJS.ArrayBufferView): Buffer;
232 update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer; 247 update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer;
233 - update(data: Binary, input_encoding: undefined, output_encoding: Utf8AsciiBinaryEncoding): string; 248 + update(data: NodeJS.ArrayBufferView, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string;
234 update(data: string, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string; 249 update(data: string, input_encoding: HexBase64BinaryEncoding | undefined, output_encoding: Utf8AsciiBinaryEncoding): string;
235 final(): Buffer; 250 final(): Buffer;
236 final(output_encoding: string): string; 251 final(output_encoding: string): string;
237 setAutoPadding(auto_padding?: boolean): this; 252 setAutoPadding(auto_padding?: boolean): this;
238 - // setAuthTag(tag: Binary): this; 253 + // setAuthTag(tag: NodeJS.ArrayBufferView): this;
239 - // setAAD(buffer: Binary): this; 254 + // setAAD(buffer: NodeJS.ArrayBufferView): this;
240 } 255 }
241 interface DecipherCCM extends Decipher { 256 interface DecipherCCM extends Decipher {
242 - setAuthTag(buffer: Binary): this; 257 + setAuthTag(buffer: NodeJS.ArrayBufferView): this;
243 - setAAD(buffer: Binary, options: { plaintextLength: number }): this; 258 + setAAD(buffer: NodeJS.ArrayBufferView, options: { plaintextLength: number }): this;
244 } 259 }
245 interface DecipherGCM extends Decipher { 260 interface DecipherGCM extends Decipher {
246 - setAuthTag(buffer: Binary): this; 261 + setAuthTag(buffer: NodeJS.ArrayBufferView): this;
247 - setAAD(buffer: Binary, options?: { plaintextLength: number }): this; 262 + setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this;
248 } 263 }
249 264
250 interface PrivateKeyInput { 265 interface PrivateKeyInput {
...@@ -261,16 +276,22 @@ declare module "crypto" { ...@@ -261,16 +276,22 @@ declare module "crypto" {
261 } 276 }
262 277
263 function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject; 278 function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject;
264 - function createPublicKey(key: PublicKeyInput | string | Buffer): KeyObject; 279 + function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject;
265 function createSecretKey(key: Buffer): KeyObject; 280 function createSecretKey(key: Buffer): KeyObject;
266 281
267 function createSign(algorithm: string, options?: stream.WritableOptions): Signer; 282 function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
268 283
269 - interface SignPrivateKeyInput extends PrivateKeyInput { 284 + interface SigningOptions {
285 + /**
286 + * @See crypto.constants.RSA_PKCS1_PADDING
287 + */
270 padding?: number; 288 padding?: number;
271 saltLength?: number; 289 saltLength?: number;
272 } 290 }
273 291
292 + interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {
293 + }
294 +
274 type KeyLike = string | Buffer | KeyObject; 295 type KeyLike = string | Buffer | KeyObject;
275 296
276 class Signer extends stream.Writable { 297 class Signer extends stream.Writable {
...@@ -282,29 +303,29 @@ declare module "crypto" { ...@@ -282,29 +303,29 @@ declare module "crypto" {
282 sign(private_key: SignPrivateKeyInput | KeyLike, output_format: HexBase64Latin1Encoding): string; 303 sign(private_key: SignPrivateKeyInput | KeyLike, output_format: HexBase64Latin1Encoding): string;
283 } 304 }
284 305
285 - function createVerify(algorith: string, options?: stream.WritableOptions): Verify; 306 + function createVerify(algorithm: string, options?: stream.WritableOptions): Verify;
286 class Verify extends stream.Writable { 307 class Verify extends stream.Writable {
287 private constructor(); 308 private constructor();
288 309
289 update(data: BinaryLike): Verify; 310 update(data: BinaryLike): Verify;
290 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Verify; 311 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Verify;
291 - verify(object: Object | KeyLike, signature: Binary): boolean; 312 + verify(object: Object | KeyLike, signature: NodeJS.ArrayBufferView): boolean;
292 verify(object: Object | KeyLike, signature: string, signature_format?: HexBase64Latin1Encoding): boolean; 313 verify(object: Object | KeyLike, signature: string, signature_format?: HexBase64Latin1Encoding): boolean;
293 // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format 314 // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format
294 // The signature field accepts a TypedArray type, but it is only available starting ES2017 315 // The signature field accepts a TypedArray type, but it is only available starting ES2017
295 } 316 }
296 - function createDiffieHellman(prime_length: number, generator?: number | Binary): DiffieHellman; 317 + function createDiffieHellman(prime_length: number, generator?: number | NodeJS.ArrayBufferView): DiffieHellman;
297 - function createDiffieHellman(prime: Binary): DiffieHellman; 318 + function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman;
298 function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman; 319 function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman;
299 - function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: number | Binary): DiffieHellman; 320 + function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: number | NodeJS.ArrayBufferView): DiffieHellman;
300 function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: string, generator_encoding: HexBase64Latin1Encoding): DiffieHellman; 321 function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding, generator: string, generator_encoding: HexBase64Latin1Encoding): DiffieHellman;
301 class DiffieHellman { 322 class DiffieHellman {
302 private constructor(); 323 private constructor();
303 generateKeys(): Buffer; 324 generateKeys(): Buffer;
304 generateKeys(encoding: HexBase64Latin1Encoding): string; 325 generateKeys(encoding: HexBase64Latin1Encoding): string;
305 - computeSecret(other_public_key: Binary): Buffer; 326 + computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer;
306 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; 327 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
307 - computeSecret(other_public_key: Binary, output_encoding: HexBase64Latin1Encoding): string; 328 + computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string;
308 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; 329 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
309 getPrime(): Buffer; 330 getPrime(): Buffer;
310 getPrime(encoding: HexBase64Latin1Encoding): string; 331 getPrime(encoding: HexBase64Latin1Encoding): string;
...@@ -314,9 +335,9 @@ declare module "crypto" { ...@@ -314,9 +335,9 @@ declare module "crypto" {
314 getPublicKey(encoding: HexBase64Latin1Encoding): string; 335 getPublicKey(encoding: HexBase64Latin1Encoding): string;
315 getPrivateKey(): Buffer; 336 getPrivateKey(): Buffer;
316 getPrivateKey(encoding: HexBase64Latin1Encoding): string; 337 getPrivateKey(encoding: HexBase64Latin1Encoding): string;
317 - setPublicKey(public_key: Binary): void; 338 + setPublicKey(public_key: NodeJS.ArrayBufferView): void;
318 setPublicKey(public_key: string, encoding: string): void; 339 setPublicKey(public_key: string, encoding: string): void;
319 - setPrivateKey(private_key: Binary): void; 340 + setPrivateKey(private_key: NodeJS.ArrayBufferView): void;
320 setPrivateKey(private_key: string, encoding: string): void; 341 setPrivateKey(private_key: string, encoding: string): void;
321 verifyError: number; 342 verifyError: number;
322 } 343 }
...@@ -336,10 +357,10 @@ declare module "crypto" { ...@@ -336,10 +357,10 @@ declare module "crypto" {
336 function pseudoRandomBytes(size: number): Buffer; 357 function pseudoRandomBytes(size: number): Buffer;
337 function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; 358 function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
338 359
339 - function randomFillSync<T extends Binary>(buffer: T, offset?: number, size?: number): T; 360 + function randomFillSync<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number, size?: number): T;
340 - function randomFill<T extends Binary>(buffer: T, callback: (err: Error | null, buf: T) => void): void; 361 + function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
341 - function randomFill<T extends Binary>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void; 362 + function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
342 - function randomFill<T extends Binary>(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void; 363 + function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
343 364
344 interface ScryptOptions { 365 interface ScryptOptions {
345 N?: number; 366 N?: number;
...@@ -368,12 +389,17 @@ declare module "crypto" { ...@@ -368,12 +389,17 @@ declare module "crypto" {
368 interface RsaPrivateKey { 389 interface RsaPrivateKey {
369 key: KeyLike; 390 key: KeyLike;
370 passphrase?: string; 391 passphrase?: string;
392 + /**
393 + * @default 'sha1'
394 + */
395 + oaepHash?: string;
396 + oaepLabel?: NodeJS.TypedArray;
371 padding?: number; 397 padding?: number;
372 } 398 }
373 - function publicEncrypt(public_key: RsaPublicKey | KeyLike, buffer: Binary): Buffer; 399 + function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
374 - function privateDecrypt(private_key: RsaPrivateKey | KeyLike, buffer: Binary): Buffer; 400 + function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
375 - function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: Binary): Buffer; 401 + function privateDecrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
376 - function publicDecrypt(public_key: RsaPublicKey | KeyLike, buffer: Binary): Buffer; 402 + function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
377 function getCiphers(): string[]; 403 function getCiphers(): string[];
378 function getCurves(): string[]; 404 function getCurves(): string[];
379 function getHashes(): string[]; 405 function getHashes(): string[];
...@@ -388,29 +414,29 @@ declare module "crypto" { ...@@ -388,29 +414,29 @@ declare module "crypto" {
388 ): Buffer | string; 414 ): Buffer | string;
389 generateKeys(): Buffer; 415 generateKeys(): Buffer;
390 generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; 416 generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string;
391 - computeSecret(other_public_key: Binary): Buffer; 417 + computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer;
392 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer; 418 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
393 - computeSecret(other_public_key: Binary, output_encoding: HexBase64Latin1Encoding): string; 419 + computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: HexBase64Latin1Encoding): string;
394 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string; 420 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding, output_encoding: HexBase64Latin1Encoding): string;
395 getPrivateKey(): Buffer; 421 getPrivateKey(): Buffer;
396 getPrivateKey(encoding: HexBase64Latin1Encoding): string; 422 getPrivateKey(encoding: HexBase64Latin1Encoding): string;
397 getPublicKey(): Buffer; 423 getPublicKey(): Buffer;
398 getPublicKey(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string; 424 getPublicKey(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string;
399 - setPrivateKey(private_key: Binary): void; 425 + setPrivateKey(private_key: NodeJS.ArrayBufferView): void;
400 setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void; 426 setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void;
401 } 427 }
402 function createECDH(curve_name: string): ECDH; 428 function createECDH(curve_name: string): ECDH;
403 - function timingSafeEqual(a: Binary, b: Binary): boolean; 429 + function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
404 /** @deprecated since v10.0.0 */ 430 /** @deprecated since v10.0.0 */
405 const DEFAULT_ENCODING: string; 431 const DEFAULT_ENCODING: string;
406 432
407 - export type KeyType = 'rsa' | 'dsa' | 'ec'; 433 + type KeyType = 'rsa' | 'dsa' | 'ec';
408 - export type KeyFormat = 'pem' | 'der'; 434 + type KeyFormat = 'pem' | 'der';
409 435
410 interface BasePrivateKeyEncodingOptions<T extends KeyFormat> { 436 interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
411 format: T; 437 format: T;
412 - cipher: string; 438 + cipher?: string;
413 - passphrase: string; 439 + passphrase?: string;
414 } 440 }
415 441
416 interface KeyPairKeyObjectResult { 442 interface KeyPairKeyObjectResult {
...@@ -562,4 +588,27 @@ declare module "crypto" { ...@@ -562,4 +588,27 @@ declare module "crypto" {
562 function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>; 588 function __promisify__(type: "ec", options: ECKeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
563 function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>; 589 function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
564 } 590 }
591 +
592 + /**
593 + * Calculates and returns the signature for `data` using the given private key and
594 + * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
595 + * dependent upon the key type (especially Ed25519 and Ed448).
596 + *
597 + * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
598 + * passed to [`crypto.createPrivateKey()`][].
599 + */
600 + function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignPrivateKeyInput): Buffer;
601 +
602 + interface VerifyKeyWithOptions extends KeyObject, SigningOptions {
603 + }
604 +
605 + /**
606 + * Calculates and returns the signature for `data` using the given private key and
607 + * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
608 + * dependent upon the key type (especially Ed25519 and Ed448).
609 + *
610 + * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
611 + * passed to [`crypto.createPublicKey()`][].
612 + */
613 + function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyWithOptions, signature: NodeJS.ArrayBufferView): Buffer;
565 } 614 }
......
...@@ -11,9 +11,10 @@ declare module "dgram" { ...@@ -11,9 +11,10 @@ declare module "dgram" {
11 } 11 }
12 12
13 interface BindOptions { 13 interface BindOptions {
14 - port: number; 14 + port?: number;
15 address?: string; 15 address?: string;
16 exclusive?: boolean; 16 exclusive?: boolean;
17 + fd?: number;
17 } 18 }
18 19
19 type SocketType = "udp4" | "udp6"; 20 type SocketType = "udp4" | "udp6";
...@@ -27,74 +28,89 @@ declare module "dgram" { ...@@ -27,74 +28,89 @@ declare module "dgram" {
27 ipv6Only?: boolean; 28 ipv6Only?: boolean;
28 recvBufferSize?: number; 29 recvBufferSize?: number;
29 sendBufferSize?: number; 30 sendBufferSize?: number;
30 - lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void) => void; 31 + lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
31 } 32 }
32 33
33 function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; 34 function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
34 function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; 35 function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
35 36
36 class Socket extends events.EventEmitter { 37 class Socket extends events.EventEmitter {
37 - send(msg: Buffer | string | Uint8Array | any[], port: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; 38 + addMembership(multicastAddress: string, multicastInterface?: string): void;
38 - send(msg: Buffer | string | Uint8Array, offset: number, length: number, port: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void; 39 + address(): AddressInfo;
39 bind(port?: number, address?: string, callback?: () => void): void; 40 bind(port?: number, address?: string, callback?: () => void): void;
40 bind(port?: number, callback?: () => void): void; 41 bind(port?: number, callback?: () => void): void;
41 bind(callback?: () => void): void; 42 bind(callback?: () => void): void;
42 bind(options: BindOptions, callback?: () => void): void; 43 bind(options: BindOptions, callback?: () => void): void;
43 close(callback?: () => void): void; 44 close(callback?: () => void): void;
44 - address(): AddressInfo | string; 45 + connect(port: number, address?: string, callback?: () => void): void;
46 + connect(port: number, callback: () => void): void;
47 + disconnect(): void;
48 + dropMembership(multicastAddress: string, multicastInterface?: string): void;
49 + getRecvBufferSize(): number;
50 + getSendBufferSize(): number;
51 + ref(): this;
52 + remoteAddress(): AddressInfo;
53 + send(msg: string | Uint8Array | any[], port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
54 + send(msg: string | Uint8Array | any[], port?: number, callback?: (error: Error | null, bytes: number) => void): void;
55 + send(msg: string | Uint8Array | any[], callback?: (error: Error | null, bytes: number) => void): void;
56 + send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
57 + send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
58 + send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
45 setBroadcast(flag: boolean): void; 59 setBroadcast(flag: boolean): void;
46 - setTTL(ttl: number): void;
47 - setMulticastTTL(ttl: number): void;
48 setMulticastInterface(multicastInterface: string): void; 60 setMulticastInterface(multicastInterface: string): void;
49 setMulticastLoopback(flag: boolean): void; 61 setMulticastLoopback(flag: boolean): void;
50 - addMembership(multicastAddress: string, multicastInterface?: string): void; 62 + setMulticastTTL(ttl: number): void;
51 - dropMembership(multicastAddress: string, multicastInterface?: string): void;
52 - ref(): this;
53 - unref(): this;
54 setRecvBufferSize(size: number): void; 63 setRecvBufferSize(size: number): void;
55 setSendBufferSize(size: number): void; 64 setSendBufferSize(size: number): void;
56 - getRecvBufferSize(): number; 65 + setTTL(ttl: number): void;
57 - getSendBufferSize(): number; 66 + unref(): this;
58 67
59 /** 68 /**
60 * events.EventEmitter 69 * events.EventEmitter
61 * 1. close 70 * 1. close
62 - * 2. error 71 + * 2. connect
63 - * 3. listening 72 + * 3. error
64 - * 4. message 73 + * 4. listening
74 + * 5. message
65 */ 75 */
66 addListener(event: string, listener: (...args: any[]) => void): this; 76 addListener(event: string, listener: (...args: any[]) => void): this;
67 addListener(event: "close", listener: () => void): this; 77 addListener(event: "close", listener: () => void): this;
78 + addListener(event: "connect", listener: () => void): this;
68 addListener(event: "error", listener: (err: Error) => void): this; 79 addListener(event: "error", listener: (err: Error) => void): this;
69 addListener(event: "listening", listener: () => void): this; 80 addListener(event: "listening", listener: () => void): this;
70 addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; 81 addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
71 82
72 emit(event: string | symbol, ...args: any[]): boolean; 83 emit(event: string | symbol, ...args: any[]): boolean;
73 emit(event: "close"): boolean; 84 emit(event: "close"): boolean;
85 + emit(event: "connect"): boolean;
74 emit(event: "error", err: Error): boolean; 86 emit(event: "error", err: Error): boolean;
75 emit(event: "listening"): boolean; 87 emit(event: "listening"): boolean;
76 emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean; 88 emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean;
77 89
78 on(event: string, listener: (...args: any[]) => void): this; 90 on(event: string, listener: (...args: any[]) => void): this;
79 on(event: "close", listener: () => void): this; 91 on(event: "close", listener: () => void): this;
92 + on(event: "connect", listener: () => void): this;
80 on(event: "error", listener: (err: Error) => void): this; 93 on(event: "error", listener: (err: Error) => void): this;
81 on(event: "listening", listener: () => void): this; 94 on(event: "listening", listener: () => void): this;
82 on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; 95 on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
83 96
84 once(event: string, listener: (...args: any[]) => void): this; 97 once(event: string, listener: (...args: any[]) => void): this;
85 once(event: "close", listener: () => void): this; 98 once(event: "close", listener: () => void): this;
99 + once(event: "connect", listener: () => void): this;
86 once(event: "error", listener: (err: Error) => void): this; 100 once(event: "error", listener: (err: Error) => void): this;
87 once(event: "listening", listener: () => void): this; 101 once(event: "listening", listener: () => void): this;
88 once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; 102 once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
89 103
90 prependListener(event: string, listener: (...args: any[]) => void): this; 104 prependListener(event: string, listener: (...args: any[]) => void): this;
91 prependListener(event: "close", listener: () => void): this; 105 prependListener(event: "close", listener: () => void): this;
106 + prependListener(event: "connect", listener: () => void): this;
92 prependListener(event: "error", listener: (err: Error) => void): this; 107 prependListener(event: "error", listener: (err: Error) => void): this;
93 prependListener(event: "listening", listener: () => void): this; 108 prependListener(event: "listening", listener: () => void): this;
94 prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; 109 prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
95 110
96 prependOnceListener(event: string, listener: (...args: any[]) => void): this; 111 prependOnceListener(event: string, listener: (...args: any[]) => void): this;
97 prependOnceListener(event: "close", listener: () => void): this; 112 prependOnceListener(event: "close", listener: () => void): this;
113 + prependOnceListener(event: "connect", listener: () => void): this;
98 prependOnceListener(event: "error", listener: (err: Error) => void): this; 114 prependOnceListener(event: "error", listener: (err: Error) => void): this;
99 prependOnceListener(event: "listening", listener: () => void): this; 115 prependOnceListener(event: "listening", listener: () => void): this;
100 prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; 116 prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
......
...@@ -23,20 +23,20 @@ declare module "dns" { ...@@ -23,20 +23,20 @@ declare module "dns" {
23 family: number; 23 family: number;
24 } 24 }
25 25
26 - function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; 26 + function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
27 - function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; 27 + function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
28 - function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void; 28 + function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
29 - function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void; 29 + function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
30 - function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void; 30 + function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
31 31
32 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 32 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
33 namespace lookup { 33 namespace lookup {
34 - function __promisify__(hostname: string, options: LookupAllOptions): Promise<{ address: LookupAddress[] }>; 34 + function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
35 - function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<{ address: string, family: number }>; 35 + function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
36 - function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>; 36 + function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
37 } 37 }
38 38
39 - function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void; 39 + function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
40 40
41 namespace lookupService { 41 namespace lookupService {
42 function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>; 42 function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
...@@ -144,22 +144,22 @@ declare module "dns" { ...@@ -144,22 +144,22 @@ declare module "dns" {
144 AnySrvRecord | 144 AnySrvRecord |
145 AnyTxtRecord; 145 AnyTxtRecord;
146 146
147 - function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 147 + function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
148 - function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 148 + function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
149 - function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 149 + function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
150 - function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; 150 + function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
151 - function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 151 + function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
152 - function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; 152 + function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
153 - function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; 153 + function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
154 - function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 154 + function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
155 - function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 155 + function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
156 - function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void; 156 + function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
157 - function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; 157 + function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
158 - function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; 158 + function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
159 function resolve( 159 function resolve(
160 hostname: string, 160 hostname: string,
161 rrtype: string, 161 rrtype: string,
162 - callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void, 162 + callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void,
163 ): void; 163 ): void;
164 164
165 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 165 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
...@@ -174,9 +174,9 @@ declare module "dns" { ...@@ -174,9 +174,9 @@ declare module "dns" {
174 function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>; 174 function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
175 } 175 }
176 176
177 - function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 177 + function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
178 - function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void; 178 + function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
179 - function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void; 179 + function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
180 180
181 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 181 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
182 namespace resolve4 { 182 namespace resolve4 {
...@@ -185,9 +185,9 @@ declare module "dns" { ...@@ -185,9 +185,9 @@ declare module "dns" {
185 function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>; 185 function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
186 } 186 }
187 187
188 - function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 188 + function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
189 - function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void; 189 + function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
190 - function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void; 190 + function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
191 191
192 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 192 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
193 namespace resolve6 { 193 namespace resolve6 {
...@@ -196,53 +196,53 @@ declare module "dns" { ...@@ -196,53 +196,53 @@ declare module "dns" {
196 function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>; 196 function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
197 } 197 }
198 198
199 - function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 199 + function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
200 namespace resolveCname { 200 namespace resolveCname {
201 function __promisify__(hostname: string): Promise<string[]>; 201 function __promisify__(hostname: string): Promise<string[]>;
202 } 202 }
203 203
204 - function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void; 204 + function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
205 namespace resolveMx { 205 namespace resolveMx {
206 function __promisify__(hostname: string): Promise<MxRecord[]>; 206 function __promisify__(hostname: string): Promise<MxRecord[]>;
207 } 207 }
208 208
209 - function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void; 209 + function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
210 namespace resolveNaptr { 210 namespace resolveNaptr {
211 function __promisify__(hostname: string): Promise<NaptrRecord[]>; 211 function __promisify__(hostname: string): Promise<NaptrRecord[]>;
212 } 212 }
213 213
214 - function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 214 + function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
215 namespace resolveNs { 215 namespace resolveNs {
216 function __promisify__(hostname: string): Promise<string[]>; 216 function __promisify__(hostname: string): Promise<string[]>;
217 } 217 }
218 218
219 - function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void; 219 + function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
220 namespace resolvePtr { 220 namespace resolvePtr {
221 function __promisify__(hostname: string): Promise<string[]>; 221 function __promisify__(hostname: string): Promise<string[]>;
222 } 222 }
223 223
224 - function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void; 224 + function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
225 namespace resolveSoa { 225 namespace resolveSoa {
226 function __promisify__(hostname: string): Promise<SoaRecord>; 226 function __promisify__(hostname: string): Promise<SoaRecord>;
227 } 227 }
228 228
229 - function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void; 229 + function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
230 namespace resolveSrv { 230 namespace resolveSrv {
231 function __promisify__(hostname: string): Promise<SrvRecord[]>; 231 function __promisify__(hostname: string): Promise<SrvRecord[]>;
232 } 232 }
233 233
234 - function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void; 234 + function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
235 namespace resolveTxt { 235 namespace resolveTxt {
236 function __promisify__(hostname: string): Promise<string[][]>; 236 function __promisify__(hostname: string): Promise<string[][]>;
237 } 237 }
238 238
239 - function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: AnyRecord[]) => void): void; 239 + function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
240 namespace resolveAny { 240 namespace resolveAny {
241 function __promisify__(hostname: string): Promise<AnyRecord[]>; 241 function __promisify__(hostname: string): Promise<AnyRecord[]>;
242 } 242 }
243 243
244 - function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void; 244 + function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
245 - function setServers(servers: string[]): void; 245 + function setServers(servers: ReadonlyArray<string>): void;
246 function getServers(): string[]; 246 function getServers(): string[];
247 247
248 // Error codes 248 // Error codes
...@@ -289,4 +289,78 @@ declare module "dns" { ...@@ -289,4 +289,78 @@ declare module "dns" {
289 reverse: typeof reverse; 289 reverse: typeof reverse;
290 cancel(): void; 290 cancel(): void;
291 } 291 }
292 +
293 + namespace promises {
294 + function getServers(): string[];
295 +
296 + function lookup(hostname: string, family: number): Promise<LookupAddress>;
297 + function lookup(hostname: string, options: LookupOneOptions): Promise<LookupAddress>;
298 + function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
299 + function lookup(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
300 + function lookup(hostname: string): Promise<LookupAddress>;
301 +
302 + function lookupService(address: string, port: number): Promise<{ hostname: string, service: string }>;
303 +
304 + function resolve(hostname: string): Promise<string[]>;
305 + function resolve(hostname: string, rrtype: "A"): Promise<string[]>;
306 + function resolve(hostname: string, rrtype: "AAAA"): Promise<string[]>;
307 + function resolve(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
308 + function resolve(hostname: string, rrtype: "CNAME"): Promise<string[]>;
309 + function resolve(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
310 + function resolve(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
311 + function resolve(hostname: string, rrtype: "NS"): Promise<string[]>;
312 + function resolve(hostname: string, rrtype: "PTR"): Promise<string[]>;
313 + function resolve(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
314 + function resolve(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
315 + function resolve(hostname: string, rrtype: "TXT"): Promise<string[][]>;
316 + function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
317 +
318 + function resolve4(hostname: string): Promise<string[]>;
319 + function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
320 + function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
321 +
322 + function resolve6(hostname: string): Promise<string[]>;
323 + function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
324 + function resolve6(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
325 +
326 + function resolveAny(hostname: string): Promise<AnyRecord[]>;
327 +
328 + function resolveCname(hostname: string): Promise<string[]>;
329 +
330 + function resolveMx(hostname: string): Promise<MxRecord[]>;
331 +
332 + function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
333 +
334 + function resolveNs(hostname: string): Promise<string[]>;
335 +
336 + function resolvePtr(hostname: string): Promise<string[]>;
337 +
338 + function resolveSoa(hostname: string): Promise<SoaRecord>;
339 +
340 + function resolveSrv(hostname: string): Promise<SrvRecord[]>;
341 +
342 + function resolveTxt(hostname: string): Promise<string[][]>;
343 +
344 + function reverse(ip: string): Promise<string[]>;
345 +
346 + function setServers(servers: ReadonlyArray<string>): void;
347 +
348 + class Resolver {
349 + getServers: typeof getServers;
350 + resolve: typeof resolve;
351 + resolve4: typeof resolve4;
352 + resolve6: typeof resolve6;
353 + resolveAny: typeof resolveAny;
354 + resolveCname: typeof resolveCname;
355 + resolveMx: typeof resolveMx;
356 + resolveNaptr: typeof resolveNaptr;
357 + resolveNs: typeof resolveNs;
358 + resolvePtr: typeof resolvePtr;
359 + resolveSoa: typeof resolveSoa;
360 + resolveSrv: typeof resolveSrv;
361 + resolveTxt: typeof resolveTxt;
362 + reverse: typeof reverse;
363 + setServers: typeof setServers;
364 + }
365 + }
292 } 366 }
......
1 declare module "events" { 1 declare module "events" {
2 class internal extends NodeJS.EventEmitter { } 2 class internal extends NodeJS.EventEmitter { }
3 3
4 + interface NodeEventTarget {
5 + once(event: string | symbol, listener: (...args: any[]) => void): this;
6 + }
7 +
8 + interface DOMEventTarget {
9 + addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any;
10 + }
11 +
4 namespace internal { 12 namespace internal {
13 + function once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
14 + function once(emitter: DOMEventTarget, event: string): Promise<any[]>;
5 class EventEmitter extends internal { 15 class EventEmitter extends internal {
6 /** @deprecated since v4.0.0 */ 16 /** @deprecated since v4.0.0 */
7 static listenerCount(emitter: EventEmitter, event: string | symbol): number; 17 static listenerCount(emitter: EventEmitter, event: string | symbol): number;
......
...@@ -8,8 +8,9 @@ declare module "fs" { ...@@ -8,8 +8,9 @@ declare module "fs" {
8 */ 8 */
9 type PathLike = string | Buffer | URL; 9 type PathLike = string | Buffer | URL;
10 10
11 - type BinaryData = Buffer | DataView | NodeJS.TypedArray; 11 + type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
12 - class Stats { 12 +
13 + interface StatsBase<T> {
13 isFile(): boolean; 14 isFile(): boolean;
14 isDirectory(): boolean; 15 isDirectory(): boolean;
15 isBlockDevice(): boolean; 16 isBlockDevice(): boolean;
...@@ -17,6 +18,7 @@ declare module "fs" { ...@@ -17,6 +18,7 @@ declare module "fs" {
17 isSymbolicLink(): boolean; 18 isSymbolicLink(): boolean;
18 isFIFO(): boolean; 19 isFIFO(): boolean;
19 isSocket(): boolean; 20 isSocket(): boolean;
21 +
20 dev: number; 22 dev: number;
21 ino: number; 23 ino: number;
22 mode: number; 24 mode: number;
...@@ -37,6 +39,12 @@ declare module "fs" { ...@@ -37,6 +39,12 @@ declare module "fs" {
37 birthtime: Date; 39 birthtime: Date;
38 } 40 }
39 41
42 + interface Stats extends StatsBase<number> {
43 + }
44 +
45 + class Stats {
46 + }
47 +
40 class Dirent { 48 class Dirent {
41 isFile(): boolean; 49 isFile(): boolean;
42 isDirectory(): boolean; 50 isDirectory(): boolean;
...@@ -48,6 +56,46 @@ declare module "fs" { ...@@ -48,6 +56,46 @@ declare module "fs" {
48 name: string; 56 name: string;
49 } 57 }
50 58
59 + /**
60 + * A class representing a directory stream.
61 + */
62 + class Dir {
63 + readonly path: string;
64 +
65 + /**
66 + * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read.
67 + */
68 + [Symbol.asyncIterator](): AsyncIterableIterator<Dirent>;
69 +
70 + /**
71 + * Asynchronously close the directory's underlying resource handle.
72 + * Subsequent reads will result in errors.
73 + */
74 + close(): Promise<void>;
75 + close(cb: NoParamCallback): void;
76 +
77 + /**
78 + * Synchronously close the directory's underlying resource handle.
79 + * Subsequent reads will result in errors.
80 + */
81 + closeSync(): void;
82 +
83 + /**
84 + * Asynchronously read the next directory entry via `readdir(3)` as an `Dirent`.
85 + * After the read is completed, a value is returned that will be resolved with an `Dirent`, or `null` if there are no more directory entries to read.
86 + * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.
87 + */
88 + read(): Promise<Dirent | null>;
89 + read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void;
90 +
91 + /**
92 + * Synchronously read the next directory entry via `readdir(3)` as a `Dirent`.
93 + * If there are no more directory entries to read, null will be returned.
94 + * Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.
95 + */
96 + readSync(): Dirent;
97 + }
98 +
51 interface FSWatcher extends events.EventEmitter { 99 interface FSWatcher extends events.EventEmitter {
52 close(): void; 100 close(): void;
53 101
...@@ -146,7 +194,7 @@ declare module "fs" { ...@@ -146,7 +194,7 @@ declare module "fs" {
146 * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. 194 * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
147 * URL support is _experimental_. 195 * URL support is _experimental_.
148 */ 196 */
149 - function rename(oldPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; 197 + function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
150 198
151 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 199 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
152 namespace rename { 200 namespace rename {
...@@ -174,14 +222,14 @@ declare module "fs" { ...@@ -174,14 +222,14 @@ declare module "fs" {
174 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 222 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
175 * @param len If not specified, defaults to `0`. 223 * @param len If not specified, defaults to `0`.
176 */ 224 */
177 - function truncate(path: PathLike, len: number | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; 225 + function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void;
178 226
179 /** 227 /**
180 * Asynchronous truncate(2) - Truncate a file to a specified length. 228 * Asynchronous truncate(2) - Truncate a file to a specified length.
181 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 229 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
182 * URL support is _experimental_. 230 * URL support is _experimental_.
183 */ 231 */
184 - function truncate(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; 232 + function truncate(path: PathLike, callback: NoParamCallback): void;
185 233
186 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 234 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
187 namespace truncate { 235 namespace truncate {
...@@ -205,13 +253,13 @@ declare module "fs" { ...@@ -205,13 +253,13 @@ declare module "fs" {
205 * @param fd A file descriptor. 253 * @param fd A file descriptor.
206 * @param len If not specified, defaults to `0`. 254 * @param len If not specified, defaults to `0`.
207 */ 255 */
208 - function ftruncate(fd: number, len: number | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; 256 + function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void;
209 257
210 /** 258 /**
211 * Asynchronous ftruncate(2) - Truncate a file to a specified length. 259 * Asynchronous ftruncate(2) - Truncate a file to a specified length.
212 * @param fd A file descriptor. 260 * @param fd A file descriptor.
213 */ 261 */
214 - function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; 262 + function ftruncate(fd: number, callback: NoParamCallback): void;
215 263
216 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 264 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
217 namespace ftruncate { 265 namespace ftruncate {
...@@ -234,7 +282,7 @@ declare module "fs" { ...@@ -234,7 +282,7 @@ declare module "fs" {
234 * Asynchronous chown(2) - Change ownership of a file. 282 * Asynchronous chown(2) - Change ownership of a file.
235 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 283 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
236 */ 284 */
237 - function chown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; 285 + function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
238 286
239 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 287 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
240 namespace chown { 288 namespace chown {
...@@ -255,7 +303,7 @@ declare module "fs" { ...@@ -255,7 +303,7 @@ declare module "fs" {
255 * Asynchronous fchown(2) - Change ownership of a file. 303 * Asynchronous fchown(2) - Change ownership of a file.
256 * @param fd A file descriptor. 304 * @param fd A file descriptor.
257 */ 305 */
258 - function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; 306 + function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
259 307
260 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 308 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
261 namespace fchown { 309 namespace fchown {
...@@ -276,7 +324,7 @@ declare module "fs" { ...@@ -276,7 +324,7 @@ declare module "fs" {
276 * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. 324 * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
277 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 325 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
278 */ 326 */
279 - function lchown(path: PathLike, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void; 327 + function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
280 328
281 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 329 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
282 namespace lchown { 330 namespace lchown {
...@@ -298,7 +346,7 @@ declare module "fs" { ...@@ -298,7 +346,7 @@ declare module "fs" {
298 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 346 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
299 * @param mode A file mode. If a string is passed, it is parsed as an octal integer. 347 * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
300 */ 348 */
301 - function chmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; 349 + function chmod(path: PathLike, mode: string | number, callback: NoParamCallback): void;
302 350
303 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 351 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
304 namespace chmod { 352 namespace chmod {
...@@ -322,7 +370,7 @@ declare module "fs" { ...@@ -322,7 +370,7 @@ declare module "fs" {
322 * @param fd A file descriptor. 370 * @param fd A file descriptor.
323 * @param mode A file mode. If a string is passed, it is parsed as an octal integer. 371 * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
324 */ 372 */
325 - function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; 373 + function fchmod(fd: number, mode: string | number, callback: NoParamCallback): void;
326 374
327 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 375 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
328 namespace fchmod { 376 namespace fchmod {
...@@ -346,7 +394,7 @@ declare module "fs" { ...@@ -346,7 +394,7 @@ declare module "fs" {
346 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 394 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
347 * @param mode A file mode. If a string is passed, it is parsed as an octal integer. 395 * @param mode A file mode. If a string is passed, it is parsed as an octal integer.
348 */ 396 */
349 - function lchmod(path: PathLike, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void; 397 + function lchmod(path: PathLike, mode: string | number, callback: NoParamCallback): void;
350 398
351 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 399 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
352 namespace lchmod { 400 namespace lchmod {
...@@ -369,7 +417,7 @@ declare module "fs" { ...@@ -369,7 +417,7 @@ declare module "fs" {
369 * Asynchronous stat(2) - Get file status. 417 * Asynchronous stat(2) - Get file status.
370 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 418 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
371 */ 419 */
372 - function stat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; 420 + function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
373 421
374 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 422 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
375 namespace stat { 423 namespace stat {
...@@ -390,7 +438,7 @@ declare module "fs" { ...@@ -390,7 +438,7 @@ declare module "fs" {
390 * Asynchronous fstat(2) - Get file status. 438 * Asynchronous fstat(2) - Get file status.
391 * @param fd A file descriptor. 439 * @param fd A file descriptor.
392 */ 440 */
393 - function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; 441 + function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
394 442
395 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 443 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
396 namespace fstat { 444 namespace fstat {
...@@ -411,7 +459,7 @@ declare module "fs" { ...@@ -411,7 +459,7 @@ declare module "fs" {
411 * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. 459 * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
412 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 460 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
413 */ 461 */
414 - function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException, stats: Stats) => void): void; 462 + function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
415 463
416 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 464 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
417 namespace lstat { 465 namespace lstat {
...@@ -433,7 +481,7 @@ declare module "fs" { ...@@ -433,7 +481,7 @@ declare module "fs" {
433 * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. 481 * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
434 * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. 482 * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
435 */ 483 */
436 - function link(existingPath: PathLike, newPath: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; 484 + function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
437 485
438 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 486 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
439 namespace link { 487 namespace link {
...@@ -442,7 +490,7 @@ declare module "fs" { ...@@ -442,7 +490,7 @@ declare module "fs" {
442 * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. 490 * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
443 * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. 491 * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
444 */ 492 */
445 - function link(existingPath: PathLike, newPath: PathLike): Promise<void>; 493 + function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
446 } 494 }
447 495
448 /** 496 /**
...@@ -459,14 +507,14 @@ declare module "fs" { ...@@ -459,14 +507,14 @@ declare module "fs" {
459 * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). 507 * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
460 * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. 508 * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
461 */ 509 */
462 - function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; 510 + function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void;
463 511
464 /** 512 /**
465 * Asynchronous symlink(2) - Create a new symbolic link to an existing file. 513 * Asynchronous symlink(2) - Create a new symbolic link to an existing file.
466 * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. 514 * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
467 * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. 515 * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
468 */ 516 */
469 - function symlink(target: PathLike, path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; 517 + function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
470 518
471 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 519 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
472 namespace symlink { 520 namespace symlink {
...@@ -496,27 +544,31 @@ declare module "fs" { ...@@ -496,27 +544,31 @@ declare module "fs" {
496 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 544 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
497 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 545 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
498 */ 546 */
499 - function readlink(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void; 547 + function readlink(
548 + path: PathLike,
549 + options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
550 + callback: (err: NodeJS.ErrnoException | null, linkString: string) => void
551 + ): void;
500 552
501 /** 553 /**
502 * Asynchronous readlink(2) - read value of a symbolic link. 554 * Asynchronous readlink(2) - read value of a symbolic link.
503 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 555 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
504 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 556 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
505 */ 557 */
506 - function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, linkString: Buffer) => void): void; 558 + function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void;
507 559
508 /** 560 /**
509 * Asynchronous readlink(2) - read value of a symbolic link. 561 * Asynchronous readlink(2) - read value of a symbolic link.
510 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 562 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
511 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 563 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
512 */ 564 */
513 - function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, linkString: string | Buffer) => void): void; 565 + function readlink(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void;
514 566
515 /** 567 /**
516 * Asynchronous readlink(2) - read value of a symbolic link. 568 * Asynchronous readlink(2) - read value of a symbolic link.
517 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 569 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
518 */ 570 */
519 - function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException, linkString: string) => void): void; 571 + function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void;
520 572
521 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 573 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
522 namespace readlink { 574 namespace readlink {
...@@ -568,27 +620,31 @@ declare module "fs" { ...@@ -568,27 +620,31 @@ declare module "fs" {
568 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 620 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
569 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 621 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
570 */ 622 */
571 - function realpath(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; 623 + function realpath(
624 + path: PathLike,
625 + options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
626 + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
627 + ): void;
572 628
573 /** 629 /**
574 * Asynchronous realpath(3) - return the canonicalized absolute pathname. 630 * Asynchronous realpath(3) - return the canonicalized absolute pathname.
575 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 631 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
576 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 632 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
577 */ 633 */
578 - function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, resolvedPath: Buffer) => void): void; 634 + function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
579 635
580 /** 636 /**
581 * Asynchronous realpath(3) - return the canonicalized absolute pathname. 637 * Asynchronous realpath(3) - return the canonicalized absolute pathname.
582 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 638 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
583 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 639 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
584 */ 640 */
585 - function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string | Buffer) => void): void; 641 + function realpath(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
586 642
587 /** 643 /**
588 * Asynchronous realpath(3) - return the canonicalized absolute pathname. 644 * Asynchronous realpath(3) - return the canonicalized absolute pathname.
589 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 645 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
590 */ 646 */
591 - function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; 647 + function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
592 648
593 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 649 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
594 namespace realpath { 650 namespace realpath {
...@@ -613,10 +669,14 @@ declare module "fs" { ...@@ -613,10 +669,14 @@ declare module "fs" {
613 */ 669 */
614 function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>; 670 function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
615 671
616 - function native(path: PathLike, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; 672 + function native(
617 - function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, resolvedPath: Buffer) => void): void; 673 + path: PathLike,
618 - function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, resolvedPath: string | Buffer) => void): void; 674 + options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null,
619 - function native(path: PathLike, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => void): void; 675 + callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
676 + ): void;
677 + function native(path: PathLike, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
678 + function native(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
679 + function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
620 } 680 }
621 681
622 /** 682 /**
...@@ -650,7 +710,7 @@ declare module "fs" { ...@@ -650,7 +710,7 @@ declare module "fs" {
650 * Asynchronous unlink(2) - delete a name and possibly the file it refers to. 710 * Asynchronous unlink(2) - delete a name and possibly the file it refers to.
651 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 711 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
652 */ 712 */
653 - function unlink(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; 713 + function unlink(path: PathLike, callback: NoParamCallback): void;
654 714
655 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 715 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
656 namespace unlink { 716 namespace unlink {
...@@ -667,11 +727,42 @@ declare module "fs" { ...@@ -667,11 +727,42 @@ declare module "fs" {
667 */ 727 */
668 function unlinkSync(path: PathLike): void; 728 function unlinkSync(path: PathLike): void;
669 729
730 + interface RmDirOptions {
731 + /**
732 + * If `true`, perform a recursive directory removal. In
733 + * recursive mode, errors are not reported if `path` does not exist, and
734 + * operations are retried on failure.
735 + * @experimental
736 + * @default false
737 + */
738 + recursive?: boolean;
739 + }
740 +
741 + interface RmDirAsyncOptions extends RmDirOptions {
742 + /**
743 + * If an `EMFILE` error is encountered, Node.js will
744 + * retry the operation with a linear backoff of 1ms longer on each try until the
745 + * timeout duration passes this limit. This option is ignored if the `recursive`
746 + * option is not `true`.
747 + * @default 1000
748 + */
749 + emfileWait?: number;
750 + /**
751 + * If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
752 + * encountered, Node.js will retry the operation with a linear backoff wait of
753 + * 100ms longer on each try. This option represents the number of retries. This
754 + * option is ignored if the `recursive` option is not `true`.
755 + * @default 3
756 + */
757 + maxBusyTries?: number;
758 + }
759 +
670 /** 760 /**
671 * Asynchronous rmdir(2) - delete a directory. 761 * Asynchronous rmdir(2) - delete a directory.
672 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 762 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
673 */ 763 */
674 - function rmdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; 764 + function rmdir(path: PathLike, callback: NoParamCallback): void;
765 + function rmdir(path: PathLike, options: RmDirAsyncOptions, callback: NoParamCallback): void;
675 766
676 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 767 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
677 namespace rmdir { 768 namespace rmdir {
...@@ -679,16 +770,16 @@ declare module "fs" { ...@@ -679,16 +770,16 @@ declare module "fs" {
679 * Asynchronous rmdir(2) - delete a directory. 770 * Asynchronous rmdir(2) - delete a directory.
680 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 771 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
681 */ 772 */
682 - function __promisify__(path: PathLike): Promise<void>; 773 + function __promisify__(path: PathLike, options?: RmDirAsyncOptions): Promise<void>;
683 } 774 }
684 775
685 /** 776 /**
686 * Synchronous rmdir(2) - delete a directory. 777 * Synchronous rmdir(2) - delete a directory.
687 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 778 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
688 */ 779 */
689 - function rmdirSync(path: PathLike): void; 780 + function rmdirSync(path: PathLike, options?: RmDirOptions): void;
690 781
691 - export interface MakeDirectoryOptions { 782 + interface MakeDirectoryOptions {
692 /** 783 /**
693 * Indicates whether parent folders should be created. 784 * Indicates whether parent folders should be created.
694 * @default false 785 * @default false
...@@ -707,13 +798,13 @@ declare module "fs" { ...@@ -707,13 +798,13 @@ declare module "fs" {
707 * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders 798 * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
708 * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. 799 * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
709 */ 800 */
710 - function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: (err: NodeJS.ErrnoException) => void): void; 801 + function mkdir(path: PathLike, options: number | string | MakeDirectoryOptions | undefined | null, callback: NoParamCallback): void;
711 802
712 /** 803 /**
713 * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. 804 * Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
714 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 805 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
715 */ 806 */
716 - function mkdir(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; 807 + function mkdir(path: PathLike, callback: NoParamCallback): void;
717 808
718 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 809 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
719 namespace mkdir { 810 namespace mkdir {
...@@ -739,27 +830,27 @@ declare module "fs" { ...@@ -739,27 +830,27 @@ declare module "fs" {
739 * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. 830 * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
740 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 831 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
741 */ 832 */
742 - function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; 833 + function mkdtemp(prefix: string, options: { encoding?: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
743 834
744 /** 835 /**
745 * Asynchronously creates a unique temporary directory. 836 * Asynchronously creates a unique temporary directory.
746 * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. 837 * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
747 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 838 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
748 */ 839 */
749 - function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException, folder: Buffer) => void): void; 840 + function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void;
750 841
751 /** 842 /**
752 * Asynchronously creates a unique temporary directory. 843 * Asynchronously creates a unique temporary directory.
753 * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. 844 * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
754 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 845 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
755 */ 846 */
756 - function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, folder: string | Buffer) => void): void; 847 + function mkdtemp(prefix: string, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void;
757 848
758 /** 849 /**
759 * Asynchronously creates a unique temporary directory. 850 * Asynchronously creates a unique temporary directory.
760 * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. 851 * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
761 */ 852 */
762 - function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void; 853 + function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
763 854
764 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 855 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
765 namespace mkdtemp { 856 namespace mkdtemp {
...@@ -814,7 +905,7 @@ declare module "fs" { ...@@ -814,7 +905,7 @@ declare module "fs" {
814 function readdir( 905 function readdir(
815 path: PathLike, 906 path: PathLike,
816 options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null, 907 options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null,
817 - callback: (err: NodeJS.ErrnoException, files: string[]) => void, 908 + callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
818 ): void; 909 ): void;
819 910
820 /** 911 /**
...@@ -822,7 +913,7 @@ declare module "fs" { ...@@ -822,7 +913,7 @@ declare module "fs" {
822 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 913 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
823 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 914 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
824 */ 915 */
825 - function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException, files: Buffer[]) => void): void; 916 + function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer", callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void): void;
826 917
827 /** 918 /**
828 * Asynchronous readdir(3) - read a directory. 919 * Asynchronous readdir(3) - read a directory.
...@@ -832,21 +923,21 @@ declare module "fs" { ...@@ -832,21 +923,21 @@ declare module "fs" {
832 function readdir( 923 function readdir(
833 path: PathLike, 924 path: PathLike,
834 options: { encoding?: string | null; withFileTypes?: false } | string | undefined | null, 925 options: { encoding?: string | null; withFileTypes?: false } | string | undefined | null,
835 - callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void, 926 + callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
836 ): void; 927 ): void;
837 928
838 /** 929 /**
839 * Asynchronous readdir(3) - read a directory. 930 * Asynchronous readdir(3) - read a directory.
840 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 931 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
841 */ 932 */
842 - function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; 933 + function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void;
843 934
844 /** 935 /**
845 * Asynchronous readdir(3) - read a directory. 936 * Asynchronous readdir(3) - read a directory.
846 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 937 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
847 * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. 938 * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
848 */ 939 */
849 - function readdir(path: PathLike, options: { withFileTypes: true }, callback: (err: NodeJS.ErrnoException, files: Dirent[]) => void): void; 940 + function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void;
850 941
851 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 942 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
852 namespace readdir { 943 namespace readdir {
...@@ -876,7 +967,7 @@ declare module "fs" { ...@@ -876,7 +967,7 @@ declare module "fs" {
876 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 967 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
877 * @param options If called with `withFileTypes: true` the result data will be an array of Dirent 968 * @param options If called with `withFileTypes: true` the result data will be an array of Dirent
878 */ 969 */
879 - function __promisify__(path: PathLike, options: { withFileTypes: true }): Promise<Dirent[]>; 970 + function __promisify__(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise<Dirent[]>;
880 } 971 }
881 972
882 /** 973 /**
...@@ -901,17 +992,17 @@ declare module "fs" { ...@@ -901,17 +992,17 @@ declare module "fs" {
901 function readdirSync(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): string[] | Buffer[]; 992 function readdirSync(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): string[] | Buffer[];
902 993
903 /** 994 /**
904 - * Asynchronous readdir(3) - read a directory. 995 + * Synchronous readdir(3) - read a directory.
905 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 996 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
906 * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. 997 * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
907 */ 998 */
908 - function readdirSync(path: PathLike, options: { withFileTypes: true }): Dirent[]; 999 + function readdirSync(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Dirent[];
909 1000
910 /** 1001 /**
911 * Asynchronous close(2) - close a file descriptor. 1002 * Asynchronous close(2) - close a file descriptor.
912 * @param fd A file descriptor. 1003 * @param fd A file descriptor.
913 */ 1004 */
914 - function close(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; 1005 + function close(fd: number, callback: NoParamCallback): void;
915 1006
916 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1007 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
917 namespace close { 1008 namespace close {
...@@ -933,13 +1024,13 @@ declare module "fs" { ...@@ -933,13 +1024,13 @@ declare module "fs" {
933 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 1024 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
934 * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. 1025 * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
935 */ 1026 */
936 - function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; 1027 + function open(path: PathLike, flags: string | number, mode: string | number | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
937 1028
938 /** 1029 /**
939 * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. 1030 * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
940 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 1031 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
941 */ 1032 */
942 - function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; 1033 + function open(path: PathLike, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
943 1034
944 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1035 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
945 namespace open { 1036 namespace open {
...@@ -964,7 +1055,7 @@ declare module "fs" { ...@@ -964,7 +1055,7 @@ declare module "fs" {
964 * @param atime The last access time. If a string is provided, it will be coerced to number. 1055 * @param atime The last access time. If a string is provided, it will be coerced to number.
965 * @param mtime The last modified time. If a string is provided, it will be coerced to number. 1056 * @param mtime The last modified time. If a string is provided, it will be coerced to number.
966 */ 1057 */
967 - function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException) => void): void; 1058 + function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
968 1059
969 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1060 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
970 namespace utimes { 1061 namespace utimes {
...@@ -991,7 +1082,7 @@ declare module "fs" { ...@@ -991,7 +1082,7 @@ declare module "fs" {
991 * @param atime The last access time. If a string is provided, it will be coerced to number. 1082 * @param atime The last access time. If a string is provided, it will be coerced to number.
992 * @param mtime The last modified time. If a string is provided, it will be coerced to number. 1083 * @param mtime The last modified time. If a string is provided, it will be coerced to number.
993 */ 1084 */
994 - function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: (err: NodeJS.ErrnoException) => void): void; 1085 + function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
995 1086
996 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1087 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
997 namespace futimes { 1088 namespace futimes {
...@@ -1016,7 +1107,7 @@ declare module "fs" { ...@@ -1016,7 +1107,7 @@ declare module "fs" {
1016 * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. 1107 * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
1017 * @param fd A file descriptor. 1108 * @param fd A file descriptor.
1018 */ 1109 */
1019 - function fsync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; 1110 + function fsync(fd: number, callback: NoParamCallback): void;
1020 1111
1021 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1112 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1022 namespace fsync { 1113 namespace fsync {
...@@ -1040,13 +1131,13 @@ declare module "fs" { ...@@ -1040,13 +1131,13 @@ declare module "fs" {
1040 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. 1131 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1041 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. 1132 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1042 */ 1133 */
1043 - function write<TBuffer extends BinaryData>( 1134 + function write<TBuffer extends NodeJS.ArrayBufferView>(
1044 fd: number, 1135 fd: number,
1045 buffer: TBuffer, 1136 buffer: TBuffer,
1046 offset: number | undefined | null, 1137 offset: number | undefined | null,
1047 length: number | undefined | null, 1138 length: number | undefined | null,
1048 position: number | undefined | null, 1139 position: number | undefined | null,
1049 - callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void, 1140 + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
1050 ): void; 1141 ): void;
1051 1142
1052 /** 1143 /**
...@@ -1055,12 +1146,12 @@ declare module "fs" { ...@@ -1055,12 +1146,12 @@ declare module "fs" {
1055 * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. 1146 * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
1056 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. 1147 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1057 */ 1148 */
1058 - function write<TBuffer extends BinaryData>( 1149 + function write<TBuffer extends NodeJS.ArrayBufferView>(
1059 fd: number, 1150 fd: number,
1060 buffer: TBuffer, 1151 buffer: TBuffer,
1061 offset: number | undefined | null, 1152 offset: number | undefined | null,
1062 length: number | undefined | null, 1153 length: number | undefined | null,
1063 - callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void, 1154 + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
1064 ): void; 1155 ): void;
1065 1156
1066 /** 1157 /**
...@@ -1068,13 +1159,18 @@ declare module "fs" { ...@@ -1068,13 +1159,18 @@ declare module "fs" {
1068 * @param fd A file descriptor. 1159 * @param fd A file descriptor.
1069 * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. 1160 * @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
1070 */ 1161 */
1071 - function write<TBuffer extends BinaryData>(fd: number, buffer: TBuffer, offset: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; 1162 + function write<TBuffer extends NodeJS.ArrayBufferView>(
1163 + fd: number,
1164 + buffer: TBuffer,
1165 + offset: number | undefined | null,
1166 + callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
1167 + ): void;
1072 1168
1073 /** 1169 /**
1074 * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. 1170 * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
1075 * @param fd A file descriptor. 1171 * @param fd A file descriptor.
1076 */ 1172 */
1077 - function write<TBuffer extends BinaryData>(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException, written: number, buffer: TBuffer) => void): void; 1173 + function write<TBuffer extends NodeJS.ArrayBufferView>(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void;
1078 1174
1079 /** 1175 /**
1080 * Asynchronously writes `string` to the file referenced by the supplied file descriptor. 1176 * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
...@@ -1088,7 +1184,7 @@ declare module "fs" { ...@@ -1088,7 +1184,7 @@ declare module "fs" {
1088 string: any, 1184 string: any,
1089 position: number | undefined | null, 1185 position: number | undefined | null,
1090 encoding: string | undefined | null, 1186 encoding: string | undefined | null,
1091 - callback: (err: NodeJS.ErrnoException, written: number, str: string) => void, 1187 + callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
1092 ): void; 1188 ): void;
1093 1189
1094 /** 1190 /**
...@@ -1097,14 +1193,14 @@ declare module "fs" { ...@@ -1097,14 +1193,14 @@ declare module "fs" {
1097 * @param string A string to write. If something other than a string is supplied it will be coerced to a string. 1193 * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
1098 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. 1194 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1099 */ 1195 */
1100 - function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; 1196 + function write(fd: number, string: any, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
1101 1197
1102 /** 1198 /**
1103 * Asynchronously writes `string` to the file referenced by the supplied file descriptor. 1199 * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
1104 * @param fd A file descriptor. 1200 * @param fd A file descriptor.
1105 * @param string A string to write. If something other than a string is supplied it will be coerced to a string. 1201 * @param string A string to write. If something other than a string is supplied it will be coerced to a string.
1106 */ 1202 */
1107 - function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void; 1203 + function write(fd: number, string: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
1108 1204
1109 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1205 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1110 namespace write { 1206 namespace write {
...@@ -1115,7 +1211,7 @@ declare module "fs" { ...@@ -1115,7 +1211,7 @@ declare module "fs" {
1115 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. 1211 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1116 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. 1212 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1117 */ 1213 */
1118 - function __promisify__<TBuffer extends BinaryData>( 1214 + function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
1119 fd: number, 1215 fd: number,
1120 buffer?: TBuffer, 1216 buffer?: TBuffer,
1121 offset?: number, 1217 offset?: number,
...@@ -1140,7 +1236,7 @@ declare module "fs" { ...@@ -1140,7 +1236,7 @@ declare module "fs" {
1140 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. 1236 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1141 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. 1237 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1142 */ 1238 */
1143 - function writeSync(fd: number, buffer: BinaryData, offset?: number | null, length?: number | null, position?: number | null): number; 1239 + function writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number;
1144 1240
1145 /** 1241 /**
1146 * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. 1242 * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written.
...@@ -1159,13 +1255,13 @@ declare module "fs" { ...@@ -1159,13 +1255,13 @@ declare module "fs" {
1159 * @param length The number of bytes to read. 1255 * @param length The number of bytes to read.
1160 * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. 1256 * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
1161 */ 1257 */
1162 - function read<TBuffer extends BinaryData>( 1258 + function read<TBuffer extends NodeJS.ArrayBufferView>(
1163 fd: number, 1259 fd: number,
1164 buffer: TBuffer, 1260 buffer: TBuffer,
1165 offset: number, 1261 offset: number,
1166 length: number, 1262 length: number,
1167 position: number | null, 1263 position: number | null,
1168 - callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: TBuffer) => void, 1264 + callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
1169 ): void; 1265 ): void;
1170 1266
1171 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1267 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
...@@ -1177,7 +1273,13 @@ declare module "fs" { ...@@ -1177,7 +1273,13 @@ declare module "fs" {
1177 * @param length The number of bytes to read. 1273 * @param length The number of bytes to read.
1178 * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. 1274 * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
1179 */ 1275 */
1180 - function __promisify__<TBuffer extends BinaryData>(fd: number, buffer: TBuffer, offset: number, length: number, position: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; 1276 + function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
1277 + fd: number,
1278 + buffer: TBuffer,
1279 + offset: number,
1280 + length: number,
1281 + position: number | null
1282 + ): Promise<{ bytesRead: number, buffer: TBuffer }>;
1181 } 1283 }
1182 1284
1183 /** 1285 /**
...@@ -1188,7 +1290,7 @@ declare module "fs" { ...@@ -1188,7 +1290,7 @@ declare module "fs" {
1188 * @param length The number of bytes to read. 1290 * @param length The number of bytes to read.
1189 * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. 1291 * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
1190 */ 1292 */
1191 - function readSync(fd: number, buffer: BinaryData, offset: number, length: number, position: number | null): number; 1293 + function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number;
1192 1294
1193 /** 1295 /**
1194 * Asynchronously reads the entire contents of a file. 1296 * Asynchronously reads the entire contents of a file.
...@@ -1197,7 +1299,7 @@ declare module "fs" { ...@@ -1197,7 +1299,7 @@ declare module "fs" {
1197 * @param options An object that may contain an optional flag. 1299 * @param options An object that may contain an optional flag.
1198 * If a flag is not provided, it defaults to `'r'`. 1300 * If a flag is not provided, it defaults to `'r'`.
1199 */ 1301 */
1200 - function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; 1302 + function readFile(path: PathLike | number, options: { encoding?: null; flag?: string; } | undefined | null, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
1201 1303
1202 /** 1304 /**
1203 * Asynchronously reads the entire contents of a file. 1305 * Asynchronously reads the entire contents of a file.
...@@ -1207,7 +1309,7 @@ declare module "fs" { ...@@ -1207,7 +1309,7 @@ declare module "fs" {
1207 * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. 1309 * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1208 * If a flag is not provided, it defaults to `'r'`. 1310 * If a flag is not provided, it defaults to `'r'`.
1209 */ 1311 */
1210 - function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; 1312 + function readFile(path: PathLike | number, options: { encoding: string; flag?: string; } | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
1211 1313
1212 /** 1314 /**
1213 * Asynchronously reads the entire contents of a file. 1315 * Asynchronously reads the entire contents of a file.
...@@ -1220,7 +1322,7 @@ declare module "fs" { ...@@ -1220,7 +1322,7 @@ declare module "fs" {
1220 function readFile( 1322 function readFile(
1221 path: PathLike | number, 1323 path: PathLike | number,
1222 options: { encoding?: string | null; flag?: string; } | string | undefined | null, 1324 options: { encoding?: string | null; flag?: string; } | string | undefined | null,
1223 - callback: (err: NodeJS.ErrnoException, data: string | Buffer) => void, 1325 + callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
1224 ): void; 1326 ): void;
1225 1327
1226 /** 1328 /**
...@@ -1228,7 +1330,7 @@ declare module "fs" { ...@@ -1228,7 +1330,7 @@ declare module "fs" {
1228 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 1330 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1229 * If a file descriptor is provided, the underlying file will _not_ be closed automatically. 1331 * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1230 */ 1332 */
1231 - function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; 1333 + function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
1232 1334
1233 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1335 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1234 namespace readFile { 1336 namespace readFile {
...@@ -1305,7 +1407,7 @@ declare module "fs" { ...@@ -1305,7 +1407,7 @@ declare module "fs" {
1305 * If `mode` is a string, it is parsed as an octal integer. 1407 * If `mode` is a string, it is parsed as an octal integer.
1306 * If `flag` is not supplied, the default of `'w'` is used. 1408 * If `flag` is not supplied, the default of `'w'` is used.
1307 */ 1409 */
1308 - function writeFile(path: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException) => void): void; 1410 + function writeFile(path: PathLike | number, data: any, options: WriteFileOptions, callback: NoParamCallback): void;
1309 1411
1310 /** 1412 /**
1311 * Asynchronously writes data to a file, replacing the file if it already exists. 1413 * Asynchronously writes data to a file, replacing the file if it already exists.
...@@ -1314,7 +1416,7 @@ declare module "fs" { ...@@ -1314,7 +1416,7 @@ declare module "fs" {
1314 * If a file descriptor is provided, the underlying file will _not_ be closed automatically. 1416 * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1315 * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. 1417 * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1316 */ 1418 */
1317 - function writeFile(path: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; 1419 + function writeFile(path: PathLike | number, data: any, callback: NoParamCallback): void;
1318 1420
1319 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1421 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1320 namespace writeFile { 1422 namespace writeFile {
...@@ -1359,7 +1461,7 @@ declare module "fs" { ...@@ -1359,7 +1461,7 @@ declare module "fs" {
1359 * If `mode` is a string, it is parsed as an octal integer. 1461 * If `mode` is a string, it is parsed as an octal integer.
1360 * If `flag` is not supplied, the default of `'a'` is used. 1462 * If `flag` is not supplied, the default of `'a'` is used.
1361 */ 1463 */
1362 - function appendFile(file: PathLike | number, data: any, options: WriteFileOptions, callback: (err: NodeJS.ErrnoException) => void): void; 1464 + function appendFile(file: PathLike | number, data: any, options: WriteFileOptions, callback: NoParamCallback): void;
1363 1465
1364 /** 1466 /**
1365 * Asynchronously append data to a file, creating the file if it does not exist. 1467 * Asynchronously append data to a file, creating the file if it does not exist.
...@@ -1368,7 +1470,7 @@ declare module "fs" { ...@@ -1368,7 +1470,7 @@ declare module "fs" {
1368 * If a file descriptor is provided, the underlying file will _not_ be closed automatically. 1470 * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1369 * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. 1471 * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1370 */ 1472 */
1371 - function appendFile(file: PathLike | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void; 1473 + function appendFile(file: PathLike | number, data: any, callback: NoParamCallback): void;
1372 1474
1373 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1475 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1374 namespace appendFile { 1476 namespace appendFile {
...@@ -1646,6 +1748,13 @@ declare module "fs" { ...@@ -1646,6 +1748,13 @@ declare module "fs" {
1646 1748
1647 /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ 1749 /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */
1648 const S_IXOTH: number; 1750 const S_IXOTH: number;
1751 +
1752 + /**
1753 + * When set, a memory file mapping is used to access the file. This flag
1754 + * is available on Windows operating systems only. On other operating systems,
1755 + * this flag is ignored.
1756 + */
1757 + const UV_FS_O_FILEMAP: number;
1649 } 1758 }
1650 1759
1651 /** 1760 /**
...@@ -1653,14 +1762,14 @@ declare module "fs" { ...@@ -1653,14 +1762,14 @@ declare module "fs" {
1653 * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. 1762 * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1654 * URL support is _experimental_. 1763 * URL support is _experimental_.
1655 */ 1764 */
1656 - function access(path: PathLike, mode: number | undefined, callback: (err: NodeJS.ErrnoException) => void): void; 1765 + function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
1657 1766
1658 /** 1767 /**
1659 * Asynchronously tests a user's permissions for the file specified by path. 1768 * Asynchronously tests a user's permissions for the file specified by path.
1660 * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. 1769 * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1661 * URL support is _experimental_. 1770 * URL support is _experimental_.
1662 */ 1771 */
1663 - function access(path: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; 1772 + function access(path: PathLike, callback: NoParamCallback): void;
1664 1773
1665 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1774 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1666 namespace access { 1775 namespace access {
...@@ -1690,6 +1799,10 @@ declare module "fs" { ...@@ -1690,6 +1799,10 @@ declare module "fs" {
1690 fd?: number; 1799 fd?: number;
1691 mode?: number; 1800 mode?: number;
1692 autoClose?: boolean; 1801 autoClose?: boolean;
1802 + /**
1803 + * @default false
1804 + */
1805 + emitClose?: boolean;
1693 start?: number; 1806 start?: number;
1694 end?: number; 1807 end?: number;
1695 highWaterMark?: number; 1808 highWaterMark?: number;
...@@ -1707,13 +1820,14 @@ declare module "fs" { ...@@ -1707,13 +1820,14 @@ declare module "fs" {
1707 mode?: number; 1820 mode?: number;
1708 autoClose?: boolean; 1821 autoClose?: boolean;
1709 start?: number; 1822 start?: number;
1823 + highWaterMark?: number;
1710 }): WriteStream; 1824 }): WriteStream;
1711 1825
1712 /** 1826 /**
1713 * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. 1827 * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
1714 * @param fd A file descriptor. 1828 * @param fd A file descriptor.
1715 */ 1829 */
1716 - function fdatasync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void; 1830 + function fdatasync(fd: number, callback: NoParamCallback): void;
1717 1831
1718 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1832 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1719 namespace fdatasync { 1833 namespace fdatasync {
...@@ -1739,7 +1853,7 @@ declare module "fs" { ...@@ -1739,7 +1853,7 @@ declare module "fs" {
1739 * @param src A path to the source file. 1853 * @param src A path to the source file.
1740 * @param dest A path to the destination file. 1854 * @param dest A path to the destination file.
1741 */ 1855 */
1742 - function copyFile(src: PathLike, dest: PathLike, callback: (err: NodeJS.ErrnoException) => void): void; 1856 + function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
1743 /** 1857 /**
1744 * Asynchronously copies src to dest. By default, dest is overwritten if it already exists. 1858 * Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
1745 * No arguments other than a possible exception are given to the callback function. 1859 * No arguments other than a possible exception are given to the callback function.
...@@ -1750,7 +1864,7 @@ declare module "fs" { ...@@ -1750,7 +1864,7 @@ declare module "fs" {
1750 * @param dest A path to the destination file. 1864 * @param dest A path to the destination file.
1751 * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists. 1865 * @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
1752 */ 1866 */
1753 - function copyFile(src: PathLike, dest: PathLike, flags: number, callback: (err: NodeJS.ErrnoException) => void): void; 1867 + function copyFile(src: PathLike, dest: PathLike, flags: number, callback: NoParamCallback): void;
1754 1868
1755 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime. 1869 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1756 namespace copyFile { 1870 namespace copyFile {
...@@ -1781,6 +1895,52 @@ declare module "fs" { ...@@ -1781,6 +1895,52 @@ declare module "fs" {
1781 */ 1895 */
1782 function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void; 1896 function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void;
1783 1897
1898 + /**
1899 + * Write an array of ArrayBufferViews to the file specified by fd using writev().
1900 + * position is the offset from the beginning of the file where this data should be written.
1901 + * It is unsafe to use fs.writev() multiple times on the same file without waiting for the callback. For this scenario, use fs.createWriteStream().
1902 + * On Linux, positional writes don't work when the file is opened in append mode.
1903 + * The kernel ignores the position argument and always appends the data to the end of the file.
1904 + */
1905 + function writev(
1906 + fd: number,
1907 + buffers: NodeJS.ArrayBufferView[],
1908 + cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
1909 + ): void;
1910 + function writev(
1911 + fd: number,
1912 + buffers: NodeJS.ArrayBufferView[],
1913 + position: number,
1914 + cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
1915 + ): void;
1916 +
1917 + interface WriteVResult {
1918 + bytesWritten: number;
1919 + buffers: NodeJS.ArrayBufferView[];
1920 + }
1921 +
1922 + namespace writev {
1923 + function __promisify__(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
1924 + }
1925 +
1926 + /**
1927 + * See `writev`.
1928 + */
1929 + function writevSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number): number;
1930 +
1931 + interface OpenDirOptions {
1932 + encoding?: BufferEncoding;
1933 + }
1934 +
1935 + function opendirSync(path: string, options?: OpenDirOptions): Dir;
1936 +
1937 + function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
1938 + function opendir(path: string, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
1939 +
1940 + namespace opendir {
1941 + function __promisify__(path: string, options?: OpenDirOptions): Promise<Dir>;
1942 + }
1943 +
1784 namespace promises { 1944 namespace promises {
1785 interface FileHandle { 1945 interface FileHandle {
1786 /** 1946 /**
...@@ -1829,7 +1989,7 @@ declare module "fs" { ...@@ -1829,7 +1989,7 @@ declare module "fs" {
1829 * @param length The number of bytes to read. 1989 * @param length The number of bytes to read.
1830 * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. 1990 * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
1831 */ 1991 */
1832 - read<TBuffer extends Buffer | Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>; 1992 + read<TBuffer extends Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
1833 1993
1834 /** 1994 /**
1835 * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. 1995 * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
...@@ -1881,7 +2041,7 @@ declare module "fs" { ...@@ -1881,7 +2041,7 @@ declare module "fs" {
1881 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. 2041 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1882 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. 2042 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1883 */ 2043 */
1884 - write<TBuffer extends Buffer | Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>; 2044 + write<TBuffer extends Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
1885 2045
1886 /** 2046 /**
1887 * Asynchronously writes `string` to the file. 2047 * Asynchronously writes `string` to the file.
...@@ -1908,6 +2068,11 @@ declare module "fs" { ...@@ -1908,6 +2068,11 @@ declare module "fs" {
1908 writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>; 2068 writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
1909 2069
1910 /** 2070 /**
2071 + * See `fs.writev` promisified version.
2072 + */
2073 + writev(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<WriteVResult>;
2074 +
2075 + /**
1911 * Asynchronous close(2) - close a `FileHandle`. 2076 * Asynchronous close(2) - close a `FileHandle`.
1912 */ 2077 */
1913 close(): Promise<void>; 2078 close(): Promise<void>;
...@@ -1950,7 +2115,7 @@ declare module "fs" { ...@@ -1950,7 +2115,7 @@ declare module "fs" {
1950 * @param position The offset from the beginning of the file from which data should be read. If 2115 * @param position The offset from the beginning of the file from which data should be read. If
1951 * `null`, data will be read from the current position. 2116 * `null`, data will be read from the current position.
1952 */ 2117 */
1953 - function read<TBuffer extends Buffer | Uint8Array>( 2118 + function read<TBuffer extends Uint8Array>(
1954 handle: FileHandle, 2119 handle: FileHandle,
1955 buffer: TBuffer, 2120 buffer: TBuffer,
1956 offset?: number | null, 2121 offset?: number | null,
...@@ -1968,7 +2133,7 @@ declare module "fs" { ...@@ -1968,7 +2133,7 @@ declare module "fs" {
1968 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. 2133 * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
1969 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. 2134 * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
1970 */ 2135 */
1971 - function write<TBuffer extends Buffer | Uint8Array>( 2136 + function write<TBuffer extends Uint8Array>(
1972 handle: FileHandle, 2137 handle: FileHandle,
1973 buffer: TBuffer, 2138 buffer: TBuffer,
1974 offset?: number | null, 2139 offset?: number | null,
...@@ -2012,7 +2177,7 @@ declare module "fs" { ...@@ -2012,7 +2177,7 @@ declare module "fs" {
2012 * Asynchronous rmdir(2) - delete a directory. 2177 * Asynchronous rmdir(2) - delete a directory.
2013 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 2178 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2014 */ 2179 */
2015 - function rmdir(path: PathLike): Promise<void>; 2180 + function rmdir(path: PathLike, options?: RmDirAsyncOptions): Promise<void>;
2016 2181
2017 /** 2182 /**
2018 * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. 2183 * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
...@@ -2039,21 +2204,28 @@ declare module "fs" { ...@@ -2039,21 +2204,28 @@ declare module "fs" {
2039 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 2204 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2040 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 2205 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2041 */ 2206 */
2042 - function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string[]>; 2207 + function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
2043 2208
2044 /** 2209 /**
2045 * Asynchronous readdir(3) - read a directory. 2210 * Asynchronous readdir(3) - read a directory.
2046 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 2211 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2047 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 2212 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2048 */ 2213 */
2049 - function readdir(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer[]>; 2214 + function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise<Buffer[]>;
2050 2215
2051 /** 2216 /**
2052 * Asynchronous readdir(3) - read a directory. 2217 * Asynchronous readdir(3) - read a directory.
2053 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. 2218 * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2054 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. 2219 * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
2055 */ 2220 */
2056 - function readdir(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string[] | Buffer[]>; 2221 + function readdir(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise<string[] | Buffer[]>;
2222 +
2223 + /**
2224 + * Asynchronous readdir(3) - read a directory.
2225 + * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2226 + * @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
2227 + */
2228 + function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise<Dirent[]>;
2057 2229
2058 /** 2230 /**
2059 * Asynchronous readlink(2) - read value of a symbolic link. 2231 * Asynchronous readlink(2) - read value of a symbolic link.
...@@ -2268,5 +2440,7 @@ declare module "fs" { ...@@ -2268,5 +2440,7 @@ declare module "fs" {
2268 * If a flag is not provided, it defaults to `'r'`. 2440 * If a flag is not provided, it defaults to `'r'`.
2269 */ 2441 */
2270 function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>; 2442 function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
2443 +
2444 + function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
2271 } 2445 }
2272 } 2446 }
......
...@@ -45,7 +45,7 @@ interface Console { ...@@ -45,7 +45,7 @@ interface Console {
45 /** 45 /**
46 * The `console.groupCollapsed()` function is an alias for {@link console.group()}. 46 * The `console.groupCollapsed()` function is an alias for {@link console.group()}.
47 */ 47 */
48 - groupCollapsed(): void; 48 + groupCollapsed(...label: any[]): void;
49 /** 49 /**
50 * Decreases indentation of subsequent lines by two spaces. 50 * Decreases indentation of subsequent lines by two spaces.
51 */ 51 */
...@@ -154,6 +154,10 @@ interface String { ...@@ -154,6 +154,10 @@ interface String {
154 trimRight(): string; 154 trimRight(): string;
155 } 155 }
156 156
157 +interface ImportMeta {
158 + url: string;
159 +}
160 +
157 /*-----------------------------------------------* 161 /*-----------------------------------------------*
158 * * 162 * *
159 * GLOBAL * 163 * GLOBAL *
...@@ -181,9 +185,6 @@ declare namespace setImmediate { ...@@ -181,9 +185,6 @@ declare namespace setImmediate {
181 } 185 }
182 declare function clearImmediate(immediateId: NodeJS.Immediate): void; 186 declare function clearImmediate(immediateId: NodeJS.Immediate): void;
183 187
184 -/**
185 - * @experimental
186 - */
187 declare function queueMicrotask(callback: () => void): void; 188 declare function queueMicrotask(callback: () => void): void;
188 189
189 // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. 190 // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version.
...@@ -192,9 +193,13 @@ interface NodeRequireFunction { ...@@ -192,9 +193,13 @@ interface NodeRequireFunction {
192 (id: string): any; 193 (id: string): any;
193 } 194 }
194 195
196 +interface NodeRequireCache {
197 + [path: string]: NodeModule;
198 +}
199 +
195 interface NodeRequire extends NodeRequireFunction { 200 interface NodeRequire extends NodeRequireFunction {
196 resolve: RequireResolve; 201 resolve: RequireResolve;
197 - cache: any; 202 + cache: NodeRequireCache;
198 /** 203 /**
199 * @deprecated 204 * @deprecated
200 */ 205 */
...@@ -233,66 +238,10 @@ declare var module: NodeModule; ...@@ -233,66 +238,10 @@ declare var module: NodeModule;
233 declare var exports: any; 238 declare var exports: any;
234 239
235 // Buffer class 240 // Buffer class
236 -type BufferEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "latin1" | "binary" | "hex"; 241 +type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
237 -interface Buffer extends Uint8Array { 242 +
243 +interface Buffer {
238 constructor: typeof Buffer; 244 constructor: typeof Buffer;
239 - write(string: string, encoding?: string): number;
240 - write(string: string, offset: number, encoding?: string): number;
241 - write(string: string, offset: number, length: number, encoding?: string): number;
242 - toString(encoding?: string, start?: number, end?: number): string;
243 - toJSON(): { type: 'Buffer', data: number[] };
244 - equals(otherBuffer: Uint8Array): boolean;
245 - compare(otherBuffer: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
246 - copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
247 - slice(start?: number, end?: number): Buffer;
248 - subarray(begin: number, end?: number): Buffer;
249 - writeUIntLE(value: number, offset: number, byteLength: number): number;
250 - writeUIntBE(value: number, offset: number, byteLength: number): number;
251 - writeIntLE(value: number, offset: number, byteLength: number): number;
252 - writeIntBE(value: number, offset: number, byteLength: number): number;
253 - readUIntLE(offset: number, byteLength: number): number;
254 - readUIntBE(offset: number, byteLength: number): number;
255 - readIntLE(offset: number, byteLength: number): number;
256 - readIntBE(offset: number, byteLength: number): number;
257 - readUInt8(offset: number): number;
258 - readUInt16LE(offset: number): number;
259 - readUInt16BE(offset: number): number;
260 - readUInt32LE(offset: number): number;
261 - readUInt32BE(offset: number): number;
262 - readInt8(offset: number): number;
263 - readInt16LE(offset: number): number;
264 - readInt16BE(offset: number): number;
265 - readInt32LE(offset: number): number;
266 - readInt32BE(offset: number): number;
267 - readFloatLE(offset: number): number;
268 - readFloatBE(offset: number): number;
269 - readDoubleLE(offset: number): number;
270 - readDoubleBE(offset: number): number;
271 - reverse(): this;
272 - swap16(): Buffer;
273 - swap32(): Buffer;
274 - swap64(): Buffer;
275 - writeUInt8(value: number, offset: number): number;
276 - writeUInt16LE(value: number, offset: number): number;
277 - writeUInt16BE(value: number, offset: number): number;
278 - writeUInt32LE(value: number, offset: number): number;
279 - writeUInt32BE(value: number, offset: number): number;
280 - writeInt8(value: number, offset: number): number;
281 - writeInt16LE(value: number, offset: number): number;
282 - writeInt16BE(value: number, offset: number): number;
283 - writeInt32LE(value: number, offset: number): number;
284 - writeInt32BE(value: number, offset: number): number;
285 - writeFloatLE(value: number, offset: number): number;
286 - writeFloatBE(value: number, offset: number): number;
287 - writeDoubleLE(value: number, offset: number): number;
288 - writeDoubleBE(value: number, offset: number): number;
289 - fill(value: any, offset?: number, end?: number): this;
290 - indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: string): number;
291 - lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: string): number;
292 - entries(): IterableIterator<[number, number]>;
293 - includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
294 - keys(): IterableIterator<number>;
295 - values(): IterableIterator<number>;
296 } 245 }
297 246
298 /** 247 /**
...@@ -300,7 +249,7 @@ interface Buffer extends Uint8Array { ...@@ -300,7 +249,7 @@ interface Buffer extends Uint8Array {
300 * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. 249 * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
301 * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' 250 * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
302 */ 251 */
303 -declare const Buffer: { 252 +declare class Buffer extends Uint8Array {
304 /** 253 /**
305 * Allocates a new buffer containing the given {str}. 254 * Allocates a new buffer containing the given {str}.
306 * 255 *
...@@ -308,21 +257,21 @@ declare const Buffer: { ...@@ -308,21 +257,21 @@ declare const Buffer: {
308 * @param encoding encoding to use, optional. Default is 'utf8' 257 * @param encoding encoding to use, optional. Default is 'utf8'
309 * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. 258 * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
310 */ 259 */
311 - new(str: string, encoding?: string): Buffer; 260 + constructor(str: string, encoding?: BufferEncoding);
312 /** 261 /**
313 * Allocates a new buffer of {size} octets. 262 * Allocates a new buffer of {size} octets.
314 * 263 *
315 * @param size count of octets to allocate. 264 * @param size count of octets to allocate.
316 * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). 265 * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
317 */ 266 */
318 - new(size: number): Buffer; 267 + constructor(size: number);
319 /** 268 /**
320 * Allocates a new buffer containing the given {array} of octets. 269 * Allocates a new buffer containing the given {array} of octets.
321 * 270 *
322 * @param array The octets to store. 271 * @param array The octets to store.
323 * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. 272 * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
324 */ 273 */
325 - new(array: Uint8Array): Buffer; 274 + constructor(array: Uint8Array);
326 /** 275 /**
327 * Produces a Buffer backed by the same allocated memory as 276 * Produces a Buffer backed by the same allocated memory as
328 * the given {ArrayBuffer}/{SharedArrayBuffer}. 277 * the given {ArrayBuffer}/{SharedArrayBuffer}.
...@@ -331,22 +280,21 @@ declare const Buffer: { ...@@ -331,22 +280,21 @@ declare const Buffer: {
331 * @param arrayBuffer The ArrayBuffer with which to share memory. 280 * @param arrayBuffer The ArrayBuffer with which to share memory.
332 * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. 281 * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
333 */ 282 */
334 - new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer; 283 + constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
335 /** 284 /**
336 * Allocates a new buffer containing the given {array} of octets. 285 * Allocates a new buffer containing the given {array} of octets.
337 * 286 *
338 * @param array The octets to store. 287 * @param array The octets to store.
339 * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. 288 * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
340 */ 289 */
341 - new(array: any[]): Buffer; 290 + constructor(array: any[]);
342 /** 291 /**
343 * Copies the passed {buffer} data onto a new {Buffer} instance. 292 * Copies the passed {buffer} data onto a new {Buffer} instance.
344 * 293 *
345 * @param buffer The buffer to copy. 294 * @param buffer The buffer to copy.
346 * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. 295 * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
347 */ 296 */
348 - new(buffer: Buffer): Buffer; 297 + constructor(buffer: Buffer);
349 - prototype: Buffer;
350 /** 298 /**
351 * When passed a reference to the .buffer property of a TypedArray instance, 299 * When passed a reference to the .buffer property of a TypedArray instance,
352 * the newly created Buffer will share the same allocated memory as the TypedArray. 300 * the newly created Buffer will share the same allocated memory as the TypedArray.
...@@ -355,37 +303,37 @@ declare const Buffer: { ...@@ -355,37 +303,37 @@ declare const Buffer: {
355 * 303 *
356 * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer() 304 * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
357 */ 305 */
358 - from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; 306 + static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
359 /** 307 /**
360 * Creates a new Buffer using the passed {data} 308 * Creates a new Buffer using the passed {data}
361 * @param data data to create a new Buffer 309 * @param data data to create a new Buffer
362 */ 310 */
363 - from(data: number[]): Buffer; 311 + static from(data: number[]): Buffer;
364 - from(data: Uint8Array): Buffer; 312 + static from(data: Uint8Array): Buffer;
365 /** 313 /**
366 * Creates a new Buffer containing the given JavaScript string {str}. 314 * Creates a new Buffer containing the given JavaScript string {str}.
367 * If provided, the {encoding} parameter identifies the character encoding. 315 * If provided, the {encoding} parameter identifies the character encoding.
368 * If not provided, {encoding} defaults to 'utf8'. 316 * If not provided, {encoding} defaults to 'utf8'.
369 */ 317 */
370 - from(str: string, encoding?: string): Buffer; 318 + static from(str: string, encoding?: BufferEncoding): Buffer;
371 /** 319 /**
372 * Creates a new Buffer using the passed {data} 320 * Creates a new Buffer using the passed {data}
373 * @param values to create a new Buffer 321 * @param values to create a new Buffer
374 */ 322 */
375 - of(...items: number[]): Buffer; 323 + static of(...items: number[]): Buffer;
376 /** 324 /**
377 * Returns true if {obj} is a Buffer 325 * Returns true if {obj} is a Buffer
378 * 326 *
379 * @param obj object to test. 327 * @param obj object to test.
380 */ 328 */
381 - isBuffer(obj: any): obj is Buffer; 329 + static isBuffer(obj: any): obj is Buffer;
382 /** 330 /**
383 * Returns true if {encoding} is a valid encoding argument. 331 * Returns true if {encoding} is a valid encoding argument.
384 * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' 332 * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
385 * 333 *
386 * @param encoding string to test. 334 * @param encoding string to test.
387 */ 335 */
388 - isEncoding(encoding: string): boolean | undefined; 336 + static isEncoding(encoding: string): encoding is BufferEncoding;
389 /** 337 /**
390 * Gives the actual byte length of a string. encoding defaults to 'utf8'. 338 * Gives the actual byte length of a string. encoding defaults to 'utf8'.
391 * This is not the same as String.prototype.length since that returns the number of characters in a string. 339 * This is not the same as String.prototype.length since that returns the number of characters in a string.
...@@ -393,7 +341,10 @@ declare const Buffer: { ...@@ -393,7 +341,10 @@ declare const Buffer: {
393 * @param string string to test. 341 * @param string string to test.
394 * @param encoding encoding used to evaluate (defaults to 'utf8') 342 * @param encoding encoding used to evaluate (defaults to 'utf8')
395 */ 343 */
396 - byteLength(string: string | NodeJS.TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: string): number; 344 + static byteLength(
345 + string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
346 + encoding?: BufferEncoding
347 + ): number;
397 /** 348 /**
398 * Returns a buffer which is the result of concatenating all the buffers in the list together. 349 * Returns a buffer which is the result of concatenating all the buffers in the list together.
399 * 350 *
...@@ -405,11 +356,11 @@ declare const Buffer: { ...@@ -405,11 +356,11 @@ declare const Buffer: {
405 * @param totalLength Total length of the buffers when concatenated. 356 * @param totalLength Total length of the buffers when concatenated.
406 * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. 357 * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
407 */ 358 */
408 - concat(list: Uint8Array[], totalLength?: number): Buffer; 359 + static concat(list: Uint8Array[], totalLength?: number): Buffer;
409 /** 360 /**
410 * The same as buf1.compare(buf2). 361 * The same as buf1.compare(buf2).
411 */ 362 */
412 - compare(buf1: Uint8Array, buf2: Uint8Array): number; 363 + static compare(buf1: Uint8Array, buf2: Uint8Array): number;
413 /** 364 /**
414 * Allocates a new buffer of {size} octets. 365 * Allocates a new buffer of {size} octets.
415 * 366 *
...@@ -418,26 +369,108 @@ declare const Buffer: { ...@@ -418,26 +369,108 @@ declare const Buffer: {
418 * If parameter is omitted, buffer will be filled with zeros. 369 * If parameter is omitted, buffer will be filled with zeros.
419 * @param encoding encoding used for call to buf.fill while initalizing 370 * @param encoding encoding used for call to buf.fill while initalizing
420 */ 371 */
421 - alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; 372 + static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
422 /** 373 /**
423 * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents 374 * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
424 * of the newly created Buffer are unknown and may contain sensitive data. 375 * of the newly created Buffer are unknown and may contain sensitive data.
425 * 376 *
426 * @param size count of octets to allocate 377 * @param size count of octets to allocate
427 */ 378 */
428 - allocUnsafe(size: number): Buffer; 379 + static allocUnsafe(size: number): Buffer;
429 /** 380 /**
430 * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents 381 * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
431 * of the newly created Buffer are unknown and may contain sensitive data. 382 * of the newly created Buffer are unknown and may contain sensitive data.
432 * 383 *
433 * @param size count of octets to allocate 384 * @param size count of octets to allocate
434 */ 385 */
435 - allocUnsafeSlow(size: number): Buffer; 386 + static allocUnsafeSlow(size: number): Buffer;
436 /** 387 /**
437 * This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified. 388 * This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified.
438 */ 389 */
439 - poolSize: number; 390 + static poolSize: number;
440 -}; 391 +
392 + write(string: string, encoding?: BufferEncoding): number;
393 + write(string: string, offset: number, encoding?: BufferEncoding): number;
394 + write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
395 + toString(encoding?: string, start?: number, end?: number): string;
396 + toJSON(): { type: 'Buffer'; data: number[] };
397 + equals(otherBuffer: Uint8Array): boolean;
398 + compare(
399 + otherBuffer: Uint8Array,
400 + targetStart?: number,
401 + targetEnd?: number,
402 + sourceStart?: number,
403 + sourceEnd?: number
404 + ): number;
405 + copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
406 + /**
407 + * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
408 + *
409 + * This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
410 + *
411 + * @param begin Where the new `Buffer` will start. Default: `0`.
412 + * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
413 + */
414 + slice(begin?: number, end?: number): Buffer;
415 + /**
416 + * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
417 + *
418 + * This method is compatible with `Uint8Array#subarray()`.
419 + *
420 + * @param begin Where the new `Buffer` will start. Default: `0`.
421 + * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
422 + */
423 + subarray(begin?: number, end?: number): Buffer;
424 + writeUIntLE(value: number, offset: number, byteLength: number): number;
425 + writeUIntBE(value: number, offset: number, byteLength: number): number;
426 + writeIntLE(value: number, offset: number, byteLength: number): number;
427 + writeIntBE(value: number, offset: number, byteLength: number): number;
428 + readUIntLE(offset: number, byteLength: number): number;
429 + readUIntBE(offset: number, byteLength: number): number;
430 + readIntLE(offset: number, byteLength: number): number;
431 + readIntBE(offset: number, byteLength: number): number;
432 + readUInt8(offset: number): number;
433 + readUInt16LE(offset: number): number;
434 + readUInt16BE(offset: number): number;
435 + readUInt32LE(offset: number): number;
436 + readUInt32BE(offset: number): number;
437 + readInt8(offset: number): number;
438 + readInt16LE(offset: number): number;
439 + readInt16BE(offset: number): number;
440 + readInt32LE(offset: number): number;
441 + readInt32BE(offset: number): number;
442 + readFloatLE(offset: number): number;
443 + readFloatBE(offset: number): number;
444 + readDoubleLE(offset: number): number;
445 + readDoubleBE(offset: number): number;
446 + reverse(): this;
447 + swap16(): Buffer;
448 + swap32(): Buffer;
449 + swap64(): Buffer;
450 + writeUInt8(value: number, offset: number): number;
451 + writeUInt16LE(value: number, offset: number): number;
452 + writeUInt16BE(value: number, offset: number): number;
453 + writeUInt32LE(value: number, offset: number): number;
454 + writeUInt32BE(value: number, offset: number): number;
455 + writeInt8(value: number, offset: number): number;
456 + writeInt16LE(value: number, offset: number): number;
457 + writeInt16BE(value: number, offset: number): number;
458 + writeInt32LE(value: number, offset: number): number;
459 + writeInt32BE(value: number, offset: number): number;
460 + writeFloatLE(value: number, offset: number): number;
461 + writeFloatBE(value: number, offset: number): number;
462 + writeDoubleLE(value: number, offset: number): number;
463 + writeDoubleBE(value: number, offset: number): number;
464 +
465 + fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
466 +
467 + indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
468 + lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
469 + entries(): IterableIterator<[number, number]>;
470 + includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
471 + keys(): IterableIterator<number>;
472 + values(): IterableIterator<number>;
473 +}
441 474
442 /*----------------------------------------------* 475 /*----------------------------------------------*
443 * * 476 * *
...@@ -603,26 +636,23 @@ declare namespace NodeJS { ...@@ -603,26 +636,23 @@ declare namespace NodeJS {
603 isPaused(): boolean; 636 isPaused(): boolean;
604 pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T; 637 pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
605 unpipe(destination?: WritableStream): this; 638 unpipe(destination?: WritableStream): this;
606 - unshift(chunk: string): void; 639 + unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
607 - unshift(chunk: Buffer): void;
608 wrap(oldStream: ReadableStream): this; 640 wrap(oldStream: ReadableStream): this;
609 [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>; 641 [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
610 } 642 }
611 643
612 interface WritableStream extends EventEmitter { 644 interface WritableStream extends EventEmitter {
613 writable: boolean; 645 writable: boolean;
614 - write(buffer: Buffer | Uint8Array | string, cb?: (err?: Error | null) => void): boolean; 646 + write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
615 write(str: string, encoding?: string, cb?: (err?: Error | null) => void): boolean; 647 write(str: string, encoding?: string, cb?: (err?: Error | null) => void): boolean;
616 end(cb?: () => void): void; 648 end(cb?: () => void): void;
617 - end(data: string | Uint8Array | Buffer, cb?: () => void): void; 649 + end(data: string | Uint8Array, cb?: () => void): void;
618 end(str: string, encoding?: string, cb?: () => void): void; 650 end(str: string, encoding?: string, cb?: () => void): void;
619 } 651 }
620 652
621 interface ReadWriteStream extends ReadableStream, WritableStream { } 653 interface ReadWriteStream extends ReadableStream, WritableStream { }
622 654
623 - interface Events extends EventEmitter { } 655 + interface Domain extends EventEmitter {
624 -
625 - interface Domain extends Events {
626 run<T>(fn: (...args: any[]) => T, ...args: any[]): T; 656 run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
627 add(emitter: EventEmitter | Timer): void; 657 add(emitter: EventEmitter | Timer): void;
628 remove(emitter: EventEmitter | Timer): void; 658 remove(emitter: EventEmitter | Timer): void;
...@@ -675,7 +705,8 @@ declare namespace NodeJS { ...@@ -675,7 +705,8 @@ declare namespace NodeJS {
675 | 'openbsd' 705 | 'openbsd'
676 | 'sunos' 706 | 'sunos'
677 | 'win32' 707 | 'win32'
678 - | 'cygwin'; 708 + | 'cygwin'
709 + | 'netbsd';
679 710
680 type Signals = 711 type Signals =
681 "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" | 712 "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" |
...@@ -706,30 +737,6 @@ declare namespace NodeJS { ...@@ -706,30 +737,6 @@ declare namespace NodeJS {
706 [key: string]: string | undefined; 737 [key: string]: string | undefined;
707 } 738 }
708 739
709 - interface WriteStream extends Socket {
710 - readonly writableHighWaterMark: number;
711 - readonly writableLength: number;
712 - columns?: number;
713 - rows?: number;
714 - _write(chunk: any, encoding: string, callback: (err?: null | Error) => void): void;
715 - _destroy(err: Error | null, callback: (err?: null | Error) => void): void;
716 - _final(callback: (err?: null | Error) => void): void;
717 - setDefaultEncoding(encoding: string): this;
718 - cork(): void;
719 - uncork(): void;
720 - destroy(error?: Error): void;
721 - }
722 - interface ReadStream extends Socket {
723 - readonly readableHighWaterMark: number;
724 - readonly readableLength: number;
725 - isRaw?: boolean;
726 - setRawMode?(mode: boolean): void;
727 - _read(size: number): void;
728 - _destroy(err: Error | null, callback: (err?: null | Error) => void): void;
729 - push(chunk: any, encoding?: string): boolean;
730 - destroy(error?: Error): void;
731 - }
732 -
733 interface HRTime { 740 interface HRTime {
734 (time?: [number, number]): [number, number]; 741 (time?: [number, number]): [number, number];
735 } 742 }
...@@ -799,6 +806,25 @@ declare namespace NodeJS { ...@@ -799,6 +806,25 @@ declare namespace NodeJS {
799 writeReport(fileName?: string, err?: Error): string; 806 writeReport(fileName?: string, err?: Error): string;
800 } 807 }
801 808
809 + interface ResourceUsage {
810 + fsRead: number;
811 + fsWrite: number;
812 + involuntaryContextSwitches: number;
813 + ipcReceived: number;
814 + ipcSent: number;
815 + majorPageFault: number;
816 + maxRSS: number;
817 + minorPageFault: number;
818 + sharedMemorySize: number;
819 + signalsCount: number;
820 + swappedOut: number;
821 + systemCPUTime: number;
822 + unsharedDataSize: number;
823 + unsharedStackSize: number;
824 + userCPUTime: number;
825 + voluntaryContextSwitches: number;
826 + }
827 +
802 interface Process extends EventEmitter { 828 interface Process extends EventEmitter {
803 /** 829 /**
804 * Can also be a tty.WriteStream, not typed due to limitation.s 830 * Can also be a tty.WriteStream, not typed due to limitation.s
...@@ -821,7 +847,7 @@ declare namespace NodeJS { ...@@ -821,7 +847,7 @@ declare namespace NodeJS {
821 emitWarning(warning: string | Error, name?: string, ctor?: Function): void; 847 emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
822 env: ProcessEnv; 848 env: ProcessEnv;
823 exit(code?: number): never; 849 exit(code?: number): never;
824 - exitCode: number; 850 + exitCode?: number;
825 getgid(): number; 851 getgid(): number;
826 setgid(id: number | string): void; 852 setgid(id: number | string): void;
827 getuid(): number; 853 getuid(): number;
...@@ -892,7 +918,7 @@ declare namespace NodeJS { ...@@ -892,7 +918,7 @@ declare namespace NodeJS {
892 domain: Domain; 918 domain: Domain;
893 919
894 // Worker 920 // Worker
895 - send?(message: any, sendHandle?: any): void; 921 + send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean;
896 disconnect(): void; 922 disconnect(): void;
897 connected: boolean; 923 connected: boolean;
898 924
...@@ -908,6 +934,8 @@ declare namespace NodeJS { ...@@ -908,6 +934,8 @@ declare namespace NodeJS {
908 */ 934 */
909 report?: ProcessReport; 935 report?: ProcessReport;
910 936
937 + resourceUsage(): ResourceUsage;
938 +
911 /** 939 /**
912 * EventEmitter 940 * EventEmitter
913 * 1. beforeExit 941 * 1. beforeExit
...@@ -1081,28 +1109,37 @@ declare namespace NodeJS { ...@@ -1081,28 +1109,37 @@ declare namespace NodeJS {
1081 v8debug?: any; 1109 v8debug?: any;
1082 } 1110 }
1083 1111
1112 + // compatibility with older typings
1084 interface Timer { 1113 interface Timer {
1085 - ref(): void; 1114 + hasRef(): boolean;
1086 - refresh(): void; 1115 + ref(): this;
1087 - unref(): void; 1116 + refresh(): this;
1117 + unref(): this;
1088 } 1118 }
1089 1119
1090 class Immediate { 1120 class Immediate {
1091 - ref(): void; 1121 + hasRef(): boolean;
1092 - unref(): void; 1122 + ref(): this;
1123 + unref(): this;
1093 _onImmediate: Function; // to distinguish it from the Timeout class 1124 _onImmediate: Function; // to distinguish it from the Timeout class
1094 } 1125 }
1095 1126
1096 class Timeout implements Timer { 1127 class Timeout implements Timer {
1097 - ref(): void; 1128 + hasRef(): boolean;
1098 - refresh(): void; 1129 + ref(): this;
1099 - unref(): void; 1130 + refresh(): this;
1131 + unref(): this;
1100 } 1132 }
1101 1133
1102 class Module { 1134 class Module {
1103 static runMain(): void; 1135 static runMain(): void;
1104 static wrap(code: string): string; 1136 static wrap(code: string): string;
1105 - static createRequireFromPath(path: string): (path: string) => any; 1137 +
1138 + /**
1139 + * @deprecated Deprecated since: v12.2.0. Please use createRequire() instead.
1140 + */
1141 + static createRequireFromPath(path: string): NodeRequire;
1142 + static createRequire(path: string): NodeRequire;
1106 static builtinModules: string[]; 1143 static builtinModules: string[];
1107 1144
1108 static Module: typeof Module; 1145 static Module: typeof Module;
...@@ -1120,4 +1157,9 @@ declare namespace NodeJS { ...@@ -1120,4 +1157,9 @@ declare namespace NodeJS {
1120 } 1157 }
1121 1158
1122 type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array; 1159 type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
1160 + type ArrayBufferView = TypedArray | DataView;
1161 +
1162 + // The value type here is a "poor man's `unknown`". When these types support TypeScript
1163 + // 3.0+, we can replace this with `unknown`.
1164 + type PoorMansUnknown = {} | null | undefined;
1123 } 1165 }
......
...@@ -7,6 +7,7 @@ declare module "http" { ...@@ -7,6 +7,7 @@ declare module "http" {
7 // incoming headers will never contain number 7 // incoming headers will never contain number
8 interface IncomingHttpHeaders { 8 interface IncomingHttpHeaders {
9 'accept'?: string; 9 'accept'?: string;
10 + 'accept-language'?: string;
10 'accept-patch'?: string; 11 'accept-patch'?: string;
11 'accept-ranges'?: string; 12 'accept-ranges'?: string;
12 'access-control-allow-credentials'?: string; 13 'access-control-allow-credentials'?: string;
...@@ -68,18 +69,18 @@ declare module "http" { ...@@ -68,18 +69,18 @@ declare module "http" {
68 } 69 }
69 70
70 interface ClientRequestArgs { 71 interface ClientRequestArgs {
71 - protocol?: string; 72 + protocol?: string | null;
72 - host?: string; 73 + host?: string | null;
73 - hostname?: string; 74 + hostname?: string | null;
74 family?: number; 75 family?: number;
75 - port?: number | string; 76 + port?: number | string | null;
76 defaultPort?: number | string; 77 defaultPort?: number | string;
77 localAddress?: string; 78 localAddress?: string;
78 socketPath?: string; 79 socketPath?: string;
79 method?: string; 80 method?: string;
80 - path?: string; 81 + path?: string | null;
81 headers?: OutgoingHttpHeaders; 82 headers?: OutgoingHttpHeaders;
82 - auth?: string; 83 + auth?: string | null;
83 agent?: Agent | boolean; 84 agent?: Agent | boolean;
84 _defaultAgent?: Agent; 85 _defaultAgent?: Agent;
85 timeout?: number; 86 timeout?: number;
...@@ -145,6 +146,7 @@ declare module "http" { ...@@ -145,6 +146,7 @@ declare module "http" {
145 class ServerResponse extends OutgoingMessage { 146 class ServerResponse extends OutgoingMessage {
146 statusCode: number; 147 statusCode: number;
147 statusMessage: string; 148 statusMessage: string;
149 + writableFinished: boolean;
148 150
149 constructor(req: IncomingMessage); 151 constructor(req: IncomingMessage);
150 152
...@@ -155,6 +157,17 @@ declare module "http" { ...@@ -155,6 +157,17 @@ declare module "http" {
155 writeContinue(callback?: () => void): void; 157 writeContinue(callback?: () => void): void;
156 writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders): this; 158 writeHead(statusCode: number, reasonPhrase?: string, headers?: OutgoingHttpHeaders): this;
157 writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; 159 writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
160 + writeProcessing(): void;
161 + }
162 +
163 + interface InformationEvent {
164 + statusCode: number;
165 + statusMessage: string;
166 + httpVersion: string;
167 + httpVersionMajor: number;
168 + httpVersionMinor: number;
169 + headers: IncomingHttpHeaders;
170 + rawHeaders: string[];
158 } 171 }
159 172
160 // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77 173 // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L77
...@@ -171,6 +184,86 @@ declare module "http" { ...@@ -171,6 +184,86 @@ declare module "http" {
171 setTimeout(timeout: number, callback?: () => void): this; 184 setTimeout(timeout: number, callback?: () => void): this;
172 setNoDelay(noDelay?: boolean): void; 185 setNoDelay(noDelay?: boolean): void;
173 setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; 186 setSocketKeepAlive(enable?: boolean, initialDelay?: number): void;
187 +
188 + addListener(event: 'abort', listener: () => void): this;
189 + addListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
190 + addListener(event: 'continue', listener: () => void): this;
191 + addListener(event: 'information', listener: (info: InformationEvent) => void): this;
192 + addListener(event: 'response', listener: (response: IncomingMessage) => void): this;
193 + addListener(event: 'socket', listener: (socket: Socket) => void): this;
194 + addListener(event: 'timeout', listener: () => void): this;
195 + addListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
196 + addListener(event: 'close', listener: () => void): this;
197 + addListener(event: 'drain', listener: () => void): this;
198 + addListener(event: 'error', listener: (err: Error) => void): this;
199 + addListener(event: 'finish', listener: () => void): this;
200 + addListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
201 + addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
202 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
203 +
204 + on(event: 'abort', listener: () => void): this;
205 + on(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
206 + on(event: 'continue', listener: () => void): this;
207 + on(event: 'information', listener: (info: InformationEvent) => void): this;
208 + on(event: 'response', listener: (response: IncomingMessage) => void): this;
209 + on(event: 'socket', listener: (socket: Socket) => void): this;
210 + on(event: 'timeout', listener: () => void): this;
211 + on(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
212 + on(event: 'close', listener: () => void): this;
213 + on(event: 'drain', listener: () => void): this;
214 + on(event: 'error', listener: (err: Error) => void): this;
215 + on(event: 'finish', listener: () => void): this;
216 + on(event: 'pipe', listener: (src: stream.Readable) => void): this;
217 + on(event: 'unpipe', listener: (src: stream.Readable) => void): this;
218 + on(event: string | symbol, listener: (...args: any[]) => void): this;
219 +
220 + once(event: 'abort', listener: () => void): this;
221 + once(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
222 + once(event: 'continue', listener: () => void): this;
223 + once(event: 'information', listener: (info: InformationEvent) => void): this;
224 + once(event: 'response', listener: (response: IncomingMessage) => void): this;
225 + once(event: 'socket', listener: (socket: Socket) => void): this;
226 + once(event: 'timeout', listener: () => void): this;
227 + once(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
228 + once(event: 'close', listener: () => void): this;
229 + once(event: 'drain', listener: () => void): this;
230 + once(event: 'error', listener: (err: Error) => void): this;
231 + once(event: 'finish', listener: () => void): this;
232 + once(event: 'pipe', listener: (src: stream.Readable) => void): this;
233 + once(event: 'unpipe', listener: (src: stream.Readable) => void): this;
234 + once(event: string | symbol, listener: (...args: any[]) => void): this;
235 +
236 + prependListener(event: 'abort', listener: () => void): this;
237 + prependListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
238 + prependListener(event: 'continue', listener: () => void): this;
239 + prependListener(event: 'information', listener: (info: InformationEvent) => void): this;
240 + prependListener(event: 'response', listener: (response: IncomingMessage) => void): this;
241 + prependListener(event: 'socket', listener: (socket: Socket) => void): this;
242 + prependListener(event: 'timeout', listener: () => void): this;
243 + prependListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
244 + prependListener(event: 'close', listener: () => void): this;
245 + prependListener(event: 'drain', listener: () => void): this;
246 + prependListener(event: 'error', listener: (err: Error) => void): this;
247 + prependListener(event: 'finish', listener: () => void): this;
248 + prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
249 + prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
250 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
251 +
252 + prependOnceListener(event: 'abort', listener: () => void): this;
253 + prependOnceListener(event: 'connect', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
254 + prependOnceListener(event: 'continue', listener: () => void): this;
255 + prependOnceListener(event: 'information', listener: (info: InformationEvent) => void): this;
256 + prependOnceListener(event: 'response', listener: (response: IncomingMessage) => void): this;
257 + prependOnceListener(event: 'socket', listener: (socket: Socket) => void): this;
258 + prependOnceListener(event: 'timeout', listener: () => void): this;
259 + prependOnceListener(event: 'upgrade', listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this;
260 + prependOnceListener(event: 'close', listener: () => void): this;
261 + prependOnceListener(event: 'drain', listener: () => void): this;
262 + prependOnceListener(event: 'error', listener: (err: Error) => void): this;
263 + prependOnceListener(event: 'finish', listener: () => void): this;
264 + prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
265 + prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
266 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
174 } 267 }
175 268
176 class IncomingMessage extends stream.Readable { 269 class IncomingMessage extends stream.Readable {
...@@ -179,12 +272,13 @@ declare module "http" { ...@@ -179,12 +272,13 @@ declare module "http" {
179 httpVersion: string; 272 httpVersion: string;
180 httpVersionMajor: number; 273 httpVersionMajor: number;
181 httpVersionMinor: number; 274 httpVersionMinor: number;
275 + complete: boolean;
182 connection: Socket; 276 connection: Socket;
183 headers: IncomingHttpHeaders; 277 headers: IncomingHttpHeaders;
184 rawHeaders: string[]; 278 rawHeaders: string[];
185 trailers: { [key: string]: string | undefined }; 279 trailers: { [key: string]: string | undefined };
186 rawTrailers: string[]; 280 rawTrailers: string[];
187 - setTimeout(msecs: number, callback: () => void): this; 281 + setTimeout(msecs: number, callback?: () => void): this;
188 /** 282 /**
189 * Only valid for request obtained from http.Server. 283 * Only valid for request obtained from http.Server.
190 */ 284 */
......
...@@ -6,7 +6,7 @@ declare module "http2" { ...@@ -6,7 +6,7 @@ declare module "http2" {
6 import * as tls from "tls"; 6 import * as tls from "tls";
7 import * as url from "url"; 7 import * as url from "url";
8 8
9 - import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders } from "http"; 9 + import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders, IncomingMessage, ServerResponse } from "http";
10 export { OutgoingHttpHeaders } from "http"; 10 export { OutgoingHttpHeaders } from "http";
11 11
12 export interface IncomingHttpStatusHeader { 12 export interface IncomingHttpStatusHeader {
...@@ -32,8 +32,8 @@ declare module "http2" { ...@@ -32,8 +32,8 @@ declare module "http2" {
32 export interface StreamState { 32 export interface StreamState {
33 localWindowSize?: number; 33 localWindowSize?: number;
34 state?: number; 34 state?: number;
35 - streamLocalClose?: number; 35 + localClose?: number;
36 - streamRemoteClose?: number; 36 + remoteClose?: number;
37 sumDependencyWeight?: number; 37 sumDependencyWeight?: number;
38 weight?: number; 38 weight?: number;
39 } 39 }
...@@ -49,20 +49,27 @@ declare module "http2" { ...@@ -49,20 +49,27 @@ declare module "http2" {
49 } 49 }
50 50
51 export interface ServerStreamFileResponseOptions { 51 export interface ServerStreamFileResponseOptions {
52 - statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void | boolean; 52 + statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean;
53 - getTrailers?: (trailers: OutgoingHttpHeaders) => void; 53 + waitForTrailers?: boolean;
54 offset?: number; 54 offset?: number;
55 length?: number; 55 length?: number;
56 } 56 }
57 57
58 export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { 58 export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions {
59 - onError?: (err: NodeJS.ErrnoException) => void; 59 + onError?(err: NodeJS.ErrnoException): void;
60 } 60 }
61 61
62 export interface Http2Stream extends stream.Duplex { 62 export interface Http2Stream extends stream.Duplex {
63 readonly aborted: boolean; 63 readonly aborted: boolean;
64 + readonly bufferSize: number;
64 readonly closed: boolean; 65 readonly closed: boolean;
65 readonly destroyed: boolean; 66 readonly destroyed: boolean;
67 + /**
68 + * Set the true if the END_STREAM flag was set in the request or response HEADERS frame received,
69 + * indicating that no additional data should be received and the readable side of the Http2Stream will be closed.
70 + */
71 + readonly endAfterHeaders: boolean;
72 + readonly id?: number;
66 readonly pending: boolean; 73 readonly pending: boolean;
67 readonly rstCode: number; 74 readonly rstCode: number;
68 readonly sentHeaders: OutgoingHttpHeaders; 75 readonly sentHeaders: OutgoingHttpHeaders;
...@@ -70,16 +77,12 @@ declare module "http2" { ...@@ -70,16 +77,12 @@ declare module "http2" {
70 readonly sentTrailers?: OutgoingHttpHeaders; 77 readonly sentTrailers?: OutgoingHttpHeaders;
71 readonly session: Http2Session; 78 readonly session: Http2Session;
72 readonly state: StreamState; 79 readonly state: StreamState;
73 - /** 80 +
74 - * Set the true if the END_STREAM flag was set in the request or response HEADERS frame received,
75 - * indicating that no additional data should be received and the readable side of the Http2Stream will be closed.
76 - */
77 - readonly endAfterHeaders: boolean;
78 close(code?: number, callback?: () => void): void; 81 close(code?: number, callback?: () => void): void;
79 priority(options: StreamPriorityOptions): void; 82 priority(options: StreamPriorityOptions): void;
80 setTimeout(msecs: number, callback?: () => void): void; 83 setTimeout(msecs: number, callback?: () => void): void;
84 + sendTrailers(headers: OutgoingHttpHeaders): void;
81 85
82 - addListener(event: string, listener: (...args: any[]) => void): this;
83 addListener(event: "aborted", listener: () => void): this; 86 addListener(event: "aborted", listener: () => void): this;
84 addListener(event: "close", listener: () => void): this; 87 addListener(event: "close", listener: () => void): this;
85 addListener(event: "data", listener: (chunk: Buffer | string) => void): this; 88 addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
...@@ -94,8 +97,8 @@ declare module "http2" { ...@@ -94,8 +97,8 @@ declare module "http2" {
94 addListener(event: "timeout", listener: () => void): this; 97 addListener(event: "timeout", listener: () => void): this;
95 addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; 98 addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
96 addListener(event: "wantTrailers", listener: () => void): this; 99 addListener(event: "wantTrailers", listener: () => void): this;
100 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
97 101
98 - emit(event: string | symbol, ...args: any[]): boolean;
99 emit(event: "aborted"): boolean; 102 emit(event: "aborted"): boolean;
100 emit(event: "close"): boolean; 103 emit(event: "close"): boolean;
101 emit(event: "data", chunk: Buffer | string): boolean; 104 emit(event: "data", chunk: Buffer | string): boolean;
...@@ -110,8 +113,8 @@ declare module "http2" { ...@@ -110,8 +113,8 @@ declare module "http2" {
110 emit(event: "timeout"): boolean; 113 emit(event: "timeout"): boolean;
111 emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean; 114 emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean;
112 emit(event: "wantTrailers"): boolean; 115 emit(event: "wantTrailers"): boolean;
116 + emit(event: string | symbol, ...args: any[]): boolean;
113 117
114 - on(event: string, listener: (...args: any[]) => void): this;
115 on(event: "aborted", listener: () => void): this; 118 on(event: "aborted", listener: () => void): this;
116 on(event: "close", listener: () => void): this; 119 on(event: "close", listener: () => void): this;
117 on(event: "data", listener: (chunk: Buffer | string) => void): this; 120 on(event: "data", listener: (chunk: Buffer | string) => void): this;
...@@ -126,8 +129,8 @@ declare module "http2" { ...@@ -126,8 +129,8 @@ declare module "http2" {
126 on(event: "timeout", listener: () => void): this; 129 on(event: "timeout", listener: () => void): this;
127 on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; 130 on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
128 on(event: "wantTrailers", listener: () => void): this; 131 on(event: "wantTrailers", listener: () => void): this;
132 + on(event: string | symbol, listener: (...args: any[]) => void): this;
129 133
130 - once(event: string, listener: (...args: any[]) => void): this;
131 once(event: "aborted", listener: () => void): this; 134 once(event: "aborted", listener: () => void): this;
132 once(event: "close", listener: () => void): this; 135 once(event: "close", listener: () => void): this;
133 once(event: "data", listener: (chunk: Buffer | string) => void): this; 136 once(event: "data", listener: (chunk: Buffer | string) => void): this;
...@@ -142,8 +145,8 @@ declare module "http2" { ...@@ -142,8 +145,8 @@ declare module "http2" {
142 once(event: "timeout", listener: () => void): this; 145 once(event: "timeout", listener: () => void): this;
143 once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; 146 once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
144 once(event: "wantTrailers", listener: () => void): this; 147 once(event: "wantTrailers", listener: () => void): this;
148 + once(event: string | symbol, listener: (...args: any[]) => void): this;
145 149
146 - prependListener(event: string, listener: (...args: any[]) => void): this;
147 prependListener(event: "aborted", listener: () => void): this; 150 prependListener(event: "aborted", listener: () => void): this;
148 prependListener(event: "close", listener: () => void): this; 151 prependListener(event: "close", listener: () => void): this;
149 prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; 152 prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
...@@ -158,8 +161,8 @@ declare module "http2" { ...@@ -158,8 +161,8 @@ declare module "http2" {
158 prependListener(event: "timeout", listener: () => void): this; 161 prependListener(event: "timeout", listener: () => void): this;
159 prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; 162 prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
160 prependListener(event: "wantTrailers", listener: () => void): this; 163 prependListener(event: "wantTrailers", listener: () => void): this;
164 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
161 165
162 - prependOnceListener(event: string, listener: (...args: any[]) => void): this;
163 prependOnceListener(event: "aborted", listener: () => void): this; 166 prependOnceListener(event: "aborted", listener: () => void): this;
164 prependOnceListener(event: "close", listener: () => void): this; 167 prependOnceListener(event: "close", listener: () => void): this;
165 prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; 168 prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
...@@ -174,50 +177,55 @@ declare module "http2" { ...@@ -174,50 +177,55 @@ declare module "http2" {
174 prependOnceListener(event: "timeout", listener: () => void): this; 177 prependOnceListener(event: "timeout", listener: () => void): this;
175 prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; 178 prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this;
176 prependOnceListener(event: "wantTrailers", listener: () => void): this; 179 prependOnceListener(event: "wantTrailers", listener: () => void): this;
177 - 180 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
178 - sendTrailers(headers: OutgoingHttpHeaders): this;
179 } 181 }
180 182
181 export interface ClientHttp2Stream extends Http2Stream { 183 export interface ClientHttp2Stream extends Http2Stream {
182 - addListener(event: string, listener: (...args: any[]) => void): this; 184 + addListener(event: "continue", listener: () => {}): this;
183 addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 185 addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
184 addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; 186 addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
185 addListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 187 addListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
188 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
186 189
187 - emit(event: string | symbol, ...args: any[]): boolean; 190 + emit(event: "continue"): boolean;
188 emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; 191 emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
189 emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; 192 emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean;
190 emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; 193 emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
194 + emit(event: string | symbol, ...args: any[]): boolean;
191 195
192 - on(event: string, listener: (...args: any[]) => void): this; 196 + on(event: "continue", listener: () => {}): this;
193 on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 197 on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
194 on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; 198 on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
195 on(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 199 on(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
200 + on(event: string | symbol, listener: (...args: any[]) => void): this;
196 201
197 - once(event: string, listener: (...args: any[]) => void): this; 202 + once(event: "continue", listener: () => {}): this;
198 once(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 203 once(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
199 once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; 204 once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
200 once(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 205 once(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
206 + once(event: string | symbol, listener: (...args: any[]) => void): this;
201 207
202 - prependListener(event: string, listener: (...args: any[]) => void): this; 208 + prependListener(event: "continue", listener: () => {}): this;
203 prependListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 209 prependListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
204 prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; 210 prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
205 prependListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 211 prependListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
212 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
206 213
207 - prependOnceListener(event: string, listener: (...args: any[]) => void): this; 214 + prependOnceListener(event: "continue", listener: () => {}): this;
208 prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 215 prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
209 prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; 216 prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
210 prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 217 prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
218 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
211 } 219 }
212 220
213 export interface ServerHttp2Stream extends Http2Stream { 221 export interface ServerHttp2Stream extends Http2Stream {
214 - additionalHeaders(headers: OutgoingHttpHeaders): void;
215 readonly headersSent: boolean; 222 readonly headersSent: boolean;
216 readonly pushAllowed: boolean; 223 readonly pushAllowed: boolean;
224 + additionalHeaders(headers: OutgoingHttpHeaders): void;
217 pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; 225 pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void;
218 pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; 226 pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void;
219 respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; 227 respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void;
220 - respondWithFD(fd: number, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void; 228 + respondWithFD(fd: number | fs.promises.FileHandle, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void;
221 respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void; 229 respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void;
222 } 230 }
223 231
...@@ -230,6 +238,7 @@ declare module "http2" { ...@@ -230,6 +238,7 @@ declare module "http2" {
230 maxFrameSize?: number; 238 maxFrameSize?: number;
231 maxConcurrentStreams?: number; 239 maxConcurrentStreams?: number;
232 maxHeaderListSize?: number; 240 maxHeaderListSize?: number;
241 + enableConnectProtocol?: boolean;
233 } 242 }
234 243
235 export interface ClientSessionRequestOptions { 244 export interface ClientSessionRequestOptions {
...@@ -237,7 +246,7 @@ declare module "http2" { ...@@ -237,7 +246,7 @@ declare module "http2" {
237 exclusive?: boolean; 246 exclusive?: boolean;
238 parent?: number; 247 parent?: number;
239 weight?: number; 248 weight?: number;
240 - getTrailers?: (trailers: OutgoingHttpHeaders, flags: number) => void; 249 + waitForTrailers?: boolean;
241 } 250 }
242 251
243 export interface SessionState { 252 export interface SessionState {
...@@ -254,122 +263,127 @@ declare module "http2" { ...@@ -254,122 +263,127 @@ declare module "http2" {
254 263
255 export interface Http2Session extends events.EventEmitter { 264 export interface Http2Session extends events.EventEmitter {
256 readonly alpnProtocol?: string; 265 readonly alpnProtocol?: string;
257 - close(callback?: () => void): void;
258 readonly closed: boolean; 266 readonly closed: boolean;
259 readonly connecting: boolean; 267 readonly connecting: boolean;
260 - destroy(error?: Error, code?: number): void;
261 readonly destroyed: boolean; 268 readonly destroyed: boolean;
262 readonly encrypted?: boolean; 269 readonly encrypted?: boolean;
263 - goaway(code?: number, lastStreamID?: number, opaqueData?: Buffer | DataView | NodeJS.TypedArray): void;
264 readonly localSettings: Settings; 270 readonly localSettings: Settings;
265 readonly originSet?: string[]; 271 readonly originSet?: string[];
266 readonly pendingSettingsAck: boolean; 272 readonly pendingSettingsAck: boolean;
267 - ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean;
268 - ping(payload: Buffer | DataView | NodeJS.TypedArray , callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean;
269 - ref(): void;
270 readonly remoteSettings: Settings; 273 readonly remoteSettings: Settings;
271 - rstStream(stream: Http2Stream, code?: number): void;
272 - setTimeout(msecs: number, callback?: () => void): void;
273 readonly socket: net.Socket | tls.TLSSocket; 274 readonly socket: net.Socket | tls.TLSSocket;
274 readonly state: SessionState; 275 readonly state: SessionState;
275 - priority(stream: Http2Stream, options: StreamPriorityOptions): void;
276 - settings(settings: Settings): void;
277 readonly type: number; 276 readonly type: number;
277 +
278 + close(callback?: () => void): void;
279 + destroy(error?: Error, code?: number): void;
280 + goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void;
281 + ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean;
282 + ping(payload: NodeJS.ArrayBufferView, callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean;
283 + ref(): void;
284 + setTimeout(msecs: number, callback?: () => void): void;
285 + settings(settings: Settings): void;
278 unref(): void; 286 unref(): void;
279 287
280 - addListener(event: string, listener: (...args: any[]) => void): this;
281 addListener(event: "close", listener: () => void): this; 288 addListener(event: "close", listener: () => void): this;
282 addListener(event: "error", listener: (err: Error) => void): this; 289 addListener(event: "error", listener: (err: Error) => void): this;
283 addListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; 290 addListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
284 addListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; 291 addListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
285 addListener(event: "localSettings", listener: (settings: Settings) => void): this; 292 addListener(event: "localSettings", listener: (settings: Settings) => void): this;
293 + addListener(event: "ping", listener: () => void): this;
286 addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; 294 addListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
287 addListener(event: "timeout", listener: () => void): this; 295 addListener(event: "timeout", listener: () => void): this;
288 - addListener(event: "ping", listener: () => void): this; 296 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
289 297
290 - emit(event: string | symbol, ...args: any[]): boolean;
291 emit(event: "close"): boolean; 298 emit(event: "close"): boolean;
292 emit(event: "error", err: Error): boolean; 299 emit(event: "error", err: Error): boolean;
293 emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean; 300 emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean;
294 emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean; 301 emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean;
295 emit(event: "localSettings", settings: Settings): boolean; 302 emit(event: "localSettings", settings: Settings): boolean;
303 + emit(event: "ping"): boolean;
296 emit(event: "remoteSettings", settings: Settings): boolean; 304 emit(event: "remoteSettings", settings: Settings): boolean;
297 emit(event: "timeout"): boolean; 305 emit(event: "timeout"): boolean;
298 - emit(event: "ping"): boolean; 306 + emit(event: string | symbol, ...args: any[]): boolean;
299 307
300 - on(event: string, listener: (...args: any[]) => void): this;
301 on(event: "close", listener: () => void): this; 308 on(event: "close", listener: () => void): this;
302 on(event: "error", listener: (err: Error) => void): this; 309 on(event: "error", listener: (err: Error) => void): this;
303 on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; 310 on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
304 on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; 311 on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
305 on(event: "localSettings", listener: (settings: Settings) => void): this; 312 on(event: "localSettings", listener: (settings: Settings) => void): this;
313 + on(event: "ping", listener: () => void): this;
306 on(event: "remoteSettings", listener: (settings: Settings) => void): this; 314 on(event: "remoteSettings", listener: (settings: Settings) => void): this;
307 on(event: "timeout", listener: () => void): this; 315 on(event: "timeout", listener: () => void): this;
308 - on(event: "ping", listener: () => void): this; 316 + on(event: string | symbol, listener: (...args: any[]) => void): this;
309 317
310 - once(event: string, listener: (...args: any[]) => void): this;
311 once(event: "close", listener: () => void): this; 318 once(event: "close", listener: () => void): this;
312 once(event: "error", listener: (err: Error) => void): this; 319 once(event: "error", listener: (err: Error) => void): this;
313 once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; 320 once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
314 once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; 321 once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
315 once(event: "localSettings", listener: (settings: Settings) => void): this; 322 once(event: "localSettings", listener: (settings: Settings) => void): this;
323 + once(event: "ping", listener: () => void): this;
316 once(event: "remoteSettings", listener: (settings: Settings) => void): this; 324 once(event: "remoteSettings", listener: (settings: Settings) => void): this;
317 once(event: "timeout", listener: () => void): this; 325 once(event: "timeout", listener: () => void): this;
318 - once(event: "ping", listener: () => void): this; 326 + once(event: string | symbol, listener: (...args: any[]) => void): this;
319 327
320 - prependListener(event: string, listener: (...args: any[]) => void): this;
321 prependListener(event: "close", listener: () => void): this; 328 prependListener(event: "close", listener: () => void): this;
322 prependListener(event: "error", listener: (err: Error) => void): this; 329 prependListener(event: "error", listener: (err: Error) => void): this;
323 prependListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; 330 prependListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
324 prependListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; 331 prependListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
325 prependListener(event: "localSettings", listener: (settings: Settings) => void): this; 332 prependListener(event: "localSettings", listener: (settings: Settings) => void): this;
333 + prependListener(event: "ping", listener: () => void): this;
326 prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; 334 prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
327 prependListener(event: "timeout", listener: () => void): this; 335 prependListener(event: "timeout", listener: () => void): this;
328 - prependListener(event: "ping", listener: () => void): this; 336 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
329 337
330 - prependOnceListener(event: string, listener: (...args: any[]) => void): this;
331 prependOnceListener(event: "close", listener: () => void): this; 338 prependOnceListener(event: "close", listener: () => void): this;
332 prependOnceListener(event: "error", listener: (err: Error) => void): this; 339 prependOnceListener(event: "error", listener: (err: Error) => void): this;
333 prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; 340 prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this;
334 prependOnceListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; 341 prependOnceListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this;
335 prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; 342 prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this;
343 + prependOnceListener(event: "ping", listener: () => void): this;
336 prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; 344 prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this;
337 prependOnceListener(event: "timeout", listener: () => void): this; 345 prependOnceListener(event: "timeout", listener: () => void): this;
338 - prependOnceListener(event: "ping", listener: () => void): this; 346 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
339 } 347 }
340 348
341 export interface ClientHttp2Session extends Http2Session { 349 export interface ClientHttp2Session extends Http2Session {
342 request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; 350 request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream;
343 351
344 - addListener(event: string, listener: (...args: any[]) => void): this;
345 addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; 352 addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
353 + addListener(event: "origin", listener: (origins: string[]) => void): this;
346 addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 354 addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
347 addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 355 addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
356 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
348 357
349 - emit(event: string | symbol, ...args: any[]): boolean;
350 emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; 358 emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
359 + emit(event: "origin", origins: string[]): boolean;
351 emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; 360 emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
352 emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; 361 emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
362 + emit(event: string | symbol, ...args: any[]): boolean;
353 363
354 - on(event: string, listener: (...args: any[]) => void): this;
355 on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; 364 on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
365 + on(event: "origin", listener: (origins: string[]) => void): this;
356 on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 366 on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
357 on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 367 on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
368 + on(event: string | symbol, listener: (...args: any[]) => void): this;
358 369
359 - once(event: string, listener: (...args: any[]) => void): this;
360 once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; 370 once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
371 + once(event: "origin", listener: (origins: string[]) => void): this;
361 once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 372 once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
362 once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 373 once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
374 + once(event: string | symbol, listener: (...args: any[]) => void): this;
363 375
364 - prependListener(event: string, listener: (...args: any[]) => void): this;
365 prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; 376 prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
377 + prependListener(event: "origin", listener: (origins: string[]) => void): this;
366 prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 378 prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
367 prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 379 prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
380 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
368 381
369 - prependOnceListener(event: string, listener: (...args: any[]) => void): this;
370 prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; 382 prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
383 + prependOnceListener(event: "origin", listener: (origins: string[]) => void): this;
371 prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 384 prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
372 prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this; 385 prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
386 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
373 } 387 }
374 388
375 export interface AlternativeServiceOptions { 389 export interface AlternativeServiceOptions {
...@@ -377,49 +391,63 @@ declare module "http2" { ...@@ -377,49 +391,63 @@ declare module "http2" {
377 } 391 }
378 392
379 export interface ServerHttp2Session extends Http2Session { 393 export interface ServerHttp2Session extends Http2Session {
380 - altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void;
381 readonly server: Http2Server | Http2SecureServer; 394 readonly server: Http2Server | Http2SecureServer;
382 395
383 - addListener(event: string, listener: (...args: any[]) => void): this; 396 + altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void;
397 + origin(...args: Array<string | url.URL | { origin: string }>): void;
398 +
384 addListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 399 addListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
385 addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 400 addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
401 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
386 402
387 - emit(event: string | symbol, ...args: any[]): boolean;
388 emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; 403 emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
389 emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; 404 emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
405 + emit(event: string | symbol, ...args: any[]): boolean;
390 406
391 - on(event: string, listener: (...args: any[]) => void): this;
392 on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 407 on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
393 on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 408 on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
409 + on(event: string | symbol, listener: (...args: any[]) => void): this;
394 410
395 - once(event: string, listener: (...args: any[]) => void): this;
396 once(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 411 once(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
397 once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 412 once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
413 + once(event: string | symbol, listener: (...args: any[]) => void): this;
398 414
399 - prependListener(event: string, listener: (...args: any[]) => void): this;
400 prependListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 415 prependListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
401 prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 416 prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
417 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
402 418
403 - prependOnceListener(event: string, listener: (...args: any[]) => void): this;
404 prependOnceListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; 419 prependOnceListener(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
405 prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 420 prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
421 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
406 } 422 }
407 423
408 // Http2Server 424 // Http2Server
409 425
410 export interface SessionOptions { 426 export interface SessionOptions {
411 maxDeflateDynamicTableSize?: number; 427 maxDeflateDynamicTableSize?: number;
412 - maxReservedRemoteStreams?: number; 428 + maxSessionMemory?: number;
429 + maxHeaderListPairs?: number;
430 + maxOutstandingPings?: number;
413 maxSendHeaderBlockLength?: number; 431 maxSendHeaderBlockLength?: number;
414 paddingStrategy?: number; 432 paddingStrategy?: number;
415 peerMaxConcurrentStreams?: number; 433 peerMaxConcurrentStreams?: number;
416 - selectPadding?: (frameLen: number, maxFrameLen: number) => number;
417 settings?: Settings; 434 settings?: Settings;
435 +
436 + selectPadding?(frameLen: number, maxFrameLen: number): number;
437 + createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex;
438 + }
439 +
440 + export interface ClientSessionOptions extends SessionOptions {
441 + maxReservedRemoteStreams?: number;
418 createConnection?: (authority: url.URL, option: SessionOptions) => stream.Duplex; 442 createConnection?: (authority: url.URL, option: SessionOptions) => stream.Duplex;
419 } 443 }
420 444
421 - export type ClientSessionOptions = SessionOptions; 445 + export interface ServerSessionOptions extends SessionOptions {
422 - export type ServerSessionOptions = SessionOptions; 446 + Http1IncomingMessage?: typeof IncomingMessage;
447 + Http1ServerResponse?: typeof ServerResponse;
448 + Http2ServerRequest?: typeof Http2ServerRequest;
449 + Http2ServerResponse?: typeof Http2ServerResponse;
450 + }
423 451
424 export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { } 452 export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions { }
425 export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { } 453 export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions { }
...@@ -428,203 +456,263 @@ declare module "http2" { ...@@ -428,203 +456,263 @@ declare module "http2" {
428 456
429 export interface SecureServerOptions extends SecureServerSessionOptions { 457 export interface SecureServerOptions extends SecureServerSessionOptions {
430 allowHTTP1?: boolean; 458 allowHTTP1?: boolean;
459 + origins?: string[];
431 } 460 }
432 461
433 export interface Http2Server extends net.Server { 462 export interface Http2Server extends net.Server {
434 - addListener(event: string, listener: (...args: any[]) => void): this;
435 addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 463 addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
436 addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 464 addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
465 + addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
437 addListener(event: "sessionError", listener: (err: Error) => void): this; 466 addListener(event: "sessionError", listener: (err: Error) => void): this;
438 addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 467 addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
439 addListener(event: "timeout", listener: () => void): this; 468 addListener(event: "timeout", listener: () => void): this;
469 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
440 470
441 - emit(event: string | symbol, ...args: any[]): boolean;
442 emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; 471 emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
443 emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; 472 emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
473 + emit(event: "session", session: ServerHttp2Session): boolean;
444 emit(event: "sessionError", err: Error): boolean; 474 emit(event: "sessionError", err: Error): boolean;
445 emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; 475 emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
446 emit(event: "timeout"): boolean; 476 emit(event: "timeout"): boolean;
477 + emit(event: string | symbol, ...args: any[]): boolean;
447 478
448 - on(event: string, listener: (...args: any[]) => void): this;
449 on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 479 on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
450 on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 480 on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
481 + on(event: "session", listener: (session: ServerHttp2Session) => void): this;
451 on(event: "sessionError", listener: (err: Error) => void): this; 482 on(event: "sessionError", listener: (err: Error) => void): this;
452 on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 483 on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
453 on(event: "timeout", listener: () => void): this; 484 on(event: "timeout", listener: () => void): this;
485 + on(event: string | symbol, listener: (...args: any[]) => void): this;
454 486
455 - once(event: string, listener: (...args: any[]) => void): this;
456 once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 487 once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
457 once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 488 once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
489 + once(event: "session", listener: (session: ServerHttp2Session) => void): this;
458 once(event: "sessionError", listener: (err: Error) => void): this; 490 once(event: "sessionError", listener: (err: Error) => void): this;
459 once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 491 once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
460 once(event: "timeout", listener: () => void): this; 492 once(event: "timeout", listener: () => void): this;
493 + once(event: string | symbol, listener: (...args: any[]) => void): this;
461 494
462 - prependListener(event: string, listener: (...args: any[]) => void): this;
463 prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 495 prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
464 prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 496 prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
497 + prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
465 prependListener(event: "sessionError", listener: (err: Error) => void): this; 498 prependListener(event: "sessionError", listener: (err: Error) => void): this;
466 prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 499 prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
467 prependListener(event: "timeout", listener: () => void): this; 500 prependListener(event: "timeout", listener: () => void): this;
501 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
468 502
469 - prependOnceListener(event: string, listener: (...args: any[]) => void): this;
470 prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 503 prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
471 prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 504 prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
505 + prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
472 prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; 506 prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
473 prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 507 prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
474 prependOnceListener(event: "timeout", listener: () => void): this; 508 prependOnceListener(event: "timeout", listener: () => void): this;
509 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
510 +
511 + setTimeout(msec?: number, callback?: () => void): this;
475 } 512 }
476 513
477 export interface Http2SecureServer extends tls.Server { 514 export interface Http2SecureServer extends tls.Server {
478 - addListener(event: string, listener: (...args: any[]) => void): this;
479 addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 515 addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
480 addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 516 addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
517 + addListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
481 addListener(event: "sessionError", listener: (err: Error) => void): this; 518 addListener(event: "sessionError", listener: (err: Error) => void): this;
482 addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 519 addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
483 addListener(event: "timeout", listener: () => void): this; 520 addListener(event: "timeout", listener: () => void): this;
484 addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; 521 addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
522 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
485 523
486 - emit(event: string | symbol, ...args: any[]): boolean;
487 emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; 524 emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
488 emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; 525 emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean;
526 + emit(event: "session", session: ServerHttp2Session): boolean;
489 emit(event: "sessionError", err: Error): boolean; 527 emit(event: "sessionError", err: Error): boolean;
490 emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; 528 emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
491 emit(event: "timeout"): boolean; 529 emit(event: "timeout"): boolean;
492 emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; 530 emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean;
531 + emit(event: string | symbol, ...args: any[]): boolean;
493 532
494 - on(event: string, listener: (...args: any[]) => void): this;
495 on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 533 on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
496 on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 534 on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
535 + on(event: "session", listener: (session: ServerHttp2Session) => void): this;
497 on(event: "sessionError", listener: (err: Error) => void): this; 536 on(event: "sessionError", listener: (err: Error) => void): this;
498 on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 537 on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
499 on(event: "timeout", listener: () => void): this; 538 on(event: "timeout", listener: () => void): this;
500 on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; 539 on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
540 + on(event: string | symbol, listener: (...args: any[]) => void): this;
501 541
502 - once(event: string, listener: (...args: any[]) => void): this;
503 once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 542 once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
504 once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 543 once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
544 + once(event: "session", listener: (session: ServerHttp2Session) => void): this;
505 once(event: "sessionError", listener: (err: Error) => void): this; 545 once(event: "sessionError", listener: (err: Error) => void): this;
506 once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 546 once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
507 once(event: "timeout", listener: () => void): this; 547 once(event: "timeout", listener: () => void): this;
508 once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; 548 once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
549 + once(event: string | symbol, listener: (...args: any[]) => void): this;
509 550
510 - prependListener(event: string, listener: (...args: any[]) => void): this;
511 prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 551 prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
512 prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 552 prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
553 + prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
513 prependListener(event: "sessionError", listener: (err: Error) => void): this; 554 prependListener(event: "sessionError", listener: (err: Error) => void): this;
514 prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 555 prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
515 prependListener(event: "timeout", listener: () => void): this; 556 prependListener(event: "timeout", listener: () => void): this;
516 prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; 557 prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
558 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
517 559
518 - prependOnceListener(event: string, listener: (...args: any[]) => void): this;
519 prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 560 prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
520 prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; 561 prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this;
562 + prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this;
521 prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; 563 prependOnceListener(event: "sessionError", listener: (err: Error) => void): this;
522 prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; 564 prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
523 prependOnceListener(event: "timeout", listener: () => void): this; 565 prependOnceListener(event: "timeout", listener: () => void): this;
524 prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; 566 prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this;
567 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
568 +
569 + setTimeout(msec?: number, callback?: () => void): this;
525 } 570 }
526 571
527 export class Http2ServerRequest extends stream.Readable { 572 export class Http2ServerRequest extends stream.Readable {
528 - private constructor(); 573 + constructor(stream: ServerHttp2Stream, headers: IncomingHttpHeaders, options: stream.ReadableOptions, rawHeaders: string[]);
529 - headers: IncomingHttpHeaders; 574 +
530 - httpVersion: string; 575 + readonly aborted: boolean;
531 - method: string; 576 + readonly authority: string;
532 - rawHeaders: string[]; 577 + readonly headers: IncomingHttpHeaders;
533 - rawTrailers: string[]; 578 + readonly httpVersion: string;
579 + readonly method: string;
580 + readonly rawHeaders: string[];
581 + readonly rawTrailers: string[];
582 + readonly scheme: string;
583 + readonly socket: net.Socket | tls.TLSSocket;
584 + readonly stream: ServerHttp2Stream;
585 + readonly trailers: IncomingHttpHeaders;
586 + readonly url: string;
587 +
534 setTimeout(msecs: number, callback?: () => void): void; 588 setTimeout(msecs: number, callback?: () => void): void;
535 - socket: net.Socket | tls.TLSSocket; 589 + read(size?: number): Buffer | string | null;
536 - stream: ServerHttp2Stream;
537 - trailers: IncomingHttpHeaders;
538 - url: string;
539 590
540 - addListener(event: string, listener: (...args: any[]) => void): this;
541 addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; 591 addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
592 + addListener(event: "close", listener: () => void): this;
593 + addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
594 + addListener(event: "end", listener: () => void): this;
595 + addListener(event: "readable", listener: () => void): this;
596 + addListener(event: "error", listener: (err: Error) => void): this;
597 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
542 598
543 - emit(event: string | symbol, ...args: any[]): boolean;
544 emit(event: "aborted", hadError: boolean, code: number): boolean; 599 emit(event: "aborted", hadError: boolean, code: number): boolean;
600 + emit(event: "close"): boolean;
601 + emit(event: "data", chunk: Buffer | string): boolean;
602 + emit(event: "end"): boolean;
603 + emit(event: "readable"): boolean;
604 + emit(event: "error", err: Error): boolean;
605 + emit(event: string | symbol, ...args: any[]): boolean;
545 606
546 - on(event: string, listener: (...args: any[]) => void): this;
547 on(event: "aborted", listener: (hadError: boolean, code: number) => void): this; 607 on(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
608 + on(event: "close", listener: () => void): this;
609 + on(event: "data", listener: (chunk: Buffer | string) => void): this;
610 + on(event: "end", listener: () => void): this;
611 + on(event: "readable", listener: () => void): this;
612 + on(event: "error", listener: (err: Error) => void): this;
613 + on(event: string | symbol, listener: (...args: any[]) => void): this;
548 614
549 - once(event: string, listener: (...args: any[]) => void): this;
550 once(event: "aborted", listener: (hadError: boolean, code: number) => void): this; 615 once(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
616 + once(event: "close", listener: () => void): this;
617 + once(event: "data", listener: (chunk: Buffer | string) => void): this;
618 + once(event: "end", listener: () => void): this;
619 + once(event: "readable", listener: () => void): this;
620 + once(event: "error", listener: (err: Error) => void): this;
621 + once(event: string | symbol, listener: (...args: any[]) => void): this;
551 622
552 - prependListener(event: string, listener: (...args: any[]) => void): this;
553 prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; 623 prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
624 + prependListener(event: "close", listener: () => void): this;
625 + prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
626 + prependListener(event: "end", listener: () => void): this;
627 + prependListener(event: "readable", listener: () => void): this;
628 + prependListener(event: "error", listener: (err: Error) => void): this;
629 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
554 630
555 - prependOnceListener(event: string, listener: (...args: any[]) => void): this;
556 prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; 631 prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
632 + prependOnceListener(event: "close", listener: () => void): this;
633 + prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
634 + prependOnceListener(event: "end", listener: () => void): this;
635 + prependOnceListener(event: "readable", listener: () => void): this;
636 + prependOnceListener(event: "error", listener: (err: Error) => void): this;
637 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
557 } 638 }
558 639
559 export class Http2ServerResponse extends stream.Stream { 640 export class Http2ServerResponse extends stream.Stream {
560 - private constructor(); 641 + constructor(stream: ServerHttp2Stream);
642 +
643 + readonly connection: net.Socket | tls.TLSSocket;
644 + readonly finished: boolean;
645 + readonly headersSent: boolean;
646 + readonly socket: net.Socket | tls.TLSSocket;
647 + readonly stream: ServerHttp2Stream;
648 + sendDate: boolean;
649 + statusCode: number;
650 + statusMessage: '';
561 addTrailers(trailers: OutgoingHttpHeaders): void; 651 addTrailers(trailers: OutgoingHttpHeaders): void;
562 - connection: net.Socket | tls.TLSSocket;
563 end(callback?: () => void): void; 652 end(callback?: () => void): void;
564 - end(data?: string | Buffer, callback?: () => void): void; 653 + end(data: string | Uint8Array, callback?: () => void): void;
565 - end(data?: string | Buffer, encoding?: string, callback?: () => void): void; 654 + end(data: string | Uint8Array, encoding: string, callback?: () => void): void;
566 - readonly finished: boolean;
567 getHeader(name: string): string; 655 getHeader(name: string): string;
568 getHeaderNames(): string[]; 656 getHeaderNames(): string[];
569 getHeaders(): OutgoingHttpHeaders; 657 getHeaders(): OutgoingHttpHeaders;
570 hasHeader(name: string): boolean; 658 hasHeader(name: string): boolean;
571 - readonly headersSent: boolean;
572 removeHeader(name: string): void; 659 removeHeader(name: string): void;
573 - sendDate: boolean;
574 setHeader(name: string, value: number | string | string[]): void; 660 setHeader(name: string, value: number | string | string[]): void;
575 setTimeout(msecs: number, callback?: () => void): void; 661 setTimeout(msecs: number, callback?: () => void): void;
576 - socket: net.Socket | tls.TLSSocket; 662 + write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean;
577 - statusCode: number; 663 + write(chunk: string | Uint8Array, encoding: string, callback?: (err: Error) => void): boolean;
578 - statusMessage: '';
579 - stream: ServerHttp2Stream;
580 - write(chunk: string | Buffer, callback?: (err: Error) => void): boolean;
581 - write(chunk: string | Buffer, encoding?: string, callback?: (err: Error) => void): boolean;
582 writeContinue(): void; 664 writeContinue(): void;
583 writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; 665 writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
584 - writeHead(statusCode: number, statusMessage?: string, headers?: OutgoingHttpHeaders): this; 666 + writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this;
585 createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void; 667 createPushResponse(headers: OutgoingHttpHeaders, callback: (err: Error | null, res: Http2ServerResponse) => void): void;
586 668
587 - addListener(event: string, listener: (...args: any[]) => void): this;
588 - addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
589 addListener(event: "close", listener: () => void): this; 669 addListener(event: "close", listener: () => void): this;
590 addListener(event: "drain", listener: () => void): this; 670 addListener(event: "drain", listener: () => void): this;
591 addListener(event: "error", listener: (error: Error) => void): this; 671 addListener(event: "error", listener: (error: Error) => void): this;
592 addListener(event: "finish", listener: () => void): this; 672 addListener(event: "finish", listener: () => void): this;
673 + addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
674 + addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
675 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
593 676
594 - emit(event: string | symbol, ...args: any[]): boolean;
595 - emit(event: "aborted", hadError: boolean, code: number): boolean;
596 emit(event: "close"): boolean; 677 emit(event: "close"): boolean;
597 emit(event: "drain"): boolean; 678 emit(event: "drain"): boolean;
598 emit(event: "error", error: Error): boolean; 679 emit(event: "error", error: Error): boolean;
599 emit(event: "finish"): boolean; 680 emit(event: "finish"): boolean;
681 + emit(event: "pipe", src: stream.Readable): boolean;
682 + emit(event: "unpipe", src: stream.Readable): boolean;
683 + emit(event: string | symbol, ...args: any[]): boolean;
600 684
601 - on(event: string, listener: (...args: any[]) => void): this;
602 - on(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
603 on(event: "close", listener: () => void): this; 685 on(event: "close", listener: () => void): this;
604 on(event: "drain", listener: () => void): this; 686 on(event: "drain", listener: () => void): this;
605 on(event: "error", listener: (error: Error) => void): this; 687 on(event: "error", listener: (error: Error) => void): this;
606 on(event: "finish", listener: () => void): this; 688 on(event: "finish", listener: () => void): this;
689 + on(event: "pipe", listener: (src: stream.Readable) => void): this;
690 + on(event: "unpipe", listener: (src: stream.Readable) => void): this;
691 + on(event: string | symbol, listener: (...args: any[]) => void): this;
607 692
608 - once(event: string, listener: (...args: any[]) => void): this;
609 - once(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
610 once(event: "close", listener: () => void): this; 693 once(event: "close", listener: () => void): this;
611 once(event: "drain", listener: () => void): this; 694 once(event: "drain", listener: () => void): this;
612 once(event: "error", listener: (error: Error) => void): this; 695 once(event: "error", listener: (error: Error) => void): this;
613 once(event: "finish", listener: () => void): this; 696 once(event: "finish", listener: () => void): this;
697 + once(event: "pipe", listener: (src: stream.Readable) => void): this;
698 + once(event: "unpipe", listener: (src: stream.Readable) => void): this;
699 + once(event: string | symbol, listener: (...args: any[]) => void): this;
614 700
615 - prependListener(event: string, listener: (...args: any[]) => void): this;
616 - prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
617 prependListener(event: "close", listener: () => void): this; 701 prependListener(event: "close", listener: () => void): this;
618 prependListener(event: "drain", listener: () => void): this; 702 prependListener(event: "drain", listener: () => void): this;
619 prependListener(event: "error", listener: (error: Error) => void): this; 703 prependListener(event: "error", listener: (error: Error) => void): this;
620 prependListener(event: "finish", listener: () => void): this; 704 prependListener(event: "finish", listener: () => void): this;
705 + prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
706 + prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
707 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
621 708
622 - prependOnceListener(event: string, listener: (...args: any[]) => void): this;
623 - prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this;
624 prependOnceListener(event: "close", listener: () => void): this; 709 prependOnceListener(event: "close", listener: () => void): this;
625 prependOnceListener(event: "drain", listener: () => void): this; 710 prependOnceListener(event: "drain", listener: () => void): this;
626 prependOnceListener(event: "error", listener: (error: Error) => void): this; 711 prependOnceListener(event: "error", listener: (error: Error) => void): this;
627 prependOnceListener(event: "finish", listener: () => void): this; 712 prependOnceListener(event: "finish", listener: () => void): this;
713 + prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
714 + prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
715 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
628 } 716 }
629 717
630 // Public API 718 // Public API
...@@ -841,8 +929,8 @@ declare module "http2" { ...@@ -841,8 +929,8 @@ declare module "http2" {
841 } 929 }
842 930
843 export function getDefaultSettings(): Settings; 931 export function getDefaultSettings(): Settings;
844 - export function getPackedSettings(settings: Settings): Settings; 932 + export function getPackedSettings(settings: Settings): Buffer;
845 - export function getUnpackedSettings(buf: Buffer | Uint8Array): Settings; 933 + export function getUnpackedSettings(buf: Uint8Array): Settings;
846 934
847 export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; 935 export function createServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server;
848 export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server; 936 export function createServer(options: ServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2Server;
...@@ -850,10 +938,10 @@ declare module "http2" { ...@@ -850,10 +938,10 @@ declare module "http2" {
850 export function createSecureServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; 938 export function createSecureServer(onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer;
851 export function createSecureServer(options: SecureServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer; 939 export function createSecureServer(options: SecureServerOptions, onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void): Http2SecureServer;
852 940
853 - export function connect(authority: string | url.URL, listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): ClientHttp2Session; 941 + export function connect(authority: string | url.URL, listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): ClientHttp2Session;
854 export function connect( 942 export function connect(
855 authority: string | url.URL, 943 authority: string | url.URL,
856 options?: ClientSessionOptions | SecureClientSessionOptions, 944 options?: ClientSessionOptions | SecureClientSessionOptions,
857 - listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, 945 + listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void
858 ): ClientHttp2Session; 946 ): ClientHttp2Session;
859 } 947 }
......
...@@ -22,6 +22,7 @@ declare module "https" { ...@@ -22,6 +22,7 @@ declare module "https" {
22 } 22 }
23 23
24 class Server extends tls.Server { 24 class Server extends tls.Server {
25 + constructor(requestListener?: http.RequestListener);
25 constructor(options: ServerOptions, requestListener?: http.RequestListener); 26 constructor(options: ServerOptions, requestListener?: http.RequestListener);
26 27
27 setTimeout(callback: () => void): this; 28 setTimeout(callback: () => void): this;
...@@ -42,6 +43,7 @@ declare module "https" { ...@@ -42,6 +43,7 @@ declare module "https" {
42 keepAliveTimeout: number; 43 keepAliveTimeout: number;
43 } 44 }
44 45
46 + function createServer(requestListener?: http.RequestListener): Server;
45 function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server; 47 function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server;
46 function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; 48 function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
47 function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; 49 function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
......
1 -// Type definitions for non-npm package Node.js 11.12 1 +// Type definitions for non-npm package Node.js 12.12
2 // Project: http://nodejs.org/ 2 // Project: http://nodejs.org/
3 // Definitions by: Microsoft TypeScript <https://github.com/Microsoft> 3 // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4 // DefinitelyTyped <https://github.com/DefinitelyTyped> 4 // DefinitelyTyped <https://github.com/DefinitelyTyped>
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
21 // Klaus Meinhardt <https://github.com/ajafff> 21 // Klaus Meinhardt <https://github.com/ajafff>
22 // Lishude <https://github.com/islishude> 22 // Lishude <https://github.com/islishude>
23 // Mariusz Wiktorczyk <https://github.com/mwiktorczyk> 23 // Mariusz Wiktorczyk <https://github.com/mwiktorczyk>
24 -// Matthieu Sieben <https://github.com/matthieusieben>
25 // Mohsen Azimi <https://github.com/mohsen1> 24 // Mohsen Azimi <https://github.com/mohsen1>
26 // Nicolas Even <https://github.com/n-e> 25 // Nicolas Even <https://github.com/n-e>
27 // Nicolas Voigt <https://github.com/octo-sniffle> 26 // Nicolas Voigt <https://github.com/octo-sniffle>
27 +// Nikita Galkin <https://github.com/galkin>
28 // Parambir Singh <https://github.com/parambirs> 28 // Parambir Singh <https://github.com/parambirs>
29 // Sebastian Silbermann <https://github.com/eps1lon> 29 // Sebastian Silbermann <https://github.com/eps1lon>
30 // Simon Schick <https://github.com/SimonSchick> 30 // Simon Schick <https://github.com/SimonSchick>
...@@ -32,11 +32,15 @@ ...@@ -32,11 +32,15 @@
32 // Wilco Bakker <https://github.com/WilcoBakker> 32 // Wilco Bakker <https://github.com/WilcoBakker>
33 // wwwy3y3 <https://github.com/wwwy3y3> 33 // wwwy3y3 <https://github.com/wwwy3y3>
34 // Zane Hannan AU <https://github.com/ZaneHannanAU> 34 // Zane Hannan AU <https://github.com/ZaneHannanAU>
35 -// Jeremie Rodriguez <https://github.com/jeremiergz>
36 // Samuel Ainsworth <https://github.com/samuela> 35 // Samuel Ainsworth <https://github.com/samuela>
37 // Kyle Uehlein <https://github.com/kuehlein> 36 // Kyle Uehlein <https://github.com/kuehlein>
38 // Jordi Oliveras Rovira <https://github.com/j-oliveras> 37 // Jordi Oliveras Rovira <https://github.com/j-oliveras>
39 // Thanik Bhongbhibhat <https://github.com/bhongy> 38 // Thanik Bhongbhibhat <https://github.com/bhongy>
39 +// Marcin Kopacz <https://github.com/chyzwar>
40 +// Trivikram Kamat <https://github.com/trivikr>
41 +// Minh Son Nguyen <https://github.com/nguymin4>
42 +// Junxiao Shi <https://github.com/yoursunny>
43 +// Ilia Baryshnikov <https://github.com/qwelias>
40 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 44 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
41 45
42 // NOTE: These definitions support NodeJS and TypeScript 3.2. 46 // NOTE: These definitions support NodeJS and TypeScript 3.2.
...@@ -66,8 +70,9 @@ interface WeakSetConstructor { } ...@@ -66,8 +70,9 @@ interface WeakSetConstructor { }
66 interface Set<T> {} 70 interface Set<T> {}
67 interface Map<K, V> {} 71 interface Map<K, V> {}
68 interface ReadonlySet<T> {} 72 interface ReadonlySet<T> {}
69 -interface IteratorResult<T> { }
70 interface Iterable<T> { } 73 interface Iterable<T> { }
74 +interface IteratorResult<T> { }
75 +interface AsyncIterable<T> { }
71 interface Iterator<T> { 76 interface Iterator<T> {
72 next(value?: any): IteratorResult<T>; 77 next(value?: any): IteratorResult<T>;
73 } 78 }
......
This diff could not be displayed because it is too large.
...@@ -18,7 +18,26 @@ declare module "net" { ...@@ -18,7 +18,26 @@ declare module "net" {
18 writable?: boolean; 18 writable?: boolean;
19 } 19 }
20 20
21 - interface TcpSocketConnectOpts { 21 + interface OnReadOpts {
22 + buffer: Uint8Array | (() => Uint8Array);
23 + /**
24 + * This function is called for every chunk of incoming data.
25 + * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer.
26 + * Return false from this function to implicitly pause() the socket.
27 + */
28 + callback(bytesWritten: number, buf: Uint8Array): boolean;
29 + }
30 +
31 + interface ConnectOpts {
32 + /**
33 + * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket.
34 + * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will
35 + * still be emitted as normal and methods like pause() and resume() will also behave as expected.
36 + */
37 + onread?: OnReadOpts;
38 + }
39 +
40 + interface TcpSocketConnectOpts extends ConnectOpts {
22 port: number; 41 port: number;
23 host?: string; 42 host?: string;
24 localAddress?: string; 43 localAddress?: string;
...@@ -28,7 +47,7 @@ declare module "net" { ...@@ -28,7 +47,7 @@ declare module "net" {
28 lookup?: LookupFunction; 47 lookup?: LookupFunction;
29 } 48 }
30 49
31 - interface IpcSocketConnectOpts { 50 + interface IpcSocketConnectOpts extends ConnectOpts {
32 path: string; 51 path: string;
33 } 52 }
34 53
...@@ -38,8 +57,8 @@ declare module "net" { ...@@ -38,8 +57,8 @@ declare module "net" {
38 constructor(options?: SocketConstructorOpts); 57 constructor(options?: SocketConstructorOpts);
39 58
40 // Extended base methods 59 // Extended base methods
41 - write(buffer: Buffer | Uint8Array | string, cb?: (err?: Error) => void): boolean; 60 + write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
42 - write(str: Buffer | Uint8Array | string, encoding?: string, cb?: (err?: Error) => void): boolean; 61 + write(str: Uint8Array | string, encoding?: string, cb?: (err?: Error) => void): boolean;
43 62
44 connect(options: SocketConnectOpts, connectionListener?: () => void): this; 63 connect(options: SocketConnectOpts, connectionListener?: () => void): this;
45 connect(port: number, host: string, connectionListener?: () => void): this; 64 connect(port: number, host: string, connectionListener?: () => void): this;
...@@ -69,8 +88,8 @@ declare module "net" { ...@@ -69,8 +88,8 @@ declare module "net" {
69 88
70 // Extended base methods 89 // Extended base methods
71 end(cb?: () => void): void; 90 end(cb?: () => void): void;
72 - end(buffer: Buffer | Uint8Array | string, cb?: () => void): void; 91 + end(buffer: Uint8Array | string, cb?: () => void): void;
73 - end(str: Buffer | Uint8Array | string, encoding?: string, cb?: () => void): void; 92 + end(str: Uint8Array | string, encoding?: string, cb?: () => void): void;
74 93
75 /** 94 /**
76 * events.EventEmitter 95 * events.EventEmitter
......
...@@ -52,6 +52,7 @@ declare module "os" { ...@@ -52,6 +52,7 @@ declare module "os" {
52 function userInfo(options?: { encoding: string }): UserInfo<string>; 52 function userInfo(options?: { encoding: string }): UserInfo<string>;
53 const constants: { 53 const constants: {
54 UV_UDP_REUSEADDR: number; 54 UV_UDP_REUSEADDR: number;
55 + // signals: { [key in NodeJS.Signals]: number; }; @todo: change after migration to typescript 2.1
55 signals: { 56 signals: {
56 SIGHUP: number; 57 SIGHUP: number;
57 SIGINT: number; 58 SIGINT: number;
...@@ -74,6 +75,7 @@ declare module "os" { ...@@ -74,6 +75,7 @@ declare module "os" {
74 SIGCONT: number; 75 SIGCONT: number;
75 SIGSTOP: number; 76 SIGSTOP: number;
76 SIGTSTP: number; 77 SIGTSTP: number;
78 + SIGBREAK: number;
77 SIGTTIN: number; 79 SIGTTIN: number;
78 SIGTTOU: number; 80 SIGTTOU: number;
79 SIGURG: number; 81 SIGURG: number;
...@@ -84,7 +86,9 @@ declare module "os" { ...@@ -84,7 +86,9 @@ declare module "os" {
84 SIGWINCH: number; 86 SIGWINCH: number;
85 SIGIO: number; 87 SIGIO: number;
86 SIGPOLL: number; 88 SIGPOLL: number;
89 + SIGLOST: number;
87 SIGPWR: number; 90 SIGPWR: number;
91 + SIGINFO: number;
88 SIGSYS: number; 92 SIGSYS: number;
89 SIGUNUSED: number; 93 SIGUNUSED: number;
90 }; 94 };
...@@ -168,6 +172,64 @@ declare module "os" { ...@@ -168,6 +172,64 @@ declare module "os" {
168 ETXTBSY: number; 172 ETXTBSY: number;
169 EWOULDBLOCK: number; 173 EWOULDBLOCK: number;
170 EXDEV: number; 174 EXDEV: number;
175 + WSAEINTR: number;
176 + WSAEBADF: number;
177 + WSAEACCES: number;
178 + WSAEFAULT: number;
179 + WSAEINVAL: number;
180 + WSAEMFILE: number;
181 + WSAEWOULDBLOCK: number;
182 + WSAEINPROGRESS: number;
183 + WSAEALREADY: number;
184 + WSAENOTSOCK: number;
185 + WSAEDESTADDRREQ: number;
186 + WSAEMSGSIZE: number;
187 + WSAEPROTOTYPE: number;
188 + WSAENOPROTOOPT: number;
189 + WSAEPROTONOSUPPORT: number;
190 + WSAESOCKTNOSUPPORT: number;
191 + WSAEOPNOTSUPP: number;
192 + WSAEPFNOSUPPORT: number;
193 + WSAEAFNOSUPPORT: number;
194 + WSAEADDRINUSE: number;
195 + WSAEADDRNOTAVAIL: number;
196 + WSAENETDOWN: number;
197 + WSAENETUNREACH: number;
198 + WSAENETRESET: number;
199 + WSAECONNABORTED: number;
200 + WSAECONNRESET: number;
201 + WSAENOBUFS: number;
202 + WSAEISCONN: number;
203 + WSAENOTCONN: number;
204 + WSAESHUTDOWN: number;
205 + WSAETOOMANYREFS: number;
206 + WSAETIMEDOUT: number;
207 + WSAECONNREFUSED: number;
208 + WSAELOOP: number;
209 + WSAENAMETOOLONG: number;
210 + WSAEHOSTDOWN: number;
211 + WSAEHOSTUNREACH: number;
212 + WSAENOTEMPTY: number;
213 + WSAEPROCLIM: number;
214 + WSAEUSERS: number;
215 + WSAEDQUOT: number;
216 + WSAESTALE: number;
217 + WSAEREMOTE: number;
218 + WSASYSNOTREADY: number;
219 + WSAVERNOTSUPPORTED: number;
220 + WSANOTINITIALISED: number;
221 + WSAEDISCON: number;
222 + WSAENOMORE: number;
223 + WSAECANCELLED: number;
224 + WSAEINVALIDPROCTABLE: number;
225 + WSAEINVALIDPROVIDER: number;
226 + WSAEPROVIDERFAILEDINIT: number;
227 + WSASYSCALLFAILURE: number;
228 + WSASERVICE_NOT_FOUND: number;
229 + WSATYPE_NOT_FOUND: number;
230 + WSA_E_NO_MORE: number;
231 + WSA_E_CANCELLED: number;
232 + WSAEREFUSED: number;
171 }; 233 };
172 priority: { 234 priority: {
173 PRIORITY_LOW: number; 235 PRIORITY_LOW: number;
......
1 { 1 {
2 "_args": [ 2 "_args": [
3 [ 3 [
4 - "@types/node@11.12.0", 4 + "@types/node@12.12.14",
5 - "/Users/ye/Desktop/NodeBook/nodejs-book/ch12/12.4/node-auction" 5 + "C:\\Users\\15Z950.1703\\Desktop\\2-2\\옾소\\프젝\\OPproject"
6 ] 6 ]
7 ], 7 ],
8 - "_from": "@types/node@11.12.0", 8 + "_from": "@types/node@12.12.14",
9 - "_id": "@types/node@11.12.0", 9 + "_id": "@types/node@12.12.14",
10 "_inBundle": false, 10 "_inBundle": false,
11 - "_integrity": "sha512-Lg00egj78gM+4aE0Erw05cuDbvX9sLJbaaPwwRtdCdAMnIudqrQZ0oZX98Ek0yiSK/A2nubHgJfvII/rTT2Dwg==", 11 + "_integrity": "sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA==",
12 "_location": "/@types/node", 12 "_location": "/@types/node",
13 "_phantomChildren": {}, 13 "_phantomChildren": {},
14 "_requested": { 14 "_requested": {
15 "type": "version", 15 "type": "version",
16 "registry": true, 16 "registry": true,
17 - "raw": "@types/node@11.12.0", 17 + "raw": "@types/node@12.12.14",
18 "name": "@types/node", 18 "name": "@types/node",
19 "escapedName": "@types%2fnode", 19 "escapedName": "@types%2fnode",
20 "scope": "@types", 20 "scope": "@types",
21 - "rawSpec": "11.12.0", 21 + "rawSpec": "12.12.14",
22 "saveSpec": null, 22 "saveSpec": null,
23 - "fetchSpec": "11.12.0" 23 + "fetchSpec": "12.12.14"
24 }, 24 },
25 "_requiredBy": [ 25 "_requiredBy": [
26 "/wkx" 26 "/wkx"
27 ], 27 ],
28 - "_resolved": "https://registry.npmjs.org/@types/node/-/node-11.12.0.tgz", 28 + "_resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.14.tgz",
29 - "_spec": "11.12.0", 29 + "_spec": "12.12.14",
30 - "_where": "/Users/ye/Desktop/NodeBook/nodejs-book/ch12/12.4/node-auction", 30 + "_where": "C:\\Users\\15Z950.1703\\Desktop\\2-2\\옾소\\프젝\\OPproject",
31 "bugs": { 31 "bugs": {
32 "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues" 32 "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
33 }, 33 },
...@@ -117,10 +117,6 @@ ...@@ -117,10 +117,6 @@
117 "url": "https://github.com/mwiktorczyk" 117 "url": "https://github.com/mwiktorczyk"
118 }, 118 },
119 { 119 {
120 - "name": "Matthieu Sieben",
121 - "url": "https://github.com/matthieusieben"
122 - },
123 - {
124 "name": "Mohsen Azimi", 120 "name": "Mohsen Azimi",
125 "url": "https://github.com/mohsen1" 121 "url": "https://github.com/mohsen1"
126 }, 122 },
...@@ -133,6 +129,10 @@ ...@@ -133,6 +129,10 @@
133 "url": "https://github.com/octo-sniffle" 129 "url": "https://github.com/octo-sniffle"
134 }, 130 },
135 { 131 {
132 + "name": "Nikita Galkin",
133 + "url": "https://github.com/galkin"
134 + },
135 + {
136 "name": "Parambir Singh", 136 "name": "Parambir Singh",
137 "url": "https://github.com/parambirs" 137 "url": "https://github.com/parambirs"
138 }, 138 },
...@@ -161,10 +161,6 @@ ...@@ -161,10 +161,6 @@
161 "url": "https://github.com/ZaneHannanAU" 161 "url": "https://github.com/ZaneHannanAU"
162 }, 162 },
163 { 163 {
164 - "name": "Jeremie Rodriguez",
165 - "url": "https://github.com/jeremiergz"
166 - },
167 - {
168 "name": "Samuel Ainsworth", 164 "name": "Samuel Ainsworth",
169 "url": "https://github.com/samuela" 165 "url": "https://github.com/samuela"
170 }, 166 },
...@@ -179,6 +175,26 @@ ...@@ -179,6 +175,26 @@
179 { 175 {
180 "name": "Thanik Bhongbhibhat", 176 "name": "Thanik Bhongbhibhat",
181 "url": "https://github.com/bhongy" 177 "url": "https://github.com/bhongy"
178 + },
179 + {
180 + "name": "Marcin Kopacz",
181 + "url": "https://github.com/chyzwar"
182 + },
183 + {
184 + "name": "Trivikram Kamat",
185 + "url": "https://github.com/trivikr"
186 + },
187 + {
188 + "name": "Minh Son Nguyen",
189 + "url": "https://github.com/nguymin4"
190 + },
191 + {
192 + "name": "Junxiao Shi",
193 + "url": "https://github.com/yoursunny"
194 + },
195 + {
196 + "name": "Ilia Baryshnikov",
197 + "url": "https://github.com/qwelias"
182 } 198 }
183 ], 199 ],
184 "dependencies": {}, 200 "dependencies": {},
...@@ -193,9 +209,9 @@ ...@@ -193,9 +209,9 @@
193 "directory": "types/node" 209 "directory": "types/node"
194 }, 210 },
195 "scripts": {}, 211 "scripts": {},
196 - "typeScriptVersion": "2.0", 212 + "typeScriptVersion": "2.8",
197 - "types": "index", 213 + "types": "index.d.ts",
198 - "typesPublisherContentHash": "8e6e38ea6d4123e645bb9bae11238d4c35590b3433292b649e2cb9fba834fe0b", 214 + "typesPublisherContentHash": "305a8ff81632f0e70287898475e87d6aedbd683a5e37cb775f9ea845625cfa06",
199 "typesVersions": { 215 "typesVersions": {
200 ">=3.2.0-0": { 216 ">=3.2.0-0": {
201 "*": [ 217 "*": [
...@@ -203,5 +219,5 @@ ...@@ -203,5 +219,5 @@
203 ] 219 ]
204 } 220 }
205 }, 221 },
206 - "version": "11.12.0" 222 + "version": "12.12.14"
207 } 223 }
......
1 declare module "process" { 1 declare module "process" {
2 + import * as tty from "tty";
3 +
4 + global {
5 + namespace NodeJS {
6 + // this namespace merge is here because these are specifically used
7 + // as the type for process.stdin, process.stdout, and process.stderr.
8 + // they can't live in tty.d.ts because we need to disambiguate the imported name.
9 + interface ReadStream extends tty.ReadStream {}
10 + interface WriteStream extends tty.WriteStream {}
11 + }
12 + }
13 +
2 export = process; 14 export = process;
3 } 15 }
......
...@@ -10,8 +10,20 @@ declare module "querystring" { ...@@ -10,8 +10,20 @@ declare module "querystring" {
10 10
11 interface ParsedUrlQuery { [key: string]: string | string[]; } 11 interface ParsedUrlQuery { [key: string]: string | string[]; }
12 12
13 - function stringify(obj?: {}, sep?: string, eq?: string, options?: StringifyOptions): string; 13 + interface ParsedUrlQueryInput {
14 + [key: string]: NodeJS.PoorMansUnknown;
15 + }
16 +
17 + function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
14 function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; 18 function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
19 + /**
20 + * The querystring.encode() function is an alias for querystring.stringify().
21 + */
22 + const encode: typeof stringify;
23 + /**
24 + * The querystring.decode() function is an alias for querystring.parse().
25 + */
26 + const decode: typeof parse;
15 function escape(str: string): string; 27 function escape(str: string): string;
16 function unescape(str: string): string; 28 function unescape(str: string): string;
17 } 29 }
......
...@@ -127,10 +127,24 @@ declare module "readline" { ...@@ -127,10 +127,24 @@ declare module "readline" {
127 127
128 function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface; 128 function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
129 function createInterface(options: ReadLineOptions): Interface; 129 function createInterface(options: ReadLineOptions): Interface;
130 + function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
130 131
131 - function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number): void; 132 + type Direction = -1 | 0 | 1;
132 - function emitKeypressEvents(stream: NodeJS.ReadableStream, interface?: Interface): void; 133 +
133 - function moveCursor(stream: NodeJS.WritableStream, dx: number | string, dy: number | string): void; 134 + /**
134 - function clearLine(stream: NodeJS.WritableStream, dir: number): void; 135 + * Clears the current line of this WriteStream in a direction identified by `dir`.
135 - function clearScreenDown(stream: NodeJS.WritableStream): void; 136 + */
137 + function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
138 + /**
139 + * Clears this `WriteStream` from the current cursor down.
140 + */
141 + function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
142 + /**
143 + * Moves this WriteStream's cursor to the specified position.
144 + */
145 + function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
146 + /**
147 + * Moves this WriteStream's cursor relative to its current position.
148 + */
149 + function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
136 } 150 }
......
...@@ -353,13 +353,13 @@ declare module "repl" { ...@@ -353,13 +353,13 @@ declare module "repl" {
353 /** 353 /**
354 * A flag passed in the REPL options. Evaluates expressions in sloppy mode. 354 * A flag passed in the REPL options. Evaluates expressions in sloppy mode.
355 */ 355 */
356 - export const REPL_MODE_SLOPPY: symbol; // TODO: unique symbol 356 + const REPL_MODE_SLOPPY: symbol; // TODO: unique symbol
357 357
358 /** 358 /**
359 * A flag passed in the REPL options. Evaluates expressions in strict mode. 359 * A flag passed in the REPL options. Evaluates expressions in strict mode.
360 * This is equivalent to prefacing every repl statement with `'use strict'`. 360 * This is equivalent to prefacing every repl statement with `'use strict'`.
361 */ 361 */
362 - export const REPL_MODE_STRICT: symbol; // TODO: unique symbol 362 + const REPL_MODE_STRICT: symbol; // TODO: unique symbol
363 363
364 /** 364 /**
365 * Creates and starts a `repl.REPLServer` instance. 365 * Creates and starts a `repl.REPLServer` instance.
......
...@@ -18,9 +18,16 @@ declare module "stream" { ...@@ -18,9 +18,16 @@ declare module "stream" {
18 } 18 }
19 19
20 class Readable extends Stream implements NodeJS.ReadableStream { 20 class Readable extends Stream implements NodeJS.ReadableStream {
21 + /**
22 + * A utility method for creating Readable Streams out of iterators.
23 + */
24 + static from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable;
25 +
21 readable: boolean; 26 readable: boolean;
22 readonly readableHighWaterMark: number; 27 readonly readableHighWaterMark: number;
23 readonly readableLength: number; 28 readonly readableLength: number;
29 + readonly readableObjectMode: boolean;
30 + destroyed: boolean;
24 constructor(opts?: ReadableOptions); 31 constructor(opts?: ReadableOptions);
25 _read(size: number): void; 32 _read(size: number): void;
26 read(size?: number): any; 33 read(size?: number): any;
...@@ -29,7 +36,7 @@ declare module "stream" { ...@@ -29,7 +36,7 @@ declare module "stream" {
29 resume(): this; 36 resume(): this;
30 isPaused(): boolean; 37 isPaused(): boolean;
31 unpipe(destination?: NodeJS.WritableStream): this; 38 unpipe(destination?: NodeJS.WritableStream): this;
32 - unshift(chunk: any): void; 39 + unshift(chunk: any, encoding?: BufferEncoding): void;
33 wrap(oldStream: NodeJS.ReadableStream): this; 40 wrap(oldStream: NodeJS.ReadableStream): this;
34 push(chunk: any, encoding?: string): boolean; 41 push(chunk: any, encoding?: string): boolean;
35 _destroy(error: Error | null, callback: (error?: Error | null) => void): void; 42 _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
...@@ -110,20 +117,24 @@ declare module "stream" { ...@@ -110,20 +117,24 @@ declare module "stream" {
110 } 117 }
111 118
112 class Writable extends Stream implements NodeJS.WritableStream { 119 class Writable extends Stream implements NodeJS.WritableStream {
113 - writable: boolean; 120 + readonly writable: boolean;
121 + readonly writableEnded: boolean;
122 + readonly writableFinished: boolean;
114 readonly writableHighWaterMark: number; 123 readonly writableHighWaterMark: number;
115 readonly writableLength: number; 124 readonly writableLength: number;
125 + readonly writableObjectMode: boolean;
126 + destroyed: boolean;
116 constructor(opts?: WritableOptions); 127 constructor(opts?: WritableOptions);
117 _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; 128 _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void;
118 _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; 129 _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void;
119 _destroy(error: Error | null, callback: (error?: Error | null) => void): void; 130 _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
120 _final(callback: (error?: Error | null) => void): void; 131 _final(callback: (error?: Error | null) => void): void;
121 write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; 132 write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean;
122 - write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean; 133 + write(chunk: any, encoding: string, cb?: (error: Error | null | undefined) => void): boolean;
123 setDefaultEncoding(encoding: string): this; 134 setDefaultEncoding(encoding: string): this;
124 end(cb?: () => void): void; 135 end(cb?: () => void): void;
125 end(chunk: any, cb?: () => void): void; 136 end(chunk: any, cb?: () => void): void;
126 - end(chunk: any, encoding?: string, cb?: () => void): void; 137 + end(chunk: any, encoding: string, cb?: () => void): void;
127 cork(): void; 138 cork(): void;
128 uncork(): void; 139 uncork(): void;
129 destroy(error?: Error): void; 140 destroy(error?: Error): void;
...@@ -208,9 +219,12 @@ declare module "stream" { ...@@ -208,9 +219,12 @@ declare module "stream" {
208 219
209 // Note: Duplex extends both Readable and Writable. 220 // Note: Duplex extends both Readable and Writable.
210 class Duplex extends Readable implements Writable { 221 class Duplex extends Readable implements Writable {
211 - writable: boolean; 222 + readonly writable: boolean;
223 + readonly writableEnded: boolean;
224 + readonly writableFinished: boolean;
212 readonly writableHighWaterMark: number; 225 readonly writableHighWaterMark: number;
213 readonly writableLength: number; 226 readonly writableLength: number;
227 + readonly writableObjectMode: boolean;
214 constructor(opts?: DuplexOptions); 228 constructor(opts?: DuplexOptions);
215 _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; 229 _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void;
216 _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void; 230 _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (error?: Error | null) => void): void;
...@@ -246,19 +260,19 @@ declare module "stream" { ...@@ -246,19 +260,19 @@ declare module "stream" {
246 260
247 class PassThrough extends Transform { } 261 class PassThrough extends Transform { }
248 262
249 - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException) => void): () => void; 263 + function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException | null) => void): () => void;
250 namespace finished { 264 namespace finished {
251 function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream): Promise<void>; 265 function __promisify__(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream): Promise<void>;
252 } 266 }
253 267
254 - function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException) => void): T; 268 + function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: T, callback?: (err: NodeJS.ErrnoException | null) => void): T;
255 - function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException) => void): T; 269 + function pipeline<T extends NodeJS.WritableStream>(stream1: NodeJS.ReadableStream, stream2: NodeJS.ReadWriteStream, stream3: T, callback?: (err: NodeJS.ErrnoException | null) => void): T;
256 function pipeline<T extends NodeJS.WritableStream>( 270 function pipeline<T extends NodeJS.WritableStream>(
257 stream1: NodeJS.ReadableStream, 271 stream1: NodeJS.ReadableStream,
258 stream2: NodeJS.ReadWriteStream, 272 stream2: NodeJS.ReadWriteStream,
259 stream3: NodeJS.ReadWriteStream, 273 stream3: NodeJS.ReadWriteStream,
260 stream4: T, 274 stream4: T,
261 - callback?: (err: NodeJS.ErrnoException) => void, 275 + callback?: (err: NodeJS.ErrnoException | null) => void,
262 ): T; 276 ): T;
263 function pipeline<T extends NodeJS.WritableStream>( 277 function pipeline<T extends NodeJS.WritableStream>(
264 stream1: NodeJS.ReadableStream, 278 stream1: NodeJS.ReadableStream,
...@@ -266,13 +280,13 @@ declare module "stream" { ...@@ -266,13 +280,13 @@ declare module "stream" {
266 stream3: NodeJS.ReadWriteStream, 280 stream3: NodeJS.ReadWriteStream,
267 stream4: NodeJS.ReadWriteStream, 281 stream4: NodeJS.ReadWriteStream,
268 stream5: T, 282 stream5: T,
269 - callback?: (err: NodeJS.ErrnoException) => void, 283 + callback?: (err: NodeJS.ErrnoException | null) => void,
270 ): T; 284 ): T;
271 - function pipeline(streams: Array<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, callback?: (err: NodeJS.ErrnoException) => void): NodeJS.WritableStream; 285 + function pipeline(streams: Array<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, callback?: (err: NodeJS.ErrnoException | null) => void): NodeJS.WritableStream;
272 function pipeline( 286 function pipeline(
273 stream1: NodeJS.ReadableStream, 287 stream1: NodeJS.ReadableStream,
274 stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, 288 stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
275 - ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException) => void)>, 289 + ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void)>,
276 ): NodeJS.WritableStream; 290 ): NodeJS.WritableStream;
277 namespace pipeline { 291 namespace pipeline {
278 function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.WritableStream): Promise<void>; 292 function __promisify__(stream1: NodeJS.ReadableStream, stream2: NodeJS.WritableStream): Promise<void>;
...@@ -293,7 +307,12 @@ declare module "stream" { ...@@ -293,7 +307,12 @@ declare module "stream" {
293 ): Promise<void>; 307 ): Promise<void>;
294 } 308 }
295 309
296 - interface Pipe { } 310 + interface Pipe {
311 + close(): void;
312 + hasRef(): boolean;
313 + ref(): void;
314 + unref(): void;
315 + }
297 } 316 }
298 317
299 export = internal; 318 export = internal;
......
1 declare module "string_decoder" { 1 declare module "string_decoder" {
2 - interface NodeStringDecoder { 2 + class StringDecoder {
3 + constructor(encoding?: string);
3 write(buffer: Buffer): string; 4 write(buffer: Buffer): string;
4 end(buffer?: Buffer): string; 5 end(buffer?: Buffer): string;
5 } 6 }
6 - const StringDecoder: {
7 - new(encoding?: string): NodeStringDecoder;
8 - };
9 } 7 }
......
...@@ -64,70 +64,34 @@ declare module "tls" { ...@@ -64,70 +64,34 @@ declare module "tls" {
64 version: string; 64 version: string;
65 } 65 }
66 66
67 - class TLSSocket extends net.Socket { 67 + interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions {
68 - /**
69 - * Construct a new tls.TLSSocket object from an existing TCP socket.
70 - */
71 - constructor(socket: net.Socket, options?: {
72 - /**
73 - * An optional TLS context object from tls.createSecureContext()
74 - */
75 - secureContext?: SecureContext,
76 /** 68 /**
77 * If true the TLS socket will be instantiated in server-mode. 69 * If true the TLS socket will be instantiated in server-mode.
78 * Defaults to false. 70 * Defaults to false.
79 */ 71 */
80 - isServer?: boolean, 72 + isServer?: boolean;
81 /** 73 /**
82 * An optional net.Server instance. 74 * An optional net.Server instance.
83 */ 75 */
84 - server?: net.Server, 76 + server?: net.Server;
85 - /** 77 +
86 - * If true the server will request a certificate from clients that
87 - * connect and attempt to verify that certificate. Defaults to
88 - * false.
89 - */
90 - requestCert?: boolean,
91 - /**
92 - * If true the server will reject any connection which is not
93 - * authorized with the list of supplied CAs. This option only has an
94 - * effect if requestCert is true. Defaults to false.
95 - */
96 - rejectUnauthorized?: boolean,
97 - /**
98 - * An array of strings or a Buffer naming possible NPN protocols.
99 - * (Protocols should be ordered by their priority.)
100 - */
101 - NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array,
102 - /**
103 - * An array of strings or a Buffer naming possible ALPN protocols.
104 - * (Protocols should be ordered by their priority.) When the server
105 - * receives both NPN and ALPN extensions from the client, ALPN takes
106 - * precedence over NPN and the server does not send an NPN extension
107 - * to the client.
108 - */
109 - ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array,
110 - /**
111 - * SNICallback(servername, cb) <Function> A function that will be
112 - * called if the client supports SNI TLS extension. Two arguments
113 - * will be passed when called: servername and cb. SNICallback should
114 - * invoke cb(null, ctx), where ctx is a SecureContext instance.
115 - * (tls.createSecureContext(...) can be used to get a proper
116 - * SecureContext.) If SNICallback wasn't provided the default callback
117 - * with high-level API will be used (see below).
118 - */
119 - SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void,
120 /** 78 /**
121 * An optional Buffer instance containing a TLS session. 79 * An optional Buffer instance containing a TLS session.
122 */ 80 */
123 - session?: Buffer, 81 + session?: Buffer;
124 /** 82 /**
125 * If true, specifies that the OCSP status request extension will be 83 * If true, specifies that the OCSP status request extension will be
126 * added to the client hello and an 'OCSPResponse' event will be 84 * added to the client hello and an 'OCSPResponse' event will be
127 * emitted on the socket before establishing a secure communication 85 * emitted on the socket before establishing a secure communication
128 */ 86 */
129 - requestOCSP?: boolean 87 + requestOCSP?: boolean;
130 - }); 88 + }
89 +
90 + class TLSSocket extends net.Socket {
91 + /**
92 + * Construct a new tls.TLSSocket object from an existing TCP socket.
93 + */
94 + constructor(socket: net.Socket, options?: TLSSocketOptions);
131 95
132 /** 96 /**
133 * A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false. 97 * A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false.
...@@ -212,75 +176,116 @@ declare module "tls" { ...@@ -212,75 +176,116 @@ declare module "tls" {
212 setMaxSendFragment(size: number): boolean; 176 setMaxSendFragment(size: number): boolean;
213 177
214 /** 178 /**
215 - * events.EventEmitter 179 + * When enabled, TLS packet trace information is written to `stderr`. This can be
216 - * 1. OCSPResponse 180 + * used to debug TLS connection problems.
217 - * 2. secureConnect 181 + *
182 + * Note: The format of the output is identical to the output of `openssl s_client
183 + * -trace` or `openssl s_server -trace`. While it is produced by OpenSSL's
184 + * `SSL_trace()` function, the format is undocumented, can change without notice,
185 + * and should not be relied on.
218 */ 186 */
187 + enableTrace(): void;
188 +
219 addListener(event: string, listener: (...args: any[]) => void): this; 189 addListener(event: string, listener: (...args: any[]) => void): this;
220 addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; 190 addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
221 addListener(event: "secureConnect", listener: () => void): this; 191 addListener(event: "secureConnect", listener: () => void): this;
222 addListener(event: "session", listener: (session: Buffer) => void): this; 192 addListener(event: "session", listener: (session: Buffer) => void): this;
193 + addListener(event: "keylog", listener: (line: Buffer) => void): this;
223 194
224 emit(event: string | symbol, ...args: any[]): boolean; 195 emit(event: string | symbol, ...args: any[]): boolean;
225 emit(event: "OCSPResponse", response: Buffer): boolean; 196 emit(event: "OCSPResponse", response: Buffer): boolean;
226 emit(event: "secureConnect"): boolean; 197 emit(event: "secureConnect"): boolean;
227 emit(event: "session", session: Buffer): boolean; 198 emit(event: "session", session: Buffer): boolean;
199 + emit(event: "keylog", line: Buffer): boolean;
228 200
229 on(event: string, listener: (...args: any[]) => void): this; 201 on(event: string, listener: (...args: any[]) => void): this;
230 on(event: "OCSPResponse", listener: (response: Buffer) => void): this; 202 on(event: "OCSPResponse", listener: (response: Buffer) => void): this;
231 on(event: "secureConnect", listener: () => void): this; 203 on(event: "secureConnect", listener: () => void): this;
232 on(event: "session", listener: (session: Buffer) => void): this; 204 on(event: "session", listener: (session: Buffer) => void): this;
205 + on(event: "keylog", listener: (line: Buffer) => void): this;
233 206
234 once(event: string, listener: (...args: any[]) => void): this; 207 once(event: string, listener: (...args: any[]) => void): this;
235 once(event: "OCSPResponse", listener: (response: Buffer) => void): this; 208 once(event: "OCSPResponse", listener: (response: Buffer) => void): this;
236 once(event: "secureConnect", listener: () => void): this; 209 once(event: "secureConnect", listener: () => void): this;
237 once(event: "session", listener: (session: Buffer) => void): this; 210 once(event: "session", listener: (session: Buffer) => void): this;
211 + once(event: "keylog", listener: (line: Buffer) => void): this;
238 212
239 prependListener(event: string, listener: (...args: any[]) => void): this; 213 prependListener(event: string, listener: (...args: any[]) => void): this;
240 prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; 214 prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
241 prependListener(event: "secureConnect", listener: () => void): this; 215 prependListener(event: "secureConnect", listener: () => void): this;
242 prependListener(event: "session", listener: (session: Buffer) => void): this; 216 prependListener(event: "session", listener: (session: Buffer) => void): this;
217 + prependListener(event: "keylog", listener: (line: Buffer) => void): this;
243 218
244 prependOnceListener(event: string, listener: (...args: any[]) => void): this; 219 prependOnceListener(event: string, listener: (...args: any[]) => void): this;
245 prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; 220 prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
246 prependOnceListener(event: "secureConnect", listener: () => void): this; 221 prependOnceListener(event: "secureConnect", listener: () => void): this;
247 prependOnceListener(event: "session", listener: (session: Buffer) => void): this; 222 prependOnceListener(event: "session", listener: (session: Buffer) => void): this;
223 + prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this;
248 } 224 }
249 225
250 - interface TlsOptions extends SecureContextOptions { 226 + interface CommonConnectionOptions {
251 - handshakeTimeout?: number; 227 + /**
228 + * An optional TLS context object from tls.createSecureContext()
229 + */
230 + secureContext?: SecureContext;
231 +
232 + /**
233 + * When enabled, TLS packet trace information is written to `stderr`. This can be
234 + * used to debug TLS connection problems.
235 + * @default false
236 + */
237 + enableTrace?: boolean;
238 + /**
239 + * If true the server will request a certificate from clients that
240 + * connect and attempt to verify that certificate. Defaults to
241 + * false.
242 + */
252 requestCert?: boolean; 243 requestCert?: boolean;
253 - rejectUnauthorized?: boolean; 244 + /**
254 - NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; 245 + * An array of strings or a Buffer naming possible ALPN protocols.
255 - ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; 246 + * (Protocols should be ordered by their priority.)
247 + */
248 + ALPNProtocols?: string[] | Uint8Array[] | Uint8Array;
249 + /**
250 + * SNICallback(servername, cb) <Function> A function that will be
251 + * called if the client supports SNI TLS extension. Two arguments
252 + * will be passed when called: servername and cb. SNICallback should
253 + * invoke cb(null, ctx), where ctx is a SecureContext instance.
254 + * (tls.createSecureContext(...) can be used to get a proper
255 + * SecureContext.) If SNICallback wasn't provided the default callback
256 + * with high-level API will be used (see below).
257 + */
256 SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; 258 SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void;
259 + /**
260 + * If true the server will reject any connection which is not
261 + * authorized with the list of supplied CAs. This option only has an
262 + * effect if requestCert is true.
263 + * @default true
264 + */
265 + rejectUnauthorized?: boolean;
266 + }
267 +
268 + interface TlsOptions extends SecureContextOptions, CommonConnectionOptions {
269 + handshakeTimeout?: number;
257 sessionTimeout?: number; 270 sessionTimeout?: number;
258 ticketKeys?: Buffer; 271 ticketKeys?: Buffer;
259 } 272 }
260 273
261 - interface ConnectionOptions extends SecureContextOptions { 274 + interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions {
262 host?: string; 275 host?: string;
263 port?: number; 276 port?: number;
264 path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. 277 path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored.
265 socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket 278 socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket
266 - rejectUnauthorized?: boolean; // Defaults to true
267 - NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
268 - ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array;
269 checkServerIdentity?: typeof checkServerIdentity; 279 checkServerIdentity?: typeof checkServerIdentity;
270 servername?: string; // SNI TLS Extension 280 servername?: string; // SNI TLS Extension
271 session?: Buffer; 281 session?: Buffer;
272 minDHSize?: number; 282 minDHSize?: number;
273 - secureContext?: SecureContext; // If not provided, the entire ConnectionOptions object will be passed to tls.createSecureContext()
274 lookup?: net.LookupFunction; 283 lookup?: net.LookupFunction;
275 timeout?: number; 284 timeout?: number;
276 } 285 }
277 286
278 class Server extends net.Server { 287 class Server extends net.Server {
279 - addContext(hostName: string, credentials: { 288 + addContext(hostName: string, credentials: SecureContextOptions): void;
280 - key: string;
281 - cert: string;
282 - ca: string;
283 - }): void;
284 289
285 /** 290 /**
286 * events.EventEmitter 291 * events.EventEmitter
...@@ -296,6 +301,7 @@ declare module "tls" { ...@@ -296,6 +301,7 @@ declare module "tls" {
296 addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; 301 addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
297 addListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; 302 addListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
298 addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; 303 addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
304 + addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
299 305
300 emit(event: string | symbol, ...args: any[]): boolean; 306 emit(event: string | symbol, ...args: any[]): boolean;
301 emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; 307 emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean;
...@@ -303,6 +309,7 @@ declare module "tls" { ...@@ -303,6 +309,7 @@ declare module "tls" {
303 emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean; 309 emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void): boolean;
304 emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; 310 emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
305 emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; 311 emit(event: "secureConnection", tlsSocket: TLSSocket): boolean;
312 + emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean;
306 313
307 on(event: string, listener: (...args: any[]) => void): this; 314 on(event: string, listener: (...args: any[]) => void): this;
308 on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; 315 on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
...@@ -310,6 +317,7 @@ declare module "tls" { ...@@ -310,6 +317,7 @@ declare module "tls" {
310 on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; 317 on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
311 on(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; 318 on(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
312 on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; 319 on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
320 + on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
313 321
314 once(event: string, listener: (...args: any[]) => void): this; 322 once(event: string, listener: (...args: any[]) => void): this;
315 once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; 323 once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
...@@ -317,6 +325,7 @@ declare module "tls" { ...@@ -317,6 +325,7 @@ declare module "tls" {
317 once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; 325 once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
318 once(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; 326 once(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
319 once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; 327 once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
328 + once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
320 329
321 prependListener(event: string, listener: (...args: any[]) => void): this; 330 prependListener(event: string, listener: (...args: any[]) => void): this;
322 prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; 331 prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
...@@ -324,6 +333,7 @@ declare module "tls" { ...@@ -324,6 +333,7 @@ declare module "tls" {
324 prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; 333 prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
325 prependListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; 334 prependListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
326 prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; 335 prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
336 + prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
327 337
328 prependOnceListener(event: string, listener: (...args: any[]) => void): this; 338 prependOnceListener(event: string, listener: (...args: any[]) => void): this;
329 prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; 339 prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
...@@ -331,6 +341,7 @@ declare module "tls" { ...@@ -331,6 +341,7 @@ declare module "tls" {
331 prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this; 341 prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: (err: Error | null, resp: Buffer) => void) => void): this;
332 prependOnceListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this; 342 prependOnceListener(event: "resumeSession", listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void): this;
333 prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; 343 prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
344 + prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this;
334 } 345 }
335 346
336 interface SecurePair { 347 interface SecurePair {
...@@ -338,7 +349,7 @@ declare module "tls" { ...@@ -338,7 +349,7 @@ declare module "tls" {
338 cleartext: TLSSocket; 349 cleartext: TLSSocket;
339 } 350 }
340 351
341 - type SecureVersion = 'TLSv1.2' | 'TLSv1.1' | 'TLSv1'; 352 + type SecureVersion = 'TLSv1.3' | 'TLSv1.2' | 'TLSv1.1' | 'TLSv1';
342 353
343 interface SecureContextOptions { 354 interface SecureContextOptions {
344 pfx?: string | Buffer | Array<string | Buffer | Object>; 355 pfx?: string | Buffer | Array<string | Buffer | Object>;
...@@ -357,18 +368,22 @@ declare module "tls" { ...@@ -357,18 +368,22 @@ declare module "tls" {
357 sessionIdContext?: string; 368 sessionIdContext?: string;
358 /** 369 /**
359 * Optionally set the maximum TLS version to allow. One 370 * Optionally set the maximum TLS version to allow. One
360 - * of `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the 371 + * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
361 - * `secureProtocol` option, use one or the other. **Default:** `'TLSv1.2'`. 372 + * `secureProtocol` option, use one or the other.
373 + * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using
374 + * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to
375 + * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used.
362 */ 376 */
363 maxVersion?: SecureVersion; 377 maxVersion?: SecureVersion;
364 /** 378 /**
365 * Optionally set the minimum TLS version to allow. One 379 * Optionally set the minimum TLS version to allow. One
366 - * of `TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the 380 + * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the
367 * `secureProtocol` option, use one or the other. It is not recommended to use 381 * `secureProtocol` option, use one or the other. It is not recommended to use
368 * less than TLSv1.2, but it may be required for interoperability. 382 * less than TLSv1.2, but it may be required for interoperability.
369 * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using 383 * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using
370 - * `--tls-v1.0` changes the default to `'TLSv1'`. Using `--tls-v1.1` changes 384 + * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to
371 - * the default to `'TLSv1.1'`. 385 + * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to
386 + * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used.
372 */ 387 */
373 minVersion?: SecureVersion; 388 minVersion?: SecureVersion;
374 } 389 }
...@@ -385,6 +400,7 @@ declare module "tls" { ...@@ -385,6 +400,7 @@ declare module "tls" {
385 * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined. 400 * Returns Error object, populating it with the reason, host and cert on failure. On success, returns undefined.
386 */ 401 */
387 function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined; 402 function checkServerIdentity(host: string, cert: PeerCertificate): Error | undefined;
403 + function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server;
388 function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; 404 function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server;
389 function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; 405 function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
390 function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; 406 function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket;
...@@ -397,4 +413,6 @@ declare module "tls" { ...@@ -397,4 +413,6 @@ declare module "tls" {
397 function getCiphers(): string[]; 413 function getCiphers(): string[];
398 414
399 const DEFAULT_ECDH_CURVE: string; 415 const DEFAULT_ECDH_CURVE: string;
416 +
417 + const rootCertificates: ReadonlyArray<string>;
400 } 418 }
......
...@@ -9,7 +9,7 @@ declare module "trace_events" { ...@@ -9,7 +9,7 @@ declare module "trace_events" {
9 * event categories. Calling `tracing.disable()` will remove the categories 9 * event categories. Calling `tracing.disable()` will remove the categories
10 * from the set of enabled trace event categories. 10 * from the set of enabled trace event categories.
11 */ 11 */
12 - export interface Tracing { 12 + interface Tracing {
13 /** 13 /**
14 * A comma-separated list of the trace event categories covered by this 14 * A comma-separated list of the trace event categories covered by this
15 * `Tracing` object. 15 * `Tracing` object.
...@@ -49,7 +49,7 @@ declare module "trace_events" { ...@@ -49,7 +49,7 @@ declare module "trace_events" {
49 /** 49 /**
50 * Creates and returns a Tracing object for the given set of categories. 50 * Creates and returns a Tracing object for the given set of categories.
51 */ 51 */
52 - export function createTracing(options: CreateTracingOptions): Tracing; 52 + function createTracing(options: CreateTracingOptions): Tracing;
53 53
54 /** 54 /**
55 * Returns a comma-separated list of all currently-enabled trace event 55 * Returns a comma-separated list of all currently-enabled trace event
...@@ -57,5 +57,5 @@ declare module "trace_events" { ...@@ -57,5 +57,5 @@ declare module "trace_events" {
57 * determined by the union of all currently-enabled `Tracing` objects and 57 * determined by the union of all currently-enabled `Tracing` objects and
58 * any categories enabled using the `--trace-event-categories` flag. 58 * any categories enabled using the `--trace-event-categories` flag.
59 */ 59 */
60 - export function getEnabledCategories(): string; 60 + function getEnabledCategories(): string | undefined;
61 } 61 }
......
1 +// tslint:disable-next-line:no-bad-reference
2 +/// <reference path="../fs.d.ts" />
3 +
4 +declare module 'fs' {
5 + interface BigIntStats extends StatsBase<BigInt> {
6 + }
7 +
8 + class BigIntStats {
9 + atimeNs: BigInt;
10 + mtimeNs: BigInt;
11 + ctimeNs: BigInt;
12 + birthtimeNs: BigInt;
13 + }
14 +
15 + interface BigIntOptions {
16 + bigint: true;
17 + }
18 +
19 + interface StatOptions {
20 + bigint: boolean;
21 + }
22 +
23 + function stat(path: PathLike, options: BigIntOptions, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
24 + function stat(path: PathLike, options: StatOptions, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
25 +
26 + namespace stat {
27 + function __promisify__(path: PathLike, options: BigIntOptions): Promise<BigIntStats>;
28 + function __promisify__(path: PathLike, options: StatOptions): Promise<Stats | BigIntStats>;
29 + }
30 +
31 + function statSync(path: PathLike, options: BigIntOptions): BigIntStats;
32 + function statSync(path: PathLike, options: StatOptions): Stats | BigIntStats;
33 +}
...@@ -6,3 +6,14 @@ declare namespace NodeJS { ...@@ -6,3 +6,14 @@ declare namespace NodeJS {
6 bigint(): bigint; 6 bigint(): bigint;
7 } 7 }
8 } 8 }
9 +
10 +interface Buffer extends Uint8Array {
11 + readBigUInt64BE(offset?: number): bigint;
12 + readBigUInt64LE(offset?: number): bigint;
13 + readBigInt64BE(offset?: number): bigint;
14 + readBigInt64LE(offset?: number): bigint;
15 + writeBigInt64BE(value: bigint, offset?: number): number;
16 + writeBigInt64LE(value: bigint, offset?: number): number;
17 + writeBigUInt64BE(value: bigint, offset?: number): number;
18 + writeBigUInt64LE(value: bigint, offset?: number): number;
19 +}
......
...@@ -16,5 +16,6 @@ ...@@ -16,5 +16,6 @@
16 /// <reference path="../base.d.ts" /> 16 /// <reference path="../base.d.ts" />
17 17
18 // TypeScript 3.2-specific augmentations: 18 // TypeScript 3.2-specific augmentations:
19 +/// <reference path="fs.d.ts" />
19 /// <reference path="util.d.ts" /> 20 /// <reference path="util.d.ts" />
20 /// <reference path="globals.d.ts" /> 21 /// <reference path="globals.d.ts" />
......
...@@ -3,6 +3,7 @@ declare module "tty" { ...@@ -3,6 +3,7 @@ declare module "tty" {
3 3
4 function isatty(fd: number): boolean; 4 function isatty(fd: number): boolean;
5 class ReadStream extends net.Socket { 5 class ReadStream extends net.Socket {
6 + constructor(fd: number, options?: net.SocketConstructorOpts);
6 isRaw: boolean; 7 isRaw: boolean;
7 setRawMode(mode: boolean): void; 8 setRawMode(mode: boolean): void;
8 isTTY: boolean; 9 isTTY: boolean;
...@@ -14,6 +15,7 @@ declare module "tty" { ...@@ -14,6 +15,7 @@ declare module "tty" {
14 */ 15 */
15 type Direction = -1 | 0 | 1; 16 type Direction = -1 | 0 | 1;
16 class WriteStream extends net.Socket { 17 class WriteStream extends net.Socket {
18 + constructor(fd: number);
17 addListener(event: string, listener: (...args: any[]) => void): this; 19 addListener(event: string, listener: (...args: any[]) => void): this;
18 addListener(event: "resize", listener: () => void): this; 20 addListener(event: "resize", listener: () => void): this;
19 21
...@@ -32,13 +34,30 @@ declare module "tty" { ...@@ -32,13 +34,30 @@ declare module "tty" {
32 prependOnceListener(event: string, listener: (...args: any[]) => void): this; 34 prependOnceListener(event: string, listener: (...args: any[]) => void): this;
33 prependOnceListener(event: "resize", listener: () => void): this; 35 prependOnceListener(event: "resize", listener: () => void): this;
34 36
35 - clearLine(dir: Direction): void; 37 + /**
36 - clearScreenDown(): void; 38 + * Clears the current line of this WriteStream in a direction identified by `dir`.
37 - cursorTo(x: number, y: number): void; 39 + */
40 + clearLine(dir: Direction, callback?: () => void): boolean;
41 + /**
42 + * Clears this `WriteStream` from the current cursor down.
43 + */
44 + clearScreenDown(callback?: () => void): boolean;
45 + /**
46 + * Moves this WriteStream's cursor to the specified position.
47 + */
48 + cursorTo(x: number, y?: number, callback?: () => void): boolean;
49 + cursorTo(x: number, callback: () => void): boolean;
50 + /**
51 + * Moves this WriteStream's cursor relative to its current position.
52 + */
53 + moveCursor(dx: number, dy: number, callback?: () => void): boolean;
38 /** 54 /**
39 * @default `process.env` 55 * @default `process.env`
40 */ 56 */
41 getColorDepth(env?: {}): number; 57 getColorDepth(env?: {}): number;
58 + hasColors(depth?: number): boolean;
59 + hasColors(env?: {}): boolean;
60 + hasColors(depth: number, env?: {}): boolean;
42 getWindowSize(): [number, number]; 61 getWindowSize(): [number, number];
43 columns: number; 62 columns: number;
44 rows: number; 63 rows: number;
......
1 declare module "url" { 1 declare module "url" {
2 - import { ParsedUrlQuery } from 'querystring'; 2 + import { ParsedUrlQuery, ParsedUrlQueryInput } from 'querystring';
3 -
4 - interface UrlObjectCommon {
5 - auth?: string;
6 - hash?: string;
7 - host?: string;
8 - hostname?: string;
9 - href?: string;
10 - path?: string;
11 - pathname?: string;
12 - protocol?: string;
13 - search?: string;
14 - slashes?: boolean;
15 - }
16 3
17 // Input to `url.format` 4 // Input to `url.format`
18 - interface UrlObject extends UrlObjectCommon { 5 + interface UrlObject {
19 - port?: string | number; 6 + auth?: string | null;
20 - query?: string | null | { [key: string]: any }; 7 + hash?: string | null;
8 + host?: string | null;
9 + hostname?: string | null;
10 + href?: string | null;
11 + path?: string | null;
12 + pathname?: string | null;
13 + protocol?: string | null;
14 + search?: string | null;
15 + slashes?: boolean | null;
16 + port?: string | number | null;
17 + query?: string | null | ParsedUrlQueryInput;
21 } 18 }
22 19
23 // Output of `url.parse` 20 // Output of `url.parse`
24 - interface Url extends UrlObjectCommon { 21 + interface Url {
25 - port?: string; 22 + auth: string | null;
26 - query?: string | null | ParsedUrlQuery; 23 + hash: string | null;
24 + host: string | null;
25 + hostname: string | null;
26 + href: string;
27 + path: string | null;
28 + pathname: string | null;
29 + protocol: string | null;
30 + search: string | null;
31 + slashes: boolean | null;
32 + port: string | null;
33 + query: string | null | ParsedUrlQuery;
27 } 34 }
28 35
29 interface UrlWithParsedQuery extends Url { 36 interface UrlWithParsedQuery extends Url {
......
...@@ -2,14 +2,6 @@ declare module "util" { ...@@ -2,14 +2,6 @@ declare module "util" {
2 interface InspectOptions extends NodeJS.InspectOptions { } 2 interface InspectOptions extends NodeJS.InspectOptions { }
3 function format(format: any, ...param: any[]): string; 3 function format(format: any, ...param: any[]): string;
4 function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string; 4 function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
5 - /** @deprecated since v0.11.3 - use `console.error()` instead. */
6 - function debug(string: string): void;
7 - /** @deprecated since v0.11.3 - use `console.error()` instead. */
8 - function error(...param: any[]): void;
9 - /** @deprecated since v0.11.3 - use `console.log()` instead. */
10 - function puts(...param: any[]): void;
11 - /** @deprecated since v0.11.3 - use `console.log()` instead. */
12 - function print(...param: any[]): void;
13 /** @deprecated since v0.11.3 - use a third party module instead. */ 5 /** @deprecated since v0.11.3 - use a third party module instead. */
14 function log(string: string): void; 6 function log(string: string): void;
15 function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; 7 function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
...@@ -59,7 +51,7 @@ declare module "util" { ...@@ -59,7 +51,7 @@ declare module "util" {
59 function isSymbol(object: any): object is symbol; 51 function isSymbol(object: any): object is symbol;
60 /** @deprecated since v4.0.0 - use `value === undefined` instead. */ 52 /** @deprecated since v4.0.0 - use `value === undefined` instead. */
61 function isUndefined(object: any): object is undefined; 53 function isUndefined(object: any): object is undefined;
62 - function deprecate<T extends Function>(fn: T, message: string): T; 54 + function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
63 function isDeepStrictEqual(val1: any, val2: any): boolean; 55 function isDeepStrictEqual(val1: any, val2: any): boolean;
64 56
65 interface CustomPromisify<TCustom extends Function> extends Function { 57 interface CustomPromisify<TCustom extends Function> extends Function {
...@@ -71,44 +63,46 @@ declare module "util" { ...@@ -71,44 +63,46 @@ declare module "util" {
71 function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; 63 function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
72 function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; 64 function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
73 function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; 65 function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
74 - function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; 66 + function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
75 function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; 67 function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
76 function callbackify<T1, T2, T3, TResult>( 68 function callbackify<T1, T2, T3, TResult>(
77 - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; 69 + fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
78 function callbackify<T1, T2, T3, T4>( 70 function callbackify<T1, T2, T3, T4>(
79 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; 71 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
80 function callbackify<T1, T2, T3, T4, TResult>( 72 function callbackify<T1, T2, T3, T4, TResult>(
81 - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; 73 + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
82 function callbackify<T1, T2, T3, T4, T5>( 74 function callbackify<T1, T2, T3, T4, T5>(
83 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; 75 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
84 function callbackify<T1, T2, T3, T4, T5, TResult>( 76 function callbackify<T1, T2, T3, T4, T5, TResult>(
85 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>, 77 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
86 - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; 78 + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
87 function callbackify<T1, T2, T3, T4, T5, T6>( 79 function callbackify<T1, T2, T3, T4, T5, T6>(
88 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>, 80 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
89 ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; 81 ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
90 function callbackify<T1, T2, T3, T4, T5, T6, TResult>( 82 function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
91 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult> 83 fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
92 - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; 84 + ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void;
93 85
94 function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom; 86 function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
95 - function promisify<TResult>(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise<TResult>; 87 + function promisify<TResult>(fn: (callback: (err: any, result: TResult) => void) => void): () => Promise<TResult>;
96 - function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise<void>; 88 + function promisify(fn: (callback: (err?: any) => void) => void): () => Promise<void>;
97 - function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>; 89 + function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
98 - function promisify<T1>(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise<void>; 90 + function promisify<T1>(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise<void>;
99 - function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>; 91 + function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
100 - function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise<void>; 92 + function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
101 - function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>; 93 + function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void):
102 - function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>; 94 + (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
95 + function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
103 function promisify<T1, T2, T3, T4, TResult>( 96 function promisify<T1, T2, T3, T4, TResult>(
104 - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void, 97 + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void,
105 ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>; 98 ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
106 - function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>; 99 + function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void):
100 + (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
107 function promisify<T1, T2, T3, T4, T5, TResult>( 101 function promisify<T1, T2, T3, T4, T5, TResult>(
108 - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void, 102 + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void,
109 ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>; 103 ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
110 function promisify<T1, T2, T3, T4, T5>( 104 function promisify<T1, T2, T3, T4, T5>(
111 - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void, 105 + fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void,
112 ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>; 106 ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
113 function promisify(fn: Function): Function; 107 function promisify(fn: Function): Function;
114 108
...@@ -161,13 +155,26 @@ declare module "util" { ...@@ -161,13 +155,26 @@ declare module "util" {
161 options?: { fatal?: boolean; ignoreBOM?: boolean } 155 options?: { fatal?: boolean; ignoreBOM?: boolean }
162 ); 156 );
163 decode( 157 decode(
164 - input?: NodeJS.TypedArray | DataView | ArrayBuffer | null, 158 + input?: NodeJS.ArrayBufferView | ArrayBuffer | null,
165 options?: { stream?: boolean } 159 options?: { stream?: boolean }
166 ): string; 160 ): string;
167 } 161 }
168 162
163 + interface EncodeIntoResult {
164 + /**
165 + * The read Unicode code units of input.
166 + */
167 +
168 + read: number;
169 + /**
170 + * The written UTF-8 bytes of output.
171 + */
172 + written: number;
173 + }
174 +
169 class TextEncoder { 175 class TextEncoder {
170 readonly encoding: string; 176 readonly encoding: string;
171 encode(input?: string): Uint8Array; 177 encode(input?: string): Uint8Array;
178 + encodeInto(input: string, output: Uint8Array): EncodeIntoResult;
172 } 179 }
173 } 180 }
......
1 declare module "v8" { 1 declare module "v8" {
2 + import { Readable } from "stream";
3 +
2 interface HeapSpaceInfo { 4 interface HeapSpaceInfo {
3 space_name: string; 5 space_name: string;
4 space_size: number; 6 space_size: number;
...@@ -20,9 +22,176 @@ declare module "v8" { ...@@ -20,9 +22,176 @@ declare module "v8" {
20 malloced_memory: number; 22 malloced_memory: number;
21 peak_malloced_memory: number; 23 peak_malloced_memory: number;
22 does_zap_garbage: DoesZapCodeSpaceFlag; 24 does_zap_garbage: DoesZapCodeSpaceFlag;
25 + number_of_native_contexts: number;
26 + number_of_detached_contexts: number;
27 + }
28 +
29 + interface HeapCodeStatistics {
30 + code_and_metadata_size: number;
31 + bytecode_and_metadata_size: number;
32 + external_script_source_size: number;
23 } 33 }
24 34
35 + /**
36 + * Returns an integer representing a "version tag" derived from the V8 version, command line flags and detected CPU features.
37 + * This is useful for determining whether a vm.Script cachedData buffer is compatible with this instance of V8.
38 + */
39 + function cachedDataVersionTag(): number;
40 +
25 function getHeapStatistics(): HeapInfo; 41 function getHeapStatistics(): HeapInfo;
26 function getHeapSpaceStatistics(): HeapSpaceInfo[]; 42 function getHeapSpaceStatistics(): HeapSpaceInfo[];
27 function setFlagsFromString(flags: string): void; 43 function setFlagsFromString(flags: string): void;
44 + /**
45 + * Generates a snapshot of the current V8 heap and returns a Readable
46 + * Stream that may be used to read the JSON serialized representation.
47 + * This conversation was marked as resolved by joyeecheung
48 + * This JSON stream format is intended to be used with tools such as
49 + * Chrome DevTools. The JSON schema is undocumented and specific to the
50 + * V8 engine, and may change from one version of V8 to the next.
51 + */
52 + function getHeapSnapshot(): Readable;
53 +
54 + /**
55 + *
56 + * @param fileName The file path where the V8 heap snapshot is to be
57 + * saved. If not specified, a file name with the pattern
58 + * `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be
59 + * generated, where `{pid}` will be the PID of the Node.js process,
60 + * `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from
61 + * the main Node.js thread or the id of a worker thread.
62 + */
63 + function writeHeapSnapshot(fileName?: string): string;
64 +
65 + function getHeapCodeStatistics(): HeapCodeStatistics;
66 +
67 + /**
68 + * @experimental
69 + */
70 + class Serializer {
71 + /**
72 + * Writes out a header, which includes the serialization format version.
73 + */
74 + writeHeader(): void;
75 +
76 + /**
77 + * Serializes a JavaScript value and adds the serialized representation to the internal buffer.
78 + * This throws an error if value cannot be serialized.
79 + */
80 + writeValue(val: any): boolean;
81 +
82 + /**
83 + * Returns the stored internal buffer.
84 + * This serializer should not be used once the buffer is released.
85 + * Calling this method results in undefined behavior if a previous write has failed.
86 + */
87 + releaseBuffer(): Buffer;
88 +
89 + /**
90 + * Marks an ArrayBuffer as having its contents transferred out of band.\
91 + * Pass the corresponding ArrayBuffer in the deserializing context to deserializer.transferArrayBuffer().
92 + */
93 + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
94 +
95 + /**
96 + * Write a raw 32-bit unsigned integer.
97 + */
98 + writeUint32(value: number): void;
99 +
100 + /**
101 + * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts.
102 + */
103 + writeUint64(hi: number, lo: number): void;
104 +
105 + /**
106 + * Write a JS number value.
107 + */
108 + writeDouble(value: number): void;
109 +
110 + /**
111 + * Write raw bytes into the serializer’s internal buffer.
112 + * The deserializer will require a way to compute the length of the buffer.
113 + */
114 + writeRawBytes(buffer: NodeJS.TypedArray): void;
115 + }
116 +
117 + /**
118 + * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects,
119 + * and only stores the part of their underlying `ArrayBuffers` that they are referring to.
120 + * @experimental
121 + */
122 + class DefaultSerializer extends Serializer {
123 + }
124 +
125 + /**
126 + * @experimental
127 + */
128 + class Deserializer {
129 + constructor(data: NodeJS.TypedArray);
130 + /**
131 + * Reads and validates a header (including the format version).
132 + * May, for example, reject an invalid or unsupported wire format.
133 + * In that case, an Error is thrown.
134 + */
135 + readHeader(): boolean;
136 +
137 + /**
138 + * Deserializes a JavaScript value from the buffer and returns it.
139 + */
140 + readValue(): any;
141 +
142 + /**
143 + * Marks an ArrayBuffer as having its contents transferred out of band.
144 + * Pass the corresponding `ArrayBuffer` in the serializing context to serializer.transferArrayBuffer()
145 + * (or return the id from serializer._getSharedArrayBufferId() in the case of SharedArrayBuffers).
146 + */
147 + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
148 +
149 + /**
150 + * Reads the underlying wire format version.
151 + * Likely mostly to be useful to legacy code reading old wire format versions.
152 + * May not be called before .readHeader().
153 + */
154 + getWireFormatVersion(): number;
155 +
156 + /**
157 + * Read a raw 32-bit unsigned integer and return it.
158 + */
159 + readUint32(): number;
160 +
161 + /**
162 + * Read a raw 64-bit unsigned integer and return it as an array [hi, lo] with two 32-bit unsigned integer entries.
163 + */
164 + readUint64(): [number, number];
165 +
166 + /**
167 + * Read a JS number value.
168 + */
169 + readDouble(): number;
170 +
171 + /**
172 + * Read raw bytes from the deserializer’s internal buffer.
173 + * The length parameter must correspond to the length of the buffer that was passed to serializer.writeRawBytes().
174 + */
175 + readRawBytes(length: number): Buffer;
176 + }
177 +
178 + /**
179 + * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects,
180 + * and only stores the part of their underlying `ArrayBuffers` that they are referring to.
181 + * @experimental
182 + */
183 + class DefaultDeserializer extends Deserializer {
184 + }
185 +
186 + /**
187 + * Uses a `DefaultSerializer` to serialize value into a buffer.
188 + * @experimental
189 + */
190 + function serialize(value: any): Buffer;
191 +
192 + /**
193 + * Uses a `DefaultDeserializer` with default options to read a JS value from a buffer.
194 + * @experimental
195 + */
196 + function deserialize(data: NodeJS.TypedArray): any;
28 } 197 }
......
...@@ -26,8 +26,23 @@ declare module "vm" { ...@@ -26,8 +26,23 @@ declare module "vm" {
26 produceCachedData?: boolean; 26 produceCachedData?: boolean;
27 } 27 }
28 interface RunningScriptOptions extends BaseOptions { 28 interface RunningScriptOptions extends BaseOptions {
29 + /**
30 + * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace.
31 + * Default: `true`.
32 + */
29 displayErrors?: boolean; 33 displayErrors?: boolean;
34 + /**
35 + * Specifies the number of milliseconds to execute code before terminating execution.
36 + * If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer.
37 + */
30 timeout?: number; 38 timeout?: number;
39 + /**
40 + * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received.
41 + * Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that.
42 + * If execution is terminated, an `Error` will be thrown.
43 + * Default: `false`.
44 + */
45 + breakOnSigint?: boolean;
31 } 46 }
32 interface CompileFunctionOptions extends BaseOptions { 47 interface CompileFunctionOptions extends BaseOptions {
33 /** 48 /**
...@@ -49,13 +64,44 @@ declare module "vm" { ...@@ -49,13 +64,44 @@ declare module "vm" {
49 */ 64 */
50 contextExtensions?: Object[]; 65 contextExtensions?: Object[];
51 } 66 }
67 +
68 + interface CreateContextOptions {
69 + /**
70 + * Human-readable name of the newly created context.
71 + * @default 'VM Context i' Where i is an ascending numerical index of the created context.
72 + */
73 + name?: string;
74 + /**
75 + * Corresponds to the newly created context for display purposes.
76 + * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary),
77 + * like the value of the `url.origin` property of a URL object.
78 + * Most notably, this string should omit the trailing slash, as that denotes a path.
79 + * @default ''
80 + */
81 + origin?: string;
82 + codeGeneration?: {
83 + /**
84 + * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc)
85 + * will throw an EvalError.
86 + * @default true
87 + */
88 + strings?: boolean;
89 + /**
90 + * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError.
91 + * @default true
92 + */
93 + wasm?: boolean;
94 + };
95 + }
96 +
52 class Script { 97 class Script {
53 constructor(code: string, options?: ScriptOptions); 98 constructor(code: string, options?: ScriptOptions);
54 runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any; 99 runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any;
55 runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any; 100 runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any;
56 runInThisContext(options?: RunningScriptOptions): any; 101 runInThisContext(options?: RunningScriptOptions): any;
102 + createCachedData(): Buffer;
57 } 103 }
58 - function createContext(sandbox?: Context): Context; 104 + function createContext(sandbox?: Context, options?: CreateContextOptions): Context;
59 function isContext(sandbox: Context): boolean; 105 function isContext(sandbox: Context): boolean;
60 function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any; 106 function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any;
61 function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any; 107 function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any;
......
1 declare module "worker_threads" { 1 declare module "worker_threads" {
2 + import { Context } from "vm";
2 import { EventEmitter } from "events"; 3 import { EventEmitter } from "events";
3 import { Readable, Writable } from "stream"; 4 import { Readable, Writable } from "stream";
4 5
...@@ -72,7 +73,34 @@ declare module "worker_threads" { ...@@ -72,7 +73,34 @@ declare module "worker_threads" {
72 postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void; 73 postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
73 ref(): void; 74 ref(): void;
74 unref(): void; 75 unref(): void;
75 - terminate(callback?: (err: Error, exitCode: number) => void): void; 76 + /**
77 + * Stop all JavaScript execution in the worker thread as soon as possible.
78 + * Returns a Promise for the exit code that is fulfilled when the `exit` event is emitted.
79 + */
80 + terminate(): Promise<number>;
81 + /**
82 + * Transfer a `MessagePort` to a different `vm` Context. The original `port`
83 + * object will be rendered unusable, and the returned `MessagePort` instance will
84 + * take its place.
85 + *
86 + * The returned `MessagePort` will be an object in the target context, and will
87 + * inherit from its global `Object` class. Objects passed to the
88 + * `port.onmessage()` listener will also be created in the target context
89 + * and inherit from its global `Object` class.
90 + *
91 + * However, the created `MessagePort` will no longer inherit from
92 + * `EventEmitter`, and only `port.onmessage()` can be used to receive
93 + * events using it.
94 + */
95 + moveMessagePortToContext(port: MessagePort, context: Context): MessagePort;
96 +
97 + /**
98 + * Receive a single message from a given `MessagePort`. If no message is available,
99 + * `undefined` is returned, otherwise an object with a single `message` property
100 + * that contains the message payload, corresponding to the oldest message in the
101 + * `MessagePort`’s queue.
102 + */
103 + receiveMessageOnPort(port: MessagePort): {} | undefined;
76 104
77 addListener(event: "error", listener: (err: Error) => void): this; 105 addListener(event: "error", listener: (err: Error) => void): this;
78 addListener(event: "exit", listener: (exitCode: number) => void): this; 106 addListener(event: "exit", listener: (exitCode: number) => void): this;
......
...@@ -18,7 +18,7 @@ declare module "zlib" { ...@@ -18,7 +18,7 @@ declare module "zlib" {
18 level?: number; // compression only 18 level?: number; // compression only
19 memLevel?: number; // compression only 19 memLevel?: number; // compression only
20 strategy?: number; // compression only 20 strategy?: number; // compression only
21 - dictionary?: Buffer | NodeJS.TypedArray | DataView | ArrayBuffer; // deflate/inflate only, empty dictionary by default 21 + dictionary?: NodeJS.ArrayBufferView | ArrayBuffer; // deflate/inflate only, empty dictionary by default
22 } 22 }
23 23
24 interface BrotliOptions { 24 interface BrotliOptions {
...@@ -79,7 +79,7 @@ declare module "zlib" { ...@@ -79,7 +79,7 @@ declare module "zlib" {
79 function createInflateRaw(options?: ZlibOptions): InflateRaw; 79 function createInflateRaw(options?: ZlibOptions): InflateRaw;
80 function createUnzip(options?: ZlibOptions): Unzip; 80 function createUnzip(options?: ZlibOptions): Unzip;
81 81
82 - type InputType = string | Buffer | DataView | ArrayBuffer | NodeJS.TypedArray; 82 + type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
83 83
84 type CompressCallback = (error: Error | null, result: Buffer) => void; 84 type CompressCallback = (error: Error | null, result: Buffer) => void;
85 85
......
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../acorn/bin/acorn" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 -../acorn/bin/acorn
...\ No newline at end of file ...\ No newline at end of file
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\acorn\bin\acorn" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../acorn/bin/acorn" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed

209 Bytes | W: | H:

209 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
No preview for this file type
File mode changed
File mode changed
1 +^C:\USERS\YE JINN\DESKTOP\OPPROJECT\NODE_MODULES\BCRYPT\BUILD\RELEASE\BCRYPT_LIB.NODE
2 +call mkdir "C:\Users\YE JINN\Desktop\OPproject\node_modules\bcrypt\lib\binding" 2>nul & set ERRORLEVEL=0 & copy /Y "C:\Users\YE JINN\Desktop\OPproject\node_modules\bcrypt\build\Release\bcrypt_lib.node" "C:\Users\YE JINN\Desktop\OPproject\node_modules\bcrypt\lib\binding\bcrypt_lib.node"
3 +if %errorlevel% neq 0 exit /b %errorlevel%
1 +^C:\USERS\YE JINN\DESKTOP\OPPROJECT\NODE_MODULES\BCRYPT\BUILD\RELEASE\BCRYPT_LIB.NODE
1 +^C:\USERS\YE JINN\DESKTOP\OPPROJECT\NODE_MODULES\BCRYPT\BUILD\RELEASE\BCRYPT_LIB.NODE
2 +C:\USERS\YE JINN\DESKTOP\OPPROJECT\NODE_MODULES\BCRYPT\LIB\BINDING\BCRYPT_LIB.NODE
1 +#TargetFrameworkVersion=v4.0:PlatformToolSet=v142:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native64Bit:WindowsTargetPlatformVersion=10.0.18362.0
2 +Release|x64|C:\Users\YE JINN\Desktop\OPproject\node_modules\bcrypt\build\|
1 +#TargetFrameworkVersion=v4.0:PlatformToolSet=v142:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native64Bit:WindowsTargetPlatformVersion=10.0.18362.0
2 +Release|x64|C:\Users\YE JINN\Desktop\OPproject\node_modules\bcrypt\build\|
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup Label="ProjectConfigurations">
4 + <ProjectConfiguration Include="Debug|x64">
5 + <Configuration>Debug</Configuration>
6 + <Platform>x64</Platform>
7 + </ProjectConfiguration>
8 + <ProjectConfiguration Include="Release|x64">
9 + <Configuration>Release</Configuration>
10 + <Platform>x64</Platform>
11 + </ProjectConfiguration>
12 + </ItemGroup>
13 + <PropertyGroup Label="Globals">
14 + <ProjectGuid>{DC3F0F12-5779-E680-A0AE-35E459272F4F}</ProjectGuid>
15 + <Keyword>Win32Proj</Keyword>
16 + <RootNamespace>action_after_build</RootNamespace>
17 + <IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
18 + <PreferredToolArchitecture>x64</PreferredToolArchitecture>
19 + <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
20 + </PropertyGroup>
21 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
22 + <PropertyGroup Label="Configuration">
23 + <ConfigurationType>Utility</ConfigurationType>
24 + </PropertyGroup>
25 + <PropertyGroup Label="Locals">
26 + <PlatformToolset>v142</PlatformToolset>
27 + </PropertyGroup>
28 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
29 + <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props"/>
30 + <ImportGroup Label="ExtensionSettings"/>
31 + <ImportGroup Label="PropertySheets">
32 + <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
33 + </ImportGroup>
34 + <PropertyGroup Label="UserMacros"/>
35 + <PropertyGroup>
36 + <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\bin\;$(MSBuildProjectDirectory)\..\bin\</ExecutablePath>
37 + <IntDir>$(Configuration)\obj\$(ProjectName)\</IntDir>
38 + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
39 + <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
40 + <TargetName>$(ProjectName)</TargetName>
41 + </PropertyGroup>
42 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
43 + <ClCompile>
44 + <AdditionalIncludeDirectories>C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\include\node;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\src;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\config;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\openssl\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\uv\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\zlib;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
45 + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
46 + <BufferSecurityCheck>true</BufferSecurityCheck>
47 + <CompileAsWinRT>false</CompileAsWinRT>
48 + <DebugInformationFormat>OldStyle</DebugInformationFormat>
49 + <DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
50 + <ExceptionHandling>false</ExceptionHandling>
51 + <MinimalRebuild>false</MinimalRebuild>
52 + <MultiProcessorCompilation>true</MultiProcessorCompilation>
53 + <OmitFramePointers>false</OmitFramePointers>
54 + <Optimization>Disabled</Optimization>
55 + <PrecompiledHeader>NotUsing</PrecompiledHeader>
56 + <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=action_after_build;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;HOST_BINARY=&quot;node.exe&quot;;DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
57 + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
58 + <StringPooling>true</StringPooling>
59 + <SuppressStartupBanner>true</SuppressStartupBanner>
60 + <TreatWarningAsError>false</TreatWarningAsError>
61 + <WarningLevel>Level3</WarningLevel>
62 + </ClCompile>
63 + <Link>
64 + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;&quot;C:\\Users\\YE JINN\\AppData\\Local\\node-gyp\\Cache\\12.13.1\\x64\\node.lib&quot;</AdditionalDependencies>
65 + <AdditionalOptions>/ignore:4199 %(AdditionalOptions)</AdditionalOptions>
66 + <DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
67 + <GenerateDebugInformation>true</GenerateDebugInformation>
68 + <SuppressStartupBanner>true</SuppressStartupBanner>
69 + <TargetMachine>MachineX64</TargetMachine>
70 + </Link>
71 + <ResourceCompile>
72 + <AdditionalIncludeDirectories>C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\include\node;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\src;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\config;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\openssl\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\uv\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\zlib;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
73 + <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=action_after_build;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;HOST_BINARY=&quot;node.exe&quot;;DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
74 + </ResourceCompile>
75 + </ItemDefinitionGroup>
76 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
77 + <ClCompile>
78 + <AdditionalIncludeDirectories>C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\include\node;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\src;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\config;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\openssl\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\uv\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\zlib;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
79 + <BufferSecurityCheck>true</BufferSecurityCheck>
80 + <CompileAsWinRT>false</CompileAsWinRT>
81 + <DebugInformationFormat>OldStyle</DebugInformationFormat>
82 + <DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
83 + <ExceptionHandling>false</ExceptionHandling>
84 + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
85 + <FunctionLevelLinking>true</FunctionLevelLinking>
86 + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
87 + <IntrinsicFunctions>true</IntrinsicFunctions>
88 + <MultiProcessorCompilation>true</MultiProcessorCompilation>
89 + <OmitFramePointers>true</OmitFramePointers>
90 + <Optimization>Full</Optimization>
91 + <PrecompiledHeader>NotUsing</PrecompiledHeader>
92 + <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=action_after_build;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;HOST_BINARY=&quot;node.exe&quot;;%(PreprocessorDefinitions)</PreprocessorDefinitions>
93 + <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
94 + <RuntimeTypeInfo>false</RuntimeTypeInfo>
95 + <StringPooling>true</StringPooling>
96 + <SuppressStartupBanner>true</SuppressStartupBanner>
97 + <TreatWarningAsError>false</TreatWarningAsError>
98 + <WarningLevel>Level3</WarningLevel>
99 + </ClCompile>
100 + <Link>
101 + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;&quot;C:\\Users\\YE JINN\\AppData\\Local\\node-gyp\\Cache\\12.13.1\\x64\\node.lib&quot;</AdditionalDependencies>
102 + <AdditionalOptions>/ignore:4199 %(AdditionalOptions)</AdditionalOptions>
103 + <DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
104 + <GenerateDebugInformation>true</GenerateDebugInformation>
105 + <SuppressStartupBanner>true</SuppressStartupBanner>
106 + <TargetMachine>MachineX64</TargetMachine>
107 + </Link>
108 + <ResourceCompile>
109 + <AdditionalIncludeDirectories>C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\include\node;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\src;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\config;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\openssl\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\uv\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\zlib;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
110 + <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=action_after_build;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;HOST_BINARY=&quot;node.exe&quot;;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
111 + </ResourceCompile>
112 + </ItemDefinitionGroup>
113 + <ItemGroup>
114 + <None Include="..\binding.gyp"/>
115 + </ItemGroup>
116 + <ItemGroup>
117 + <ClCompile Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"/>
118 + </ItemGroup>
119 + <ItemGroup>
120 + <CustomBuild Include="$(OutDir)\bcrypt_lib.node">
121 + <FileType>Document</FileType>
122 + <Command>call mkdir &quot;C:\Users\YE JINN\Desktop\OPproject\node_modules\bcrypt\lib\binding&quot; 2&gt;nul &amp; set ERRORLEVEL=0 &amp; copy /Y &quot;$(OutDir)bcrypt_lib.node&quot; &quot;C:\Users\YE JINN\Desktop\OPproject\node_modules\bcrypt\lib\binding\bcrypt_lib.node&quot;&#xD;&#xA;if %errorlevel% neq 0 exit /b %errorlevel%</Command>
123 + <Message>Copying $(OutDir)/bcrypt_lib.node to C:/Users/YE JINN/Desktop/OPproject/node_modules/bcrypt/lib/binding\bcrypt_lib.node</Message>
124 + <Outputs>C:\Users\YE JINN\Desktop\OPproject\node_modules\bcrypt\lib\binding\bcrypt_lib.node</Outputs>
125 + </CustomBuild>
126 + </ItemGroup>
127 + <ItemGroup>
128 + <ProjectReference Include="bcrypt_lib.vcxproj">
129 + <Project>{F0A7D559-D928-69AA-64CE-A68B1483F5F6}</Project>
130 + <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
131 + </ProjectReference>
132 + </ItemGroup>
133 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
134 + <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets"/>
135 + <ImportGroup Label="ExtensionTargets"/>
136 +</Project>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup>
4 + <Filter Include="C:">
5 + <UniqueIdentifier>{7B735499-E5DD-1C2B-6C26-70023832A1CF}</UniqueIdentifier>
6 + </Filter>
7 + <Filter Include="C:\Program Files">
8 + <UniqueIdentifier>{92EF4BA8-6BC2-65D1-451F-28EBD4AE726A}</UniqueIdentifier>
9 + </Filter>
10 + <Filter Include="C:\Program Files\nodejs">
11 + <UniqueIdentifier>{A3C8E949-BCF6-0C67-6656-340A2A097708}</UniqueIdentifier>
12 + </Filter>
13 + <Filter Include="C:\Program Files\nodejs\node_modules">
14 + <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
15 + </Filter>
16 + <Filter Include="C:\Program Files\nodejs\node_modules\npm">
17 + <UniqueIdentifier>{741E0E76-39B2-B1AB-9FA1-F1A20B16F295}</UniqueIdentifier>
18 + </Filter>
19 + <Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules">
20 + <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
21 + </Filter>
22 + <Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp">
23 + <UniqueIdentifier>{77348C0E-2034-7791-74D5-63C077DF5A3B}</UniqueIdentifier>
24 + </Filter>
25 + <Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src">
26 + <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
27 + </Filter>
28 + <Filter Include="..">
29 + <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
30 + </Filter>
31 + <Filter Include="$(OutDir)">
32 + <UniqueIdentifier>{ECA95933-7FA6-5798-4EC4-C0CAC6DD34DE}</UniqueIdentifier>
33 + </Filter>
34 + </ItemGroup>
35 + <ItemGroup>
36 + <ClCompile Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc">
37 + <Filter>C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src</Filter>
38 + </ClCompile>
39 + <None Include="..\binding.gyp">
40 + <Filter>..</Filter>
41 + </None>
42 + <None Include="$(OutDir)\bcrypt_lib.node">
43 + <Filter>$(OutDir)</Filter>
44 + </None>
45 + </ItemGroup>
46 +</Project>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup Label="ProjectConfigurations">
4 + <ProjectConfiguration Include="Debug|x64">
5 + <Configuration>Debug</Configuration>
6 + <Platform>x64</Platform>
7 + </ProjectConfiguration>
8 + <ProjectConfiguration Include="Release|x64">
9 + <Configuration>Release</Configuration>
10 + <Platform>x64</Platform>
11 + </ProjectConfiguration>
12 + </ItemGroup>
13 + <PropertyGroup Label="Globals">
14 + <ProjectGuid>{F0A7D559-D928-69AA-64CE-A68B1483F5F6}</ProjectGuid>
15 + <Keyword>Win32Proj</Keyword>
16 + <RootNamespace>bcrypt_lib</RootNamespace>
17 + <IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
18 + <PreferredToolArchitecture>x64</PreferredToolArchitecture>
19 + <WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
20 + </PropertyGroup>
21 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
22 + <PropertyGroup Label="Configuration">
23 + <ConfigurationType>DynamicLibrary</ConfigurationType>
24 + </PropertyGroup>
25 + <PropertyGroup Label="Locals">
26 + <PlatformToolset>v142</PlatformToolset>
27 + </PropertyGroup>
28 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
29 + <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props"/>
30 + <ImportGroup Label="ExtensionSettings"/>
31 + <ImportGroup Label="PropertySheets">
32 + <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
33 + </ImportGroup>
34 + <PropertyGroup Label="UserMacros"/>
35 + <PropertyGroup>
36 + <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\bin\;$(MSBuildProjectDirectory)\..\bin\</ExecutablePath>
37 + <IgnoreImportLibrary>true</IgnoreImportLibrary>
38 + <IntDir>$(Configuration)\obj\$(ProjectName)\</IntDir>
39 + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
40 + <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
41 + <TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
42 + <TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.node</TargetExt>
43 + <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
44 + <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.node</TargetExt>
45 + <TargetName>$(ProjectName)</TargetName>
46 + <TargetPath>$(OutDir)\$(ProjectName).node</TargetPath>
47 + </PropertyGroup>
48 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
49 + <ClCompile>
50 + <AdditionalIncludeDirectories>C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\include\node;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\src;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\config;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\openssl\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\uv\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\zlib;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\v8\include;..\node_modules\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
51 + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
52 + <BufferSecurityCheck>true</BufferSecurityCheck>
53 + <CompileAsWinRT>false</CompileAsWinRT>
54 + <DebugInformationFormat>OldStyle</DebugInformationFormat>
55 + <DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
56 + <ExceptionHandling>false</ExceptionHandling>
57 + <MinimalRebuild>false</MinimalRebuild>
58 + <MultiProcessorCompilation>true</MultiProcessorCompilation>
59 + <OmitFramePointers>false</OmitFramePointers>
60 + <Optimization>Disabled</Optimization>
61 + <PrecompiledHeader>NotUsing</PrecompiledHeader>
62 + <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=bcrypt_lib;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;uint=unsigned int;BUILDING_NODE_EXTENSION;HOST_BINARY=&quot;node.exe&quot;;DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
63 + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
64 + <StringPooling>true</StringPooling>
65 + <SuppressStartupBanner>true</SuppressStartupBanner>
66 + <TreatWarningAsError>false</TreatWarningAsError>
67 + <WarningLevel>Level3</WarningLevel>
68 + </ClCompile>
69 + <Link>
70 + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;&quot;C:\\Users\\YE JINN\\AppData\\Local\\node-gyp\\Cache\\12.13.1\\x64\\node.lib&quot;</AdditionalDependencies>
71 + <AdditionalOptions>/ignore:4199 %(AdditionalOptions)</AdditionalOptions>
72 + <DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
73 + <GenerateDebugInformation>true</GenerateDebugInformation>
74 + <OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
75 + <SuppressStartupBanner>true</SuppressStartupBanner>
76 + <TargetExt>.node</TargetExt>
77 + <TargetMachine>MachineX64</TargetMachine>
78 + </Link>
79 + <ResourceCompile>
80 + <AdditionalIncludeDirectories>C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\include\node;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\src;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\config;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\openssl\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\uv\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\zlib;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\v8\include;..\node_modules\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
81 + <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=bcrypt_lib;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;uint=unsigned int;BUILDING_NODE_EXTENSION;HOST_BINARY=&quot;node.exe&quot;;DEBUG;_DEBUG;V8_ENABLE_CHECKS;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
82 + </ResourceCompile>
83 + </ItemDefinitionGroup>
84 + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
85 + <ClCompile>
86 + <AdditionalIncludeDirectories>C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\include\node;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\src;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\config;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\openssl\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\uv\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\zlib;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\v8\include;..\node_modules\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
87 + <BufferSecurityCheck>true</BufferSecurityCheck>
88 + <CompileAsWinRT>false</CompileAsWinRT>
89 + <DebugInformationFormat>OldStyle</DebugInformationFormat>
90 + <DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
91 + <ExceptionHandling>false</ExceptionHandling>
92 + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
93 + <FunctionLevelLinking>true</FunctionLevelLinking>
94 + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
95 + <IntrinsicFunctions>true</IntrinsicFunctions>
96 + <MultiProcessorCompilation>true</MultiProcessorCompilation>
97 + <OmitFramePointers>true</OmitFramePointers>
98 + <Optimization>Full</Optimization>
99 + <PrecompiledHeader>NotUsing</PrecompiledHeader>
100 + <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=bcrypt_lib;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;uint=unsigned int;BUILDING_NODE_EXTENSION;HOST_BINARY=&quot;node.exe&quot;;%(PreprocessorDefinitions)</PreprocessorDefinitions>
101 + <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
102 + <RuntimeTypeInfo>false</RuntimeTypeInfo>
103 + <StringPooling>true</StringPooling>
104 + <SuppressStartupBanner>true</SuppressStartupBanner>
105 + <TreatWarningAsError>false</TreatWarningAsError>
106 + <WarningLevel>Level3</WarningLevel>
107 + </ClCompile>
108 + <Link>
109 + <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;DelayImp.lib;&quot;C:\\Users\\YE JINN\\AppData\\Local\\node-gyp\\Cache\\12.13.1\\x64\\node.lib&quot;</AdditionalDependencies>
110 + <AdditionalOptions>/ignore:4199 %(AdditionalOptions)</AdditionalOptions>
111 + <DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
112 + <GenerateDebugInformation>true</GenerateDebugInformation>
113 + <OutputFile>$(OutDir)$(ProjectName).node</OutputFile>
114 + <SuppressStartupBanner>true</SuppressStartupBanner>
115 + <TargetExt>.node</TargetExt>
116 + <TargetMachine>MachineX64</TargetMachine>
117 + </Link>
118 + <ResourceCompile>
119 + <AdditionalIncludeDirectories>C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\include\node;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\src;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\config;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\openssl\openssl\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\uv\include;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\zlib;C:\Users\YE JINN\AppData\Local\node-gyp\Cache\12.13.1\deps\v8\include;..\node_modules\nan;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
120 + <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=bcrypt_lib;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;V8_DEPRECATION_WARNINGS;V8_IMMINENT_DEPRECATION_WARNINGS;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;uint=unsigned int;BUILDING_NODE_EXTENSION;HOST_BINARY=&quot;node.exe&quot;;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
121 + </ResourceCompile>
122 + </ItemDefinitionGroup>
123 + <ItemGroup>
124 + <None Include="..\binding.gyp"/>
125 + </ItemGroup>
126 + <ItemGroup>
127 + <ClCompile Include="..\src\blowfish.cc"/>
128 + <ClCompile Include="..\src\bcrypt.cc"/>
129 + <ClCompile Include="..\src\bcrypt_node.cc"/>
130 + <ClCompile Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"/>
131 + </ItemGroup>
132 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
133 + <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets"/>
134 + <ImportGroup Label="ExtensionTargets"/>
135 +</Project>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 + <ItemGroup>
4 + <Filter Include="..">
5 + <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
6 + </Filter>
7 + <Filter Include="..\src">
8 + <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
9 + </Filter>
10 + <Filter Include="..">
11 + <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
12 + </Filter>
13 + <Filter Include="..\src">
14 + <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
15 + </Filter>
16 + <Filter Include="..">
17 + <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
18 + </Filter>
19 + <Filter Include="..\src">
20 + <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
21 + </Filter>
22 + <Filter Include="C:">
23 + <UniqueIdentifier>{7B735499-E5DD-1C2B-6C26-70023832A1CF}</UniqueIdentifier>
24 + </Filter>
25 + <Filter Include="C:\Program Files">
26 + <UniqueIdentifier>{92EF4BA8-6BC2-65D1-451F-28EBD4AE726A}</UniqueIdentifier>
27 + </Filter>
28 + <Filter Include="C:\Program Files\nodejs">
29 + <UniqueIdentifier>{A3C8E949-BCF6-0C67-6656-340A2A097708}</UniqueIdentifier>
30 + </Filter>
31 + <Filter Include="C:\Program Files\nodejs\node_modules">
32 + <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
33 + </Filter>
34 + <Filter Include="C:\Program Files\nodejs\node_modules\npm">
35 + <UniqueIdentifier>{741E0E76-39B2-B1AB-9FA1-F1A20B16F295}</UniqueIdentifier>
36 + </Filter>
37 + <Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules">
38 + <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
39 + </Filter>
40 + <Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp">
41 + <UniqueIdentifier>{77348C0E-2034-7791-74D5-63C077DF5A3B}</UniqueIdentifier>
42 + </Filter>
43 + <Filter Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src">
44 + <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
45 + </Filter>
46 + <Filter Include="..">
47 + <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
48 + </Filter>
49 + </ItemGroup>
50 + <ItemGroup>
51 + <ClCompile Include="..\src\blowfish.cc">
52 + <Filter>..\src</Filter>
53 + </ClCompile>
54 + <ClCompile Include="..\src\bcrypt.cc">
55 + <Filter>..\src</Filter>
56 + </ClCompile>
57 + <ClCompile Include="..\src\bcrypt_node.cc">
58 + <Filter>..\src</Filter>
59 + </ClCompile>
60 + <ClCompile Include="C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc">
61 + <Filter>C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src</Filter>
62 + </ClCompile>
63 + <None Include="..\binding.gyp">
64 + <Filter>..</Filter>
65 + </None>
66 + </ItemGroup>
67 +</Project>
1 +Microsoft Visual Studio Solution File, Format Version 12.00
2 +# Visual Studio 2015
3 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "action_after_build", "action_after_build.vcxproj", "{DC3F0F12-5779-E680-A0AE-35E459272F4F}"
4 + ProjectSection(ProjectDependencies) = postProject
5 + {F0A7D559-D928-69AA-64CE-A68B1483F5F6} = {F0A7D559-D928-69AA-64CE-A68B1483F5F6}
6 + EndProjectSection
7 +EndProject
8 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bcrypt_lib", "bcrypt_lib.vcxproj", "{F0A7D559-D928-69AA-64CE-A68B1483F5F6}"
9 +EndProject
10 +Global
11 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 + Debug|x64 = Debug|x64
13 + Release|x64 = Release|x64
14 + EndGlobalSection
15 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 + {DC3F0F12-5779-E680-A0AE-35E459272F4F}.Debug|x64.ActiveCfg = Debug|x64
17 + {DC3F0F12-5779-E680-A0AE-35E459272F4F}.Debug|x64.Build.0 = Debug|x64
18 + {DC3F0F12-5779-E680-A0AE-35E459272F4F}.Release|x64.ActiveCfg = Release|x64
19 + {DC3F0F12-5779-E680-A0AE-35E459272F4F}.Release|x64.Build.0 = Release|x64
20 + {F0A7D559-D928-69AA-64CE-A68B1483F5F6}.Debug|x64.ActiveCfg = Debug|x64
21 + {F0A7D559-D928-69AA-64CE-A68B1483F5F6}.Debug|x64.Build.0 = Debug|x64
22 + {F0A7D559-D928-69AA-64CE-A68B1483F5F6}.Release|x64.ActiveCfg = Release|x64
23 + {F0A7D559-D928-69AA-64CE-A68B1483F5F6}.Release|x64.Build.0 = Release|x64
24 + EndGlobalSection
25 + GlobalSection(SolutionProperties) = preSolution
26 + HideSolutionNode = FALSE
27 + EndGlobalSection
28 +EndGlobal
1 +# Do not edit. File was generated by node-gyp's "configure" step
2 +{
3 + "target_defaults": {
4 + "cflags": [],
5 + "default_configuration": "Release",
6 + "defines": [],
7 + "include_dirs": [],
8 + "libraries": [],
9 + "msbuild_toolset": "v142",
10 + "msvs_windows_target_platform_version": "10.0.18362.0"
11 + },
12 + "variables": {
13 + "asan": 0,
14 + "build_v8_with_gn": "false",
15 + "coverage": "false",
16 + "debug_nghttp2": "false",
17 + "enable_lto": "false",
18 + "enable_pgo_generate": "false",
19 + "enable_pgo_use": "false",
20 + "force_dynamic_crt": 0,
21 + "host_arch": "x64",
22 + "icu_data_in": "..\\..\\deps/icu-small\\source/data/in\\icudt64l.dat",
23 + "icu_endianness": "l",
24 + "icu_gyp_path": "tools/icu/icu-generic.gyp",
25 + "icu_locales": "en,root",
26 + "icu_path": "deps/icu-small",
27 + "icu_small": "true",
28 + "icu_ver_major": "64",
29 + "is_debug": 0,
30 + "napi_build_version": "0",
31 + "nasm_version": "2.14",
32 + "node_byteorder": "little",
33 + "node_code_cache": "yes",
34 + "node_debug_lib": "false",
35 + "node_enable_d8": "false",
36 + "node_install_npm": "true",
37 + "node_module_version": 72,
38 + "node_no_browser_globals": "false",
39 + "node_prefix": "/usr/local",
40 + "node_release_urlbase": "https://nodejs.org/download/release/",
41 + "node_report": "true",
42 + "node_shared": "false",
43 + "node_shared_cares": "false",
44 + "node_shared_http_parser": "false",
45 + "node_shared_libuv": "false",
46 + "node_shared_nghttp2": "false",
47 + "node_shared_openssl": "false",
48 + "node_shared_zlib": "false",
49 + "node_tag": "",
50 + "node_target_type": "executable",
51 + "node_use_bundled_v8": "true",
52 + "node_use_dtrace": "false",
53 + "node_use_etw": "true",
54 + "node_use_large_pages": "false",
55 + "node_use_large_pages_script_lld": "false",
56 + "node_use_node_snapshot": "true",
57 + "node_use_openssl": "true",
58 + "node_use_v8_platform": "true",
59 + "node_with_ltcg": "true",
60 + "node_without_node_options": "false",
61 + "openssl_fips": "",
62 + "openssl_is_fips": "false",
63 + "shlib_suffix": "so.72",
64 + "target_arch": "x64",
65 + "v8_enable_gdbjit": 0,
66 + "v8_enable_i18n_support": 1,
67 + "v8_enable_inspector": 1,
68 + "v8_no_strict_aliasing": 1,
69 + "v8_optimized_debug": 1,
70 + "v8_promise_internal_field_count": 1,
71 + "v8_random_seed": 0,
72 + "v8_trace_maps": 0,
73 + "v8_use_siphash": 1,
74 + "v8_use_snapshot": 1,
75 + "want_separate_host_toolset": 0,
76 + "nodedir": "C:\\Users\\YE JINN\\AppData\\Local\\node-gyp\\Cache\\12.13.1",
77 + "standalone_static_library": 1,
78 + "msbuild_path": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe",
79 + "fallback_to_build": "true",
80 + "module": "C:\\Users\\YE JINN\\Desktop\\OPproject\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node",
81 + "module_name": "bcrypt_lib",
82 + "module_path": "C:\\Users\\YE JINN\\Desktop\\OPproject\\node_modules\\bcrypt\\lib\\binding",
83 + "napi_version": "5",
84 + "node_abi_napi": "napi",
85 + "node_napi_label": "node-v72",
86 + "access": "",
87 + "allow_same_version": "",
88 + "also": "",
89 + "always_auth": "",
90 + "audit": "true",
91 + "audit_level": "low",
92 + "auth_type": "legacy",
93 + "before": "",
94 + "bin_links": "true",
95 + "browser": "",
96 + "ca": "",
97 + "cache": "C:\\Users\\YE JINN\\AppData\\Roaming\\npm-cache",
98 + "cache_lock_retries": "10",
99 + "cache_lock_stale": "60000",
100 + "cache_lock_wait": "10000",
101 + "cache_max": "Infinity",
102 + "cache_min": "10",
103 + "cert": "",
104 + "cidr": "",
105 + "color": "true",
106 + "commit_hooks": "true",
107 + "depth": "Infinity",
108 + "description": "true",
109 + "dev": "",
110 + "dry_run": "",
111 + "editor": "notepad.exe",
112 + "engine_strict": "",
113 + "fetch_retries": "2",
114 + "fetch_retry_factor": "10",
115 + "fetch_retry_maxtimeout": "60000",
116 + "fetch_retry_mintimeout": "10000",
117 + "force": "",
118 + "format_package_lock": "true",
119 + "git": "git",
120 + "git_tag_version": "true",
121 + "global": "",
122 + "globalconfig": "C:\\Users\\YE JINN\\AppData\\Roaming\\npm\\etc\\npmrc",
123 + "globalignorefile": "C:\\Users\\YE JINN\\AppData\\Roaming\\npm\\etc\\npmignore",
124 + "global_style": "",
125 + "group": "",
126 + "ham_it_up": "",
127 + "heading": "npm",
128 + "https_proxy": "",
129 + "if_present": "",
130 + "ignore_prepublish": "",
131 + "ignore_scripts": "",
132 + "init_author_email": "",
133 + "init_author_name": "",
134 + "init_author_url": "",
135 + "init_license": "ISC",
136 + "init_module": "C:\\Users\\YE JINN\\.npm-init.js",
137 + "init_version": "1.0.0",
138 + "json": "",
139 + "key": "",
140 + "legacy_bundling": "",
141 + "link": "",
142 + "local_address": "",
143 + "logs_max": "10",
144 + "long": "",
145 + "maxsockets": "50",
146 + "message": "%s",
147 + "metrics_registry": "https://registry.npmjs.org/",
148 + "node_gyp": "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js",
149 + "node_options": "",
150 + "node_version": "12.13.1",
151 + "noproxy": "",
152 + "offline": "",
153 + "onload_script": "",
154 + "only": "",
155 + "optional": "true",
156 + "otp": "",
157 + "package_lock": "true",
158 + "package_lock_only": "",
159 + "parseable": "",
160 + "prefer_offline": "",
161 + "prefer_online": "",
162 + "prefix": "C:\\Users\\YE JINN\\AppData\\Roaming\\npm",
163 + "preid": "",
164 + "production": "",
165 + "progress": "true",
166 + "read_only": "",
167 + "rebuild_bundle": "true",
168 + "registry": "https://registry.npmjs.org/",
169 + "rollback": "true",
170 + "save": "true",
171 + "save_bundle": "",
172 + "save_dev": "",
173 + "save_exact": "",
174 + "save_optional": "",
175 + "save_prefix": "^",
176 + "save_prod": "",
177 + "scope": "",
178 + "scripts_prepend_node_path": "warn-only",
179 + "script_shell": "",
180 + "searchexclude": "",
181 + "searchlimit": "20",
182 + "searchopts": "",
183 + "searchstaleness": "900",
184 + "send_metrics": "",
185 + "shell": "C:\\Windows\\system32\\cmd.exe",
186 + "shrinkwrap": "true",
187 + "sign_git_commit": "",
188 + "sign_git_tag": "",
189 + "sso_poll_frequency": "500",
190 + "sso_type": "oauth",
191 + "strict_ssl": "true",
192 + "tag": "latest",
193 + "tag_version_prefix": "v",
194 + "timing": "",
195 + "tmp": "C:\\Users\\YEJINN~1\\AppData\\Local\\Temp",
196 + "umask": "0000",
197 + "unicode": "",
198 + "unsafe_perm": "true",
199 + "update_notifier": "true",
200 + "usage": "",
201 + "user": "",
202 + "userconfig": "C:\\Users\\YE JINN\\.npmrc",
203 + "user_agent": "npm/6.12.1 node/v12.13.1 win32 x64",
204 + "version": "",
205 + "versions": "",
206 + "viewer": "browser"
207 + }
208 +}
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 "_resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", 21 "_resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
22 "_shasum": "7818f722027b2459a86f0295d434d1fc2336c52c", 22 "_shasum": "7818f722027b2459a86f0295d434d1fc2336c52c",
23 "_spec": "nan@2.14.0", 23 "_spec": "nan@2.14.0",
24 - "_where": "/Users/ye/Desktop/NodeBook/nodejs-book/ch12/12.4/node-auction/node_modules/bcrypt", 24 + "_where": "C:\\Users\\YE JINN\\Desktop\\OPproject\\node_modules\\bcrypt",
25 "bugs": { 25 "bugs": {
26 "url": "https://github.com/nodejs/nan/issues" 26 "url": "https://github.com/nodejs/nan/issues"
27 }, 27 },
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
22 "_resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-3.0.7.tgz", 22 "_resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-3.0.7.tgz",
23 "_shasum": "1187d29df2e1cde44268152b13e3d4a655a7c7de", 23 "_shasum": "1187d29df2e1cde44268152b13e3d4a655a7c7de",
24 "_spec": "bcrypt@^3.0.4", 24 "_spec": "bcrypt@^3.0.4",
25 - "_where": "/Users/ye/Desktop/NodeBook/nodejs-book/ch12/12.4/node-auction", 25 + "_where": "C:\\Users\\YE JINN\\Desktop\\OPproject",
26 "author": { 26 "author": {
27 "name": "Nick Campbell", 27 "name": "Nick Campbell",
28 "url": "https://github.com/ncb000gt" 28 "url": "https://github.com/ncb000gt"
......
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
...@@ -35,7 +35,7 @@ Thanks to BrowserStack for providing us with a free account which lets us suppor ...@@ -35,7 +35,7 @@ Thanks to BrowserStack for providing us with a free account which lets us suppor
35 35
36 The MIT License (MIT) 36 The MIT License (MIT)
37 37
38 -Copyright (c) 2013-2017 Petka Antonov 38 +Copyright (c) 2013-2019 Petka Antonov
39 39
40 Permission is hereby granted, free of charge, to any person obtaining a copy 40 Permission is hereby granted, free of charge, to any person obtaining a copy
41 of this software and associated documentation files (the "Software"), to deal 41 of this software and associated documentation files (the "Software"), to deal
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
23 * 23 *
24 */ 24 */
25 /** 25 /**
26 - * bluebird build version 3.5.3 26 + * bluebird build version 3.7.2
27 * Features enabled: core 27 * Features enabled: core
28 * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each 28 * Features disabled: race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each
29 */ 29 */
...@@ -33,7 +33,6 @@ var firstLineError; ...@@ -33,7 +33,6 @@ var firstLineError;
33 try {throw new Error(); } catch (e) {firstLineError = e;} 33 try {throw new Error(); } catch (e) {firstLineError = e;}
34 var schedule = _dereq_("./schedule"); 34 var schedule = _dereq_("./schedule");
35 var Queue = _dereq_("./queue"); 35 var Queue = _dereq_("./queue");
36 -var util = _dereq_("./util");
37 36
38 function Async() { 37 function Async() {
39 this._customScheduler = false; 38 this._customScheduler = false;
...@@ -41,7 +40,6 @@ function Async() { ...@@ -41,7 +40,6 @@ function Async() {
41 this._lateQueue = new Queue(16); 40 this._lateQueue = new Queue(16);
42 this._normalQueue = new Queue(16); 41 this._normalQueue = new Queue(16);
43 this._haveDrainedQueues = false; 42 this._haveDrainedQueues = false;
44 - this._trampolineEnabled = true;
45 var self = this; 43 var self = this;
46 this.drainQueues = function () { 44 this.drainQueues = function () {
47 self._drainQueues(); 45 self._drainQueues();
...@@ -60,16 +58,6 @@ Async.prototype.hasCustomScheduler = function() { ...@@ -60,16 +58,6 @@ Async.prototype.hasCustomScheduler = function() {
60 return this._customScheduler; 58 return this._customScheduler;
61 }; 59 };
62 60
63 -Async.prototype.enableTrampoline = function() {
64 - this._trampolineEnabled = true;
65 -};
66 -
67 -Async.prototype.disableTrampolineIfNecessary = function() {
68 - if (util.hasDevTools) {
69 - this._trampolineEnabled = false;
70 - }
71 -};
72 -
73 Async.prototype.haveItemsQueued = function () { 61 Async.prototype.haveItemsQueued = function () {
74 return this._isTickUsed || this._haveDrainedQueues; 62 return this._isTickUsed || this._haveDrainedQueues;
75 }; 63 };
...@@ -118,43 +106,10 @@ function AsyncSettlePromises(promise) { ...@@ -118,43 +106,10 @@ function AsyncSettlePromises(promise) {
118 this._queueTick(); 106 this._queueTick();
119 } 107 }
120 108
121 -if (!util.hasDevTools) { 109 +Async.prototype.invokeLater = AsyncInvokeLater;
122 - Async.prototype.invokeLater = AsyncInvokeLater; 110 +Async.prototype.invoke = AsyncInvoke;
123 - Async.prototype.invoke = AsyncInvoke; 111 +Async.prototype.settlePromises = AsyncSettlePromises;
124 - Async.prototype.settlePromises = AsyncSettlePromises;
125 -} else {
126 - Async.prototype.invokeLater = function (fn, receiver, arg) {
127 - if (this._trampolineEnabled) {
128 - AsyncInvokeLater.call(this, fn, receiver, arg);
129 - } else {
130 - this._schedule(function() {
131 - setTimeout(function() {
132 - fn.call(receiver, arg);
133 - }, 100);
134 - });
135 - }
136 - };
137 112
138 - Async.prototype.invoke = function (fn, receiver, arg) {
139 - if (this._trampolineEnabled) {
140 - AsyncInvoke.call(this, fn, receiver, arg);
141 - } else {
142 - this._schedule(function() {
143 - fn.call(receiver, arg);
144 - });
145 - }
146 - };
147 -
148 - Async.prototype.settlePromises = function(promise) {
149 - if (this._trampolineEnabled) {
150 - AsyncSettlePromises.call(this, promise);
151 - } else {
152 - this._schedule(function() {
153 - promise._settlePromises();
154 - });
155 - }
156 - };
157 -}
158 113
159 function _drainQueue(queue) { 114 function _drainQueue(queue) {
160 while (queue.length() > 0) { 115 while (queue.length() > 0) {
...@@ -194,7 +149,7 @@ Async.prototype._reset = function () { ...@@ -194,7 +149,7 @@ Async.prototype._reset = function () {
194 module.exports = Async; 149 module.exports = Async;
195 module.exports.firstLineError = firstLineError; 150 module.exports.firstLineError = firstLineError;
196 151
197 -},{"./queue":17,"./schedule":18,"./util":21}],2:[function(_dereq_,module,exports){ 152 +},{"./queue":17,"./schedule":18}],2:[function(_dereq_,module,exports){
198 "use strict"; 153 "use strict";
199 module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { 154 module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
200 var calledBind = false; 155 var calledBind = false;
...@@ -524,8 +479,8 @@ return Context; ...@@ -524,8 +479,8 @@ return Context;
524 479
525 },{}],7:[function(_dereq_,module,exports){ 480 },{}],7:[function(_dereq_,module,exports){
526 "use strict"; 481 "use strict";
527 -module.exports = function(Promise, Context) { 482 +module.exports = function(Promise, Context,
528 -var getDomain = Promise._getDomain; 483 + enableAsyncHooks, disableAsyncHooks) {
529 var async = Promise._async; 484 var async = Promise._async;
530 var Warning = _dereq_("./errors").Warning; 485 var Warning = _dereq_("./errors").Warning;
531 var util = _dereq_("./util"); 486 var util = _dereq_("./util");
...@@ -555,6 +510,34 @@ var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && ...@@ -555,6 +510,34 @@ var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
555 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && 510 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
556 (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); 511 (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
557 512
513 +var deferUnhandledRejectionCheck;
514 +(function() {
515 + var promises = [];
516 +
517 + function unhandledRejectionCheck() {
518 + for (var i = 0; i < promises.length; ++i) {
519 + promises[i]._notifyUnhandledRejection();
520 + }
521 + unhandledRejectionClear();
522 + }
523 +
524 + function unhandledRejectionClear() {
525 + promises.length = 0;
526 + }
527 +
528 + deferUnhandledRejectionCheck = function(promise) {
529 + promises.push(promise);
530 + setTimeout(unhandledRejectionCheck, 1);
531 + };
532 +
533 + es5.defineProperty(Promise, "_unhandledRejectionCheck", {
534 + value: unhandledRejectionCheck
535 + });
536 + es5.defineProperty(Promise, "_unhandledRejectionClear", {
537 + value: unhandledRejectionClear
538 + });
539 +})();
540 +
558 Promise.prototype.suppressUnhandledRejections = function() { 541 Promise.prototype.suppressUnhandledRejections = function() {
559 var target = this._target(); 542 var target = this._target();
560 target._bitField = ((target._bitField & (~1048576)) | 543 target._bitField = ((target._bitField & (~1048576)) |
...@@ -564,10 +547,7 @@ Promise.prototype.suppressUnhandledRejections = function() { ...@@ -564,10 +547,7 @@ Promise.prototype.suppressUnhandledRejections = function() {
564 Promise.prototype._ensurePossibleRejectionHandled = function () { 547 Promise.prototype._ensurePossibleRejectionHandled = function () {
565 if ((this._bitField & 524288) !== 0) return; 548 if ((this._bitField & 524288) !== 0) return;
566 this._setRejectionIsUnhandled(); 549 this._setRejectionIsUnhandled();
567 - var self = this; 550 + deferUnhandledRejectionCheck(this);
568 - setTimeout(function() {
569 - self._notifyUnhandledRejection();
570 - }, 1);
571 }; 551 };
572 552
573 Promise.prototype._notifyUnhandledRejectionIsHandled = function () { 553 Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
...@@ -625,19 +605,13 @@ Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { ...@@ -625,19 +605,13 @@ Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
625 }; 605 };
626 606
627 Promise.onPossiblyUnhandledRejection = function (fn) { 607 Promise.onPossiblyUnhandledRejection = function (fn) {
628 - var domain = getDomain(); 608 + var context = Promise._getContext();
629 - possiblyUnhandledRejection = 609 + possiblyUnhandledRejection = util.contextBind(context, fn);
630 - typeof fn === "function" ? (domain === null ?
631 - fn : util.domainBind(domain, fn))
632 - : undefined;
633 }; 610 };
634 611
635 Promise.onUnhandledRejectionHandled = function (fn) { 612 Promise.onUnhandledRejectionHandled = function (fn) {
636 - var domain = getDomain(); 613 + var context = Promise._getContext();
637 - unhandledRejectionHandled = 614 + unhandledRejectionHandled = util.contextBind(context, fn);
638 - typeof fn === "function" ? (domain === null ?
639 - fn : util.domainBind(domain, fn))
640 - : undefined;
641 }; 615 };
642 616
643 var disableLongStackTraces = function() {}; 617 var disableLongStackTraces = function() {};
...@@ -658,14 +632,12 @@ Promise.longStackTraces = function () { ...@@ -658,14 +632,12 @@ Promise.longStackTraces = function () {
658 Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; 632 Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
659 Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; 633 Promise.prototype._dereferenceTrace = Promise_dereferenceTrace;
660 Context.deactivateLongStackTraces(); 634 Context.deactivateLongStackTraces();
661 - async.enableTrampoline();
662 config.longStackTraces = false; 635 config.longStackTraces = false;
663 }; 636 };
664 Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; 637 Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
665 Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; 638 Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
666 Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; 639 Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace;
667 Context.activateLongStackTraces(); 640 Context.activateLongStackTraces();
668 - async.disableTrampolineIfNecessary();
669 } 641 }
670 }; 642 };
671 643
...@@ -673,43 +645,85 @@ Promise.hasLongStackTraces = function () { ...@@ -673,43 +645,85 @@ Promise.hasLongStackTraces = function () {
673 return config.longStackTraces && longStackTracesIsSupported(); 645 return config.longStackTraces && longStackTracesIsSupported();
674 }; 646 };
675 647
648 +
649 +var legacyHandlers = {
650 + unhandledrejection: {
651 + before: function() {
652 + var ret = util.global.onunhandledrejection;
653 + util.global.onunhandledrejection = null;
654 + return ret;
655 + },
656 + after: function(fn) {
657 + util.global.onunhandledrejection = fn;
658 + }
659 + },
660 + rejectionhandled: {
661 + before: function() {
662 + var ret = util.global.onrejectionhandled;
663 + util.global.onrejectionhandled = null;
664 + return ret;
665 + },
666 + after: function(fn) {
667 + util.global.onrejectionhandled = fn;
668 + }
669 + }
670 +};
671 +
676 var fireDomEvent = (function() { 672 var fireDomEvent = (function() {
673 + var dispatch = function(legacy, e) {
674 + if (legacy) {
675 + var fn;
676 + try {
677 + fn = legacy.before();
678 + return !util.global.dispatchEvent(e);
679 + } finally {
680 + legacy.after(fn);
681 + }
682 + } else {
683 + return !util.global.dispatchEvent(e);
684 + }
685 + };
677 try { 686 try {
678 if (typeof CustomEvent === "function") { 687 if (typeof CustomEvent === "function") {
679 var event = new CustomEvent("CustomEvent"); 688 var event = new CustomEvent("CustomEvent");
680 util.global.dispatchEvent(event); 689 util.global.dispatchEvent(event);
681 return function(name, event) { 690 return function(name, event) {
691 + name = name.toLowerCase();
682 var eventData = { 692 var eventData = {
683 detail: event, 693 detail: event,
684 cancelable: true 694 cancelable: true
685 }; 695 };
696 + var domEvent = new CustomEvent(name, eventData);
697 + es5.defineProperty(
698 + domEvent, "promise", {value: event.promise});
686 es5.defineProperty( 699 es5.defineProperty(
687 - eventData, "promise", {value: event.promise}); 700 + domEvent, "reason", {value: event.reason});
688 - es5.defineProperty(eventData, "reason", {value: event.reason}); 701 +
689 - var domEvent = new CustomEvent(name.toLowerCase(), eventData); 702 + return dispatch(legacyHandlers[name], domEvent);
690 - return !util.global.dispatchEvent(domEvent);
691 }; 703 };
692 } else if (typeof Event === "function") { 704 } else if (typeof Event === "function") {
693 var event = new Event("CustomEvent"); 705 var event = new Event("CustomEvent");
694 util.global.dispatchEvent(event); 706 util.global.dispatchEvent(event);
695 return function(name, event) { 707 return function(name, event) {
696 - var domEvent = new Event(name.toLowerCase(), { 708 + name = name.toLowerCase();
709 + var domEvent = new Event(name, {
697 cancelable: true 710 cancelable: true
698 }); 711 });
699 domEvent.detail = event; 712 domEvent.detail = event;
700 es5.defineProperty(domEvent, "promise", {value: event.promise}); 713 es5.defineProperty(domEvent, "promise", {value: event.promise});
701 es5.defineProperty(domEvent, "reason", {value: event.reason}); 714 es5.defineProperty(domEvent, "reason", {value: event.reason});
702 - return !util.global.dispatchEvent(domEvent); 715 + return dispatch(legacyHandlers[name], domEvent);
703 }; 716 };
704 } else { 717 } else {
705 var event = document.createEvent("CustomEvent"); 718 var event = document.createEvent("CustomEvent");
706 event.initCustomEvent("testingtheevent", false, true, {}); 719 event.initCustomEvent("testingtheevent", false, true, {});
707 util.global.dispatchEvent(event); 720 util.global.dispatchEvent(event);
708 return function(name, event) { 721 return function(name, event) {
722 + name = name.toLowerCase();
709 var domEvent = document.createEvent("CustomEvent"); 723 var domEvent = document.createEvent("CustomEvent");
710 - domEvent.initCustomEvent(name.toLowerCase(), false, true, 724 + domEvent.initCustomEvent(name, false, true,
711 event); 725 event);
712 - return !util.global.dispatchEvent(domEvent); 726 + return dispatch(legacyHandlers[name], domEvent);
713 }; 727 };
714 } 728 }
715 } catch (e) {} 729 } catch (e) {}
...@@ -827,6 +841,18 @@ Promise.config = function(opts) { ...@@ -827,6 +841,18 @@ Promise.config = function(opts) {
827 Promise.prototype._fireEvent = defaultFireEvent; 841 Promise.prototype._fireEvent = defaultFireEvent;
828 } 842 }
829 } 843 }
844 + if ("asyncHooks" in opts && util.nodeSupportsAsyncResource) {
845 + var prev = config.asyncHooks;
846 + var cur = !!opts.asyncHooks;
847 + if (prev !== cur) {
848 + config.asyncHooks = cur;
849 + if (cur) {
850 + enableAsyncHooks();
851 + } else {
852 + disableAsyncHooks();
853 + }
854 + }
855 + }
830 return Promise; 856 return Promise;
831 }; 857 };
832 858
...@@ -1214,8 +1240,8 @@ function parseLineInfo(line) { ...@@ -1214,8 +1240,8 @@ function parseLineInfo(line) {
1214 1240
1215 function setBounds(firstLineError, lastLineError) { 1241 function setBounds(firstLineError, lastLineError) {
1216 if (!longStackTracesIsSupported()) return; 1242 if (!longStackTracesIsSupported()) return;
1217 - var firstStackLines = firstLineError.stack.split("\n"); 1243 + var firstStackLines = (firstLineError.stack || "").split("\n");
1218 - var lastStackLines = lastLineError.stack.split("\n"); 1244 + var lastStackLines = (lastLineError.stack || "").split("\n");
1219 var firstIndex = -1; 1245 var firstIndex = -1;
1220 var lastIndex = -1; 1246 var lastIndex = -1;
1221 var firstFileName; 1247 var firstFileName;
...@@ -1424,12 +1450,16 @@ var config = { ...@@ -1424,12 +1450,16 @@ var config = {
1424 warnings: warnings, 1450 warnings: warnings,
1425 longStackTraces: false, 1451 longStackTraces: false,
1426 cancellation: false, 1452 cancellation: false,
1427 - monitoring: false 1453 + monitoring: false,
1454 + asyncHooks: false
1428 }; 1455 };
1429 1456
1430 if (longStackTraces) Promise.longStackTraces(); 1457 if (longStackTraces) Promise.longStackTraces();
1431 1458
1432 return { 1459 return {
1460 + asyncHooks: function() {
1461 + return config.asyncHooks;
1462 + },
1433 longStackTraces: function() { 1463 longStackTraces: function() {
1434 return config.longStackTraces; 1464 return config.longStackTraces;
1435 }, 1465 },
...@@ -1857,8 +1887,7 @@ return PassThroughHandlerContext; ...@@ -1857,8 +1887,7 @@ return PassThroughHandlerContext;
1857 },{"./catch_filter":5,"./util":21}],12:[function(_dereq_,module,exports){ 1887 },{"./catch_filter":5,"./util":21}],12:[function(_dereq_,module,exports){
1858 "use strict"; 1888 "use strict";
1859 module.exports = 1889 module.exports =
1860 -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, 1890 +function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) {
1861 - getDomain) {
1862 var util = _dereq_("./util"); 1891 var util = _dereq_("./util");
1863 var canEvaluate = util.canEvaluate; 1892 var canEvaluate = util.canEvaluate;
1864 var tryCatch = util.tryCatch; 1893 var tryCatch = util.tryCatch;
...@@ -2004,10 +2033,8 @@ Promise.join = function () { ...@@ -2004,10 +2033,8 @@ Promise.join = function () {
2004 2033
2005 if (!ret._isFateSealed()) { 2034 if (!ret._isFateSealed()) {
2006 if (holder.asyncNeeded) { 2035 if (holder.asyncNeeded) {
2007 - var domain = getDomain(); 2036 + var context = Promise._getContext();
2008 - if (domain !== null) { 2037 + holder.fn = util.contextBind(context, holder.fn);
2009 - holder.fn = util.domainBind(domain, holder.fn);
2010 - }
2011 } 2038 }
2012 ret._setAsyncGuaranteed(); 2039 ret._setAsyncGuaranteed();
2013 ret._setOnCancel(holder); 2040 ret._setOnCancel(holder);
...@@ -2149,20 +2176,42 @@ var apiRejection = function(msg) { ...@@ -2149,20 +2176,42 @@ var apiRejection = function(msg) {
2149 function Proxyable() {} 2176 function Proxyable() {}
2150 var UNDEFINED_BINDING = {}; 2177 var UNDEFINED_BINDING = {};
2151 var util = _dereq_("./util"); 2178 var util = _dereq_("./util");
2179 +util.setReflectHandler(reflectHandler);
2152 2180
2153 -var getDomain; 2181 +var getDomain = function() {
2154 -if (util.isNode) { 2182 + var domain = process.domain;
2155 - getDomain = function() { 2183 + if (domain === undefined) {
2156 - var ret = process.domain;
2157 - if (ret === undefined) ret = null;
2158 - return ret;
2159 - };
2160 -} else {
2161 - getDomain = function() {
2162 return null; 2184 return null;
2185 + }
2186 + return domain;
2187 +};
2188 +var getContextDefault = function() {
2189 + return null;
2190 +};
2191 +var getContextDomain = function() {
2192 + return {
2193 + domain: getDomain(),
2194 + async: null
2163 }; 2195 };
2164 -} 2196 +};
2165 -util.notEnumerableProp(Promise, "_getDomain", getDomain); 2197 +var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ?
2198 + _dereq_("async_hooks").AsyncResource : null;
2199 +var getContextAsyncHooks = function() {
2200 + return {
2201 + domain: getDomain(),
2202 + async: new AsyncResource("Bluebird::Promise")
2203 + };
2204 +};
2205 +var getContext = util.isNode ? getContextDomain : getContextDefault;
2206 +util.notEnumerableProp(Promise, "_getContext", getContext);
2207 +var enableAsyncHooks = function() {
2208 + getContext = getContextAsyncHooks;
2209 + util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks);
2210 +};
2211 +var disableAsyncHooks = function() {
2212 + getContext = getContextDomain;
2213 + util.notEnumerableProp(Promise, "_getContext", getContextDomain);
2214 +};
2166 2215
2167 var es5 = _dereq_("./es5"); 2216 var es5 = _dereq_("./es5");
2168 var Async = _dereq_("./async"); 2217 var Async = _dereq_("./async");
...@@ -2186,7 +2235,9 @@ var PromiseArray = ...@@ -2186,7 +2235,9 @@ var PromiseArray =
2186 var Context = _dereq_("./context")(Promise); 2235 var Context = _dereq_("./context")(Promise);
2187 /*jshint unused:false*/ 2236 /*jshint unused:false*/
2188 var createContext = Context.create; 2237 var createContext = Context.create;
2189 -var debug = _dereq_("./debuggability")(Promise, Context); 2238 +
2239 +var debug = _dereq_("./debuggability")(Promise, Context,
2240 + enableAsyncHooks, disableAsyncHooks);
2190 var CapturedTrace = debug.CapturedTrace; 2241 var CapturedTrace = debug.CapturedTrace;
2191 var PassThroughHandlerContext = 2242 var PassThroughHandlerContext =
2192 _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); 2243 _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER);
...@@ -2238,6 +2289,11 @@ Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { ...@@ -2238,6 +2289,11 @@ Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
2238 } 2289 }
2239 catchInstances.length = j; 2290 catchInstances.length = j;
2240 fn = arguments[i]; 2291 fn = arguments[i];
2292 +
2293 + if (typeof fn !== "function") {
2294 + throw new TypeError("The last argument to .catch() " +
2295 + "must be a function, got " + util.toString(fn));
2296 + }
2241 return this.then(undefined, catchFilter(catchInstances, fn, this)); 2297 return this.then(undefined, catchFilter(catchInstances, fn, this));
2242 } 2298 }
2243 return this.then(undefined, fn); 2299 return this.then(undefined, fn);
...@@ -2378,7 +2434,7 @@ Promise.prototype._then = function ( ...@@ -2378,7 +2434,7 @@ Promise.prototype._then = function (
2378 this._fireEvent("promiseChained", this, promise); 2434 this._fireEvent("promiseChained", this, promise);
2379 } 2435 }
2380 2436
2381 - var domain = getDomain(); 2437 + var context = getContext();
2382 if (!((bitField & 50397184) === 0)) { 2438 if (!((bitField & 50397184) === 0)) {
2383 var handler, value, settler = target._settlePromiseCtx; 2439 var handler, value, settler = target._settlePromiseCtx;
2384 if (((bitField & 33554432) !== 0)) { 2440 if (((bitField & 33554432) !== 0)) {
...@@ -2396,15 +2452,14 @@ Promise.prototype._then = function ( ...@@ -2396,15 +2452,14 @@ Promise.prototype._then = function (
2396 } 2452 }
2397 2453
2398 async.invoke(settler, target, { 2454 async.invoke(settler, target, {
2399 - handler: domain === null ? handler 2455 + handler: util.contextBind(context, handler),
2400 - : (typeof handler === "function" &&
2401 - util.domainBind(domain, handler)),
2402 promise: promise, 2456 promise: promise,
2403 receiver: receiver, 2457 receiver: receiver,
2404 value: value 2458 value: value
2405 }); 2459 });
2406 } else { 2460 } else {
2407 - target._addCallbacks(didFulfill, didReject, promise, receiver, domain); 2461 + target._addCallbacks(didFulfill, didReject, promise,
2462 + receiver, context);
2408 } 2463 }
2409 2464
2410 return promise; 2465 return promise;
...@@ -2465,7 +2520,15 @@ Promise.prototype._setWillBeCancelled = function() { ...@@ -2465,7 +2520,15 @@ Promise.prototype._setWillBeCancelled = function() {
2465 2520
2466 Promise.prototype._setAsyncGuaranteed = function() { 2521 Promise.prototype._setAsyncGuaranteed = function() {
2467 if (async.hasCustomScheduler()) return; 2522 if (async.hasCustomScheduler()) return;
2468 - this._bitField = this._bitField | 134217728; 2523 + var bitField = this._bitField;
2524 + this._bitField = bitField |
2525 + (((bitField & 536870912) >> 2) ^
2526 + 134217728);
2527 +};
2528 +
2529 +Promise.prototype._setNoAsyncGuarantee = function() {
2530 + this._bitField = (this._bitField | 536870912) &
2531 + (~134217728);
2469 }; 2532 };
2470 2533
2471 Promise.prototype._receiverAt = function (index) { 2534 Promise.prototype._receiverAt = function (index) {
...@@ -2520,7 +2583,7 @@ Promise.prototype._addCallbacks = function ( ...@@ -2520,7 +2583,7 @@ Promise.prototype._addCallbacks = function (
2520 reject, 2583 reject,
2521 promise, 2584 promise,
2522 receiver, 2585 receiver,
2523 - domain 2586 + context
2524 ) { 2587 ) {
2525 var index = this._length(); 2588 var index = this._length();
2526 2589
...@@ -2533,12 +2596,10 @@ Promise.prototype._addCallbacks = function ( ...@@ -2533,12 +2596,10 @@ Promise.prototype._addCallbacks = function (
2533 this._promise0 = promise; 2596 this._promise0 = promise;
2534 this._receiver0 = receiver; 2597 this._receiver0 = receiver;
2535 if (typeof fulfill === "function") { 2598 if (typeof fulfill === "function") {
2536 - this._fulfillmentHandler0 = 2599 + this._fulfillmentHandler0 = util.contextBind(context, fulfill);
2537 - domain === null ? fulfill : util.domainBind(domain, fulfill);
2538 } 2600 }
2539 if (typeof reject === "function") { 2601 if (typeof reject === "function") {
2540 - this._rejectionHandler0 = 2602 + this._rejectionHandler0 = util.contextBind(context, reject);
2541 - domain === null ? reject : util.domainBind(domain, reject);
2542 } 2603 }
2543 } else { 2604 } else {
2544 var base = index * 4 - 4; 2605 var base = index * 4 - 4;
...@@ -2546,11 +2607,11 @@ Promise.prototype._addCallbacks = function ( ...@@ -2546,11 +2607,11 @@ Promise.prototype._addCallbacks = function (
2546 this[base + 3] = receiver; 2607 this[base + 3] = receiver;
2547 if (typeof fulfill === "function") { 2608 if (typeof fulfill === "function") {
2548 this[base + 0] = 2609 this[base + 0] =
2549 - domain === null ? fulfill : util.domainBind(domain, fulfill); 2610 + util.contextBind(context, fulfill);
2550 } 2611 }
2551 if (typeof reject === "function") { 2612 if (typeof reject === "function") {
2552 this[base + 1] = 2613 this[base + 1] =
2553 - domain === null ? reject : util.domainBind(domain, reject); 2614 + util.contextBind(context, reject);
2554 } 2615 }
2555 } 2616 }
2556 this._setLength(index + 1); 2617 this._setLength(index + 1);
...@@ -2570,6 +2631,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) { ...@@ -2570,6 +2631,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) {
2570 2631
2571 if (shouldBind) this._propagateFrom(maybePromise, 2); 2632 if (shouldBind) this._propagateFrom(maybePromise, 2);
2572 2633
2634 +
2573 var promise = maybePromise._target(); 2635 var promise = maybePromise._target();
2574 2636
2575 if (promise === this) { 2637 if (promise === this) {
...@@ -2586,7 +2648,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) { ...@@ -2586,7 +2648,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) {
2586 } 2648 }
2587 this._setFollowing(); 2649 this._setFollowing();
2588 this._setLength(0); 2650 this._setLength(0);
2589 - this._setFollowee(promise); 2651 + this._setFollowee(maybePromise);
2590 } else if (((bitField & 33554432) !== 0)) { 2652 } else if (((bitField & 33554432) !== 0)) {
2591 this._fulfill(promise._value()); 2653 this._fulfill(promise._value());
2592 } else if (((bitField & 16777216) !== 0)) { 2654 } else if (((bitField & 16777216) !== 0)) {
...@@ -2845,6 +2907,14 @@ Promise.prototype._settledValue = function() { ...@@ -2845,6 +2907,14 @@ Promise.prototype._settledValue = function() {
2845 } 2907 }
2846 }; 2908 };
2847 2909
2910 +if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
2911 + es5.defineProperty(Promise.prototype, Symbol.toStringTag, {
2912 + get: function () {
2913 + return "Object";
2914 + }
2915 + });
2916 +}
2917 +
2848 function deferResolve(v) {this.promise._resolveCallback(v);} 2918 function deferResolve(v) {this.promise._resolveCallback(v);}
2849 function deferReject(v) {this.promise._rejectCallback(v, false);} 2919 function deferReject(v) {this.promise._rejectCallback(v, false);}
2850 2920
...@@ -2869,9 +2939,9 @@ _dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug); ...@@ -2869,9 +2939,9 @@ _dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug);
2869 _dereq_("./direct_resolve")(Promise); 2939 _dereq_("./direct_resolve")(Promise);
2870 _dereq_("./synchronous_inspection")(Promise); 2940 _dereq_("./synchronous_inspection")(Promise);
2871 _dereq_("./join")( 2941 _dereq_("./join")(
2872 - Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); 2942 + Promise, PromiseArray, tryConvertToPromise, INTERNAL, async);
2873 Promise.Promise = Promise; 2943 Promise.Promise = Promise;
2874 -Promise.version = "3.5.3"; 2944 +Promise.version = "3.7.2";
2875 2945
2876 util.toFastProperties(Promise); 2946 util.toFastProperties(Promise);
2877 util.toFastProperties(Promise.prototype); 2947 util.toFastProperties(Promise.prototype);
...@@ -2897,7 +2967,7 @@ Promise.version = "3.5.3"; ...@@ -2897,7 +2967,7 @@ Promise.version = "3.5.3";
2897 2967
2898 }; 2968 };
2899 2969
2900 -},{"./async":1,"./bind":2,"./cancel":4,"./catch_filter":5,"./context":6,"./debuggability":7,"./direct_resolve":8,"./errors":9,"./es5":10,"./finally":11,"./join":12,"./method":13,"./nodeback":14,"./promise_array":16,"./synchronous_inspection":19,"./thenables":20,"./util":21}],16:[function(_dereq_,module,exports){ 2970 +},{"./async":1,"./bind":2,"./cancel":4,"./catch_filter":5,"./context":6,"./debuggability":7,"./direct_resolve":8,"./errors":9,"./es5":10,"./finally":11,"./join":12,"./method":13,"./nodeback":14,"./promise_array":16,"./synchronous_inspection":19,"./thenables":20,"./util":21,"async_hooks":undefined}],16:[function(_dereq_,module,exports){
2901 "use strict"; 2971 "use strict";
2902 module.exports = function(Promise, INTERNAL, tryConvertToPromise, 2972 module.exports = function(Promise, INTERNAL, tryConvertToPromise,
2903 apiRejection, Proxyable) { 2973 apiRejection, Proxyable) {
...@@ -2916,6 +2986,7 @@ function PromiseArray(values) { ...@@ -2916,6 +2986,7 @@ function PromiseArray(values) {
2916 var promise = this._promise = new Promise(INTERNAL); 2986 var promise = this._promise = new Promise(INTERNAL);
2917 if (values instanceof Promise) { 2987 if (values instanceof Promise) {
2918 promise._propagateFrom(values, 3); 2988 promise._propagateFrom(values, 3);
2989 + values.suppressUnhandledRejections();
2919 } 2990 }
2920 promise._setOnCancel(this); 2991 promise._setOnCancel(this);
2921 this._values = values; 2992 this._values = values;
...@@ -3182,7 +3253,8 @@ if (util.isNode && typeof MutationObserver === "undefined") { ...@@ -3182,7 +3253,8 @@ if (util.isNode && typeof MutationObserver === "undefined") {
3182 } else if ((typeof MutationObserver !== "undefined") && 3253 } else if ((typeof MutationObserver !== "undefined") &&
3183 !(typeof window !== "undefined" && 3254 !(typeof window !== "undefined" &&
3184 window.navigator && 3255 window.navigator &&
3185 - (window.navigator.standalone || window.cordova))) { 3256 + (window.navigator.standalone || window.cordova)) &&
3257 + ("classList" in document.documentElement)) {
3186 schedule = (function() { 3258 schedule = (function() {
3187 var div = document.createElement("div"); 3259 var div = document.createElement("div");
3188 var opts = {attributes: true}; 3260 var opts = {attributes: true};
...@@ -3744,18 +3816,42 @@ function getNativePromise() { ...@@ -3744,18 +3816,42 @@ function getNativePromise() {
3744 if (typeof Promise === "function") { 3816 if (typeof Promise === "function") {
3745 try { 3817 try {
3746 var promise = new Promise(function(){}); 3818 var promise = new Promise(function(){});
3747 - if ({}.toString.call(promise) === "[object Promise]") { 3819 + if (classString(promise) === "[object Promise]") {
3748 return Promise; 3820 return Promise;
3749 } 3821 }
3750 } catch (e) {} 3822 } catch (e) {}
3751 } 3823 }
3752 } 3824 }
3753 3825
3754 -function domainBind(self, cb) { 3826 +var reflectHandler;
3755 - return self.bind(cb); 3827 +function contextBind(ctx, cb) {
3828 + if (ctx === null ||
3829 + typeof cb !== "function" ||
3830 + cb === reflectHandler) {
3831 + return cb;
3832 + }
3833 +
3834 + if (ctx.domain !== null) {
3835 + cb = ctx.domain.bind(cb);
3836 + }
3837 +
3838 + var async = ctx.async;
3839 + if (async !== null) {
3840 + var old = cb;
3841 + cb = function() {
3842 + var args = (new Array(2)).concat([].slice.call(arguments));;
3843 + args[0] = old;
3844 + args[1] = this;
3845 + return async.runInAsyncScope.apply(async, args);
3846 + };
3847 + }
3848 + return cb;
3756 } 3849 }
3757 3850
3758 var ret = { 3851 var ret = {
3852 + setReflectHandler: function(fn) {
3853 + reflectHandler = fn;
3854 + },
3759 isClass: isClass, 3855 isClass: isClass,
3760 isIdentifier: isIdentifier, 3856 isIdentifier: isIdentifier,
3761 inheritedDataKeys: inheritedDataKeys, 3857 inheritedDataKeys: inheritedDataKeys,
...@@ -3782,24 +3878,37 @@ var ret = { ...@@ -3782,24 +3878,37 @@ var ret = {
3782 markAsOriginatingFromRejection: markAsOriginatingFromRejection, 3878 markAsOriginatingFromRejection: markAsOriginatingFromRejection,
3783 classString: classString, 3879 classString: classString,
3784 copyDescriptors: copyDescriptors, 3880 copyDescriptors: copyDescriptors,
3785 - hasDevTools: typeof chrome !== "undefined" && chrome &&
3786 - typeof chrome.loadTimes === "function",
3787 isNode: isNode, 3881 isNode: isNode,
3788 hasEnvVariables: hasEnvVariables, 3882 hasEnvVariables: hasEnvVariables,
3789 env: env, 3883 env: env,
3790 global: globalObject, 3884 global: globalObject,
3791 getNativePromise: getNativePromise, 3885 getNativePromise: getNativePromise,
3792 - domainBind: domainBind 3886 + contextBind: contextBind
3793 }; 3887 };
3794 ret.isRecentNode = ret.isNode && (function() { 3888 ret.isRecentNode = ret.isNode && (function() {
3795 - var version = process.versions.node.split(".").map(Number); 3889 + var version;
3890 + if (process.versions && process.versions.node) {
3891 + version = process.versions.node.split(".").map(Number);
3892 + } else if (process.version) {
3893 + version = process.version.split(".").map(Number);
3894 + }
3796 return (version[0] === 0 && version[1] > 10) || (version[0] > 0); 3895 return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
3797 })(); 3896 })();
3897 +ret.nodeSupportsAsyncResource = ret.isNode && (function() {
3898 + var supportsAsync = false;
3899 + try {
3900 + var res = _dereq_("async_hooks").AsyncResource;
3901 + supportsAsync = typeof res.prototype.runInAsyncScope === "function";
3902 + } catch (e) {
3903 + supportsAsync = false;
3904 + }
3905 + return supportsAsync;
3906 +})();
3798 3907
3799 if (ret.isNode) ret.toFastProperties(process); 3908 if (ret.isNode) ret.toFastProperties(process);
3800 3909
3801 try {throw new Error(); } catch (e) {ret.lastLineError = e;} 3910 try {throw new Error(); } catch (e) {ret.lastLineError = e;}
3802 module.exports = ret; 3911 module.exports = ret;
3803 3912
3804 -},{"./es5":10}]},{},[3])(3) 3913 +},{"./es5":10,"async_hooks":undefined}]},{},[3])(3)
3805 }); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } 3914 }); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }
...\ No newline at end of file ...\ No newline at end of file
......
This diff could not be displayed because it is too large.
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
23 * 23 *
24 */ 24 */
25 /** 25 /**
26 - * bluebird build version 3.5.3 26 + * bluebird build version 3.7.2
27 * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each 27 * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each
28 */ 28 */
29 !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ 29 !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
...@@ -55,7 +55,6 @@ var firstLineError; ...@@ -55,7 +55,6 @@ var firstLineError;
55 try {throw new Error(); } catch (e) {firstLineError = e;} 55 try {throw new Error(); } catch (e) {firstLineError = e;}
56 var schedule = _dereq_("./schedule"); 56 var schedule = _dereq_("./schedule");
57 var Queue = _dereq_("./queue"); 57 var Queue = _dereq_("./queue");
58 -var util = _dereq_("./util");
59 58
60 function Async() { 59 function Async() {
61 this._customScheduler = false; 60 this._customScheduler = false;
...@@ -63,7 +62,6 @@ function Async() { ...@@ -63,7 +62,6 @@ function Async() {
63 this._lateQueue = new Queue(16); 62 this._lateQueue = new Queue(16);
64 this._normalQueue = new Queue(16); 63 this._normalQueue = new Queue(16);
65 this._haveDrainedQueues = false; 64 this._haveDrainedQueues = false;
66 - this._trampolineEnabled = true;
67 var self = this; 65 var self = this;
68 this.drainQueues = function () { 66 this.drainQueues = function () {
69 self._drainQueues(); 67 self._drainQueues();
...@@ -82,16 +80,6 @@ Async.prototype.hasCustomScheduler = function() { ...@@ -82,16 +80,6 @@ Async.prototype.hasCustomScheduler = function() {
82 return this._customScheduler; 80 return this._customScheduler;
83 }; 81 };
84 82
85 -Async.prototype.enableTrampoline = function() {
86 - this._trampolineEnabled = true;
87 -};
88 -
89 -Async.prototype.disableTrampolineIfNecessary = function() {
90 - if (util.hasDevTools) {
91 - this._trampolineEnabled = false;
92 - }
93 -};
94 -
95 Async.prototype.haveItemsQueued = function () { 83 Async.prototype.haveItemsQueued = function () {
96 return this._isTickUsed || this._haveDrainedQueues; 84 return this._isTickUsed || this._haveDrainedQueues;
97 }; 85 };
...@@ -140,43 +128,10 @@ function AsyncSettlePromises(promise) { ...@@ -140,43 +128,10 @@ function AsyncSettlePromises(promise) {
140 this._queueTick(); 128 this._queueTick();
141 } 129 }
142 130
143 -if (!util.hasDevTools) { 131 +Async.prototype.invokeLater = AsyncInvokeLater;
144 - Async.prototype.invokeLater = AsyncInvokeLater; 132 +Async.prototype.invoke = AsyncInvoke;
145 - Async.prototype.invoke = AsyncInvoke; 133 +Async.prototype.settlePromises = AsyncSettlePromises;
146 - Async.prototype.settlePromises = AsyncSettlePromises;
147 -} else {
148 - Async.prototype.invokeLater = function (fn, receiver, arg) {
149 - if (this._trampolineEnabled) {
150 - AsyncInvokeLater.call(this, fn, receiver, arg);
151 - } else {
152 - this._schedule(function() {
153 - setTimeout(function() {
154 - fn.call(receiver, arg);
155 - }, 100);
156 - });
157 - }
158 - };
159 134
160 - Async.prototype.invoke = function (fn, receiver, arg) {
161 - if (this._trampolineEnabled) {
162 - AsyncInvoke.call(this, fn, receiver, arg);
163 - } else {
164 - this._schedule(function() {
165 - fn.call(receiver, arg);
166 - });
167 - }
168 - };
169 -
170 - Async.prototype.settlePromises = function(promise) {
171 - if (this._trampolineEnabled) {
172 - AsyncSettlePromises.call(this, promise);
173 - } else {
174 - this._schedule(function() {
175 - promise._settlePromises();
176 - });
177 - }
178 - };
179 -}
180 135
181 function _drainQueue(queue) { 136 function _drainQueue(queue) {
182 while (queue.length() > 0) { 137 while (queue.length() > 0) {
...@@ -216,7 +171,7 @@ Async.prototype._reset = function () { ...@@ -216,7 +171,7 @@ Async.prototype._reset = function () {
216 module.exports = Async; 171 module.exports = Async;
217 module.exports.firstLineError = firstLineError; 172 module.exports.firstLineError = firstLineError;
218 173
219 -},{"./queue":26,"./schedule":29,"./util":36}],3:[function(_dereq_,module,exports){ 174 +},{"./queue":26,"./schedule":29}],3:[function(_dereq_,module,exports){
220 "use strict"; 175 "use strict";
221 module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) { 176 module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
222 var calledBind = false; 177 var calledBind = false;
...@@ -671,8 +626,8 @@ return Context; ...@@ -671,8 +626,8 @@ return Context;
671 626
672 },{}],9:[function(_dereq_,module,exports){ 627 },{}],9:[function(_dereq_,module,exports){
673 "use strict"; 628 "use strict";
674 -module.exports = function(Promise, Context) { 629 +module.exports = function(Promise, Context,
675 -var getDomain = Promise._getDomain; 630 + enableAsyncHooks, disableAsyncHooks) {
676 var async = Promise._async; 631 var async = Promise._async;
677 var Warning = _dereq_("./errors").Warning; 632 var Warning = _dereq_("./errors").Warning;
678 var util = _dereq_("./util"); 633 var util = _dereq_("./util");
...@@ -702,6 +657,34 @@ var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && ...@@ -702,6 +657,34 @@ var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
702 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && 657 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
703 (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); 658 (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
704 659
660 +var deferUnhandledRejectionCheck;
661 +(function() {
662 + var promises = [];
663 +
664 + function unhandledRejectionCheck() {
665 + for (var i = 0; i < promises.length; ++i) {
666 + promises[i]._notifyUnhandledRejection();
667 + }
668 + unhandledRejectionClear();
669 + }
670 +
671 + function unhandledRejectionClear() {
672 + promises.length = 0;
673 + }
674 +
675 + deferUnhandledRejectionCheck = function(promise) {
676 + promises.push(promise);
677 + setTimeout(unhandledRejectionCheck, 1);
678 + };
679 +
680 + es5.defineProperty(Promise, "_unhandledRejectionCheck", {
681 + value: unhandledRejectionCheck
682 + });
683 + es5.defineProperty(Promise, "_unhandledRejectionClear", {
684 + value: unhandledRejectionClear
685 + });
686 +})();
687 +
705 Promise.prototype.suppressUnhandledRejections = function() { 688 Promise.prototype.suppressUnhandledRejections = function() {
706 var target = this._target(); 689 var target = this._target();
707 target._bitField = ((target._bitField & (~1048576)) | 690 target._bitField = ((target._bitField & (~1048576)) |
...@@ -711,10 +694,7 @@ Promise.prototype.suppressUnhandledRejections = function() { ...@@ -711,10 +694,7 @@ Promise.prototype.suppressUnhandledRejections = function() {
711 Promise.prototype._ensurePossibleRejectionHandled = function () { 694 Promise.prototype._ensurePossibleRejectionHandled = function () {
712 if ((this._bitField & 524288) !== 0) return; 695 if ((this._bitField & 524288) !== 0) return;
713 this._setRejectionIsUnhandled(); 696 this._setRejectionIsUnhandled();
714 - var self = this; 697 + deferUnhandledRejectionCheck(this);
715 - setTimeout(function() {
716 - self._notifyUnhandledRejection();
717 - }, 1);
718 }; 698 };
719 699
720 Promise.prototype._notifyUnhandledRejectionIsHandled = function () { 700 Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
...@@ -772,19 +752,13 @@ Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { ...@@ -772,19 +752,13 @@ Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
772 }; 752 };
773 753
774 Promise.onPossiblyUnhandledRejection = function (fn) { 754 Promise.onPossiblyUnhandledRejection = function (fn) {
775 - var domain = getDomain(); 755 + var context = Promise._getContext();
776 - possiblyUnhandledRejection = 756 + possiblyUnhandledRejection = util.contextBind(context, fn);
777 - typeof fn === "function" ? (domain === null ?
778 - fn : util.domainBind(domain, fn))
779 - : undefined;
780 }; 757 };
781 758
782 Promise.onUnhandledRejectionHandled = function (fn) { 759 Promise.onUnhandledRejectionHandled = function (fn) {
783 - var domain = getDomain(); 760 + var context = Promise._getContext();
784 - unhandledRejectionHandled = 761 + unhandledRejectionHandled = util.contextBind(context, fn);
785 - typeof fn === "function" ? (domain === null ?
786 - fn : util.domainBind(domain, fn))
787 - : undefined;
788 }; 762 };
789 763
790 var disableLongStackTraces = function() {}; 764 var disableLongStackTraces = function() {};
...@@ -805,14 +779,12 @@ Promise.longStackTraces = function () { ...@@ -805,14 +779,12 @@ Promise.longStackTraces = function () {
805 Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; 779 Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
806 Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; 780 Promise.prototype._dereferenceTrace = Promise_dereferenceTrace;
807 Context.deactivateLongStackTraces(); 781 Context.deactivateLongStackTraces();
808 - async.enableTrampoline();
809 config.longStackTraces = false; 782 config.longStackTraces = false;
810 }; 783 };
811 Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; 784 Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
812 Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; 785 Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
813 Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; 786 Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace;
814 Context.activateLongStackTraces(); 787 Context.activateLongStackTraces();
815 - async.disableTrampolineIfNecessary();
816 } 788 }
817 }; 789 };
818 790
...@@ -820,43 +792,85 @@ Promise.hasLongStackTraces = function () { ...@@ -820,43 +792,85 @@ Promise.hasLongStackTraces = function () {
820 return config.longStackTraces && longStackTracesIsSupported(); 792 return config.longStackTraces && longStackTracesIsSupported();
821 }; 793 };
822 794
795 +
796 +var legacyHandlers = {
797 + unhandledrejection: {
798 + before: function() {
799 + var ret = util.global.onunhandledrejection;
800 + util.global.onunhandledrejection = null;
801 + return ret;
802 + },
803 + after: function(fn) {
804 + util.global.onunhandledrejection = fn;
805 + }
806 + },
807 + rejectionhandled: {
808 + before: function() {
809 + var ret = util.global.onrejectionhandled;
810 + util.global.onrejectionhandled = null;
811 + return ret;
812 + },
813 + after: function(fn) {
814 + util.global.onrejectionhandled = fn;
815 + }
816 + }
817 +};
818 +
823 var fireDomEvent = (function() { 819 var fireDomEvent = (function() {
820 + var dispatch = function(legacy, e) {
821 + if (legacy) {
822 + var fn;
823 + try {
824 + fn = legacy.before();
825 + return !util.global.dispatchEvent(e);
826 + } finally {
827 + legacy.after(fn);
828 + }
829 + } else {
830 + return !util.global.dispatchEvent(e);
831 + }
832 + };
824 try { 833 try {
825 if (typeof CustomEvent === "function") { 834 if (typeof CustomEvent === "function") {
826 var event = new CustomEvent("CustomEvent"); 835 var event = new CustomEvent("CustomEvent");
827 util.global.dispatchEvent(event); 836 util.global.dispatchEvent(event);
828 return function(name, event) { 837 return function(name, event) {
838 + name = name.toLowerCase();
829 var eventData = { 839 var eventData = {
830 detail: event, 840 detail: event,
831 cancelable: true 841 cancelable: true
832 }; 842 };
843 + var domEvent = new CustomEvent(name, eventData);
833 es5.defineProperty( 844 es5.defineProperty(
834 - eventData, "promise", {value: event.promise}); 845 + domEvent, "promise", {value: event.promise});
835 - es5.defineProperty(eventData, "reason", {value: event.reason}); 846 + es5.defineProperty(
836 - var domEvent = new CustomEvent(name.toLowerCase(), eventData); 847 + domEvent, "reason", {value: event.reason});
837 - return !util.global.dispatchEvent(domEvent); 848 +
849 + return dispatch(legacyHandlers[name], domEvent);
838 }; 850 };
839 } else if (typeof Event === "function") { 851 } else if (typeof Event === "function") {
840 var event = new Event("CustomEvent"); 852 var event = new Event("CustomEvent");
841 util.global.dispatchEvent(event); 853 util.global.dispatchEvent(event);
842 return function(name, event) { 854 return function(name, event) {
843 - var domEvent = new Event(name.toLowerCase(), { 855 + name = name.toLowerCase();
856 + var domEvent = new Event(name, {
844 cancelable: true 857 cancelable: true
845 }); 858 });
846 domEvent.detail = event; 859 domEvent.detail = event;
847 es5.defineProperty(domEvent, "promise", {value: event.promise}); 860 es5.defineProperty(domEvent, "promise", {value: event.promise});
848 es5.defineProperty(domEvent, "reason", {value: event.reason}); 861 es5.defineProperty(domEvent, "reason", {value: event.reason});
849 - return !util.global.dispatchEvent(domEvent); 862 + return dispatch(legacyHandlers[name], domEvent);
850 }; 863 };
851 } else { 864 } else {
852 var event = document.createEvent("CustomEvent"); 865 var event = document.createEvent("CustomEvent");
853 event.initCustomEvent("testingtheevent", false, true, {}); 866 event.initCustomEvent("testingtheevent", false, true, {});
854 util.global.dispatchEvent(event); 867 util.global.dispatchEvent(event);
855 return function(name, event) { 868 return function(name, event) {
869 + name = name.toLowerCase();
856 var domEvent = document.createEvent("CustomEvent"); 870 var domEvent = document.createEvent("CustomEvent");
857 - domEvent.initCustomEvent(name.toLowerCase(), false, true, 871 + domEvent.initCustomEvent(name, false, true,
858 event); 872 event);
859 - return !util.global.dispatchEvent(domEvent); 873 + return dispatch(legacyHandlers[name], domEvent);
860 }; 874 };
861 } 875 }
862 } catch (e) {} 876 } catch (e) {}
...@@ -974,6 +988,18 @@ Promise.config = function(opts) { ...@@ -974,6 +988,18 @@ Promise.config = function(opts) {
974 Promise.prototype._fireEvent = defaultFireEvent; 988 Promise.prototype._fireEvent = defaultFireEvent;
975 } 989 }
976 } 990 }
991 + if ("asyncHooks" in opts && util.nodeSupportsAsyncResource) {
992 + var prev = config.asyncHooks;
993 + var cur = !!opts.asyncHooks;
994 + if (prev !== cur) {
995 + config.asyncHooks = cur;
996 + if (cur) {
997 + enableAsyncHooks();
998 + } else {
999 + disableAsyncHooks();
1000 + }
1001 + }
1002 + }
977 return Promise; 1003 return Promise;
978 }; 1004 };
979 1005
...@@ -1361,8 +1387,8 @@ function parseLineInfo(line) { ...@@ -1361,8 +1387,8 @@ function parseLineInfo(line) {
1361 1387
1362 function setBounds(firstLineError, lastLineError) { 1388 function setBounds(firstLineError, lastLineError) {
1363 if (!longStackTracesIsSupported()) return; 1389 if (!longStackTracesIsSupported()) return;
1364 - var firstStackLines = firstLineError.stack.split("\n"); 1390 + var firstStackLines = (firstLineError.stack || "").split("\n");
1365 - var lastStackLines = lastLineError.stack.split("\n"); 1391 + var lastStackLines = (lastLineError.stack || "").split("\n");
1366 var firstIndex = -1; 1392 var firstIndex = -1;
1367 var lastIndex = -1; 1393 var lastIndex = -1;
1368 var firstFileName; 1394 var firstFileName;
...@@ -1571,12 +1597,16 @@ var config = { ...@@ -1571,12 +1597,16 @@ var config = {
1571 warnings: warnings, 1597 warnings: warnings,
1572 longStackTraces: false, 1598 longStackTraces: false,
1573 cancellation: false, 1599 cancellation: false,
1574 - monitoring: false 1600 + monitoring: false,
1601 + asyncHooks: false
1575 }; 1602 };
1576 1603
1577 if (longStackTraces) Promise.longStackTraces(); 1604 if (longStackTraces) Promise.longStackTraces();
1578 1605
1579 return { 1606 return {
1607 + asyncHooks: function() {
1608 + return config.asyncHooks;
1609 + },
1580 longStackTraces: function() { 1610 longStackTraces: function() {
1581 return config.longStackTraces; 1611 return config.longStackTraces;
1582 }, 1612 },
...@@ -2275,8 +2305,7 @@ Promise.spawn = function (generatorFunction) { ...@@ -2275,8 +2305,7 @@ Promise.spawn = function (generatorFunction) {
2275 },{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){ 2305 },{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){
2276 "use strict"; 2306 "use strict";
2277 module.exports = 2307 module.exports =
2278 -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, 2308 +function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) {
2279 - getDomain) {
2280 var util = _dereq_("./util"); 2309 var util = _dereq_("./util");
2281 var canEvaluate = util.canEvaluate; 2310 var canEvaluate = util.canEvaluate;
2282 var tryCatch = util.tryCatch; 2311 var tryCatch = util.tryCatch;
...@@ -2422,10 +2451,8 @@ Promise.join = function () { ...@@ -2422,10 +2451,8 @@ Promise.join = function () {
2422 2451
2423 if (!ret._isFateSealed()) { 2452 if (!ret._isFateSealed()) {
2424 if (holder.asyncNeeded) { 2453 if (holder.asyncNeeded) {
2425 - var domain = getDomain(); 2454 + var context = Promise._getContext();
2426 - if (domain !== null) { 2455 + holder.fn = util.contextBind(context, holder.fn);
2427 - holder.fn = util.domainBind(domain, holder.fn);
2428 - }
2429 } 2456 }
2430 ret._setAsyncGuaranteed(); 2457 ret._setAsyncGuaranteed();
2431 ret._setOnCancel(holder); 2458 ret._setOnCancel(holder);
...@@ -2450,7 +2477,6 @@ module.exports = function(Promise, ...@@ -2450,7 +2477,6 @@ module.exports = function(Promise,
2450 tryConvertToPromise, 2477 tryConvertToPromise,
2451 INTERNAL, 2478 INTERNAL,
2452 debug) { 2479 debug) {
2453 -var getDomain = Promise._getDomain;
2454 var util = _dereq_("./util"); 2480 var util = _dereq_("./util");
2455 var tryCatch = util.tryCatch; 2481 var tryCatch = util.tryCatch;
2456 var errorObj = util.errorObj; 2482 var errorObj = util.errorObj;
...@@ -2459,8 +2485,8 @@ var async = Promise._async; ...@@ -2459,8 +2485,8 @@ var async = Promise._async;
2459 function MappingPromiseArray(promises, fn, limit, _filter) { 2485 function MappingPromiseArray(promises, fn, limit, _filter) {
2460 this.constructor$(promises); 2486 this.constructor$(promises);
2461 this._promise._captureStackTrace(); 2487 this._promise._captureStackTrace();
2462 - var domain = getDomain(); 2488 + var context = Promise._getContext();
2463 - this._callback = domain === null ? fn : util.domainBind(domain, fn); 2489 + this._callback = util.contextBind(context, fn);
2464 this._preservedValues = _filter === INTERNAL 2490 this._preservedValues = _filter === INTERNAL
2465 ? new Array(this.length()) 2491 ? new Array(this.length())
2466 : null; 2492 : null;
...@@ -2468,6 +2494,14 @@ function MappingPromiseArray(promises, fn, limit, _filter) { ...@@ -2468,6 +2494,14 @@ function MappingPromiseArray(promises, fn, limit, _filter) {
2468 this._inFlight = 0; 2494 this._inFlight = 0;
2469 this._queue = []; 2495 this._queue = [];
2470 async.invoke(this._asyncInit, this, undefined); 2496 async.invoke(this._asyncInit, this, undefined);
2497 + if (util.isArray(promises)) {
2498 + for (var i = 0; i < promises.length; ++i) {
2499 + var maybePromise = promises[i];
2500 + if (maybePromise instanceof Promise) {
2501 + maybePromise.suppressUnhandledRejections();
2502 + }
2503 + }
2504 + }
2471 } 2505 }
2472 util.inherits(MappingPromiseArray, PromiseArray); 2506 util.inherits(MappingPromiseArray, PromiseArray);
2473 2507
...@@ -2797,20 +2831,42 @@ var apiRejection = function(msg) { ...@@ -2797,20 +2831,42 @@ var apiRejection = function(msg) {
2797 function Proxyable() {} 2831 function Proxyable() {}
2798 var UNDEFINED_BINDING = {}; 2832 var UNDEFINED_BINDING = {};
2799 var util = _dereq_("./util"); 2833 var util = _dereq_("./util");
2834 +util.setReflectHandler(reflectHandler);
2800 2835
2801 -var getDomain; 2836 +var getDomain = function() {
2802 -if (util.isNode) { 2837 + var domain = process.domain;
2803 - getDomain = function() { 2838 + if (domain === undefined) {
2804 - var ret = process.domain;
2805 - if (ret === undefined) ret = null;
2806 - return ret;
2807 - };
2808 -} else {
2809 - getDomain = function() {
2810 return null; 2839 return null;
2840 + }
2841 + return domain;
2842 +};
2843 +var getContextDefault = function() {
2844 + return null;
2845 +};
2846 +var getContextDomain = function() {
2847 + return {
2848 + domain: getDomain(),
2849 + async: null
2811 }; 2850 };
2812 -} 2851 +};
2813 -util.notEnumerableProp(Promise, "_getDomain", getDomain); 2852 +var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ?
2853 + _dereq_("async_hooks").AsyncResource : null;
2854 +var getContextAsyncHooks = function() {
2855 + return {
2856 + domain: getDomain(),
2857 + async: new AsyncResource("Bluebird::Promise")
2858 + };
2859 +};
2860 +var getContext = util.isNode ? getContextDomain : getContextDefault;
2861 +util.notEnumerableProp(Promise, "_getContext", getContext);
2862 +var enableAsyncHooks = function() {
2863 + getContext = getContextAsyncHooks;
2864 + util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks);
2865 +};
2866 +var disableAsyncHooks = function() {
2867 + getContext = getContextDomain;
2868 + util.notEnumerableProp(Promise, "_getContext", getContextDomain);
2869 +};
2814 2870
2815 var es5 = _dereq_("./es5"); 2871 var es5 = _dereq_("./es5");
2816 var Async = _dereq_("./async"); 2872 var Async = _dereq_("./async");
...@@ -2834,7 +2890,9 @@ var PromiseArray = ...@@ -2834,7 +2890,9 @@ var PromiseArray =
2834 var Context = _dereq_("./context")(Promise); 2890 var Context = _dereq_("./context")(Promise);
2835 /*jshint unused:false*/ 2891 /*jshint unused:false*/
2836 var createContext = Context.create; 2892 var createContext = Context.create;
2837 -var debug = _dereq_("./debuggability")(Promise, Context); 2893 +
2894 +var debug = _dereq_("./debuggability")(Promise, Context,
2895 + enableAsyncHooks, disableAsyncHooks);
2838 var CapturedTrace = debug.CapturedTrace; 2896 var CapturedTrace = debug.CapturedTrace;
2839 var PassThroughHandlerContext = 2897 var PassThroughHandlerContext =
2840 _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); 2898 _dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER);
...@@ -2886,6 +2944,11 @@ Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { ...@@ -2886,6 +2944,11 @@ Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
2886 } 2944 }
2887 catchInstances.length = j; 2945 catchInstances.length = j;
2888 fn = arguments[i]; 2946 fn = arguments[i];
2947 +
2948 + if (typeof fn !== "function") {
2949 + throw new TypeError("The last argument to .catch() " +
2950 + "must be a function, got " + util.toString(fn));
2951 + }
2889 return this.then(undefined, catchFilter(catchInstances, fn, this)); 2952 return this.then(undefined, catchFilter(catchInstances, fn, this));
2890 } 2953 }
2891 return this.then(undefined, fn); 2954 return this.then(undefined, fn);
...@@ -3026,7 +3089,7 @@ Promise.prototype._then = function ( ...@@ -3026,7 +3089,7 @@ Promise.prototype._then = function (
3026 this._fireEvent("promiseChained", this, promise); 3089 this._fireEvent("promiseChained", this, promise);
3027 } 3090 }
3028 3091
3029 - var domain = getDomain(); 3092 + var context = getContext();
3030 if (!((bitField & 50397184) === 0)) { 3093 if (!((bitField & 50397184) === 0)) {
3031 var handler, value, settler = target._settlePromiseCtx; 3094 var handler, value, settler = target._settlePromiseCtx;
3032 if (((bitField & 33554432) !== 0)) { 3095 if (((bitField & 33554432) !== 0)) {
...@@ -3044,15 +3107,14 @@ Promise.prototype._then = function ( ...@@ -3044,15 +3107,14 @@ Promise.prototype._then = function (
3044 } 3107 }
3045 3108
3046 async.invoke(settler, target, { 3109 async.invoke(settler, target, {
3047 - handler: domain === null ? handler 3110 + handler: util.contextBind(context, handler),
3048 - : (typeof handler === "function" &&
3049 - util.domainBind(domain, handler)),
3050 promise: promise, 3111 promise: promise,
3051 receiver: receiver, 3112 receiver: receiver,
3052 value: value 3113 value: value
3053 }); 3114 });
3054 } else { 3115 } else {
3055 - target._addCallbacks(didFulfill, didReject, promise, receiver, domain); 3116 + target._addCallbacks(didFulfill, didReject, promise,
3117 + receiver, context);
3056 } 3118 }
3057 3119
3058 return promise; 3120 return promise;
...@@ -3113,7 +3175,15 @@ Promise.prototype._setWillBeCancelled = function() { ...@@ -3113,7 +3175,15 @@ Promise.prototype._setWillBeCancelled = function() {
3113 3175
3114 Promise.prototype._setAsyncGuaranteed = function() { 3176 Promise.prototype._setAsyncGuaranteed = function() {
3115 if (async.hasCustomScheduler()) return; 3177 if (async.hasCustomScheduler()) return;
3116 - this._bitField = this._bitField | 134217728; 3178 + var bitField = this._bitField;
3179 + this._bitField = bitField |
3180 + (((bitField & 536870912) >> 2) ^
3181 + 134217728);
3182 +};
3183 +
3184 +Promise.prototype._setNoAsyncGuarantee = function() {
3185 + this._bitField = (this._bitField | 536870912) &
3186 + (~134217728);
3117 }; 3187 };
3118 3188
3119 Promise.prototype._receiverAt = function (index) { 3189 Promise.prototype._receiverAt = function (index) {
...@@ -3168,7 +3238,7 @@ Promise.prototype._addCallbacks = function ( ...@@ -3168,7 +3238,7 @@ Promise.prototype._addCallbacks = function (
3168 reject, 3238 reject,
3169 promise, 3239 promise,
3170 receiver, 3240 receiver,
3171 - domain 3241 + context
3172 ) { 3242 ) {
3173 var index = this._length(); 3243 var index = this._length();
3174 3244
...@@ -3181,12 +3251,10 @@ Promise.prototype._addCallbacks = function ( ...@@ -3181,12 +3251,10 @@ Promise.prototype._addCallbacks = function (
3181 this._promise0 = promise; 3251 this._promise0 = promise;
3182 this._receiver0 = receiver; 3252 this._receiver0 = receiver;
3183 if (typeof fulfill === "function") { 3253 if (typeof fulfill === "function") {
3184 - this._fulfillmentHandler0 = 3254 + this._fulfillmentHandler0 = util.contextBind(context, fulfill);
3185 - domain === null ? fulfill : util.domainBind(domain, fulfill);
3186 } 3255 }
3187 if (typeof reject === "function") { 3256 if (typeof reject === "function") {
3188 - this._rejectionHandler0 = 3257 + this._rejectionHandler0 = util.contextBind(context, reject);
3189 - domain === null ? reject : util.domainBind(domain, reject);
3190 } 3258 }
3191 } else { 3259 } else {
3192 var base = index * 4 - 4; 3260 var base = index * 4 - 4;
...@@ -3194,11 +3262,11 @@ Promise.prototype._addCallbacks = function ( ...@@ -3194,11 +3262,11 @@ Promise.prototype._addCallbacks = function (
3194 this[base + 3] = receiver; 3262 this[base + 3] = receiver;
3195 if (typeof fulfill === "function") { 3263 if (typeof fulfill === "function") {
3196 this[base + 0] = 3264 this[base + 0] =
3197 - domain === null ? fulfill : util.domainBind(domain, fulfill); 3265 + util.contextBind(context, fulfill);
3198 } 3266 }
3199 if (typeof reject === "function") { 3267 if (typeof reject === "function") {
3200 this[base + 1] = 3268 this[base + 1] =
3201 - domain === null ? reject : util.domainBind(domain, reject); 3269 + util.contextBind(context, reject);
3202 } 3270 }
3203 } 3271 }
3204 this._setLength(index + 1); 3272 this._setLength(index + 1);
...@@ -3218,6 +3286,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) { ...@@ -3218,6 +3286,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) {
3218 3286
3219 if (shouldBind) this._propagateFrom(maybePromise, 2); 3287 if (shouldBind) this._propagateFrom(maybePromise, 2);
3220 3288
3289 +
3221 var promise = maybePromise._target(); 3290 var promise = maybePromise._target();
3222 3291
3223 if (promise === this) { 3292 if (promise === this) {
...@@ -3234,7 +3303,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) { ...@@ -3234,7 +3303,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) {
3234 } 3303 }
3235 this._setFollowing(); 3304 this._setFollowing();
3236 this._setLength(0); 3305 this._setLength(0);
3237 - this._setFollowee(promise); 3306 + this._setFollowee(maybePromise);
3238 } else if (((bitField & 33554432) !== 0)) { 3307 } else if (((bitField & 33554432) !== 0)) {
3239 this._fulfill(promise._value()); 3308 this._fulfill(promise._value());
3240 } else if (((bitField & 16777216) !== 0)) { 3309 } else if (((bitField & 16777216) !== 0)) {
...@@ -3493,6 +3562,14 @@ Promise.prototype._settledValue = function() { ...@@ -3493,6 +3562,14 @@ Promise.prototype._settledValue = function() {
3493 } 3562 }
3494 }; 3563 };
3495 3564
3565 +if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
3566 + es5.defineProperty(Promise.prototype, Symbol.toStringTag, {
3567 + get: function () {
3568 + return "Object";
3569 + }
3570 + });
3571 +}
3572 +
3496 function deferResolve(v) {this.promise._resolveCallback(v);} 3573 function deferResolve(v) {this.promise._resolveCallback(v);}
3497 function deferReject(v) {this.promise._rejectCallback(v, false);} 3574 function deferReject(v) {this.promise._rejectCallback(v, false);}
3498 3575
...@@ -3517,14 +3594,12 @@ _dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug); ...@@ -3517,14 +3594,12 @@ _dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug);
3517 _dereq_("./direct_resolve")(Promise); 3594 _dereq_("./direct_resolve")(Promise);
3518 _dereq_("./synchronous_inspection")(Promise); 3595 _dereq_("./synchronous_inspection")(Promise);
3519 _dereq_("./join")( 3596 _dereq_("./join")(
3520 - Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); 3597 + Promise, PromiseArray, tryConvertToPromise, INTERNAL, async);
3521 Promise.Promise = Promise; 3598 Promise.Promise = Promise;
3522 -Promise.version = "3.5.3"; 3599 +Promise.version = "3.7.2";
3523 -_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
3524 _dereq_('./call_get.js')(Promise); 3600 _dereq_('./call_get.js')(Promise);
3525 -_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
3526 -_dereq_('./timers.js')(Promise, INTERNAL, debug);
3527 _dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); 3601 _dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
3602 +_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
3528 _dereq_('./nodeify.js')(Promise); 3603 _dereq_('./nodeify.js')(Promise);
3529 _dereq_('./promisify.js')(Promise, INTERNAL); 3604 _dereq_('./promisify.js')(Promise, INTERNAL);
3530 _dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); 3605 _dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
...@@ -3532,9 +3607,11 @@ _dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); ...@@ -3532,9 +3607,11 @@ _dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
3532 _dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); 3607 _dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
3533 _dereq_('./settle.js')(Promise, PromiseArray, debug); 3608 _dereq_('./settle.js')(Promise, PromiseArray, debug);
3534 _dereq_('./some.js')(Promise, PromiseArray, apiRejection); 3609 _dereq_('./some.js')(Promise, PromiseArray, apiRejection);
3535 -_dereq_('./filter.js')(Promise, INTERNAL); 3610 +_dereq_('./timers.js')(Promise, INTERNAL, debug);
3536 -_dereq_('./each.js')(Promise, INTERNAL); 3611 +_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
3537 _dereq_('./any.js')(Promise); 3612 _dereq_('./any.js')(Promise);
3613 +_dereq_('./each.js')(Promise, INTERNAL);
3614 +_dereq_('./filter.js')(Promise, INTERNAL);
3538 3615
3539 util.toFastProperties(Promise); 3616 util.toFastProperties(Promise);
3540 util.toFastProperties(Promise.prototype); 3617 util.toFastProperties(Promise.prototype);
...@@ -3560,7 +3637,7 @@ _dereq_('./any.js')(Promise); ...@@ -3560,7 +3637,7 @@ _dereq_('./any.js')(Promise);
3560 3637
3561 }; 3638 };
3562 3639
3563 -},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(_dereq_,module,exports){ 3640 +},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36,"async_hooks":undefined}],23:[function(_dereq_,module,exports){
3564 "use strict"; 3641 "use strict";
3565 module.exports = function(Promise, INTERNAL, tryConvertToPromise, 3642 module.exports = function(Promise, INTERNAL, tryConvertToPromise,
3566 apiRejection, Proxyable) { 3643 apiRejection, Proxyable) {
...@@ -3579,6 +3656,7 @@ function PromiseArray(values) { ...@@ -3579,6 +3656,7 @@ function PromiseArray(values) {
3579 var promise = this._promise = new Promise(INTERNAL); 3656 var promise = this._promise = new Promise(INTERNAL);
3580 if (values instanceof Promise) { 3657 if (values instanceof Promise) {
3581 promise._propagateFrom(values, 3); 3658 promise._propagateFrom(values, 3);
3659 + values.suppressUnhandledRejections();
3582 } 3660 }
3583 promise._setOnCancel(this); 3661 promise._setOnCancel(this);
3584 this._values = values; 3662 this._values = values;
...@@ -4317,14 +4395,13 @@ module.exports = function(Promise, ...@@ -4317,14 +4395,13 @@ module.exports = function(Promise,
4317 tryConvertToPromise, 4395 tryConvertToPromise,
4318 INTERNAL, 4396 INTERNAL,
4319 debug) { 4397 debug) {
4320 -var getDomain = Promise._getDomain;
4321 var util = _dereq_("./util"); 4398 var util = _dereq_("./util");
4322 var tryCatch = util.tryCatch; 4399 var tryCatch = util.tryCatch;
4323 4400
4324 function ReductionPromiseArray(promises, fn, initialValue, _each) { 4401 function ReductionPromiseArray(promises, fn, initialValue, _each) {
4325 this.constructor$(promises); 4402 this.constructor$(promises);
4326 - var domain = getDomain(); 4403 + var context = Promise._getContext();
4327 - this._fn = domain === null ? fn : util.domainBind(domain, fn); 4404 + this._fn = util.contextBind(context, fn);
4328 if (initialValue !== undefined) { 4405 if (initialValue !== undefined) {
4329 initialValue = Promise.resolve(initialValue); 4406 initialValue = Promise.resolve(initialValue);
4330 initialValue._attachCancellationCallback(this); 4407 initialValue._attachCancellationCallback(this);
...@@ -4401,6 +4478,13 @@ ReductionPromiseArray.prototype._iterate = function (values) { ...@@ -4401,6 +4478,13 @@ ReductionPromiseArray.prototype._iterate = function (values) {
4401 4478
4402 this._currentCancellable = value; 4479 this._currentCancellable = value;
4403 4480
4481 + for (var j = i; j < length; ++j) {
4482 + var maybePromise = values[j];
4483 + if (maybePromise instanceof Promise) {
4484 + maybePromise.suppressUnhandledRejections();
4485 + }
4486 + }
4487 +
4404 if (!value.isRejected()) { 4488 if (!value.isRejected()) {
4405 for (; i < length; ++i) { 4489 for (; i < length; ++i) {
4406 var ctx = { 4490 var ctx = {
...@@ -4410,7 +4494,12 @@ ReductionPromiseArray.prototype._iterate = function (values) { ...@@ -4410,7 +4494,12 @@ ReductionPromiseArray.prototype._iterate = function (values) {
4410 length: length, 4494 length: length,
4411 array: this 4495 array: this
4412 }; 4496 };
4497 +
4413 value = value._then(gotAccum, undefined, undefined, ctx, undefined); 4498 value = value._then(gotAccum, undefined, undefined, ctx, undefined);
4499 +
4500 + if ((i & 127) === 0) {
4501 + value._setNoAsyncGuarantee();
4502 + }
4414 } 4503 }
4415 } 4504 }
4416 4505
...@@ -4506,7 +4595,8 @@ if (util.isNode && typeof MutationObserver === "undefined") { ...@@ -4506,7 +4595,8 @@ if (util.isNode && typeof MutationObserver === "undefined") {
4506 } else if ((typeof MutationObserver !== "undefined") && 4595 } else if ((typeof MutationObserver !== "undefined") &&
4507 !(typeof window !== "undefined" && 4596 !(typeof window !== "undefined" &&
4508 window.navigator && 4597 window.navigator &&
4509 - (window.navigator.standalone || window.cordova))) { 4598 + (window.navigator.standalone || window.cordova)) &&
4599 + ("classList" in document.documentElement)) {
4510 schedule = (function() { 4600 schedule = (function() {
4511 var div = document.createElement("div"); 4601 var div = document.createElement("div");
4512 var opts = {attributes: true}; 4602 var opts = {attributes: true};
...@@ -4586,6 +4676,10 @@ Promise.settle = function (promises) { ...@@ -4586,6 +4676,10 @@ Promise.settle = function (promises) {
4586 return new SettledPromiseArray(promises).promise(); 4676 return new SettledPromiseArray(promises).promise();
4587 }; 4677 };
4588 4678
4679 +Promise.allSettled = function (promises) {
4680 + return new SettledPromiseArray(promises).promise();
4681 +};
4682 +
4589 Promise.prototype.settle = function () { 4683 Promise.prototype.settle = function () {
4590 return Promise.settle(this); 4684 return Promise.settle(this);
4591 }; 4685 };
...@@ -5586,18 +5680,42 @@ function getNativePromise() { ...@@ -5586,18 +5680,42 @@ function getNativePromise() {
5586 if (typeof Promise === "function") { 5680 if (typeof Promise === "function") {
5587 try { 5681 try {
5588 var promise = new Promise(function(){}); 5682 var promise = new Promise(function(){});
5589 - if ({}.toString.call(promise) === "[object Promise]") { 5683 + if (classString(promise) === "[object Promise]") {
5590 return Promise; 5684 return Promise;
5591 } 5685 }
5592 } catch (e) {} 5686 } catch (e) {}
5593 } 5687 }
5594 } 5688 }
5595 5689
5596 -function domainBind(self, cb) { 5690 +var reflectHandler;
5597 - return self.bind(cb); 5691 +function contextBind(ctx, cb) {
5692 + if (ctx === null ||
5693 + typeof cb !== "function" ||
5694 + cb === reflectHandler) {
5695 + return cb;
5696 + }
5697 +
5698 + if (ctx.domain !== null) {
5699 + cb = ctx.domain.bind(cb);
5700 + }
5701 +
5702 + var async = ctx.async;
5703 + if (async !== null) {
5704 + var old = cb;
5705 + cb = function() {
5706 + var args = (new Array(2)).concat([].slice.call(arguments));;
5707 + args[0] = old;
5708 + args[1] = this;
5709 + return async.runInAsyncScope.apply(async, args);
5710 + };
5711 + }
5712 + return cb;
5598 } 5713 }
5599 5714
5600 var ret = { 5715 var ret = {
5716 + setReflectHandler: function(fn) {
5717 + reflectHandler = fn;
5718 + },
5601 isClass: isClass, 5719 isClass: isClass,
5602 isIdentifier: isIdentifier, 5720 isIdentifier: isIdentifier,
5603 inheritedDataKeys: inheritedDataKeys, 5721 inheritedDataKeys: inheritedDataKeys,
...@@ -5624,24 +5742,37 @@ var ret = { ...@@ -5624,24 +5742,37 @@ var ret = {
5624 markAsOriginatingFromRejection: markAsOriginatingFromRejection, 5742 markAsOriginatingFromRejection: markAsOriginatingFromRejection,
5625 classString: classString, 5743 classString: classString,
5626 copyDescriptors: copyDescriptors, 5744 copyDescriptors: copyDescriptors,
5627 - hasDevTools: typeof chrome !== "undefined" && chrome &&
5628 - typeof chrome.loadTimes === "function",
5629 isNode: isNode, 5745 isNode: isNode,
5630 hasEnvVariables: hasEnvVariables, 5746 hasEnvVariables: hasEnvVariables,
5631 env: env, 5747 env: env,
5632 global: globalObject, 5748 global: globalObject,
5633 getNativePromise: getNativePromise, 5749 getNativePromise: getNativePromise,
5634 - domainBind: domainBind 5750 + contextBind: contextBind
5635 }; 5751 };
5636 ret.isRecentNode = ret.isNode && (function() { 5752 ret.isRecentNode = ret.isNode && (function() {
5637 - var version = process.versions.node.split(".").map(Number); 5753 + var version;
5754 + if (process.versions && process.versions.node) {
5755 + version = process.versions.node.split(".").map(Number);
5756 + } else if (process.version) {
5757 + version = process.version.split(".").map(Number);
5758 + }
5638 return (version[0] === 0 && version[1] > 10) || (version[0] > 0); 5759 return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
5639 })(); 5760 })();
5761 +ret.nodeSupportsAsyncResource = ret.isNode && (function() {
5762 + var supportsAsync = false;
5763 + try {
5764 + var res = _dereq_("async_hooks").AsyncResource;
5765 + supportsAsync = typeof res.prototype.runInAsyncScope === "function";
5766 + } catch (e) {
5767 + supportsAsync = false;
5768 + }
5769 + return supportsAsync;
5770 +})();
5640 5771
5641 if (ret.isNode) ret.toFastProperties(process); 5772 if (ret.isNode) ret.toFastProperties(process);
5642 5773
5643 try {throw new Error(); } catch (e) {ret.lastLineError = e;} 5774 try {throw new Error(); } catch (e) {ret.lastLineError = e;}
5644 module.exports = ret; 5775 module.exports = ret;
5645 5776
5646 -},{"./es5":13}]},{},[4])(4) 5777 +},{"./es5":13,"async_hooks":undefined}]},{},[4])(4)
5647 }); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } 5778 }); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }
...\ No newline at end of file ...\ No newline at end of file
......
This diff could not be displayed because it is too large.
...@@ -3,7 +3,6 @@ var firstLineError; ...@@ -3,7 +3,6 @@ var firstLineError;
3 try {throw new Error(); } catch (e) {firstLineError = e;} 3 try {throw new Error(); } catch (e) {firstLineError = e;}
4 var schedule = require("./schedule"); 4 var schedule = require("./schedule");
5 var Queue = require("./queue"); 5 var Queue = require("./queue");
6 -var util = require("./util");
7 6
8 function Async() { 7 function Async() {
9 this._customScheduler = false; 8 this._customScheduler = false;
...@@ -11,7 +10,6 @@ function Async() { ...@@ -11,7 +10,6 @@ function Async() {
11 this._lateQueue = new Queue(16); 10 this._lateQueue = new Queue(16);
12 this._normalQueue = new Queue(16); 11 this._normalQueue = new Queue(16);
13 this._haveDrainedQueues = false; 12 this._haveDrainedQueues = false;
14 - this._trampolineEnabled = true;
15 var self = this; 13 var self = this;
16 this.drainQueues = function () { 14 this.drainQueues = function () {
17 self._drainQueues(); 15 self._drainQueues();
...@@ -30,16 +28,6 @@ Async.prototype.hasCustomScheduler = function() { ...@@ -30,16 +28,6 @@ Async.prototype.hasCustomScheduler = function() {
30 return this._customScheduler; 28 return this._customScheduler;
31 }; 29 };
32 30
33 -Async.prototype.enableTrampoline = function() {
34 - this._trampolineEnabled = true;
35 -};
36 -
37 -Async.prototype.disableTrampolineIfNecessary = function() {
38 - if (util.hasDevTools) {
39 - this._trampolineEnabled = false;
40 - }
41 -};
42 -
43 Async.prototype.haveItemsQueued = function () { 31 Async.prototype.haveItemsQueued = function () {
44 return this._isTickUsed || this._haveDrainedQueues; 32 return this._isTickUsed || this._haveDrainedQueues;
45 }; 33 };
...@@ -88,43 +76,10 @@ function AsyncSettlePromises(promise) { ...@@ -88,43 +76,10 @@ function AsyncSettlePromises(promise) {
88 this._queueTick(); 76 this._queueTick();
89 } 77 }
90 78
91 -if (!util.hasDevTools) { 79 +Async.prototype.invokeLater = AsyncInvokeLater;
92 - Async.prototype.invokeLater = AsyncInvokeLater; 80 +Async.prototype.invoke = AsyncInvoke;
93 - Async.prototype.invoke = AsyncInvoke; 81 +Async.prototype.settlePromises = AsyncSettlePromises;
94 - Async.prototype.settlePromises = AsyncSettlePromises;
95 -} else {
96 - Async.prototype.invokeLater = function (fn, receiver, arg) {
97 - if (this._trampolineEnabled) {
98 - AsyncInvokeLater.call(this, fn, receiver, arg);
99 - } else {
100 - this._schedule(function() {
101 - setTimeout(function() {
102 - fn.call(receiver, arg);
103 - }, 100);
104 - });
105 - }
106 - };
107 82
108 - Async.prototype.invoke = function (fn, receiver, arg) {
109 - if (this._trampolineEnabled) {
110 - AsyncInvoke.call(this, fn, receiver, arg);
111 - } else {
112 - this._schedule(function() {
113 - fn.call(receiver, arg);
114 - });
115 - }
116 - };
117 -
118 - Async.prototype.settlePromises = function(promise) {
119 - if (this._trampolineEnabled) {
120 - AsyncSettlePromises.call(this, promise);
121 - } else {
122 - this._schedule(function() {
123 - promise._settlePromises();
124 - });
125 - }
126 - };
127 -}
128 83
129 function _drainQueue(queue) { 84 function _drainQueue(queue) {
130 while (queue.length() > 0) { 85 while (queue.length() > 0) {
......
1 "use strict"; 1 "use strict";
2 -module.exports = function(Promise, Context) { 2 +module.exports = function(Promise, Context,
3 -var getDomain = Promise._getDomain; 3 + enableAsyncHooks, disableAsyncHooks) {
4 var async = Promise._async; 4 var async = Promise._async;
5 var Warning = require("./errors").Warning; 5 var Warning = require("./errors").Warning;
6 var util = require("./util"); 6 var util = require("./util");
...@@ -30,6 +30,34 @@ var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && ...@@ -30,6 +30,34 @@ var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
30 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && 30 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
31 (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN")); 31 (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
32 32
33 +var deferUnhandledRejectionCheck;
34 +(function() {
35 + var promises = [];
36 +
37 + function unhandledRejectionCheck() {
38 + for (var i = 0; i < promises.length; ++i) {
39 + promises[i]._notifyUnhandledRejection();
40 + }
41 + unhandledRejectionClear();
42 + }
43 +
44 + function unhandledRejectionClear() {
45 + promises.length = 0;
46 + }
47 +
48 + deferUnhandledRejectionCheck = function(promise) {
49 + promises.push(promise);
50 + setTimeout(unhandledRejectionCheck, 1);
51 + };
52 +
53 + es5.defineProperty(Promise, "_unhandledRejectionCheck", {
54 + value: unhandledRejectionCheck
55 + });
56 + es5.defineProperty(Promise, "_unhandledRejectionClear", {
57 + value: unhandledRejectionClear
58 + });
59 +})();
60 +
33 Promise.prototype.suppressUnhandledRejections = function() { 61 Promise.prototype.suppressUnhandledRejections = function() {
34 var target = this._target(); 62 var target = this._target();
35 target._bitField = ((target._bitField & (~1048576)) | 63 target._bitField = ((target._bitField & (~1048576)) |
...@@ -39,10 +67,7 @@ Promise.prototype.suppressUnhandledRejections = function() { ...@@ -39,10 +67,7 @@ Promise.prototype.suppressUnhandledRejections = function() {
39 Promise.prototype._ensurePossibleRejectionHandled = function () { 67 Promise.prototype._ensurePossibleRejectionHandled = function () {
40 if ((this._bitField & 524288) !== 0) return; 68 if ((this._bitField & 524288) !== 0) return;
41 this._setRejectionIsUnhandled(); 69 this._setRejectionIsUnhandled();
42 - var self = this; 70 + deferUnhandledRejectionCheck(this);
43 - setTimeout(function() {
44 - self._notifyUnhandledRejection();
45 - }, 1);
46 }; 71 };
47 72
48 Promise.prototype._notifyUnhandledRejectionIsHandled = function () { 73 Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
...@@ -100,19 +125,13 @@ Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) { ...@@ -100,19 +125,13 @@ Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
100 }; 125 };
101 126
102 Promise.onPossiblyUnhandledRejection = function (fn) { 127 Promise.onPossiblyUnhandledRejection = function (fn) {
103 - var domain = getDomain(); 128 + var context = Promise._getContext();
104 - possiblyUnhandledRejection = 129 + possiblyUnhandledRejection = util.contextBind(context, fn);
105 - typeof fn === "function" ? (domain === null ?
106 - fn : util.domainBind(domain, fn))
107 - : undefined;
108 }; 130 };
109 131
110 Promise.onUnhandledRejectionHandled = function (fn) { 132 Promise.onUnhandledRejectionHandled = function (fn) {
111 - var domain = getDomain(); 133 + var context = Promise._getContext();
112 - unhandledRejectionHandled = 134 + unhandledRejectionHandled = util.contextBind(context, fn);
113 - typeof fn === "function" ? (domain === null ?
114 - fn : util.domainBind(domain, fn))
115 - : undefined;
116 }; 135 };
117 136
118 var disableLongStackTraces = function() {}; 137 var disableLongStackTraces = function() {};
...@@ -133,14 +152,12 @@ Promise.longStackTraces = function () { ...@@ -133,14 +152,12 @@ Promise.longStackTraces = function () {
133 Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; 152 Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
134 Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; 153 Promise.prototype._dereferenceTrace = Promise_dereferenceTrace;
135 Context.deactivateLongStackTraces(); 154 Context.deactivateLongStackTraces();
136 - async.enableTrampoline();
137 config.longStackTraces = false; 155 config.longStackTraces = false;
138 }; 156 };
139 Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; 157 Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
140 Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; 158 Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
141 Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; 159 Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace;
142 Context.activateLongStackTraces(); 160 Context.activateLongStackTraces();
143 - async.disableTrampolineIfNecessary();
144 } 161 }
145 }; 162 };
146 163
...@@ -148,43 +165,85 @@ Promise.hasLongStackTraces = function () { ...@@ -148,43 +165,85 @@ Promise.hasLongStackTraces = function () {
148 return config.longStackTraces && longStackTracesIsSupported(); 165 return config.longStackTraces && longStackTracesIsSupported();
149 }; 166 };
150 167
168 +
169 +var legacyHandlers = {
170 + unhandledrejection: {
171 + before: function() {
172 + var ret = util.global.onunhandledrejection;
173 + util.global.onunhandledrejection = null;
174 + return ret;
175 + },
176 + after: function(fn) {
177 + util.global.onunhandledrejection = fn;
178 + }
179 + },
180 + rejectionhandled: {
181 + before: function() {
182 + var ret = util.global.onrejectionhandled;
183 + util.global.onrejectionhandled = null;
184 + return ret;
185 + },
186 + after: function(fn) {
187 + util.global.onrejectionhandled = fn;
188 + }
189 + }
190 +};
191 +
151 var fireDomEvent = (function() { 192 var fireDomEvent = (function() {
193 + var dispatch = function(legacy, e) {
194 + if (legacy) {
195 + var fn;
196 + try {
197 + fn = legacy.before();
198 + return !util.global.dispatchEvent(e);
199 + } finally {
200 + legacy.after(fn);
201 + }
202 + } else {
203 + return !util.global.dispatchEvent(e);
204 + }
205 + };
152 try { 206 try {
153 if (typeof CustomEvent === "function") { 207 if (typeof CustomEvent === "function") {
154 var event = new CustomEvent("CustomEvent"); 208 var event = new CustomEvent("CustomEvent");
155 util.global.dispatchEvent(event); 209 util.global.dispatchEvent(event);
156 return function(name, event) { 210 return function(name, event) {
211 + name = name.toLowerCase();
157 var eventData = { 212 var eventData = {
158 detail: event, 213 detail: event,
159 cancelable: true 214 cancelable: true
160 }; 215 };
216 + var domEvent = new CustomEvent(name, eventData);
217 + es5.defineProperty(
218 + domEvent, "promise", {value: event.promise});
161 es5.defineProperty( 219 es5.defineProperty(
162 - eventData, "promise", {value: event.promise}); 220 + domEvent, "reason", {value: event.reason});
163 - es5.defineProperty(eventData, "reason", {value: event.reason}); 221 +
164 - var domEvent = new CustomEvent(name.toLowerCase(), eventData); 222 + return dispatch(legacyHandlers[name], domEvent);
165 - return !util.global.dispatchEvent(domEvent);
166 }; 223 };
167 } else if (typeof Event === "function") { 224 } else if (typeof Event === "function") {
168 var event = new Event("CustomEvent"); 225 var event = new Event("CustomEvent");
169 util.global.dispatchEvent(event); 226 util.global.dispatchEvent(event);
170 return function(name, event) { 227 return function(name, event) {
171 - var domEvent = new Event(name.toLowerCase(), { 228 + name = name.toLowerCase();
229 + var domEvent = new Event(name, {
172 cancelable: true 230 cancelable: true
173 }); 231 });
174 domEvent.detail = event; 232 domEvent.detail = event;
175 es5.defineProperty(domEvent, "promise", {value: event.promise}); 233 es5.defineProperty(domEvent, "promise", {value: event.promise});
176 es5.defineProperty(domEvent, "reason", {value: event.reason}); 234 es5.defineProperty(domEvent, "reason", {value: event.reason});
177 - return !util.global.dispatchEvent(domEvent); 235 + return dispatch(legacyHandlers[name], domEvent);
178 }; 236 };
179 } else { 237 } else {
180 var event = document.createEvent("CustomEvent"); 238 var event = document.createEvent("CustomEvent");
181 event.initCustomEvent("testingtheevent", false, true, {}); 239 event.initCustomEvent("testingtheevent", false, true, {});
182 util.global.dispatchEvent(event); 240 util.global.dispatchEvent(event);
183 return function(name, event) { 241 return function(name, event) {
242 + name = name.toLowerCase();
184 var domEvent = document.createEvent("CustomEvent"); 243 var domEvent = document.createEvent("CustomEvent");
185 - domEvent.initCustomEvent(name.toLowerCase(), false, true, 244 + domEvent.initCustomEvent(name, false, true,
186 event); 245 event);
187 - return !util.global.dispatchEvent(domEvent); 246 + return dispatch(legacyHandlers[name], domEvent);
188 }; 247 };
189 } 248 }
190 } catch (e) {} 249 } catch (e) {}
...@@ -302,6 +361,18 @@ Promise.config = function(opts) { ...@@ -302,6 +361,18 @@ Promise.config = function(opts) {
302 Promise.prototype._fireEvent = defaultFireEvent; 361 Promise.prototype._fireEvent = defaultFireEvent;
303 } 362 }
304 } 363 }
364 + if ("asyncHooks" in opts && util.nodeSupportsAsyncResource) {
365 + var prev = config.asyncHooks;
366 + var cur = !!opts.asyncHooks;
367 + if (prev !== cur) {
368 + config.asyncHooks = cur;
369 + if (cur) {
370 + enableAsyncHooks();
371 + } else {
372 + disableAsyncHooks();
373 + }
374 + }
375 + }
305 return Promise; 376 return Promise;
306 }; 377 };
307 378
...@@ -689,8 +760,8 @@ function parseLineInfo(line) { ...@@ -689,8 +760,8 @@ function parseLineInfo(line) {
689 760
690 function setBounds(firstLineError, lastLineError) { 761 function setBounds(firstLineError, lastLineError) {
691 if (!longStackTracesIsSupported()) return; 762 if (!longStackTracesIsSupported()) return;
692 - var firstStackLines = firstLineError.stack.split("\n"); 763 + var firstStackLines = (firstLineError.stack || "").split("\n");
693 - var lastStackLines = lastLineError.stack.split("\n"); 764 + var lastStackLines = (lastLineError.stack || "").split("\n");
694 var firstIndex = -1; 765 var firstIndex = -1;
695 var lastIndex = -1; 766 var lastIndex = -1;
696 var firstFileName; 767 var firstFileName;
...@@ -899,12 +970,16 @@ var config = { ...@@ -899,12 +970,16 @@ var config = {
899 warnings: warnings, 970 warnings: warnings,
900 longStackTraces: false, 971 longStackTraces: false,
901 cancellation: false, 972 cancellation: false,
902 - monitoring: false 973 + monitoring: false,
974 + asyncHooks: false
903 }; 975 };
904 976
905 if (longStackTraces) Promise.longStackTraces(); 977 if (longStackTraces) Promise.longStackTraces();
906 978
907 return { 979 return {
980 + asyncHooks: function() {
981 + return config.asyncHooks;
982 + },
908 longStackTraces: function() { 983 longStackTraces: function() {
909 return config.longStackTraces; 984 return config.longStackTraces;
910 }, 985 },
......
1 "use strict"; 1 "use strict";
2 module.exports = 2 module.exports =
3 -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, 3 +function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) {
4 - getDomain) {
5 var util = require("./util"); 4 var util = require("./util");
6 var canEvaluate = util.canEvaluate; 5 var canEvaluate = util.canEvaluate;
7 var tryCatch = util.tryCatch; 6 var tryCatch = util.tryCatch;
...@@ -147,10 +146,8 @@ Promise.join = function () { ...@@ -147,10 +146,8 @@ Promise.join = function () {
147 146
148 if (!ret._isFateSealed()) { 147 if (!ret._isFateSealed()) {
149 if (holder.asyncNeeded) { 148 if (holder.asyncNeeded) {
150 - var domain = getDomain(); 149 + var context = Promise._getContext();
151 - if (domain !== null) { 150 + holder.fn = util.contextBind(context, holder.fn);
152 - holder.fn = util.domainBind(domain, holder.fn);
153 - }
154 } 151 }
155 ret._setAsyncGuaranteed(); 152 ret._setAsyncGuaranteed();
156 ret._setOnCancel(holder); 153 ret._setOnCancel(holder);
...@@ -159,7 +156,7 @@ Promise.join = function () { ...@@ -159,7 +156,7 @@ Promise.join = function () {
159 } 156 }
160 } 157 }
161 } 158 }
162 - var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];}; 159 + var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i ];};
163 if (fn) args.pop(); 160 if (fn) args.pop();
164 var ret = new PromiseArray(args).promise(); 161 var ret = new PromiseArray(args).promise();
165 return fn !== undefined ? ret.spread(fn) : ret; 162 return fn !== undefined ? ret.spread(fn) : ret;
......
...@@ -5,7 +5,6 @@ module.exports = function(Promise, ...@@ -5,7 +5,6 @@ module.exports = function(Promise,
5 tryConvertToPromise, 5 tryConvertToPromise,
6 INTERNAL, 6 INTERNAL,
7 debug) { 7 debug) {
8 -var getDomain = Promise._getDomain;
9 var util = require("./util"); 8 var util = require("./util");
10 var tryCatch = util.tryCatch; 9 var tryCatch = util.tryCatch;
11 var errorObj = util.errorObj; 10 var errorObj = util.errorObj;
...@@ -14,8 +13,8 @@ var async = Promise._async; ...@@ -14,8 +13,8 @@ var async = Promise._async;
14 function MappingPromiseArray(promises, fn, limit, _filter) { 13 function MappingPromiseArray(promises, fn, limit, _filter) {
15 this.constructor$(promises); 14 this.constructor$(promises);
16 this._promise._captureStackTrace(); 15 this._promise._captureStackTrace();
17 - var domain = getDomain(); 16 + var context = Promise._getContext();
18 - this._callback = domain === null ? fn : util.domainBind(domain, fn); 17 + this._callback = util.contextBind(context, fn);
19 this._preservedValues = _filter === INTERNAL 18 this._preservedValues = _filter === INTERNAL
20 ? new Array(this.length()) 19 ? new Array(this.length())
21 : null; 20 : null;
...@@ -23,6 +22,14 @@ function MappingPromiseArray(promises, fn, limit, _filter) { ...@@ -23,6 +22,14 @@ function MappingPromiseArray(promises, fn, limit, _filter) {
23 this._inFlight = 0; 22 this._inFlight = 0;
24 this._queue = []; 23 this._queue = [];
25 async.invoke(this._asyncInit, this, undefined); 24 async.invoke(this._asyncInit, this, undefined);
25 + if (util.isArray(promises)) {
26 + for (var i = 0; i < promises.length; ++i) {
27 + var maybePromise = promises[i];
28 + if (maybePromise instanceof Promise) {
29 + maybePromise.suppressUnhandledRejections();
30 + }
31 + }
32 + }
26 } 33 }
27 util.inherits(MappingPromiseArray, PromiseArray); 34 util.inherits(MappingPromiseArray, PromiseArray);
28 35
......
...@@ -12,20 +12,42 @@ var apiRejection = function(msg) { ...@@ -12,20 +12,42 @@ var apiRejection = function(msg) {
12 function Proxyable() {} 12 function Proxyable() {}
13 var UNDEFINED_BINDING = {}; 13 var UNDEFINED_BINDING = {};
14 var util = require("./util"); 14 var util = require("./util");
15 +util.setReflectHandler(reflectHandler);
15 16
16 -var getDomain; 17 +var getDomain = function() {
17 -if (util.isNode) { 18 + var domain = process.domain;
18 - getDomain = function() { 19 + if (domain === undefined) {
19 - var ret = process.domain; 20 + return null;
20 - if (ret === undefined) ret = null; 21 + }
21 - return ret; 22 + return domain;
22 - }; 23 +};
23 -} else { 24 +var getContextDefault = function() {
24 - getDomain = function() {
25 return null; 25 return null;
26 +};
27 +var getContextDomain = function() {
28 + return {
29 + domain: getDomain(),
30 + async: null
26 }; 31 };
27 -} 32 +};
28 -util.notEnumerableProp(Promise, "_getDomain", getDomain); 33 +var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ?
34 + require("async_hooks").AsyncResource : null;
35 +var getContextAsyncHooks = function() {
36 + return {
37 + domain: getDomain(),
38 + async: new AsyncResource("Bluebird::Promise")
39 + };
40 +};
41 +var getContext = util.isNode ? getContextDomain : getContextDefault;
42 +util.notEnumerableProp(Promise, "_getContext", getContext);
43 +var enableAsyncHooks = function() {
44 + getContext = getContextAsyncHooks;
45 + util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks);
46 +};
47 +var disableAsyncHooks = function() {
48 + getContext = getContextDomain;
49 + util.notEnumerableProp(Promise, "_getContext", getContextDomain);
50 +};
29 51
30 var es5 = require("./es5"); 52 var es5 = require("./es5");
31 var Async = require("./async"); 53 var Async = require("./async");
...@@ -49,7 +71,9 @@ var PromiseArray = ...@@ -49,7 +71,9 @@ var PromiseArray =
49 var Context = require("./context")(Promise); 71 var Context = require("./context")(Promise);
50 /*jshint unused:false*/ 72 /*jshint unused:false*/
51 var createContext = Context.create; 73 var createContext = Context.create;
52 -var debug = require("./debuggability")(Promise, Context); 74 +
75 +var debug = require("./debuggability")(Promise, Context,
76 + enableAsyncHooks, disableAsyncHooks);
53 var CapturedTrace = debug.CapturedTrace; 77 var CapturedTrace = debug.CapturedTrace;
54 var PassThroughHandlerContext = 78 var PassThroughHandlerContext =
55 require("./finally")(Promise, tryConvertToPromise, NEXT_FILTER); 79 require("./finally")(Promise, tryConvertToPromise, NEXT_FILTER);
...@@ -101,6 +125,11 @@ Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { ...@@ -101,6 +125,11 @@ Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
101 } 125 }
102 catchInstances.length = j; 126 catchInstances.length = j;
103 fn = arguments[i]; 127 fn = arguments[i];
128 +
129 + if (typeof fn !== "function") {
130 + throw new TypeError("The last argument to .catch() " +
131 + "must be a function, got " + util.toString(fn));
132 + }
104 return this.then(undefined, catchFilter(catchInstances, fn, this)); 133 return this.then(undefined, catchFilter(catchInstances, fn, this));
105 } 134 }
106 return this.then(undefined, fn); 135 return this.then(undefined, fn);
...@@ -241,7 +270,7 @@ Promise.prototype._then = function ( ...@@ -241,7 +270,7 @@ Promise.prototype._then = function (
241 this._fireEvent("promiseChained", this, promise); 270 this._fireEvent("promiseChained", this, promise);
242 } 271 }
243 272
244 - var domain = getDomain(); 273 + var context = getContext();
245 if (!((bitField & 50397184) === 0)) { 274 if (!((bitField & 50397184) === 0)) {
246 var handler, value, settler = target._settlePromiseCtx; 275 var handler, value, settler = target._settlePromiseCtx;
247 if (((bitField & 33554432) !== 0)) { 276 if (((bitField & 33554432) !== 0)) {
...@@ -259,15 +288,14 @@ Promise.prototype._then = function ( ...@@ -259,15 +288,14 @@ Promise.prototype._then = function (
259 } 288 }
260 289
261 async.invoke(settler, target, { 290 async.invoke(settler, target, {
262 - handler: domain === null ? handler 291 + handler: util.contextBind(context, handler),
263 - : (typeof handler === "function" &&
264 - util.domainBind(domain, handler)),
265 promise: promise, 292 promise: promise,
266 receiver: receiver, 293 receiver: receiver,
267 value: value 294 value: value
268 }); 295 });
269 } else { 296 } else {
270 - target._addCallbacks(didFulfill, didReject, promise, receiver, domain); 297 + target._addCallbacks(didFulfill, didReject, promise,
298 + receiver, context);
271 } 299 }
272 300
273 return promise; 301 return promise;
...@@ -328,7 +356,15 @@ Promise.prototype._setWillBeCancelled = function() { ...@@ -328,7 +356,15 @@ Promise.prototype._setWillBeCancelled = function() {
328 356
329 Promise.prototype._setAsyncGuaranteed = function() { 357 Promise.prototype._setAsyncGuaranteed = function() {
330 if (async.hasCustomScheduler()) return; 358 if (async.hasCustomScheduler()) return;
331 - this._bitField = this._bitField | 134217728; 359 + var bitField = this._bitField;
360 + this._bitField = bitField |
361 + (((bitField & 536870912) >> 2) ^
362 + 134217728);
363 +};
364 +
365 +Promise.prototype._setNoAsyncGuarantee = function() {
366 + this._bitField = (this._bitField | 536870912) &
367 + (~134217728);
332 }; 368 };
333 369
334 Promise.prototype._receiverAt = function (index) { 370 Promise.prototype._receiverAt = function (index) {
...@@ -383,7 +419,7 @@ Promise.prototype._addCallbacks = function ( ...@@ -383,7 +419,7 @@ Promise.prototype._addCallbacks = function (
383 reject, 419 reject,
384 promise, 420 promise,
385 receiver, 421 receiver,
386 - domain 422 + context
387 ) { 423 ) {
388 var index = this._length(); 424 var index = this._length();
389 425
...@@ -396,12 +432,10 @@ Promise.prototype._addCallbacks = function ( ...@@ -396,12 +432,10 @@ Promise.prototype._addCallbacks = function (
396 this._promise0 = promise; 432 this._promise0 = promise;
397 this._receiver0 = receiver; 433 this._receiver0 = receiver;
398 if (typeof fulfill === "function") { 434 if (typeof fulfill === "function") {
399 - this._fulfillmentHandler0 = 435 + this._fulfillmentHandler0 = util.contextBind(context, fulfill);
400 - domain === null ? fulfill : util.domainBind(domain, fulfill);
401 } 436 }
402 if (typeof reject === "function") { 437 if (typeof reject === "function") {
403 - this._rejectionHandler0 = 438 + this._rejectionHandler0 = util.contextBind(context, reject);
404 - domain === null ? reject : util.domainBind(domain, reject);
405 } 439 }
406 } else { 440 } else {
407 var base = index * 4 - 4; 441 var base = index * 4 - 4;
...@@ -409,11 +443,11 @@ Promise.prototype._addCallbacks = function ( ...@@ -409,11 +443,11 @@ Promise.prototype._addCallbacks = function (
409 this[base + 3] = receiver; 443 this[base + 3] = receiver;
410 if (typeof fulfill === "function") { 444 if (typeof fulfill === "function") {
411 this[base + 0] = 445 this[base + 0] =
412 - domain === null ? fulfill : util.domainBind(domain, fulfill); 446 + util.contextBind(context, fulfill);
413 } 447 }
414 if (typeof reject === "function") { 448 if (typeof reject === "function") {
415 this[base + 1] = 449 this[base + 1] =
416 - domain === null ? reject : util.domainBind(domain, reject); 450 + util.contextBind(context, reject);
417 } 451 }
418 } 452 }
419 this._setLength(index + 1); 453 this._setLength(index + 1);
...@@ -433,6 +467,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) { ...@@ -433,6 +467,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) {
433 467
434 if (shouldBind) this._propagateFrom(maybePromise, 2); 468 if (shouldBind) this._propagateFrom(maybePromise, 2);
435 469
470 +
436 var promise = maybePromise._target(); 471 var promise = maybePromise._target();
437 472
438 if (promise === this) { 473 if (promise === this) {
...@@ -449,7 +484,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) { ...@@ -449,7 +484,7 @@ Promise.prototype._resolveCallback = function(value, shouldBind) {
449 } 484 }
450 this._setFollowing(); 485 this._setFollowing();
451 this._setLength(0); 486 this._setLength(0);
452 - this._setFollowee(promise); 487 + this._setFollowee(maybePromise);
453 } else if (((bitField & 33554432) !== 0)) { 488 } else if (((bitField & 33554432) !== 0)) {
454 this._fulfill(promise._value()); 489 this._fulfill(promise._value());
455 } else if (((bitField & 16777216) !== 0)) { 490 } else if (((bitField & 16777216) !== 0)) {
...@@ -708,6 +743,14 @@ Promise.prototype._settledValue = function() { ...@@ -708,6 +743,14 @@ Promise.prototype._settledValue = function() {
708 } 743 }
709 }; 744 };
710 745
746 +if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
747 + es5.defineProperty(Promise.prototype, Symbol.toStringTag, {
748 + get: function () {
749 + return "Object";
750 + }
751 + });
752 +}
753 +
711 function deferResolve(v) {this.promise._resolveCallback(v);} 754 function deferResolve(v) {this.promise._resolveCallback(v);}
712 function deferReject(v) {this.promise._rejectCallback(v, false);} 755 function deferReject(v) {this.promise._rejectCallback(v, false);}
713 756
...@@ -732,14 +775,12 @@ require("./cancel")(Promise, PromiseArray, apiRejection, debug); ...@@ -732,14 +775,12 @@ require("./cancel")(Promise, PromiseArray, apiRejection, debug);
732 require("./direct_resolve")(Promise); 775 require("./direct_resolve")(Promise);
733 require("./synchronous_inspection")(Promise); 776 require("./synchronous_inspection")(Promise);
734 require("./join")( 777 require("./join")(
735 - Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain); 778 + Promise, PromiseArray, tryConvertToPromise, INTERNAL, async);
736 Promise.Promise = Promise; 779 Promise.Promise = Promise;
737 -Promise.version = "3.5.3"; 780 +Promise.version = "3.7.2";
738 -require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
739 require('./call_get.js')(Promise); 781 require('./call_get.js')(Promise);
740 -require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
741 -require('./timers.js')(Promise, INTERNAL, debug);
742 require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug); 782 require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
783 +require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
743 require('./nodeify.js')(Promise); 784 require('./nodeify.js')(Promise);
744 require('./promisify.js')(Promise, INTERNAL); 785 require('./promisify.js')(Promise, INTERNAL);
745 require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); 786 require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
...@@ -747,9 +788,11 @@ require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); ...@@ -747,9 +788,11 @@ require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
747 require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug); 788 require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
748 require('./settle.js')(Promise, PromiseArray, debug); 789 require('./settle.js')(Promise, PromiseArray, debug);
749 require('./some.js')(Promise, PromiseArray, apiRejection); 790 require('./some.js')(Promise, PromiseArray, apiRejection);
750 -require('./filter.js')(Promise, INTERNAL); 791 +require('./timers.js')(Promise, INTERNAL, debug);
751 -require('./each.js')(Promise, INTERNAL); 792 +require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
752 require('./any.js')(Promise); 793 require('./any.js')(Promise);
794 +require('./each.js')(Promise, INTERNAL);
795 +require('./filter.js')(Promise, INTERNAL);
753 796
754 util.toFastProperties(Promise); 797 util.toFastProperties(Promise);
755 util.toFastProperties(Promise.prototype); 798 util.toFastProperties(Promise.prototype);
......
...@@ -16,6 +16,7 @@ function PromiseArray(values) { ...@@ -16,6 +16,7 @@ function PromiseArray(values) {
16 var promise = this._promise = new Promise(INTERNAL); 16 var promise = this._promise = new Promise(INTERNAL);
17 if (values instanceof Promise) { 17 if (values instanceof Promise) {
18 promise._propagateFrom(values, 3); 18 promise._propagateFrom(values, 3);
19 + values.suppressUnhandledRejections();
19 } 20 }
20 promise._setOnCancel(this); 21 promise._setOnCancel(this);
21 this._values = values; 22 this._values = values;
......
...@@ -5,14 +5,13 @@ module.exports = function(Promise, ...@@ -5,14 +5,13 @@ module.exports = function(Promise,
5 tryConvertToPromise, 5 tryConvertToPromise,
6 INTERNAL, 6 INTERNAL,
7 debug) { 7 debug) {
8 -var getDomain = Promise._getDomain;
9 var util = require("./util"); 8 var util = require("./util");
10 var tryCatch = util.tryCatch; 9 var tryCatch = util.tryCatch;
11 10
12 function ReductionPromiseArray(promises, fn, initialValue, _each) { 11 function ReductionPromiseArray(promises, fn, initialValue, _each) {
13 this.constructor$(promises); 12 this.constructor$(promises);
14 - var domain = getDomain(); 13 + var context = Promise._getContext();
15 - this._fn = domain === null ? fn : util.domainBind(domain, fn); 14 + this._fn = util.contextBind(context, fn);
16 if (initialValue !== undefined) { 15 if (initialValue !== undefined) {
17 initialValue = Promise.resolve(initialValue); 16 initialValue = Promise.resolve(initialValue);
18 initialValue._attachCancellationCallback(this); 17 initialValue._attachCancellationCallback(this);
...@@ -89,6 +88,13 @@ ReductionPromiseArray.prototype._iterate = function (values) { ...@@ -89,6 +88,13 @@ ReductionPromiseArray.prototype._iterate = function (values) {
89 88
90 this._currentCancellable = value; 89 this._currentCancellable = value;
91 90
91 + for (var j = i; j < length; ++j) {
92 + var maybePromise = values[j];
93 + if (maybePromise instanceof Promise) {
94 + maybePromise.suppressUnhandledRejections();
95 + }
96 + }
97 +
92 if (!value.isRejected()) { 98 if (!value.isRejected()) {
93 for (; i < length; ++i) { 99 for (; i < length; ++i) {
94 var ctx = { 100 var ctx = {
...@@ -98,7 +104,12 @@ ReductionPromiseArray.prototype._iterate = function (values) { ...@@ -98,7 +104,12 @@ ReductionPromiseArray.prototype._iterate = function (values) {
98 length: length, 104 length: length,
99 array: this 105 array: this
100 }; 106 };
107 +
101 value = value._then(gotAccum, undefined, undefined, ctx, undefined); 108 value = value._then(gotAccum, undefined, undefined, ctx, undefined);
109 +
110 + if ((i & 127) === 0) {
111 + value._setNoAsyncGuarantee();
112 + }
102 } 113 }
103 } 114 }
104 115
......
...@@ -20,7 +20,8 @@ if (util.isNode && typeof MutationObserver === "undefined") { ...@@ -20,7 +20,8 @@ if (util.isNode && typeof MutationObserver === "undefined") {
20 } else if ((typeof MutationObserver !== "undefined") && 20 } else if ((typeof MutationObserver !== "undefined") &&
21 !(typeof window !== "undefined" && 21 !(typeof window !== "undefined" &&
22 window.navigator && 22 window.navigator &&
23 - (window.navigator.standalone || window.cordova))) { 23 + (window.navigator.standalone || window.cordova)) &&
24 + ("classList" in document.documentElement)) {
24 schedule = (function() { 25 schedule = (function() {
25 var div = document.createElement("div"); 26 var div = document.createElement("div");
26 var opts = {attributes: true}; 27 var opts = {attributes: true};
......
...@@ -37,6 +37,10 @@ Promise.settle = function (promises) { ...@@ -37,6 +37,10 @@ Promise.settle = function (promises) {
37 return new SettledPromiseArray(promises).promise(); 37 return new SettledPromiseArray(promises).promise();
38 }; 38 };
39 39
40 +Promise.allSettled = function (promises) {
41 + return new SettledPromiseArray(promises).promise();
42 +};
43 +
40 Promise.prototype.settle = function () { 44 Promise.prototype.settle = function () {
41 return Promise.settle(this); 45 return Promise.settle(this);
42 }; 46 };
......
...@@ -326,18 +326,42 @@ function getNativePromise() { ...@@ -326,18 +326,42 @@ function getNativePromise() {
326 if (typeof Promise === "function") { 326 if (typeof Promise === "function") {
327 try { 327 try {
328 var promise = new Promise(function(){}); 328 var promise = new Promise(function(){});
329 - if ({}.toString.call(promise) === "[object Promise]") { 329 + if (classString(promise) === "[object Promise]") {
330 return Promise; 330 return Promise;
331 } 331 }
332 } catch (e) {} 332 } catch (e) {}
333 } 333 }
334 } 334 }
335 335
336 -function domainBind(self, cb) { 336 +var reflectHandler;
337 - return self.bind(cb); 337 +function contextBind(ctx, cb) {
338 + if (ctx === null ||
339 + typeof cb !== "function" ||
340 + cb === reflectHandler) {
341 + return cb;
342 + }
343 +
344 + if (ctx.domain !== null) {
345 + cb = ctx.domain.bind(cb);
346 + }
347 +
348 + var async = ctx.async;
349 + if (async !== null) {
350 + var old = cb;
351 + cb = function() {
352 + var $_len = arguments.length + 2;var args = new Array($_len); for(var $_i = 2; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i - 2];};
353 + args[0] = old;
354 + args[1] = this;
355 + return async.runInAsyncScope.apply(async, args);
356 + };
357 + }
358 + return cb;
338 } 359 }
339 360
340 var ret = { 361 var ret = {
362 + setReflectHandler: function(fn) {
363 + reflectHandler = fn;
364 + },
341 isClass: isClass, 365 isClass: isClass,
342 isIdentifier: isIdentifier, 366 isIdentifier: isIdentifier,
343 inheritedDataKeys: inheritedDataKeys, 367 inheritedDataKeys: inheritedDataKeys,
...@@ -364,19 +388,32 @@ var ret = { ...@@ -364,19 +388,32 @@ var ret = {
364 markAsOriginatingFromRejection: markAsOriginatingFromRejection, 388 markAsOriginatingFromRejection: markAsOriginatingFromRejection,
365 classString: classString, 389 classString: classString,
366 copyDescriptors: copyDescriptors, 390 copyDescriptors: copyDescriptors,
367 - hasDevTools: typeof chrome !== "undefined" && chrome &&
368 - typeof chrome.loadTimes === "function",
369 isNode: isNode, 391 isNode: isNode,
370 hasEnvVariables: hasEnvVariables, 392 hasEnvVariables: hasEnvVariables,
371 env: env, 393 env: env,
372 global: globalObject, 394 global: globalObject,
373 getNativePromise: getNativePromise, 395 getNativePromise: getNativePromise,
374 - domainBind: domainBind 396 + contextBind: contextBind
375 }; 397 };
376 ret.isRecentNode = ret.isNode && (function() { 398 ret.isRecentNode = ret.isNode && (function() {
377 - var version = process.versions.node.split(".").map(Number); 399 + var version;
400 + if (process.versions && process.versions.node) {
401 + version = process.versions.node.split(".").map(Number);
402 + } else if (process.version) {
403 + version = process.version.split(".").map(Number);
404 + }
378 return (version[0] === 0 && version[1] > 10) || (version[0] > 0); 405 return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
379 })(); 406 })();
407 +ret.nodeSupportsAsyncResource = ret.isNode && (function() {
408 + var supportsAsync = false;
409 + try {
410 + var res = require("async_hooks").AsyncResource;
411 + supportsAsync = typeof res.prototype.runInAsyncScope === "function";
412 + } catch (e) {
413 + supportsAsync = false;
414 + }
415 + return supportsAsync;
416 +})();
380 417
381 if (ret.isNode) ret.toFastProperties(process); 418 if (ret.isNode) ret.toFastProperties(process);
382 419
......
1 { 1 {
2 "_args": [ 2 "_args": [
3 [ 3 [
4 - "bluebird@3.5.3", 4 + "bluebird@3.7.2",
5 - "/Users/ye/Desktop/NodeBook/nodejs-book/ch12/12.4/node-auction" 5 + "C:\\Users\\15Z950.1703\\Desktop\\2-2\\옾소\\프젝\\OPproject"
6 ] 6 ]
7 ], 7 ],
8 - "_from": "bluebird@3.5.3", 8 + "_from": "bluebird@3.7.2",
9 - "_id": "bluebird@3.5.3", 9 + "_id": "bluebird@3.7.2",
10 "_inBundle": false, 10 "_inBundle": false,
11 - "_integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw==", 11 + "_integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
12 "_location": "/bluebird", 12 "_location": "/bluebird",
13 "_phantomChildren": {}, 13 "_phantomChildren": {},
14 "_requested": { 14 "_requested": {
15 "type": "version", 15 "type": "version",
16 "registry": true, 16 "registry": true,
17 - "raw": "bluebird@3.5.3", 17 + "raw": "bluebird@3.7.2",
18 "name": "bluebird", 18 "name": "bluebird",
19 "escapedName": "bluebird", 19 "escapedName": "bluebird",
20 - "rawSpec": "3.5.3", 20 + "rawSpec": "3.7.2",
21 "saveSpec": null, 21 "saveSpec": null,
22 - "fetchSpec": "3.5.3" 22 + "fetchSpec": "3.7.2"
23 }, 23 },
24 "_requiredBy": [ 24 "_requiredBy": [
25 "/retry-as-promised", 25 "/retry-as-promised",
26 "/sequelize" 26 "/sequelize"
27 ], 27 ],
28 - "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", 28 + "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
29 - "_spec": "3.5.3", 29 + "_spec": "3.7.2",
30 - "_where": "/Users/ye/Desktop/NodeBook/nodejs-book/ch12/12.4/node-auction", 30 + "_where": "C:\\Users\\15Z950.1703\\Desktop\\2-2\\옾소\\프젝\\OPproject",
31 "author": { 31 "author": {
32 "name": "Petka Antonov", 32 "name": "Petka Antonov",
33 "email": "petka_antonov@hotmail.com", 33 "email": "petka_antonov@hotmail.com",
...@@ -101,6 +101,6 @@ ...@@ -101,6 +101,6 @@
101 "prepublish": "npm run generate-browser-core && npm run generate-browser-full", 101 "prepublish": "npm run generate-browser-core && npm run generate-browser-full",
102 "test": "node --expose-gc tools/test.js" 102 "test": "node --expose-gc tools/test.js"
103 }, 103 },
104 - "version": "3.5.3", 104 + "version": "3.7.2",
105 "webpack": "./js/release/bluebird.js" 105 "webpack": "./js/release/bluebird.js"
106 } 106 }
......
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed
File mode changed