김동근

commit

Showing 1000 changed files with 4622 additions and 0 deletions

Too many changes to show.

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

...@@ -5,19 +5,29 @@ ...@@ -5,19 +5,29 @@
5 # 설치 5 # 설치
6 6
7 git clone http://khuhub.khu.ac.kr/2020-2-capstone-design2/2015104154.git 7 git clone http://khuhub.khu.ac.kr/2020-2-capstone-design2/2015104154.git
8 +
8 cd 2015104154 9 cd 2015104154
10 +
9 cd front 11 cd front
12 +
10 npm install 13 npm install
14 +
11 npm start 15 npm start
16 +
12 cd ../back 17 cd ../back
18 +
13 npm install 19 npm install
20 +
14 npm start 21 npm start
15 22
23 +
16 # 데이터 24 # 데이터
17 25
18 TMDB API : https://developers.themoviedb.org/3/getting-started/introduction 26 TMDB API : https://developers.themoviedb.org/3/getting-started/introduction
27 +
19 MovieLen : https://grouplens.org/datasets/movielens/ 28 MovieLen : https://grouplens.org/datasets/movielens/
20 29
30 +
21 # 스크린샷 31 # 스크린샷
22 32
23 ![screensh]('./screenshot1.png') 33 ![screensh]('./screenshot1.png')
......
1 +var createError = require('http-errors');
2 +var express = require('express');
3 +var path = require('path');
4 +var cookieParser = require('cookie-parser');
5 +var logger = require('morgan');
6 +var models = require('./models/index')
7 +var session = require('express-session')
8 +var cors = require('cors');
9 +
10 +var indexRouter = require('./routes/index');
11 +var usersRouter = require('./routes/users');
12 +var moviesRouter = require('./routes/movies')
13 +
14 +var app = express();
15 +
16 +// view engine setup
17 +app.set('views', path.join(__dirname, 'views'));
18 +app.set('view engine', 'ejs');
19 +
20 +app.use(logger('dev'));
21 +app.use(express.json());
22 +app.use(express.urlencoded({ extended: false }));
23 +app.use(cookieParser());
24 +app.use(express.static(path.join(__dirname, 'public')));
25 +app.use(session({
26 + key: 'sid',
27 + secret:'secret',
28 + resave: false,
29 + saveUninitialized:true,
30 + cookie:{
31 + maxAge: 24000*60*60
32 + }
33 +}))
34 +app.use(cors());
35 +
36 +models.sequelize.sync().then(() => {
37 + console.log("Connect DB");
38 +}).catch(err => {
39 + console.log("Connect Failed DB");
40 + console.log(err);
41 +})
42 +
43 +app.use('/', indexRouter);
44 +app.use('/users', usersRouter);
45 +app.use('/movies', moviesRouter);
46 +
47 +// catch 404 and forward to error handler
48 +app.use(function(req, res, next) {
49 + next(createError(404));
50 +});
51 +
52 +// error handler
53 +app.use(function(err, req, res, next) {
54 + // set locals, only providing error in development
55 + res.locals.message = err.message;
56 + res.locals.error = req.app.get('env') === 'development' ? err : {};
57 +
58 + // render the error page
59 + res.status(err.status || 500);
60 + res.render('error');
61 +});
62 +
63 +module.exports = app;
1 +#!/usr/bin/env node
2 +
3 +/**
4 + * Module dependencies.
5 + */
6 +
7 +var app = require('../app');
8 +var debug = require('debug')('capston2:server');
9 +var http = require('http');
10 +
11 +/**
12 + * Get port from environment and store in Express.
13 + */
14 +
15 +var port = normalizePort(process.env.PORT || '3002');
16 +app.set('port', port);
17 +
18 +/**
19 + * Create HTTP server.
20 + */
21 +
22 +var server = http.createServer(app);
23 +
24 +/**
25 + * Listen on provided port, on all network interfaces.
26 + */
27 +
28 +server.listen(port);
29 +server.on('error', onError);
30 +server.on('listening', onListening);
31 +
32 +/**
33 + * Normalize a port into a number, string, or false.
34 + */
35 +
36 +function normalizePort(val) {
37 + var port = parseInt(val, 10);
38 +
39 + if (isNaN(port)) {
40 + // named pipe
41 + return val;
42 + }
43 +
44 + if (port >= 0) {
45 + // port number
46 + return port;
47 + }
48 +
49 + return false;
50 +}
51 +
52 +/**
53 + * Event listener for HTTP server "error" event.
54 + */
55 +
56 +function onError(error) {
57 + if (error.syscall !== 'listen') {
58 + throw error;
59 + }
60 +
61 + var bind = typeof port === 'string'
62 + ? 'Pipe ' + port
63 + : 'Port ' + port;
64 +
65 + // handle specific listen errors with friendly messages
66 + switch (error.code) {
67 + case 'EACCES':
68 + console.error(bind + ' requires elevated privileges');
69 + process.exit(1);
70 + break;
71 + case 'EADDRINUSE':
72 + console.error(bind + ' is already in use');
73 + process.exit(1);
74 + break;
75 + default:
76 + throw error;
77 + }
78 +}
79 +
80 +/**
81 + * Event listener for HTTP server "listening" event.
82 + */
83 +
84 +function onListening() {
85 + var addr = server.address();
86 + var bind = typeof addr === 'string'
87 + ? 'pipe ' + addr
88 + : 'port ' + addr.port;
89 + debug('Listening on ' + bind);
90 +}
1 +{
2 + "development": {
3 + "username": "root",
4 + "password": "asdasd2134",
5 + "database": "database_development",
6 + "host": "127.0.0.1",
7 + "dialect": "mysql"
8 + },
9 + "test": {
10 + "username": "root",
11 + "password": null,
12 + "database": "database_test",
13 + "host": "127.0.0.1",
14 + "dialect": "mysql"
15 + },
16 + "production": {
17 + "username": "root",
18 + "password": null,
19 + "database": "database_production",
20 + "host": "127.0.0.1",
21 + "dialect": "mysql"
22 + }
23 +}
1 +'use strict';
2 +module.exports = {
3 + up: async (queryInterface, Sequelize) => {
4 + await queryInterface.createTable('users', {
5 + id: {
6 + allowNull: false,
7 + autoIncrement: true,
8 + primaryKey: true,
9 + type: Sequelize.INTEGER
10 + },
11 + email: {
12 + allowNull: false,
13 + primaryKey: true,
14 + type: Sequelize.STRING,
15 + },
16 + password: {
17 + allowNull: false,
18 + type: Sequelize.STRING
19 + },
20 + salt: {
21 + allowNull: false,
22 + type: Sequelize.STRING
23 + },
24 + createdAt: {
25 + allowNull: false,
26 + type: Sequelize.DATE
27 + },
28 + updatedAt: {
29 + allowNull: false,
30 + type: Sequelize.DATE
31 + }
32 + });
33 + },
34 + down: async (queryInterface, Sequelize) => {
35 + await queryInterface.dropTable('users');
36 + }
37 +};
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +module.exports = {
3 + up: async (queryInterface, Sequelize) => {
4 + await queryInterface.createTable('ratings', {
5 + id: {
6 + allowNull: false,
7 + autoIncrement: true,
8 + primaryKey: true,
9 + type: Sequelize.INTEGER
10 + },
11 + user_id: {
12 + allowNull: false,
13 + type: Sequelize.STRING
14 + },
15 + movie_id: {
16 + allowNull: false,
17 + type: Sequelize.STRING
18 + },
19 + rating: {
20 + allowNull: false,
21 + type: Sequelize.STRING
22 + },
23 + createdAt: {
24 + allowNull: false,
25 + type: Sequelize.DATE
26 + },
27 + updatedAt: {
28 + allowNull: false,
29 + type: Sequelize.DATE
30 + }
31 + });
32 + },
33 + down: async (queryInterface, Sequelize) => {
34 + await queryInterface.dropTable('ratings');
35 + }
36 +};
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +module.exports = {
3 + up: async (queryInterface, Sequelize) => {
4 + await queryInterface.createTable('movies', {
5 + id: {
6 + allowNull: false,
7 + autoIncrement: true,
8 + primaryKey: true,
9 + type: Sequelize.INTEGER
10 + },
11 + movie_id: {
12 + allowNull: false,
13 + type: Sequelize.STRING
14 + },
15 + movie_name: {
16 + allowNull: false,
17 + type: Sequelize.STRING
18 + },
19 + createdAt: {
20 + allowNull: false,
21 + type: Sequelize.DATE
22 + },
23 + updatedAt: {
24 + allowNull: false,
25 + type: Sequelize.DATE
26 + }
27 + });
28 + },
29 + down: async (queryInterface, Sequelize) => {
30 + await queryInterface.dropTable('movies');
31 + }
32 +};
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +const fs = require('fs');
4 +const path = require('path');
5 +const Sequelize = require('sequelize');
6 +const basename = path.basename(__filename);
7 +const env = process.env.NODE_ENV || 'development';
8 +const config = require(__dirname + '/../config/config.json')[env];
9 +const db = {};
10 +
11 +let sequelize;
12 +if (config.use_env_variable) {
13 + sequelize = new Sequelize(process.env[config.use_env_variable], config);
14 +} else {
15 + sequelize = new Sequelize(config.database, config.username, config.password, config);
16 +}
17 +
18 +fs
19 + .readdirSync(__dirname)
20 + .filter(file => {
21 + return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
22 + })
23 + .forEach(file => {
24 + const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes);
25 + db[model.name] = model;
26 + });
27 +
28 +Object.keys(db).forEach(modelName => {
29 + if (db[modelName].associate) {
30 + db[modelName].associate(db);
31 + }
32 +});
33 +
34 +db.sequelize = sequelize;
35 +db.Sequelize = Sequelize;
36 +
37 +module.exports = db;
1 +'use strict';
2 +const {
3 + Model
4 +} = require('sequelize');
5 +module.exports = (sequelize, DataTypes) => {
6 + class movies extends Model {
7 + /**
8 + * Helper method for defining associations.
9 + * This method is not a part of Sequelize lifecycle.
10 + * The `models/index` file will call this method automatically.
11 + */
12 + static associate(models) {
13 + // define association here
14 + }
15 + };
16 + movies.init({
17 + id: {
18 + allowNull: false,
19 + autoIncrement: true,
20 + primaryKey: true,
21 + type: DataTypes.INTEGER
22 + },
23 + movie_id: {
24 + allowNull:false,
25 + type:DataTypes.STRING
26 + },
27 + movie_name: {
28 + allowNull:false,
29 + type:DataTypes.STRING
30 + }
31 + }, {
32 + sequelize,
33 + modelName: 'movies',
34 + });
35 + return movies;
36 +};
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +const {
3 + Model
4 +} = require('sequelize');
5 +module.exports = (sequelize, DataTypes) => {
6 + class ratings extends Model {
7 + /**
8 + * Helper method for defining associations.
9 + * This method is not a part of Sequelize lifecycle.
10 + * The `models/index` file will call this method automatically.
11 + */
12 + static associate(models) {
13 + // define association here
14 + }
15 + };
16 + ratings.init({
17 + id: {
18 + allowNull: false,
19 + autoIncrement: true,
20 + primaryKey: true,
21 + type: DataTypes.INTEGER
22 + },
23 + user_id: {
24 + allowNull: false,
25 + type:DataTypes.INTEGER,
26 + },
27 + movie_id:{
28 + allowNull: false,
29 + type:DataTypes.INTEGER,
30 + },
31 + rating: {
32 + allowNull: false,
33 + type:DataTypes.FLOAT,
34 + },
35 + }, {
36 + sequelize,
37 + modelName: 'ratings',
38 + });
39 + return ratings;
40 +};
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +const {
3 + Model
4 +} = require('sequelize');
5 +module.exports = (sequelize, DataTypes) => {
6 + class users extends Model {
7 + /**
8 + * Helper method for defining associations.
9 + * This method is not a part of Sequelize lifecycle.
10 + * The `models/index` file will call this method automatically.
11 + */
12 + static associate(models) {
13 + // define association here
14 + }
15 + };
16 + users.init({
17 + id: {
18 + allowNull: false,
19 + autoIncrement: true,
20 + primaryKey: true,
21 + type: DataTypes.INTEGER
22 + },
23 + email: {
24 + type: DataTypes.STRING,
25 + allowNull: false,
26 + primaryKey: true
27 + },
28 + password: {
29 + type: DataTypes.STRING,
30 + allowNull: false
31 + },
32 + salt: {
33 + type: DataTypes.STRING,
34 + allowNull: false
35 + }
36 + }, {
37 + sequelize,
38 + modelName: 'users',
39 + });
40 + return users;
41 +};
...\ No newline at end of file ...\ No newline at end of file
No preview for this file type
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 +@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/../semver/bin/semver.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../semver/bin/semver.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
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.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/../semver/bin/semver.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../semver/bin/semver.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/../uuid/dist/bin/uuid" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../uuid/dist/bin/uuid" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
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\dist\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/dist/bin/uuid" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../uuid/dist/bin/uuid" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 + MIT License
2 +
3 + Copyright (c) Microsoft Corporation.
4 +
5 + Permission is hereby granted, free of charge, to any person obtaining a copy
6 + of this software and associated documentation files (the "Software"), to deal
7 + in the Software without restriction, including without limitation the rights
8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 + copies of the Software, and to permit persons to whom the Software is
10 + furnished to do so, subject to the following conditions:
11 +
12 + The above copyright notice and this permission notice shall be included in all
13 + copies or substantial portions of the Software.
14 +
15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 + SOFTWARE
1 +# Installation
2 +> `npm install --save @types/node`
3 +
4 +# Summary
5 +This package contains type definitions for Node.js (http://nodejs.org/).
6 +
7 +# Details
8 +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9 +
10 +### Additional Details
11 + * Last updated: Sat, 12 Dec 2020 17:18:07 GMT
12 + * Dependencies: none
13 + * Global values: `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14 +
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), [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), [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), [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), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Jason Kwok](https://github.com/JasonHK), and [Victor Perin](https://github.com/victorperin).
1 +declare module 'assert' {
2 + /** An alias of `assert.ok()`. */
3 + function assert(value: any, message?: string | Error): asserts value;
4 + namespace assert {
5 + class AssertionError implements Error {
6 + name: string;
7 + message: string;
8 + actual: any;
9 + expected: any;
10 + operator: string;
11 + generatedMessage: boolean;
12 + code: 'ERR_ASSERTION';
13 +
14 + constructor(options?: {
15 + /** If provided, the error message is set to this value. */
16 + message?: string;
17 + /** The `actual` property on the error instance. */
18 + actual?: any;
19 + /** The `expected` property on the error instance. */
20 + expected?: any;
21 + /** The `operator` property on the error instance. */
22 + operator?: string;
23 + /** If provided, the generated stack trace omits frames before this function. */
24 + // tslint:disable-next-line:ban-types
25 + stackStartFn?: Function;
26 + });
27 + }
28 +
29 + class CallTracker {
30 + calls(exact?: number): () => void;
31 + calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
32 + report(): CallTrackerReportInformation[];
33 + verify(): void;
34 + }
35 + interface CallTrackerReportInformation {
36 + message: string;
37 + /** The actual number of times the function was called. */
38 + actual: number;
39 + /** The number of times the function was expected to be called. */
40 + expected: number;
41 + /** The name of the function that is wrapped. */
42 + operator: string;
43 + /** A stack trace of the function. */
44 + stack: object;
45 + }
46 +
47 + type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error;
48 +
49 + function fail(message?: string | Error): never;
50 + /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
51 + function fail(
52 + actual: any,
53 + expected: any,
54 + message?: string | Error,
55 + operator?: string,
56 + // tslint:disable-next-line:ban-types
57 + stackStartFn?: Function,
58 + ): never;
59 + function ok(value: any, message?: string | Error): asserts value;
60 + /** @deprecated since v9.9.0 - use strictEqual() instead. */
61 + function equal(actual: any, expected: any, message?: string | Error): void;
62 + /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
63 + function notEqual(actual: any, expected: any, message?: string | Error): void;
64 + /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
65 + function deepEqual(actual: any, expected: any, message?: string | Error): void;
66 + /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
67 + function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
68 + function strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
69 + function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
70 + function deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
71 + function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
72 +
73 + function throws(block: () => any, message?: string | Error): void;
74 + function throws(block: () => any, error: AssertPredicate, message?: string | Error): void;
75 + function doesNotThrow(block: () => any, message?: string | Error): void;
76 + function doesNotThrow(block: () => any, error: AssertPredicate, message?: string | Error): void;
77 +
78 + function ifError(value: any): asserts value is null | undefined;
79 +
80 + function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
81 + function rejects(
82 + block: (() => Promise<any>) | Promise<any>,
83 + error: AssertPredicate,
84 + message?: string | Error,
85 + ): Promise<void>;
86 + function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
87 + function doesNotReject(
88 + block: (() => Promise<any>) | Promise<any>,
89 + error: AssertPredicate,
90 + message?: string | Error,
91 + ): Promise<void>;
92 +
93 + function match(value: string, regExp: RegExp, message?: string | Error): void;
94 + function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
95 +
96 + const strict: Omit<
97 + typeof assert,
98 + | 'equal'
99 + | 'notEqual'
100 + | 'deepEqual'
101 + | 'notDeepEqual'
102 + | 'ok'
103 + | 'strictEqual'
104 + | 'deepStrictEqual'
105 + | 'ifError'
106 + | 'strict'
107 + > & {
108 + (value: any, message?: string | Error): asserts value;
109 + equal: typeof strictEqual;
110 + notEqual: typeof notStrictEqual;
111 + deepEqual: typeof deepStrictEqual;
112 + notDeepEqual: typeof notDeepStrictEqual;
113 +
114 + // Mapped types and assertion functions are incompatible?
115 + // TS2775: Assertions require every name in the call target
116 + // to be declared with an explicit type annotation.
117 + ok: typeof ok;
118 + strictEqual: typeof strictEqual;
119 + deepStrictEqual: typeof deepStrictEqual;
120 + ifError: typeof ifError;
121 + strict: typeof strict;
122 + };
123 + }
124 +
125 + export = assert;
126 +}
1 +/**
2 + * Async Hooks module: https://nodejs.org/api/async_hooks.html
3 + */
4 +declare module "async_hooks" {
5 + /**
6 + * Returns the asyncId of the current execution context.
7 + */
8 + function executionAsyncId(): number;
9 +
10 + /**
11 + * The resource representing the current execution.
12 + * Useful to store data within the resource.
13 + *
14 + * Resource objects returned by `executionAsyncResource()` are most often internal
15 + * Node.js handle objects with undocumented APIs. Using any functions or properties
16 + * on the object is likely to crash your application and should be avoided.
17 + *
18 + * Using `executionAsyncResource()` in the top-level execution context will
19 + * return an empty object as there is no handle or request object to use,
20 + * but having an object representing the top-level can be helpful.
21 + */
22 + function executionAsyncResource(): object;
23 +
24 + /**
25 + * Returns the ID of the resource responsible for calling the callback that is currently being executed.
26 + */
27 + function triggerAsyncId(): number;
28 +
29 + interface HookCallbacks {
30 + /**
31 + * Called when a class is constructed that has the possibility to emit an asynchronous event.
32 + * @param asyncId a unique ID for the async resource
33 + * @param type the type of the async resource
34 + * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
35 + * @param resource reference to the resource representing the async operation, needs to be released during destroy
36 + */
37 + init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
38 +
39 + /**
40 + * When an asynchronous operation is initiated or completes a callback is called to notify the user.
41 + * The before callback is called just before said callback is executed.
42 + * @param asyncId the unique identifier assigned to the resource about to execute the callback.
43 + */
44 + before?(asyncId: number): void;
45 +
46 + /**
47 + * Called immediately after the callback specified in before is completed.
48 + * @param asyncId the unique identifier assigned to the resource which has executed the callback.
49 + */
50 + after?(asyncId: number): void;
51 +
52 + /**
53 + * Called when a promise has resolve() called. This may not be in the same execution id
54 + * as the promise itself.
55 + * @param asyncId the unique id for the promise that was resolve()d.
56 + */
57 + promiseResolve?(asyncId: number): void;
58 +
59 + /**
60 + * Called after the resource corresponding to asyncId is destroyed
61 + * @param asyncId a unique ID for the async resource
62 + */
63 + destroy?(asyncId: number): void;
64 + }
65 +
66 + interface AsyncHook {
67 + /**
68 + * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
69 + */
70 + enable(): this;
71 +
72 + /**
73 + * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
74 + */
75 + disable(): this;
76 + }
77 +
78 + /**
79 + * Registers functions to be called for different lifetime events of each async operation.
80 + * @param options the callbacks to register
81 + * @return an AsyncHooks instance used for disabling and enabling hooks
82 + */
83 + function createHook(options: HookCallbacks): AsyncHook;
84 +
85 + interface AsyncResourceOptions {
86 + /**
87 + * The ID of the execution context that created this async event.
88 + * Default: `executionAsyncId()`
89 + */
90 + triggerAsyncId?: number;
91 +
92 + /**
93 + * Disables automatic `emitDestroy` when the object is garbage collected.
94 + * This usually does not need to be set (even if `emitDestroy` is called
95 + * manually), unless the resource's `asyncId` is retrieved and the
96 + * sensitive API's `emitDestroy` is called with it.
97 + * Default: `false`
98 + */
99 + requireManualDestroy?: boolean;
100 + }
101 +
102 + /**
103 + * The class AsyncResource was designed to be extended by the embedder's async resources.
104 + * Using this users can easily trigger the lifetime events of their own resources.
105 + */
106 + class AsyncResource {
107 + /**
108 + * AsyncResource() is meant to be extended. Instantiating a
109 + * new AsyncResource() also triggers init. If triggerAsyncId is omitted then
110 + * async_hook.executionAsyncId() is used.
111 + * @param type The type of async event.
112 + * @param triggerAsyncId The ID of the execution context that created
113 + * this async event (default: `executionAsyncId()`), or an
114 + * AsyncResourceOptions object (since 9.3)
115 + */
116 + constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
117 +
118 + /**
119 + * Binds the given function to the current execution context.
120 + * @param fn The function to bind to the current execution context.
121 + * @param type An optional name to associate with the underlying `AsyncResource`.
122 + */
123 + static bind<Func extends (...args: any[]) => any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource };
124 +
125 + /**
126 + * Binds the given function to execute to this `AsyncResource`'s scope.
127 + * @param fn The function to bind to the current `AsyncResource`.
128 + */
129 + bind<Func extends (...args: any[]) => any>(fn: Func): Func & { asyncResource: AsyncResource };
130 +
131 + /**
132 + * Call the provided function with the provided arguments in the
133 + * execution context of the async resource. This will establish the
134 + * context, trigger the AsyncHooks before callbacks, call the function,
135 + * trigger the AsyncHooks after callbacks, and then restore the original
136 + * execution context.
137 + * @param fn The function to call in the execution context of this
138 + * async resource.
139 + * @param thisArg The receiver to be used for the function call.
140 + * @param args Optional arguments to pass to the function.
141 + */
142 + runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
143 +
144 + /**
145 + * Call AsyncHooks destroy callbacks.
146 + */
147 + emitDestroy(): void;
148 +
149 + /**
150 + * @return the unique ID assigned to this AsyncResource instance.
151 + */
152 + asyncId(): number;
153 +
154 + /**
155 + * @return the trigger ID for this AsyncResource instance.
156 + */
157 + triggerAsyncId(): number;
158 + }
159 +
160 + /**
161 + * When having multiple instances of `AsyncLocalStorage`, they are independent
162 + * from each other. It is safe to instantiate this class multiple times.
163 + */
164 + class AsyncLocalStorage<T> {
165 + /**
166 + * This method disables the instance of `AsyncLocalStorage`. All subsequent calls
167 + * to `asyncLocalStorage.getStore()` will return `undefined` until
168 + * `asyncLocalStorage.run()` is called again.
169 + *
170 + * When calling `asyncLocalStorage.disable()`, all current contexts linked to the
171 + * instance will be exited.
172 + *
173 + * Calling `asyncLocalStorage.disable()` is required before the
174 + * `asyncLocalStorage` can be garbage collected. This does not apply to stores
175 + * provided by the `asyncLocalStorage`, as those objects are garbage collected
176 + * along with the corresponding async resources.
177 + *
178 + * This method is to be used when the `asyncLocalStorage` is not in use anymore
179 + * in the current process.
180 + */
181 + disable(): void;
182 +
183 + /**
184 + * This method returns the current store. If this method is called outside of an
185 + * asynchronous context initialized by calling `asyncLocalStorage.run`, it will
186 + * return `undefined`.
187 + */
188 + getStore(): T | undefined;
189 +
190 + /**
191 + * This methods runs a function synchronously within a context and return its
192 + * return value. The store is not accessible outside of the callback function or
193 + * the asynchronous operations created within the callback.
194 + *
195 + * Optionally, arguments can be passed to the function. They will be passed to the
196 + * callback function.
197 + *
198 + * I the callback function throws an error, it will be thrown by `run` too. The
199 + * stacktrace will not be impacted by this call and the context will be exited.
200 + */
201 + // TODO: Apply generic vararg once available
202 + run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
203 +
204 + /**
205 + * This methods runs a function synchronously outside of a context and return its
206 + * return value. The store is not accessible within the callback function or the
207 + * asynchronous operations created within the callback.
208 + *
209 + * Optionally, arguments can be passed to the function. They will be passed to the
210 + * callback function.
211 + *
212 + * If the callback function throws an error, it will be thrown by `exit` too. The
213 + * stacktrace will not be impacted by this call and the context will be
214 + * re-entered.
215 + */
216 + // TODO: Apply generic vararg once available
217 + exit<R>(callback: (...args: any[]) => R, ...args: any[]): R;
218 +
219 + /**
220 + * Calling `asyncLocalStorage.enterWith(store)` will transition into the context
221 + * for the remainder of the current synchronous execution and will persist
222 + * through any following asynchronous calls.
223 + */
224 + enterWith(store: T): void;
225 + }
226 +}
1 +// NOTE: These definitions support NodeJS and TypeScript 3.7.
2 +
3 +// NOTE: TypeScript version-specific augmentations can be found in the following paths:
4 +// - ~/base.d.ts - Shared definitions common to all TypeScript versions
5 +// - ~/index.d.ts - Definitions specific to TypeScript 2.1
6 +// - ~/ts3.7/base.d.ts - Definitions specific to TypeScript 3.7
7 +// - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in
8 +
9 +// Reference required types from the default lib:
10 +/// <reference lib="es2018" />
11 +/// <reference lib="esnext.asynciterable" />
12 +/// <reference lib="esnext.intl" />
13 +/// <reference lib="esnext.bigint" />
14 +
15 +// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
16 +/// <reference path="ts3.6/base.d.ts" />
17 +
18 +// TypeScript 3.7-specific augmentations:
19 +/// <reference path="assert.d.ts" />
1 +declare module "buffer" {
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 + };
9 + const BuffType: typeof Buffer;
10 +
11 + export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
12 +
13 + export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
14 +
15 + export const SlowBuffer: {
16 + /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */
17 + new(size: number): Buffer;
18 + prototype: Buffer;
19 + };
20 +
21 + export { BuffType as Buffer };
22 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +declare module "console" {
2 + import { InspectOptions } from 'util';
3 +
4 + global {
5 + // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
6 + interface Console {
7 + Console: NodeJS.ConsoleConstructor;
8 + /**
9 + * A simple assertion test that verifies whether `value` is truthy.
10 + * If it is not, an `AssertionError` is thrown.
11 + * If provided, the error `message` is formatted using `util.format()` and used as the error message.
12 + */
13 + assert(value: any, message?: string, ...optionalParams: any[]): void;
14 + /**
15 + * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY.
16 + * When `stdout` is not a TTY, this method does nothing.
17 + */
18 + clear(): void;
19 + /**
20 + * Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`.
21 + */
22 + count(label?: string): void;
23 + /**
24 + * Resets the internal counter specific to `label`.
25 + */
26 + countReset(label?: string): void;
27 + /**
28 + * The `console.debug()` function is an alias for {@link console.log()}.
29 + */
30 + debug(message?: any, ...optionalParams: any[]): void;
31 + /**
32 + * Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`.
33 + * This function bypasses any custom `inspect()` function defined on `obj`.
34 + */
35 + dir(obj: any, options?: InspectOptions): void;
36 + /**
37 + * This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting
38 + */
39 + dirxml(...data: any[]): void;
40 + /**
41 + * Prints to `stderr` with newline.
42 + */
43 + error(message?: any, ...optionalParams: any[]): void;
44 + /**
45 + * Increases indentation of subsequent lines by two spaces.
46 + * If one or more `label`s are provided, those are printed first without the additional indentation.
47 + */
48 + group(...label: any[]): void;
49 + /**
50 + * The `console.groupCollapsed()` function is an alias for {@link console.group()}.
51 + */
52 + groupCollapsed(...label: any[]): void;
53 + /**
54 + * Decreases indentation of subsequent lines by two spaces.
55 + */
56 + groupEnd(): void;
57 + /**
58 + * The {@link console.info()} function is an alias for {@link console.log()}.
59 + */
60 + info(message?: any, ...optionalParams: any[]): void;
61 + /**
62 + * Prints to `stdout` with newline.
63 + */
64 + log(message?: any, ...optionalParams: any[]): void;
65 + /**
66 + * This method does not display anything unless used in the inspector.
67 + * Prints to `stdout` the array `array` formatted as a table.
68 + */
69 + table(tabularData: any, properties?: ReadonlyArray<string>): void;
70 + /**
71 + * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`.
72 + */
73 + time(label?: string): void;
74 + /**
75 + * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`.
76 + */
77 + timeEnd(label?: string): void;
78 + /**
79 + * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`.
80 + */
81 + timeLog(label?: string, ...data: any[]): void;
82 + /**
83 + * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code.
84 + */
85 + trace(message?: any, ...optionalParams: any[]): void;
86 + /**
87 + * The {@link console.warn()} function is an alias for {@link console.error()}.
88 + */
89 + warn(message?: any, ...optionalParams: any[]): void;
90 +
91 + // --- Inspector mode only ---
92 + /**
93 + * This method does not display anything unless used in the inspector.
94 + * Starts a JavaScript CPU profile with an optional label.
95 + */
96 + profile(label?: string): void;
97 + /**
98 + * This method does not display anything unless used in the inspector.
99 + * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
100 + */
101 + profileEnd(label?: string): void;
102 + /**
103 + * This method does not display anything unless used in the inspector.
104 + * Adds an event with the label `label` to the Timeline panel of the inspector.
105 + */
106 + timeStamp(label?: string): void;
107 + }
108 +
109 + var console: Console;
110 +
111 + namespace NodeJS {
112 + interface ConsoleConstructorOptions {
113 + stdout: WritableStream;
114 + stderr?: WritableStream;
115 + ignoreErrors?: boolean;
116 + colorMode?: boolean | 'auto';
117 + inspectOptions?: InspectOptions;
118 + }
119 +
120 + interface ConsoleConstructor {
121 + prototype: Console;
122 + new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console;
123 + new(options: ConsoleConstructorOptions): Console;
124 + }
125 +
126 + interface Global {
127 + console: typeof console;
128 + }
129 + }
130 + }
131 +
132 + export = console;
133 +}
1 +/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
2 +declare module "constants" {
3 + import { constants as osConstants, SignalConstants } from 'os';
4 + import { constants as cryptoConstants } from 'crypto';
5 + import { constants as fsConstants } from 'fs';
6 + const exp: typeof osConstants.errno & typeof osConstants.priority & SignalConstants & typeof cryptoConstants & typeof fsConstants;
7 + export = exp;
8 +}
This diff is collapsed. Click to expand it.
1 +declare module "dgram" {
2 + import { AddressInfo } from "net";
3 + import * as dns from "dns";
4 + import * as events from "events";
5 +
6 + interface RemoteInfo {
7 + address: string;
8 + family: 'IPv4' | 'IPv6';
9 + port: number;
10 + size: number;
11 + }
12 +
13 + interface BindOptions {
14 + port?: number;
15 + address?: string;
16 + exclusive?: boolean;
17 + fd?: number;
18 + }
19 +
20 + type SocketType = "udp4" | "udp6";
21 +
22 + interface SocketOptions {
23 + type: SocketType;
24 + reuseAddr?: boolean;
25 + /**
26 + * @default false
27 + */
28 + ipv6Only?: boolean;
29 + recvBufferSize?: number;
30 + sendBufferSize?: number;
31 + lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
32 + }
33 +
34 + function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
35 + function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
36 +
37 + class Socket extends events.EventEmitter {
38 + addMembership(multicastAddress: string, multicastInterface?: string): void;
39 + address(): AddressInfo;
40 + bind(port?: number, address?: string, callback?: () => void): void;
41 + bind(port?: number, callback?: () => void): void;
42 + bind(callback?: () => void): void;
43 + bind(options: BindOptions, callback?: () => void): void;
44 + close(callback?: () => void): void;
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 | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
54 + send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
55 + send(msg: string | Uint8Array | ReadonlyArray<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;
59 + setBroadcast(flag: boolean): void;
60 + setMulticastInterface(multicastInterface: string): void;
61 + setMulticastLoopback(flag: boolean): void;
62 + setMulticastTTL(ttl: number): void;
63 + setRecvBufferSize(size: number): void;
64 + setSendBufferSize(size: number): void;
65 + setTTL(ttl: number): void;
66 + unref(): this;
67 + /**
68 + * Tells the kernel to join a source-specific multicast channel at the given
69 + * `sourceAddress` and `groupAddress`, using the `multicastInterface` with the
70 + * `IP_ADD_SOURCE_MEMBERSHIP` socket option.
71 + * If the `multicastInterface` argument
72 + * is not specified, the operating system will choose one interface and will add
73 + * membership to it.
74 + * To add membership to every available interface, call
75 + * `socket.addSourceSpecificMembership()` multiple times, once per interface.
76 + */
77 + addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
78 +
79 + /**
80 + * Instructs the kernel to leave a source-specific multicast channel at the given
81 + * `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`
82 + * socket option. This method is automatically called by the kernel when the
83 + * socket is closed or the process terminates, so most apps will never have
84 + * reason to call this.
85 + *
86 + * If `multicastInterface` is not specified, the operating system will attempt to
87 + * drop membership on all valid interfaces.
88 + */
89 + dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
90 +
91 + /**
92 + * events.EventEmitter
93 + * 1. close
94 + * 2. connect
95 + * 3. error
96 + * 4. listening
97 + * 5. message
98 + */
99 + addListener(event: string, listener: (...args: any[]) => void): this;
100 + addListener(event: "close", listener: () => void): this;
101 + addListener(event: "connect", listener: () => void): this;
102 + addListener(event: "error", listener: (err: Error) => void): this;
103 + addListener(event: "listening", listener: () => void): this;
104 + addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
105 +
106 + emit(event: string | symbol, ...args: any[]): boolean;
107 + emit(event: "close"): boolean;
108 + emit(event: "connect"): boolean;
109 + emit(event: "error", err: Error): boolean;
110 + emit(event: "listening"): boolean;
111 + emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean;
112 +
113 + on(event: string, listener: (...args: any[]) => void): this;
114 + on(event: "close", listener: () => void): this;
115 + on(event: "connect", listener: () => void): this;
116 + on(event: "error", listener: (err: Error) => void): this;
117 + on(event: "listening", listener: () => void): this;
118 + on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
119 +
120 + once(event: string, listener: (...args: any[]) => void): this;
121 + once(event: "close", listener: () => void): this;
122 + once(event: "connect", listener: () => void): this;
123 + once(event: "error", listener: (err: Error) => void): this;
124 + once(event: "listening", listener: () => void): this;
125 + once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
126 +
127 + prependListener(event: string, listener: (...args: any[]) => void): this;
128 + prependListener(event: "close", listener: () => void): this;
129 + prependListener(event: "connect", listener: () => void): this;
130 + prependListener(event: "error", listener: (err: Error) => void): this;
131 + prependListener(event: "listening", listener: () => void): this;
132 + prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
133 +
134 + prependOnceListener(event: string, listener: (...args: any[]) => void): this;
135 + prependOnceListener(event: "close", listener: () => void): this;
136 + prependOnceListener(event: "connect", listener: () => void): this;
137 + prependOnceListener(event: "error", listener: (err: Error) => void): this;
138 + prependOnceListener(event: "listening", listener: () => void): this;
139 + prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
140 + }
141 +}
This diff is collapsed. Click to expand it.
1 +declare module "domain" {
2 + import { EventEmitter } from "events";
3 +
4 + global {
5 + namespace NodeJS {
6 + interface Domain extends EventEmitter {
7 + run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
8 + add(emitter: EventEmitter | Timer): void;
9 + remove(emitter: EventEmitter | Timer): void;
10 + bind<T extends Function>(cb: T): T;
11 + intercept<T extends Function>(cb: T): T;
12 + }
13 + }
14 + }
15 +
16 + interface Domain extends NodeJS.Domain {}
17 + class Domain extends EventEmitter {
18 + members: Array<EventEmitter | NodeJS.Timer>;
19 + enter(): void;
20 + exit(): void;
21 + }
22 +
23 + function create(): Domain;
24 +}
1 +declare module "events" {
2 + interface EventEmitterOptions {
3 + /**
4 + * Enables automatic capturing of promise rejection.
5 + */
6 + captureRejections?: boolean;
7 + }
8 +
9 + interface NodeEventTarget {
10 + once(event: string | symbol, listener: (...args: any[]) => void): this;
11 + }
12 +
13 + interface DOMEventTarget {
14 + addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any;
15 + }
16 +
17 + namespace EventEmitter {
18 + function once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>;
19 + function once(emitter: DOMEventTarget, event: string): Promise<any[]>;
20 + function on(emitter: EventEmitter, event: string): AsyncIterableIterator<any>;
21 + const captureRejectionSymbol: unique symbol;
22 +
23 + /**
24 + * This symbol shall be used to install a listener for only monitoring `'error'`
25 + * events. Listeners installed using this symbol are called before the regular
26 + * `'error'` listeners are called.
27 + *
28 + * Installing a listener using this symbol does not change the behavior once an
29 + * `'error'` event is emitted, therefore the process will still crash if no
30 + * regular `'error'` listener is installed.
31 + */
32 + const errorMonitor: unique symbol;
33 + /**
34 + * Sets or gets the default captureRejection value for all emitters.
35 + */
36 + let captureRejections: boolean;
37 +
38 + interface EventEmitter extends NodeJS.EventEmitter {
39 + }
40 +
41 + class EventEmitter {
42 + constructor(options?: EventEmitterOptions);
43 + /** @deprecated since v4.0.0 */
44 + static listenerCount(emitter: EventEmitter, event: string | symbol): number;
45 + static defaultMaxListeners: number;
46 + /**
47 + * This symbol shall be used to install a listener for only monitoring `'error'`
48 + * events. Listeners installed using this symbol are called before the regular
49 + * `'error'` listeners are called.
50 + *
51 + * Installing a listener using this symbol does not change the behavior once an
52 + * `'error'` event is emitted, therefore the process will still crash if no
53 + * regular `'error'` listener is installed.
54 + */
55 + static readonly errorMonitor: unique symbol;
56 + }
57 + }
58 +
59 + global {
60 + namespace NodeJS {
61 + interface EventEmitter {
62 + addListener(event: string | symbol, listener: (...args: any[]) => void): this;
63 + on(event: string | symbol, listener: (...args: any[]) => void): this;
64 + once(event: string | symbol, listener: (...args: any[]) => void): this;
65 + removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
66 + off(event: string | symbol, listener: (...args: any[]) => void): this;
67 + removeAllListeners(event?: string | symbol): this;
68 + setMaxListeners(n: number): this;
69 + getMaxListeners(): number;
70 + listeners(event: string | symbol): Function[];
71 + rawListeners(event: string | symbol): Function[];
72 + emit(event: string | symbol, ...args: any[]): boolean;
73 + listenerCount(event: string | symbol): number;
74 + // Added in Node 6...
75 + prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
76 + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
77 + eventNames(): Array<string | symbol>;
78 + }
79 + }
80 + }
81 +
82 + export = EventEmitter;
83 +}
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +declare var global: NodeJS.Global & typeof globalThis;
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +declare module "https" {
2 + import * as tls from "tls";
3 + import * as events from "events";
4 + import * as http from "http";
5 + import { URL } from "url";
6 +
7 + type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions;
8 +
9 + type RequestOptions = http.RequestOptions & tls.SecureContextOptions & {
10 + rejectUnauthorized?: boolean; // Defaults to true
11 + servername?: string; // SNI TLS Extension
12 + };
13 +
14 + interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
15 + rejectUnauthorized?: boolean;
16 + maxCachedSessions?: number;
17 + }
18 +
19 + class Agent extends http.Agent {
20 + constructor(options?: AgentOptions);
21 + options: AgentOptions;
22 + }
23 +
24 + interface Server extends http.HttpBase {}
25 + class Server extends tls.Server {
26 + constructor(requestListener?: http.RequestListener);
27 + constructor(options: ServerOptions, requestListener?: http.RequestListener);
28 + }
29 +
30 + function createServer(requestListener?: http.RequestListener): Server;
31 + function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server;
32 + function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
33 + function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
34 + function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
35 + function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest;
36 + let globalAgent: Agent;
37 +}
1 +// Type definitions for non-npm package Node.js 14.14
2 +// Project: http://nodejs.org/
3 +// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4 +// DefinitelyTyped <https://github.com/DefinitelyTyped>
5 +// Alberto Schiabel <https://github.com/jkomyno>
6 +// Alexander T. <https://github.com/a-tarasyuk>
7 +// Alvis HT Tang <https://github.com/alvis>
8 +// Andrew Makarov <https://github.com/r3nya>
9 +// Benjamin Toueg <https://github.com/btoueg>
10 +// Bruno Scheufler <https://github.com/brunoscheufler>
11 +// Chigozirim C. <https://github.com/smac89>
12 +// David Junger <https://github.com/touffy>
13 +// Deividas Bakanas <https://github.com/DeividasBakanas>
14 +// Eugene Y. Q. Shen <https://github.com/eyqs>
15 +// Flarna <https://github.com/Flarna>
16 +// Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>
17 +// Hoàng Văn Khải <https://github.com/KSXGitHub>
18 +// Huw <https://github.com/hoo29>
19 +// Kelvin Jin <https://github.com/kjin>
20 +// Klaus Meinhardt <https://github.com/ajafff>
21 +// Lishude <https://github.com/islishude>
22 +// Mariusz Wiktorczyk <https://github.com/mwiktorczyk>
23 +// Mohsen Azimi <https://github.com/mohsen1>
24 +// Nicolas Even <https://github.com/n-e>
25 +// Nikita Galkin <https://github.com/galkin>
26 +// Parambir Singh <https://github.com/parambirs>
27 +// Sebastian Silbermann <https://github.com/eps1lon>
28 +// Simon Schick <https://github.com/SimonSchick>
29 +// Thomas den Hollander <https://github.com/ThomasdenH>
30 +// Wilco Bakker <https://github.com/WilcoBakker>
31 +// wwwy3y3 <https://github.com/wwwy3y3>
32 +// Samuel Ainsworth <https://github.com/samuela>
33 +// Kyle Uehlein <https://github.com/kuehlein>
34 +// Jordi Oliveras Rovira <https://github.com/j-oliveras>
35 +// Thanik Bhongbhibhat <https://github.com/bhongy>
36 +// Marcin Kopacz <https://github.com/chyzwar>
37 +// Trivikram Kamat <https://github.com/trivikr>
38 +// Minh Son Nguyen <https://github.com/nguymin4>
39 +// Junxiao Shi <https://github.com/yoursunny>
40 +// Ilia Baryshnikov <https://github.com/qwelias>
41 +// ExE Boss <https://github.com/ExE-Boss>
42 +// Surasak Chaisurin <https://github.com/Ryan-Willpower>
43 +// Piotr Błażejewicz <https://github.com/peterblazejewicz>
44 +// Anna Henningsen <https://github.com/addaleax>
45 +// Jason Kwok <https://github.com/JasonHK>
46 +// Victor Perin <https://github.com/victorperin>
47 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
48 +
49 +// NOTE: These definitions support NodeJS and TypeScript 3.7.
50 +// Typically type modifications should be made in base.d.ts instead of here
51 +
52 +/// <reference path="base.d.ts" />
53 +
54 +// NOTE: TypeScript version-specific augmentations can be found in the following paths:
55 +// - ~/base.d.ts - Shared definitions common to all TypeScript versions
56 +// - ~/index.d.ts - Definitions specific to TypeScript 2.8
57 +// - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5
58 +
59 +// NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides
60 +// within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions
61 +// prior to TypeScript 3.5, so the older definitions will be found here.
This diff could not be displayed because it is too large.
1 +declare module "module" {
2 + import { URL } from "url";
3 + namespace Module {
4 + /**
5 + * Updates all the live bindings for builtin ES Modules to match the properties of the CommonJS exports.
6 + * It does not add or remove exported names from the ES Modules.
7 + */
8 + function syncBuiltinESMExports(): void;
9 +
10 + function findSourceMap(path: string, error?: Error): SourceMap;
11 + interface SourceMapPayload {
12 + file: string;
13 + version: number;
14 + sources: string[];
15 + sourcesContent: string[];
16 + names: string[];
17 + mappings: string;
18 + sourceRoot: string;
19 + }
20 +
21 + interface SourceMapping {
22 + generatedLine: number;
23 + generatedColumn: number;
24 + originalSource: string;
25 + originalLine: number;
26 + originalColumn: number;
27 + }
28 +
29 + class SourceMap {
30 + readonly payload: SourceMapPayload;
31 + constructor(payload: SourceMapPayload);
32 + findEntry(line: number, column: number): SourceMapping;
33 + }
34 + }
35 + interface Module extends NodeModule {}
36 + class Module {
37 + static runMain(): void;
38 + static wrap(code: string): string;
39 +
40 + /**
41 + * @deprecated Deprecated since: v12.2.0. Please use createRequire() instead.
42 + */
43 + static createRequireFromPath(path: string): NodeRequire;
44 + static createRequire(path: string | URL): NodeRequire;
45 + static builtinModules: string[];
46 +
47 + static Module: typeof Module;
48 +
49 + constructor(id: string, parent?: Module);
50 + }
51 + export = Module;
52 +}
This diff is collapsed. Click to expand it.
1 +declare module "os" {
2 + interface CpuInfo {
3 + model: string;
4 + speed: number;
5 + times: {
6 + user: number;
7 + nice: number;
8 + sys: number;
9 + idle: number;
10 + irq: number;
11 + };
12 + }
13 +
14 + interface NetworkInterfaceBase {
15 + address: string;
16 + netmask: string;
17 + mac: string;
18 + internal: boolean;
19 + cidr: string | null;
20 + }
21 +
22 + interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
23 + family: "IPv4";
24 + }
25 +
26 + interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
27 + family: "IPv6";
28 + scopeid: number;
29 + }
30 +
31 + interface UserInfo<T> {
32 + username: T;
33 + uid: number;
34 + gid: number;
35 + shell: T;
36 + homedir: T;
37 + }
38 +
39 + type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
40 +
41 + function hostname(): string;
42 + function loadavg(): number[];
43 + function uptime(): number;
44 + function freemem(): number;
45 + function totalmem(): number;
46 + function cpus(): CpuInfo[];
47 + function type(): string;
48 + function release(): string;
49 + function networkInterfaces(): NodeJS.Dict<NetworkInterfaceInfo[]>;
50 + function homedir(): string;
51 + function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
52 + function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
53 +
54 + type SignalConstants = {
55 + [key in NodeJS.Signals]: number;
56 + };
57 +
58 + namespace constants {
59 + const UV_UDP_REUSEADDR: number;
60 + namespace signals {}
61 + const signals: SignalConstants;
62 + namespace errno {
63 + const E2BIG: number;
64 + const EACCES: number;
65 + const EADDRINUSE: number;
66 + const EADDRNOTAVAIL: number;
67 + const EAFNOSUPPORT: number;
68 + const EAGAIN: number;
69 + const EALREADY: number;
70 + const EBADF: number;
71 + const EBADMSG: number;
72 + const EBUSY: number;
73 + const ECANCELED: number;
74 + const ECHILD: number;
75 + const ECONNABORTED: number;
76 + const ECONNREFUSED: number;
77 + const ECONNRESET: number;
78 + const EDEADLK: number;
79 + const EDESTADDRREQ: number;
80 + const EDOM: number;
81 + const EDQUOT: number;
82 + const EEXIST: number;
83 + const EFAULT: number;
84 + const EFBIG: number;
85 + const EHOSTUNREACH: number;
86 + const EIDRM: number;
87 + const EILSEQ: number;
88 + const EINPROGRESS: number;
89 + const EINTR: number;
90 + const EINVAL: number;
91 + const EIO: number;
92 + const EISCONN: number;
93 + const EISDIR: number;
94 + const ELOOP: number;
95 + const EMFILE: number;
96 + const EMLINK: number;
97 + const EMSGSIZE: number;
98 + const EMULTIHOP: number;
99 + const ENAMETOOLONG: number;
100 + const ENETDOWN: number;
101 + const ENETRESET: number;
102 + const ENETUNREACH: number;
103 + const ENFILE: number;
104 + const ENOBUFS: number;
105 + const ENODATA: number;
106 + const ENODEV: number;
107 + const ENOENT: number;
108 + const ENOEXEC: number;
109 + const ENOLCK: number;
110 + const ENOLINK: number;
111 + const ENOMEM: number;
112 + const ENOMSG: number;
113 + const ENOPROTOOPT: number;
114 + const ENOSPC: number;
115 + const ENOSR: number;
116 + const ENOSTR: number;
117 + const ENOSYS: number;
118 + const ENOTCONN: number;
119 + const ENOTDIR: number;
120 + const ENOTEMPTY: number;
121 + const ENOTSOCK: number;
122 + const ENOTSUP: number;
123 + const ENOTTY: number;
124 + const ENXIO: number;
125 + const EOPNOTSUPP: number;
126 + const EOVERFLOW: number;
127 + const EPERM: number;
128 + const EPIPE: number;
129 + const EPROTO: number;
130 + const EPROTONOSUPPORT: number;
131 + const EPROTOTYPE: number;
132 + const ERANGE: number;
133 + const EROFS: number;
134 + const ESPIPE: number;
135 + const ESRCH: number;
136 + const ESTALE: number;
137 + const ETIME: number;
138 + const ETIMEDOUT: number;
139 + const ETXTBSY: number;
140 + const EWOULDBLOCK: number;
141 + const EXDEV: number;
142 + const WSAEINTR: number;
143 + const WSAEBADF: number;
144 + const WSAEACCES: number;
145 + const WSAEFAULT: number;
146 + const WSAEINVAL: number;
147 + const WSAEMFILE: number;
148 + const WSAEWOULDBLOCK: number;
149 + const WSAEINPROGRESS: number;
150 + const WSAEALREADY: number;
151 + const WSAENOTSOCK: number;
152 + const WSAEDESTADDRREQ: number;
153 + const WSAEMSGSIZE: number;
154 + const WSAEPROTOTYPE: number;
155 + const WSAENOPROTOOPT: number;
156 + const WSAEPROTONOSUPPORT: number;
157 + const WSAESOCKTNOSUPPORT: number;
158 + const WSAEOPNOTSUPP: number;
159 + const WSAEPFNOSUPPORT: number;
160 + const WSAEAFNOSUPPORT: number;
161 + const WSAEADDRINUSE: number;
162 + const WSAEADDRNOTAVAIL: number;
163 + const WSAENETDOWN: number;
164 + const WSAENETUNREACH: number;
165 + const WSAENETRESET: number;
166 + const WSAECONNABORTED: number;
167 + const WSAECONNRESET: number;
168 + const WSAENOBUFS: number;
169 + const WSAEISCONN: number;
170 + const WSAENOTCONN: number;
171 + const WSAESHUTDOWN: number;
172 + const WSAETOOMANYREFS: number;
173 + const WSAETIMEDOUT: number;
174 + const WSAECONNREFUSED: number;
175 + const WSAELOOP: number;
176 + const WSAENAMETOOLONG: number;
177 + const WSAEHOSTDOWN: number;
178 + const WSAEHOSTUNREACH: number;
179 + const WSAENOTEMPTY: number;
180 + const WSAEPROCLIM: number;
181 + const WSAEUSERS: number;
182 + const WSAEDQUOT: number;
183 + const WSAESTALE: number;
184 + const WSAEREMOTE: number;
185 + const WSASYSNOTREADY: number;
186 + const WSAVERNOTSUPPORTED: number;
187 + const WSANOTINITIALISED: number;
188 + const WSAEDISCON: number;
189 + const WSAENOMORE: number;
190 + const WSAECANCELLED: number;
191 + const WSAEINVALIDPROCTABLE: number;
192 + const WSAEINVALIDPROVIDER: number;
193 + const WSAEPROVIDERFAILEDINIT: number;
194 + const WSASYSCALLFAILURE: number;
195 + const WSASERVICE_NOT_FOUND: number;
196 + const WSATYPE_NOT_FOUND: number;
197 + const WSA_E_NO_MORE: number;
198 + const WSA_E_CANCELLED: number;
199 + const WSAEREFUSED: number;
200 + }
201 + namespace priority {
202 + const PRIORITY_LOW: number;
203 + const PRIORITY_BELOW_NORMAL: number;
204 + const PRIORITY_NORMAL: number;
205 + const PRIORITY_ABOVE_NORMAL: number;
206 + const PRIORITY_HIGH: number;
207 + const PRIORITY_HIGHEST: number;
208 + }
209 + }
210 +
211 + function arch(): string;
212 + /**
213 + * Returns a string identifying the kernel version.
214 + * On POSIX systems, the operating system release is determined by calling
215 + * [uname(3)][]. On Windows, `pRtlGetVersion` is used, and if it is not available,
216 + * `GetVersionExW()` will be used. See
217 + * https://en.wikipedia.org/wiki/Uname#Examples for more information.
218 + */
219 + function version(): string;
220 + function platform(): NodeJS.Platform;
221 + function tmpdir(): string;
222 + const EOL: string;
223 + function endianness(): "BE" | "LE";
224 + /**
225 + * Gets the priority of a process.
226 + * Defaults to current process.
227 + */
228 + function getPriority(pid?: number): number;
229 + /**
230 + * Sets the priority of the current process.
231 + * @param priority Must be in range of -20 to 19
232 + */
233 + function setPriority(priority: number): void;
234 + /**
235 + * Sets the priority of the process specified process.
236 + * @param priority Must be in range of -20 to 19
237 + */
238 + function setPriority(pid: number, priority: number): void;
239 +}
1 +{
2 + "_from": "@types/node@*",
3 + "_id": "@types/node@14.14.13",
4 + "_inBundle": false,
5 + "_integrity": "sha512-vbxr0VZ8exFMMAjCW8rJwaya0dMCDyYW2ZRdTyjtrCvJoENMpdUHOT/eTzvgyA5ZnqRZ/sI0NwqAxNHKYokLJQ==",
6 + "_location": "/@types/node",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@types/node@*",
12 + "name": "@types/node",
13 + "escapedName": "@types%2fnode",
14 + "scope": "@types",
15 + "rawSpec": "*",
16 + "saveSpec": null,
17 + "fetchSpec": "*"
18 + },
19 + "_requiredBy": [
20 + "/wkx"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.13.tgz",
23 + "_shasum": "9e425079799322113ae8477297ae6ef51b8e0cdf",
24 + "_spec": "@types/node@*",
25 + "_where": "C:\\Users\\gther\\Desktop\\projects\\capston2\\node_modules\\wkx",
26 + "bugs": {
27 + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
28 + },
29 + "bundleDependencies": false,
30 + "contributors": [
31 + {
32 + "name": "Microsoft TypeScript",
33 + "url": "https://github.com/Microsoft"
34 + },
35 + {
36 + "name": "DefinitelyTyped",
37 + "url": "https://github.com/DefinitelyTyped"
38 + },
39 + {
40 + "name": "Alberto Schiabel",
41 + "url": "https://github.com/jkomyno"
42 + },
43 + {
44 + "name": "Alexander T.",
45 + "url": "https://github.com/a-tarasyuk"
46 + },
47 + {
48 + "name": "Alvis HT Tang",
49 + "url": "https://github.com/alvis"
50 + },
51 + {
52 + "name": "Andrew Makarov",
53 + "url": "https://github.com/r3nya"
54 + },
55 + {
56 + "name": "Benjamin Toueg",
57 + "url": "https://github.com/btoueg"
58 + },
59 + {
60 + "name": "Bruno Scheufler",
61 + "url": "https://github.com/brunoscheufler"
62 + },
63 + {
64 + "name": "Chigozirim C.",
65 + "url": "https://github.com/smac89"
66 + },
67 + {
68 + "name": "David Junger",
69 + "url": "https://github.com/touffy"
70 + },
71 + {
72 + "name": "Deividas Bakanas",
73 + "url": "https://github.com/DeividasBakanas"
74 + },
75 + {
76 + "name": "Eugene Y. Q. Shen",
77 + "url": "https://github.com/eyqs"
78 + },
79 + {
80 + "name": "Flarna",
81 + "url": "https://github.com/Flarna"
82 + },
83 + {
84 + "name": "Hannes Magnusson",
85 + "url": "https://github.com/Hannes-Magnusson-CK"
86 + },
87 + {
88 + "name": "Hoàng Văn Khải",
89 + "url": "https://github.com/KSXGitHub"
90 + },
91 + {
92 + "name": "Huw",
93 + "url": "https://github.com/hoo29"
94 + },
95 + {
96 + "name": "Kelvin Jin",
97 + "url": "https://github.com/kjin"
98 + },
99 + {
100 + "name": "Klaus Meinhardt",
101 + "url": "https://github.com/ajafff"
102 + },
103 + {
104 + "name": "Lishude",
105 + "url": "https://github.com/islishude"
106 + },
107 + {
108 + "name": "Mariusz Wiktorczyk",
109 + "url": "https://github.com/mwiktorczyk"
110 + },
111 + {
112 + "name": "Mohsen Azimi",
113 + "url": "https://github.com/mohsen1"
114 + },
115 + {
116 + "name": "Nicolas Even",
117 + "url": "https://github.com/n-e"
118 + },
119 + {
120 + "name": "Nikita Galkin",
121 + "url": "https://github.com/galkin"
122 + },
123 + {
124 + "name": "Parambir Singh",
125 + "url": "https://github.com/parambirs"
126 + },
127 + {
128 + "name": "Sebastian Silbermann",
129 + "url": "https://github.com/eps1lon"
130 + },
131 + {
132 + "name": "Simon Schick",
133 + "url": "https://github.com/SimonSchick"
134 + },
135 + {
136 + "name": "Thomas den Hollander",
137 + "url": "https://github.com/ThomasdenH"
138 + },
139 + {
140 + "name": "Wilco Bakker",
141 + "url": "https://github.com/WilcoBakker"
142 + },
143 + {
144 + "name": "wwwy3y3",
145 + "url": "https://github.com/wwwy3y3"
146 + },
147 + {
148 + "name": "Samuel Ainsworth",
149 + "url": "https://github.com/samuela"
150 + },
151 + {
152 + "name": "Kyle Uehlein",
153 + "url": "https://github.com/kuehlein"
154 + },
155 + {
156 + "name": "Jordi Oliveras Rovira",
157 + "url": "https://github.com/j-oliveras"
158 + },
159 + {
160 + "name": "Thanik Bhongbhibhat",
161 + "url": "https://github.com/bhongy"
162 + },
163 + {
164 + "name": "Marcin Kopacz",
165 + "url": "https://github.com/chyzwar"
166 + },
167 + {
168 + "name": "Trivikram Kamat",
169 + "url": "https://github.com/trivikr"
170 + },
171 + {
172 + "name": "Minh Son Nguyen",
173 + "url": "https://github.com/nguymin4"
174 + },
175 + {
176 + "name": "Junxiao Shi",
177 + "url": "https://github.com/yoursunny"
178 + },
179 + {
180 + "name": "Ilia Baryshnikov",
181 + "url": "https://github.com/qwelias"
182 + },
183 + {
184 + "name": "ExE Boss",
185 + "url": "https://github.com/ExE-Boss"
186 + },
187 + {
188 + "name": "Surasak Chaisurin",
189 + "url": "https://github.com/Ryan-Willpower"
190 + },
191 + {
192 + "name": "Piotr Błażejewicz",
193 + "url": "https://github.com/peterblazejewicz"
194 + },
195 + {
196 + "name": "Anna Henningsen",
197 + "url": "https://github.com/addaleax"
198 + },
199 + {
200 + "name": "Jason Kwok",
201 + "url": "https://github.com/JasonHK"
202 + },
203 + {
204 + "name": "Victor Perin",
205 + "url": "https://github.com/victorperin"
206 + }
207 + ],
208 + "dependencies": {},
209 + "deprecated": false,
210 + "description": "TypeScript definitions for Node.js",
211 + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
212 + "license": "MIT",
213 + "main": "",
214 + "name": "@types/node",
215 + "repository": {
216 + "type": "git",
217 + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
218 + "directory": "types/node"
219 + },
220 + "scripts": {},
221 + "typeScriptVersion": "3.3",
222 + "types": "index.d.ts",
223 + "typesPublisherContentHash": "2d2baa6ba176af581ab0526fbd1ecf8426794040c566cca82cf3f03d6778229f",
224 + "typesVersions": {
225 + "<=3.4": {
226 + "*": [
227 + "ts3.4/*"
228 + ]
229 + },
230 + "<=3.6": {
231 + "*": [
232 + "ts3.6/*"
233 + ]
234 + }
235 + },
236 + "version": "14.14.13"
237 +}
1 +declare module "path" {
2 + namespace path {
3 + /**
4 + * A parsed path object generated by path.parse() or consumed by path.format().
5 + */
6 + interface ParsedPath {
7 + /**
8 + * The root of the path such as '/' or 'c:\'
9 + */
10 + root: string;
11 + /**
12 + * The full directory path such as '/home/user/dir' or 'c:\path\dir'
13 + */
14 + dir: string;
15 + /**
16 + * The file name including extension (if any) such as 'index.html'
17 + */
18 + base: string;
19 + /**
20 + * The file extension (if any) such as '.html'
21 + */
22 + ext: string;
23 + /**
24 + * The file name without extension (if any) such as 'index'
25 + */
26 + name: string;
27 + }
28 +
29 + interface FormatInputPathObject {
30 + /**
31 + * The root of the path such as '/' or 'c:\'
32 + */
33 + root?: string;
34 + /**
35 + * The full directory path such as '/home/user/dir' or 'c:\path\dir'
36 + */
37 + dir?: string;
38 + /**
39 + * The file name including extension (if any) such as 'index.html'
40 + */
41 + base?: string;
42 + /**
43 + * The file extension (if any) such as '.html'
44 + */
45 + ext?: string;
46 + /**
47 + * The file name without extension (if any) such as 'index'
48 + */
49 + name?: string;
50 + }
51 +
52 + interface PlatformPath {
53 + /**
54 + * Normalize a string path, reducing '..' and '.' parts.
55 + * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
56 + *
57 + * @param p string path to normalize.
58 + */
59 + normalize(p: string): string;
60 + /**
61 + * Join all arguments together and normalize the resulting path.
62 + * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
63 + *
64 + * @param paths paths to join.
65 + */
66 + join(...paths: string[]): string;
67 + /**
68 + * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
69 + *
70 + * Starting from leftmost {from} parameter, resolves {to} to an absolute path.
71 + *
72 + * If {to} isn't already absolute, {from} arguments are prepended in right to left order,
73 + * until an absolute path is found. If after using all {from} paths still no absolute path is found,
74 + * the current working directory is used as well. The resulting path is normalized,
75 + * and trailing slashes are removed unless the path gets resolved to the root directory.
76 + *
77 + * @param pathSegments string paths to join. Non-string arguments are ignored.
78 + */
79 + resolve(...pathSegments: string[]): string;
80 + /**
81 + * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
82 + *
83 + * @param path path to test.
84 + */
85 + isAbsolute(p: string): boolean;
86 + /**
87 + * Solve the relative path from {from} to {to}.
88 + * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
89 + */
90 + relative(from: string, to: string): string;
91 + /**
92 + * Return the directory name of a path. Similar to the Unix dirname command.
93 + *
94 + * @param p the path to evaluate.
95 + */
96 + dirname(p: string): string;
97 + /**
98 + * Return the last portion of a path. Similar to the Unix basename command.
99 + * Often used to extract the file name from a fully qualified path.
100 + *
101 + * @param p the path to evaluate.
102 + * @param ext optionally, an extension to remove from the result.
103 + */
104 + basename(p: string, ext?: string): string;
105 + /**
106 + * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
107 + * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string
108 + *
109 + * @param p the path to evaluate.
110 + */
111 + extname(p: string): string;
112 + /**
113 + * The platform-specific file separator. '\\' or '/'.
114 + */
115 + readonly sep: string;
116 + /**
117 + * The platform-specific file delimiter. ';' or ':'.
118 + */
119 + readonly delimiter: string;
120 + /**
121 + * Returns an object from a path string - the opposite of format().
122 + *
123 + * @param pathString path to evaluate.
124 + */
125 + parse(p: string): ParsedPath;
126 + /**
127 + * Returns a path string from an object - the opposite of parse().
128 + *
129 + * @param pathString path to evaluate.
130 + */
131 + format(pP: FormatInputPathObject): string;
132 + /**
133 + * On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
134 + * If path is not a string, path will be returned without modifications.
135 + * This method is meaningful only on Windows system.
136 + * On POSIX systems, the method is non-operational and always returns path without modifications.
137 + */
138 + toNamespacedPath(path: string): string;
139 + /**
140 + * Posix specific pathing.
141 + * Same as parent object on posix.
142 + */
143 + readonly posix: PlatformPath;
144 + /**
145 + * Windows specific pathing.
146 + * Same as parent object on windows
147 + */
148 + readonly win32: PlatformPath;
149 + }
150 + }
151 + const path: path.PlatformPath;
152 + export = path;
153 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +declare module "punycode" {
2 + /**
3 + * @deprecated since v7.0.0
4 + * The version of the punycode module bundled in Node.js is being deprecated.
5 + * In a future major version of Node.js this module will be removed.
6 + * Users currently depending on the punycode module should switch to using
7 + * the userland-provided Punycode.js module instead.
8 + */
9 + function decode(string: string): string;
10 + /**
11 + * @deprecated since v7.0.0
12 + * The version of the punycode module bundled in Node.js is being deprecated.
13 + * In a future major version of Node.js this module will be removed.
14 + * Users currently depending on the punycode module should switch to using
15 + * the userland-provided Punycode.js module instead.
16 + */
17 + function encode(string: string): string;
18 + /**
19 + * @deprecated since v7.0.0
20 + * The version of the punycode module bundled in Node.js is being deprecated.
21 + * In a future major version of Node.js this module will be removed.
22 + * Users currently depending on the punycode module should switch to using
23 + * the userland-provided Punycode.js module instead.
24 + */
25 + function toUnicode(domain: string): string;
26 + /**
27 + * @deprecated since v7.0.0
28 + * The version of the punycode module bundled in Node.js is being deprecated.
29 + * In a future major version of Node.js this module will be removed.
30 + * Users currently depending on the punycode module should switch to using
31 + * the userland-provided Punycode.js module instead.
32 + */
33 + function toASCII(domain: string): string;
34 + /**
35 + * @deprecated since v7.0.0
36 + * The version of the punycode module bundled in Node.js is being deprecated.
37 + * In a future major version of Node.js this module will be removed.
38 + * Users currently depending on the punycode module should switch to using
39 + * the userland-provided Punycode.js module instead.
40 + */
41 + const ucs2: ucs2;
42 + interface ucs2 {
43 + /**
44 + * @deprecated since v7.0.0
45 + * The version of the punycode module bundled in Node.js is being deprecated.
46 + * In a future major version of Node.js this module will be removed.
47 + * Users currently depending on the punycode module should switch to using
48 + * the userland-provided Punycode.js module instead.
49 + */
50 + decode(string: string): number[];
51 + /**
52 + * @deprecated since v7.0.0
53 + * The version of the punycode module bundled in Node.js is being deprecated.
54 + * In a future major version of Node.js this module will be removed.
55 + * Users currently depending on the punycode module should switch to using
56 + * the userland-provided Punycode.js module instead.
57 + */
58 + encode(codePoints: ReadonlyArray<number>): string;
59 + }
60 + /**
61 + * @deprecated since v7.0.0
62 + * The version of the punycode module bundled in Node.js is being deprecated.
63 + * In a future major version of Node.js this module will be removed.
64 + * Users currently depending on the punycode module should switch to using
65 + * the userland-provided Punycode.js module instead.
66 + */
67 + const version: string;
68 +}
1 +declare module "querystring" {
2 + interface StringifyOptions {
3 + encodeURIComponent?: (str: string) => string;
4 + }
5 +
6 + interface ParseOptions {
7 + maxKeys?: number;
8 + decodeURIComponent?: (str: string) => string;
9 + }
10 +
11 + interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> { }
12 +
13 + interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {
14 + }
15 +
16 + function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
17 + function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
18 + /**
19 + * The querystring.encode() function is an alias for querystring.stringify().
20 + */
21 + const encode: typeof stringify;
22 + /**
23 + * The querystring.decode() function is an alias for querystring.parse().
24 + */
25 + const decode: typeof parse;
26 + function escape(str: string): string;
27 + function unescape(str: string): string;
28 +}
1 +declare module "readline" {
2 + import * as events from "events";
3 + import * as stream from "stream";
4 +
5 + interface Key {
6 + sequence?: string;
7 + name?: string;
8 + ctrl?: boolean;
9 + meta?: boolean;
10 + shift?: boolean;
11 + }
12 +
13 + class Interface extends events.EventEmitter {
14 + readonly terminal: boolean;
15 +
16 + // Need direct access to line/cursor data, for use in external processes
17 + // see: https://github.com/nodejs/node/issues/30347
18 + /** The current input data */
19 + readonly line: string;
20 + /** The current cursor position in the input line */
21 + readonly cursor: number;
22 +
23 + /**
24 + * NOTE: According to the documentation:
25 + *
26 + * > Instances of the `readline.Interface` class are constructed using the
27 + * > `readline.createInterface()` method.
28 + *
29 + * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
30 + */
31 + protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean);
32 + /**
33 + * NOTE: According to the documentation:
34 + *
35 + * > Instances of the `readline.Interface` class are constructed using the
36 + * > `readline.createInterface()` method.
37 + *
38 + * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
39 + */
40 + protected constructor(options: ReadLineOptions);
41 +
42 + setPrompt(prompt: string): void;
43 + prompt(preserveCursor?: boolean): void;
44 + question(query: string, callback: (answer: string) => void): void;
45 + pause(): this;
46 + resume(): this;
47 + close(): void;
48 + write(data: string | Buffer, key?: Key): void;
49 +
50 + /**
51 + * Returns the real position of the cursor in relation to the input
52 + * prompt + string. Long input (wrapping) strings, as well as multiple
53 + * line prompts are included in the calculations.
54 + */
55 + getCursorPos(): CursorPos;
56 +
57 + /**
58 + * events.EventEmitter
59 + * 1. close
60 + * 2. line
61 + * 3. pause
62 + * 4. resume
63 + * 5. SIGCONT
64 + * 6. SIGINT
65 + * 7. SIGTSTP
66 + */
67 +
68 + addListener(event: string, listener: (...args: any[]) => void): this;
69 + addListener(event: "close", listener: () => void): this;
70 + addListener(event: "line", listener: (input: string) => void): this;
71 + addListener(event: "pause", listener: () => void): this;
72 + addListener(event: "resume", listener: () => void): this;
73 + addListener(event: "SIGCONT", listener: () => void): this;
74 + addListener(event: "SIGINT", listener: () => void): this;
75 + addListener(event: "SIGTSTP", listener: () => void): this;
76 +
77 + emit(event: string | symbol, ...args: any[]): boolean;
78 + emit(event: "close"): boolean;
79 + emit(event: "line", input: string): boolean;
80 + emit(event: "pause"): boolean;
81 + emit(event: "resume"): boolean;
82 + emit(event: "SIGCONT"): boolean;
83 + emit(event: "SIGINT"): boolean;
84 + emit(event: "SIGTSTP"): boolean;
85 +
86 + on(event: string, listener: (...args: any[]) => void): this;
87 + on(event: "close", listener: () => void): this;
88 + on(event: "line", listener: (input: string) => void): this;
89 + on(event: "pause", listener: () => void): this;
90 + on(event: "resume", listener: () => void): this;
91 + on(event: "SIGCONT", listener: () => void): this;
92 + on(event: "SIGINT", listener: () => void): this;
93 + on(event: "SIGTSTP", listener: () => void): this;
94 +
95 + once(event: string, listener: (...args: any[]) => void): this;
96 + once(event: "close", listener: () => void): this;
97 + once(event: "line", listener: (input: string) => void): this;
98 + once(event: "pause", listener: () => void): this;
99 + once(event: "resume", listener: () => void): this;
100 + once(event: "SIGCONT", listener: () => void): this;
101 + once(event: "SIGINT", listener: () => void): this;
102 + once(event: "SIGTSTP", listener: () => void): this;
103 +
104 + prependListener(event: string, listener: (...args: any[]) => void): this;
105 + prependListener(event: "close", listener: () => void): this;
106 + prependListener(event: "line", listener: (input: string) => void): this;
107 + prependListener(event: "pause", listener: () => void): this;
108 + prependListener(event: "resume", listener: () => void): this;
109 + prependListener(event: "SIGCONT", listener: () => void): this;
110 + prependListener(event: "SIGINT", listener: () => void): this;
111 + prependListener(event: "SIGTSTP", listener: () => void): this;
112 +
113 + prependOnceListener(event: string, listener: (...args: any[]) => void): this;
114 + prependOnceListener(event: "close", listener: () => void): this;
115 + prependOnceListener(event: "line", listener: (input: string) => void): this;
116 + prependOnceListener(event: "pause", listener: () => void): this;
117 + prependOnceListener(event: "resume", listener: () => void): this;
118 + prependOnceListener(event: "SIGCONT", listener: () => void): this;
119 + prependOnceListener(event: "SIGINT", listener: () => void): this;
120 + prependOnceListener(event: "SIGTSTP", listener: () => void): this;
121 + [Symbol.asyncIterator](): AsyncIterableIterator<string>;
122 + }
123 +
124 + type ReadLine = Interface; // type forwarded for backwards compatiblity
125 +
126 + type Completer = (line: string) => CompleterResult;
127 + type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => any;
128 +
129 + type CompleterResult = [string[], string];
130 +
131 + interface ReadLineOptions {
132 + input: NodeJS.ReadableStream;
133 + output?: NodeJS.WritableStream;
134 + completer?: Completer | AsyncCompleter;
135 + terminal?: boolean;
136 + historySize?: number;
137 + prompt?: string;
138 + crlfDelay?: number;
139 + removeHistoryDuplicates?: boolean;
140 + escapeCodeTimeout?: number;
141 + tabSize?: number;
142 + }
143 +
144 + function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
145 + function createInterface(options: ReadLineOptions): Interface;
146 + function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
147 +
148 + type Direction = -1 | 0 | 1;
149 +
150 + interface CursorPos {
151 + rows: number;
152 + cols: number;
153 + }
154 +
155 + /**
156 + * Clears the current line of this WriteStream in a direction identified by `dir`.
157 + */
158 + function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
159 + /**
160 + * Clears this `WriteStream` from the current cursor down.
161 + */
162 + function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
163 + /**
164 + * Moves this WriteStream's cursor to the specified position.
165 + */
166 + function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
167 + /**
168 + * Moves this WriteStream's cursor relative to its current position.
169 + */
170 + function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
171 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +declare module "string_decoder" {
2 + class StringDecoder {
3 + constructor(encoding?: BufferEncoding);
4 + write(buffer: Buffer): string;
5 + end(buffer?: Buffer): string;
6 + }
7 +}
1 +declare module "timers" {
2 + function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
3 + namespace setTimeout {
4 + function __promisify__(ms: number): Promise<void>;
5 + function __promisify__<T>(ms: number, value: T): Promise<T>;
6 + }
7 + function clearTimeout(timeoutId: NodeJS.Timeout): void;
8 + function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
9 + function clearInterval(intervalId: NodeJS.Timeout): void;
10 + function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
11 + namespace setImmediate {
12 + function __promisify__(): Promise<void>;
13 + function __promisify__<T>(value: T): Promise<T>;
14 + }
15 + function clearImmediate(immediateId: NodeJS.Immediate): void;
16 +}
This diff is collapsed. Click to expand it.
1 +declare module "trace_events" {
2 + /**
3 + * The `Tracing` object is used to enable or disable tracing for sets of
4 + * categories. Instances are created using the
5 + * `trace_events.createTracing()` method.
6 + *
7 + * When created, the `Tracing` object is disabled. Calling the
8 + * `tracing.enable()` method adds the categories to the set of enabled trace
9 + * event categories. Calling `tracing.disable()` will remove the categories
10 + * from the set of enabled trace event categories.
11 + */
12 + interface Tracing {
13 + /**
14 + * A comma-separated list of the trace event categories covered by this
15 + * `Tracing` object.
16 + */
17 + readonly categories: string;
18 +
19 + /**
20 + * Disables this `Tracing` object.
21 + *
22 + * Only trace event categories _not_ covered by other enabled `Tracing`
23 + * objects and _not_ specified by the `--trace-event-categories` flag
24 + * will be disabled.
25 + */
26 + disable(): void;
27 +
28 + /**
29 + * Enables this `Tracing` object for the set of categories covered by
30 + * the `Tracing` object.
31 + */
32 + enable(): void;
33 +
34 + /**
35 + * `true` only if the `Tracing` object has been enabled.
36 + */
37 + readonly enabled: boolean;
38 + }
39 +
40 + interface CreateTracingOptions {
41 + /**
42 + * An array of trace category names. Values included in the array are
43 + * coerced to a string when possible. An error will be thrown if the
44 + * value cannot be coerced.
45 + */
46 + categories: string[];
47 + }
48 +
49 + /**
50 + * Creates and returns a Tracing object for the given set of categories.
51 + */
52 + function createTracing(options: CreateTracingOptions): Tracing;
53 +
54 + /**
55 + * Returns a comma-separated list of all currently-enabled trace event
56 + * categories. The current set of enabled trace event categories is
57 + * determined by the union of all currently-enabled `Tracing` objects and
58 + * any categories enabled using the `--trace-event-categories` flag.
59 + */
60 + function getEnabledCategories(): string | undefined;
61 +}
1 +declare module 'assert' {
2 + /** An alias of `assert.ok()`. */
3 + function assert(value: any, message?: string | Error): void;
4 + namespace assert {
5 + class AssertionError implements Error {
6 + name: string;
7 + message: string;
8 + actual: any;
9 + expected: any;
10 + operator: string;
11 + generatedMessage: boolean;
12 + code: 'ERR_ASSERTION';
13 +
14 + constructor(options?: {
15 + /** If provided, the error message is set to this value. */
16 + message?: string;
17 + /** The `actual` property on the error instance. */
18 + actual?: any;
19 + /** The `expected` property on the error instance. */
20 + expected?: any;
21 + /** The `operator` property on the error instance. */
22 + operator?: string;
23 + /** If provided, the generated stack trace omits frames before this function. */
24 + // tslint:disable-next-line:ban-types
25 + stackStartFn?: Function;
26 + });
27 + }
28 +
29 + class CallTracker {
30 + calls(exact?: number): () => void;
31 + calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
32 + report(): CallTrackerReportInformation[];
33 + verify(): void;
34 + }
35 + interface CallTrackerReportInformation {
36 + message: string;
37 + /** The actual number of times the function was called. */
38 + actual: number;
39 + /** The number of times the function was expected to be called. */
40 + expected: number;
41 + /** The name of the function that is wrapped. */
42 + operator: string;
43 + /** A stack trace of the function. */
44 + stack: object;
45 + }
46 +
47 + type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error;
48 +
49 + function fail(message?: string | Error): never;
50 + /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
51 + function fail(
52 + actual: any,
53 + expected: any,
54 + message?: string | Error,
55 + operator?: string,
56 + // tslint:disable-next-line:ban-types
57 + stackStartFn?: Function,
58 + ): never;
59 + function ok(value: any, message?: string | Error): void;
60 + /** @deprecated since v9.9.0 - use strictEqual() instead. */
61 + function equal(actual: any, expected: any, message?: string | Error): void;
62 + /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
63 + function notEqual(actual: any, expected: any, message?: string | Error): void;
64 + /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
65 + function deepEqual(actual: any, expected: any, message?: string | Error): void;
66 + /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
67 + function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
68 + function strictEqual(actual: any, expected: any, message?: string | Error): void;
69 + function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
70 + function deepStrictEqual(actual: any, expected: any, message?: string | Error): void;
71 + function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
72 +
73 + function throws(block: () => any, message?: string | Error): void;
74 + function throws(block: () => any, error: AssertPredicate, message?: string | Error): void;
75 + function doesNotThrow(block: () => any, message?: string | Error): void;
76 + function doesNotThrow(block: () => any, error: AssertPredicate, message?: string | Error): void;
77 +
78 + function ifError(value: any): void;
79 +
80 + function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
81 + function rejects(
82 + block: (() => Promise<any>) | Promise<any>,
83 + error: AssertPredicate,
84 + message?: string | Error,
85 + ): Promise<void>;
86 + function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
87 + function doesNotReject(
88 + block: (() => Promise<any>) | Promise<any>,
89 + error: AssertPredicate,
90 + message?: string | Error,
91 + ): Promise<void>;
92 +
93 + function match(value: string, regExp: RegExp, message?: string | Error): void;
94 + function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
95 +
96 + const strict: typeof assert;
97 + }
98 +
99 + export = assert;
100 +}
1 +// NOTE: These definitions support NodeJS and TypeScript 3.2 - 3.4.
2 +
3 +// NOTE: TypeScript version-specific augmentations can be found in the following paths:
4 +// - ~/base.d.ts - Shared definitions common to all TypeScript versions
5 +// - ~/index.d.ts - Definitions specific to TypeScript 2.1
6 +// - ~/ts3.2/base.d.ts - Definitions specific to TypeScript 3.2
7 +// - ~/ts3.2/index.d.ts - Definitions specific to TypeScript 3.2 with global and assert pulled in
8 +
9 +// Reference required types from the default lib:
10 +/// <reference lib="es2018" />
11 +/// <reference lib="esnext.asynciterable" />
12 +/// <reference lib="esnext.intl" />
13 +/// <reference lib="esnext.bigint" />
14 +
15 +// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
16 +
17 +/// <reference path="../globals.d.ts" />
18 +/// <reference path="../async_hooks.d.ts" />
19 +/// <reference path="../buffer.d.ts" />
20 +/// <reference path="../child_process.d.ts" />
21 +/// <reference path="../cluster.d.ts" />
22 +/// <reference path="../console.d.ts" />
23 +/// <reference path="../constants.d.ts" />
24 +/// <reference path="../crypto.d.ts" />
25 +/// <reference path="../dgram.d.ts" />
26 +/// <reference path="../dns.d.ts" />
27 +/// <reference path="../domain.d.ts" />
28 +/// <reference path="../events.d.ts" />
29 +/// <reference path="../fs.d.ts" />
30 +/// <reference path="../fs/promises.d.ts" />
31 +/// <reference path="../http.d.ts" />
32 +/// <reference path="../http2.d.ts" />
33 +/// <reference path="../https.d.ts" />
34 +/// <reference path="../inspector.d.ts" />
35 +/// <reference path="../module.d.ts" />
36 +/// <reference path="../net.d.ts" />
37 +/// <reference path="../os.d.ts" />
38 +/// <reference path="../path.d.ts" />
39 +/// <reference path="../perf_hooks.d.ts" />
40 +/// <reference path="../process.d.ts" />
41 +/// <reference path="../punycode.d.ts" />
42 +/// <reference path="../querystring.d.ts" />
43 +/// <reference path="../readline.d.ts" />
44 +/// <reference path="../repl.d.ts" />
45 +/// <reference path="../stream.d.ts" />
46 +/// <reference path="../string_decoder.d.ts" />
47 +/// <reference path="../timers.d.ts" />
48 +/// <reference path="../tls.d.ts" />
49 +/// <reference path="../trace_events.d.ts" />
50 +/// <reference path="../tty.d.ts" />
51 +/// <reference path="../url.d.ts" />
52 +/// <reference path="../util.d.ts" />
53 +/// <reference path="../v8.d.ts" />
54 +/// <reference path="../vm.d.ts" />
55 +/// <reference path="../worker_threads.d.ts" />
56 +/// <reference path="../zlib.d.ts" />
1 +// NOTE: These definitions support NodeJS and TypeScript 3.2 - 3.4.
2 +// This is required to enable globalThis support for global in ts3.5 without causing errors
3 +// This is required to enable typing assert in ts3.7 without causing errors
4 +// Typically type modifiations should be made in base.d.ts instead of here
5 +
6 +/// <reference path="base.d.ts" />
7 +/// <reference path="assert.d.ts" />
8 +/// <reference path="globals.global.d.ts" />
1 +// NOTE: These definitions support NodeJS and TypeScript 3.5.
2 +
3 +// NOTE: TypeScript version-specific augmentations can be found in the following paths:
4 +// - ~/base.d.ts - Shared definitions common to all TypeScript versions
5 +// - ~/index.d.ts - Definitions specific to TypeScript 2.1
6 +// - ~/ts3.5/base.d.ts - Definitions specific to TypeScript 3.5
7 +// - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5 with assert pulled in
8 +
9 +// Reference required types from the default lib:
10 +/// <reference lib="es2018" />
11 +/// <reference lib="esnext.asynciterable" />
12 +/// <reference lib="esnext.intl" />
13 +/// <reference lib="esnext.bigint" />
14 +
15 +// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
16 +/// <reference path="../ts3.4/base.d.ts" />
17 +
18 +// TypeScript 3.5-specific augmentations:
19 +/// <reference path="../globals.global.d.ts" />
20 +
21 +// TypeScript 3.5-specific augmentations:
22 +/// <reference path="../wasi.d.ts" />
1 +// NOTE: These definitions support NodeJS and TypeScript 3.5 - 3.6.
2 +// This is required to enable typing assert in ts3.7 without causing errors
3 +// Typically type modifications should be made in base.d.ts instead of here
4 +
5 +/// <reference path="base.d.ts" />
6 +
7 +/// <reference path="../ts3.4/assert.d.ts" />
1 +declare module "tty" {
2 + import * as net from "net";
3 +
4 + function isatty(fd: number): boolean;
5 + class ReadStream extends net.Socket {
6 + constructor(fd: number, options?: net.SocketConstructorOpts);
7 + isRaw: boolean;
8 + setRawMode(mode: boolean): this;
9 + isTTY: boolean;
10 + }
11 + /**
12 + * -1 - to the left from cursor
13 + * 0 - the entire line
14 + * 1 - to the right from cursor
15 + */
16 + type Direction = -1 | 0 | 1;
17 + class WriteStream extends net.Socket {
18 + constructor(fd: number);
19 + addListener(event: string, listener: (...args: any[]) => void): this;
20 + addListener(event: "resize", listener: () => void): this;
21 +
22 + emit(event: string | symbol, ...args: any[]): boolean;
23 + emit(event: "resize"): boolean;
24 +
25 + on(event: string, listener: (...args: any[]) => void): this;
26 + on(event: "resize", listener: () => void): this;
27 +
28 + once(event: string, listener: (...args: any[]) => void): this;
29 + once(event: "resize", listener: () => void): this;
30 +
31 + prependListener(event: string, listener: (...args: any[]) => void): this;
32 + prependListener(event: "resize", listener: () => void): this;
33 +
34 + prependOnceListener(event: string, listener: (...args: any[]) => void): this;
35 + prependOnceListener(event: "resize", listener: () => void): this;
36 +
37 + /**
38 + * Clears the current line of this WriteStream in a direction identified by `dir`.
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;
54 + /**
55 + * @default `process.env`
56 + */
57 + getColorDepth(env?: {}): number;
58 + hasColors(depth?: number): boolean;
59 + hasColors(env?: {}): boolean;
60 + hasColors(depth: number, env?: {}): boolean;
61 + getWindowSize(): [number, number];
62 + columns: number;
63 + rows: number;
64 + isTTY: boolean;
65 + }
66 +}
1 +declare module "url" {
2 + import { ParsedUrlQuery, ParsedUrlQueryInput } from 'querystring';
3 +
4 + // Input to `url.format`
5 + interface UrlObject {
6 + auth?: string | null;
7 + hash?: string | null;
8 + host?: string | null;
9 + hostname?: string | null;
10 + href?: string | null;
11 + pathname?: string | null;
12 + protocol?: string | null;
13 + search?: string | null;
14 + slashes?: boolean | null;
15 + port?: string | number | null;
16 + query?: string | null | ParsedUrlQueryInput;
17 + }
18 +
19 + // Output of `url.parse`
20 + interface Url {
21 + auth: string | null;
22 + hash: string | null;
23 + host: string | null;
24 + hostname: string | null;
25 + href: string;
26 + path: string | null;
27 + pathname: string | null;
28 + protocol: string | null;
29 + search: string | null;
30 + slashes: boolean | null;
31 + port: string | null;
32 + query: string | null | ParsedUrlQuery;
33 + }
34 +
35 + interface UrlWithParsedQuery extends Url {
36 + query: ParsedUrlQuery;
37 + }
38 +
39 + interface UrlWithStringQuery extends Url {
40 + query: string | null;
41 + }
42 +
43 + function parse(urlStr: string): UrlWithStringQuery;
44 + function parse(urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;
45 + function parse(urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
46 + function parse(urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;
47 +
48 + function format(URL: URL, options?: URLFormatOptions): string;
49 + function format(urlObject: UrlObject | string): string;
50 + function resolve(from: string, to: string): string;
51 +
52 + function domainToASCII(domain: string): string;
53 + function domainToUnicode(domain: string): string;
54 +
55 + /**
56 + * This function ensures the correct decodings of percent-encoded characters as
57 + * well as ensuring a cross-platform valid absolute path string.
58 + * @param url The file URL string or URL object to convert to a path.
59 + */
60 + function fileURLToPath(url: string | URL): string;
61 +
62 + /**
63 + * This function ensures that path is resolved absolutely, and that the URL
64 + * control characters are correctly encoded when converting into a File URL.
65 + * @param url The path to convert to a File URL.
66 + */
67 + function pathToFileURL(url: string): URL;
68 +
69 + interface URLFormatOptions {
70 + auth?: boolean;
71 + fragment?: boolean;
72 + search?: boolean;
73 + unicode?: boolean;
74 + }
75 +
76 + class URL {
77 + constructor(input: string, base?: string | URL);
78 + hash: string;
79 + host: string;
80 + hostname: string;
81 + href: string;
82 + readonly origin: string;
83 + password: string;
84 + pathname: string;
85 + port: string;
86 + protocol: string;
87 + search: string;
88 + readonly searchParams: URLSearchParams;
89 + username: string;
90 + toString(): string;
91 + toJSON(): string;
92 + }
93 +
94 + class URLSearchParams implements Iterable<[string, string]> {
95 + constructor(init?: URLSearchParams | string | NodeJS.Dict<string | ReadonlyArray<string>> | Iterable<[string, string]> | ReadonlyArray<[string, string]>);
96 + append(name: string, value: string): void;
97 + delete(name: string): void;
98 + entries(): IterableIterator<[string, string]>;
99 + forEach(callback: (value: string, name: string, searchParams: this) => void): void;
100 + get(name: string): string | null;
101 + getAll(name: string): string[];
102 + has(name: string): boolean;
103 + keys(): IterableIterator<string>;
104 + set(name: string, value: string): void;
105 + sort(): void;
106 + toString(): string;
107 + values(): IterableIterator<string>;
108 + [Symbol.iterator](): IterableIterator<[string, string]>;
109 + }
110 +}
This diff is collapsed. Click to expand it.
1 +declare module "v8" {
2 + import { Readable } from "stream";
3 +
4 + interface HeapSpaceInfo {
5 + space_name: string;
6 + space_size: number;
7 + space_used_size: number;
8 + space_available_size: number;
9 + physical_space_size: number;
10 + }
11 +
12 + // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */
13 + type DoesZapCodeSpaceFlag = 0 | 1;
14 +
15 + interface HeapInfo {
16 + total_heap_size: number;
17 + total_heap_size_executable: number;
18 + total_physical_size: number;
19 + total_available_size: number;
20 + used_heap_size: number;
21 + heap_size_limit: number;
22 + malloced_memory: number;
23 + peak_malloced_memory: number;
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;
33 + }
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 +
41 + function getHeapStatistics(): HeapInfo;
42 + function getHeapSpaceStatistics(): HeapSpaceInfo[];
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 + class Serializer {
68 + /**
69 + * Writes out a header, which includes the serialization format version.
70 + */
71 + writeHeader(): void;
72 +
73 + /**
74 + * Serializes a JavaScript value and adds the serialized representation to the internal buffer.
75 + * This throws an error if value cannot be serialized.
76 + */
77 + writeValue(val: any): boolean;
78 +
79 + /**
80 + * Returns the stored internal buffer.
81 + * This serializer should not be used once the buffer is released.
82 + * Calling this method results in undefined behavior if a previous write has failed.
83 + */
84 + releaseBuffer(): Buffer;
85 +
86 + /**
87 + * Marks an ArrayBuffer as having its contents transferred out of band.\
88 + * Pass the corresponding ArrayBuffer in the deserializing context to deserializer.transferArrayBuffer().
89 + */
90 + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
91 +
92 + /**
93 + * Write a raw 32-bit unsigned integer.
94 + */
95 + writeUint32(value: number): void;
96 +
97 + /**
98 + * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts.
99 + */
100 + writeUint64(hi: number, lo: number): void;
101 +
102 + /**
103 + * Write a JS number value.
104 + */
105 + writeDouble(value: number): void;
106 +
107 + /**
108 + * Write raw bytes into the serializer’s internal buffer.
109 + * The deserializer will require a way to compute the length of the buffer.
110 + */
111 + writeRawBytes(buffer: NodeJS.TypedArray): void;
112 + }
113 +
114 + /**
115 + * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects,
116 + * and only stores the part of their underlying `ArrayBuffers` that they are referring to.
117 + */
118 + class DefaultSerializer extends Serializer {
119 + }
120 +
121 + class Deserializer {
122 + constructor(data: NodeJS.TypedArray);
123 + /**
124 + * Reads and validates a header (including the format version).
125 + * May, for example, reject an invalid or unsupported wire format.
126 + * In that case, an Error is thrown.
127 + */
128 + readHeader(): boolean;
129 +
130 + /**
131 + * Deserializes a JavaScript value from the buffer and returns it.
132 + */
133 + readValue(): any;
134 +
135 + /**
136 + * Marks an ArrayBuffer as having its contents transferred out of band.
137 + * Pass the corresponding `ArrayBuffer` in the serializing context to serializer.transferArrayBuffer()
138 + * (or return the id from serializer._getSharedArrayBufferId() in the case of SharedArrayBuffers).
139 + */
140 + transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
141 +
142 + /**
143 + * Reads the underlying wire format version.
144 + * Likely mostly to be useful to legacy code reading old wire format versions.
145 + * May not be called before .readHeader().
146 + */
147 + getWireFormatVersion(): number;
148 +
149 + /**
150 + * Read a raw 32-bit unsigned integer and return it.
151 + */
152 + readUint32(): number;
153 +
154 + /**
155 + * Read a raw 64-bit unsigned integer and return it as an array [hi, lo] with two 32-bit unsigned integer entries.
156 + */
157 + readUint64(): [number, number];
158 +
159 + /**
160 + * Read a JS number value.
161 + */
162 + readDouble(): number;
163 +
164 + /**
165 + * Read raw bytes from the deserializer’s internal buffer.
166 + * The length parameter must correspond to the length of the buffer that was passed to serializer.writeRawBytes().
167 + */
168 + readRawBytes(length: number): Buffer;
169 + }
170 +
171 + /**
172 + * A subclass of `Serializer` that serializes `TypedArray` (in particular `Buffer`) and `DataView` objects as host objects,
173 + * and only stores the part of their underlying `ArrayBuffers` that they are referring to.
174 + */
175 + class DefaultDeserializer extends Deserializer {
176 + }
177 +
178 + /**
179 + * Uses a `DefaultSerializer` to serialize value into a buffer.
180 + */
181 + function serialize(value: any): Buffer;
182 +
183 + /**
184 + * Uses a `DefaultDeserializer` with default options to read a JS value from a buffer.
185 + */
186 + function deserialize(data: NodeJS.TypedArray): any;
187 +}
1 +declare module "vm" {
2 + interface Context extends NodeJS.Dict<any> { }
3 + interface BaseOptions {
4 + /**
5 + * Specifies the filename used in stack traces produced by this script.
6 + * Default: `''`.
7 + */
8 + filename?: string;
9 + /**
10 + * Specifies the line number offset that is displayed in stack traces produced by this script.
11 + * Default: `0`.
12 + */
13 + lineOffset?: number;
14 + /**
15 + * Specifies the column number offset that is displayed in stack traces produced by this script.
16 + * Default: `0`
17 + */
18 + columnOffset?: number;
19 + }
20 + interface ScriptOptions extends BaseOptions {
21 + displayErrors?: boolean;
22 + timeout?: number;
23 + cachedData?: Buffer;
24 + produceCachedData?: boolean;
25 + }
26 + interface RunningScriptOptions extends BaseOptions {
27 + /**
28 + * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace.
29 + * Default: `true`.
30 + */
31 + displayErrors?: boolean;
32 + /**
33 + * Specifies the number of milliseconds to execute code before terminating execution.
34 + * If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer.
35 + */
36 + timeout?: number;
37 + /**
38 + * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received.
39 + * 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.
40 + * If execution is terminated, an `Error` will be thrown.
41 + * Default: `false`.
42 + */
43 + breakOnSigint?: boolean;
44 + /**
45 + * If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
46 + */
47 + microtaskMode?: 'afterEvaluate';
48 + }
49 + interface CompileFunctionOptions extends BaseOptions {
50 + /**
51 + * Provides an optional data with V8's code cache data for the supplied source.
52 + */
53 + cachedData?: Buffer;
54 + /**
55 + * Specifies whether to produce new cache data.
56 + * Default: `false`,
57 + */
58 + produceCachedData?: boolean;
59 + /**
60 + * The sandbox/context in which the said function should be compiled in.
61 + */
62 + parsingContext?: Context;
63 +
64 + /**
65 + * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
66 + */
67 + contextExtensions?: Object[];
68 + }
69 +
70 + interface CreateContextOptions {
71 + /**
72 + * Human-readable name of the newly created context.
73 + * @default 'VM Context i' Where i is an ascending numerical index of the created context.
74 + */
75 + name?: string;
76 + /**
77 + * Corresponds to the newly created context for display purposes.
78 + * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary),
79 + * like the value of the `url.origin` property of a URL object.
80 + * Most notably, this string should omit the trailing slash, as that denotes a path.
81 + * @default ''
82 + */
83 + origin?: string;
84 + codeGeneration?: {
85 + /**
86 + * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc)
87 + * will throw an EvalError.
88 + * @default true
89 + */
90 + strings?: boolean;
91 + /**
92 + * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError.
93 + * @default true
94 + */
95 + wasm?: boolean;
96 + };
97 + }
98 +
99 + type MeasureMemoryMode = 'summary' | 'detailed';
100 +
101 + interface MeasureMemoryOptions {
102 + /**
103 + * @default 'summary'
104 + */
105 + mode?: MeasureMemoryMode;
106 + context?: Context;
107 + }
108 +
109 + interface MemoryMeasurement {
110 + total: {
111 + jsMemoryEstimate: number;
112 + jsMemoryRange: [number, number];
113 + };
114 + }
115 +
116 + class Script {
117 + constructor(code: string, options?: ScriptOptions);
118 + runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any;
119 + runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any;
120 + runInThisContext(options?: RunningScriptOptions): any;
121 + createCachedData(): Buffer;
122 + }
123 + function createContext(sandbox?: Context, options?: CreateContextOptions): Context;
124 + function isContext(sandbox: Context): boolean;
125 + function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any;
126 + function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any;
127 + function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
128 + function compileFunction(code: string, params?: ReadonlyArray<string>, options?: CompileFunctionOptions): Function;
129 +
130 + /**
131 + * Measure the memory known to V8 and used by the current execution context or a specified context.
132 + *
133 + * The format of the object that the returned Promise may resolve with is
134 + * specific to the V8 engine and may change from one version of V8 to the next.
135 + *
136 + * The returned result is different from the statistics returned by
137 + * `v8.getHeapSpaceStatistics()` in that `vm.measureMemory()` measures
138 + * the memory reachable by V8 from a specific context, while
139 + * `v8.getHeapSpaceStatistics()` measures the memory used by an instance
140 + * of V8 engine, which can switch among multiple contexts that reference
141 + * objects in the heap of one engine.
142 + *
143 + * @experimental
144 + */
145 + function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
146 +}
1 +declare module 'wasi' {
2 + interface WASIOptions {
3 + /**
4 + * An array of strings that the WebAssembly application will
5 + * see as command line arguments. The first argument is the virtual path to the
6 + * WASI command itself.
7 + */
8 + args?: string[];
9 +
10 + /**
11 + * An object similar to `process.env` that the WebAssembly
12 + * application will see as its environment.
13 + */
14 + env?: object;
15 +
16 + /**
17 + * This object represents the WebAssembly application's
18 + * sandbox directory structure. The string keys of `preopens` are treated as
19 + * directories within the sandbox. The corresponding values in `preopens` are
20 + * the real paths to those directories on the host machine.
21 + */
22 + preopens?: NodeJS.Dict<string>;
23 +
24 + /**
25 + * By default, WASI applications terminate the Node.js
26 + * process via the `__wasi_proc_exit()` function. Setting this option to `true`
27 + * causes `wasi.start()` to return the exit code rather than terminate the
28 + * process.
29 + * @default false
30 + */
31 + returnOnExit?: boolean;
32 +
33 + /**
34 + * The file descriptor used as standard input in the WebAssembly application.
35 + * @default 0
36 + */
37 + stdin?: number;
38 +
39 + /**
40 + * The file descriptor used as standard output in the WebAssembly application.
41 + * @default 1
42 + */
43 + stdout?: number;
44 +
45 + /**
46 + * The file descriptor used as standard error in the WebAssembly application.
47 + * @default 2
48 + */
49 + stderr?: number;
50 + }
51 +
52 + class WASI {
53 + constructor(options?: WASIOptions);
54 + /**
55 + *
56 + * Attempt to begin execution of `instance` by invoking its `_start()` export.
57 + * If `instance` does not contain a `_start()` export, then `start()` attempts to
58 + * invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports
59 + * is present on `instance`, then `start()` does nothing.
60 + *
61 + * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named
62 + * `memory`. If `instance` does not have a `memory` export an exception is thrown.
63 + *
64 + * If `start()` is called more than once, an exception is thrown.
65 + */
66 + start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
67 +
68 + /**
69 + * Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present.
70 + * If `instance` contains a `_start()` export, then an exception is thrown.
71 + *
72 + * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named
73 + * `memory`. If `instance` does not have a `memory` export an exception is thrown.
74 + *
75 + * If `initialize()` is called more than once, an exception is thrown.
76 + */
77 + initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
78 +
79 + /**
80 + * Is an object that implements the WASI system call API. This object
81 + * should be passed as the `wasi_snapshot_preview1` import during the instantiation of a
82 + * [`WebAssembly.Instance`][].
83 + */
84 + readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
85 + }
86 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +1.3.7 / 2019-04-29
2 +==================
3 +
4 + * deps: negotiator@0.6.2
5 + - Fix sorting charset, encoding, and language with extra parameters
6 +
7 +1.3.6 / 2019-04-28
8 +==================
9 +
10 + * deps: mime-types@~2.1.24
11 + - deps: mime-db@~1.40.0
12 +
13 +1.3.5 / 2018-02-28
14 +==================
15 +
16 + * deps: mime-types@~2.1.18
17 + - deps: mime-db@~1.33.0
18 +
19 +1.3.4 / 2017-08-22
20 +==================
21 +
22 + * deps: mime-types@~2.1.16
23 + - deps: mime-db@~1.29.0
24 +
25 +1.3.3 / 2016-05-02
26 +==================
27 +
28 + * deps: mime-types@~2.1.11
29 + - deps: mime-db@~1.23.0
30 + * deps: negotiator@0.6.1
31 + - perf: improve `Accept` parsing speed
32 + - perf: improve `Accept-Charset` parsing speed
33 + - perf: improve `Accept-Encoding` parsing speed
34 + - perf: improve `Accept-Language` parsing speed
35 +
36 +1.3.2 / 2016-03-08
37 +==================
38 +
39 + * deps: mime-types@~2.1.10
40 + - Fix extension of `application/dash+xml`
41 + - Update primary extension for `audio/mp4`
42 + - deps: mime-db@~1.22.0
43 +
44 +1.3.1 / 2016-01-19
45 +==================
46 +
47 + * deps: mime-types@~2.1.9
48 + - deps: mime-db@~1.21.0
49 +
50 +1.3.0 / 2015-09-29
51 +==================
52 +
53 + * deps: mime-types@~2.1.7
54 + - deps: mime-db@~1.19.0
55 + * deps: negotiator@0.6.0
56 + - Fix including type extensions in parameters in `Accept` parsing
57 + - Fix parsing `Accept` parameters with quoted equals
58 + - Fix parsing `Accept` parameters with quoted semicolons
59 + - Lazy-load modules from main entry point
60 + - perf: delay type concatenation until needed
61 + - perf: enable strict mode
62 + - perf: hoist regular expressions
63 + - perf: remove closures getting spec properties
64 + - perf: remove a closure from media type parsing
65 + - perf: remove property delete from media type parsing
66 +
67 +1.2.13 / 2015-09-06
68 +===================
69 +
70 + * deps: mime-types@~2.1.6
71 + - deps: mime-db@~1.18.0
72 +
73 +1.2.12 / 2015-07-30
74 +===================
75 +
76 + * deps: mime-types@~2.1.4
77 + - deps: mime-db@~1.16.0
78 +
79 +1.2.11 / 2015-07-16
80 +===================
81 +
82 + * deps: mime-types@~2.1.3
83 + - deps: mime-db@~1.15.0
84 +
85 +1.2.10 / 2015-07-01
86 +===================
87 +
88 + * deps: mime-types@~2.1.2
89 + - deps: mime-db@~1.14.0
90 +
91 +1.2.9 / 2015-06-08
92 +==================
93 +
94 + * deps: mime-types@~2.1.1
95 + - perf: fix deopt during mapping
96 +
97 +1.2.8 / 2015-06-07
98 +==================
99 +
100 + * deps: mime-types@~2.1.0
101 + - deps: mime-db@~1.13.0
102 + * perf: avoid argument reassignment & argument slice
103 + * perf: avoid negotiator recursive construction
104 + * perf: enable strict mode
105 + * perf: remove unnecessary bitwise operator
106 +
107 +1.2.7 / 2015-05-10
108 +==================
109 +
110 + * deps: negotiator@0.5.3
111 + - Fix media type parameter matching to be case-insensitive
112 +
113 +1.2.6 / 2015-05-07
114 +==================
115 +
116 + * deps: mime-types@~2.0.11
117 + - deps: mime-db@~1.9.1
118 + * deps: negotiator@0.5.2
119 + - Fix comparing media types with quoted values
120 + - Fix splitting media types with quoted commas
121 +
122 +1.2.5 / 2015-03-13
123 +==================
124 +
125 + * deps: mime-types@~2.0.10
126 + - deps: mime-db@~1.8.0
127 +
128 +1.2.4 / 2015-02-14
129 +==================
130 +
131 + * Support Node.js 0.6
132 + * deps: mime-types@~2.0.9
133 + - deps: mime-db@~1.7.0
134 + * deps: negotiator@0.5.1
135 + - Fix preference sorting to be stable for long acceptable lists
136 +
137 +1.2.3 / 2015-01-31
138 +==================
139 +
140 + * deps: mime-types@~2.0.8
141 + - deps: mime-db@~1.6.0
142 +
143 +1.2.2 / 2014-12-30
144 +==================
145 +
146 + * deps: mime-types@~2.0.7
147 + - deps: mime-db@~1.5.0
148 +
149 +1.2.1 / 2014-12-30
150 +==================
151 +
152 + * deps: mime-types@~2.0.5
153 + - deps: mime-db@~1.3.1
154 +
155 +1.2.0 / 2014-12-19
156 +==================
157 +
158 + * deps: negotiator@0.5.0
159 + - Fix list return order when large accepted list
160 + - Fix missing identity encoding when q=0 exists
161 + - Remove dynamic building of Negotiator class
162 +
163 +1.1.4 / 2014-12-10
164 +==================
165 +
166 + * deps: mime-types@~2.0.4
167 + - deps: mime-db@~1.3.0
168 +
169 +1.1.3 / 2014-11-09
170 +==================
171 +
172 + * deps: mime-types@~2.0.3
173 + - deps: mime-db@~1.2.0
174 +
175 +1.1.2 / 2014-10-14
176 +==================
177 +
178 + * deps: negotiator@0.4.9
179 + - Fix error when media type has invalid parameter
180 +
181 +1.1.1 / 2014-09-28
182 +==================
183 +
184 + * deps: mime-types@~2.0.2
185 + - deps: mime-db@~1.1.0
186 + * deps: negotiator@0.4.8
187 + - Fix all negotiations to be case-insensitive
188 + - Stable sort preferences of same quality according to client order
189 +
190 +1.1.0 / 2014-09-02
191 +==================
192 +
193 + * update `mime-types`
194 +
195 +1.0.7 / 2014-07-04
196 +==================
197 +
198 + * Fix wrong type returned from `type` when match after unknown extension
199 +
200 +1.0.6 / 2014-06-24
201 +==================
202 +
203 + * deps: negotiator@0.4.7
204 +
205 +1.0.5 / 2014-06-20
206 +==================
207 +
208 + * fix crash when unknown extension given
209 +
210 +1.0.4 / 2014-06-19
211 +==================
212 +
213 + * use `mime-types`
214 +
215 +1.0.3 / 2014-06-11
216 +==================
217 +
218 + * deps: negotiator@0.4.6
219 + - Order by specificity when quality is the same
220 +
221 +1.0.2 / 2014-05-29
222 +==================
223 +
224 + * Fix interpretation when header not in request
225 + * deps: pin negotiator@0.4.5
226 +
227 +1.0.1 / 2014-01-18
228 +==================
229 +
230 + * Identity encoding isn't always acceptable
231 + * deps: negotiator@~0.4.0
232 +
233 +1.0.0 / 2013-12-27
234 +==================
235 +
236 + * Genesis
1 +(The MIT License)
2 +
3 +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
4 +Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5 +
6 +Permission is hereby granted, free of charge, to any person obtaining
7 +a copy of this software and associated documentation files (the
8 +'Software'), to deal in the Software without restriction, including
9 +without limitation the rights to use, copy, modify, merge, publish,
10 +distribute, sublicense, and/or sell copies of the Software, and to
11 +permit persons to whom the Software is furnished to do so, subject to
12 +the following conditions:
13 +
14 +The above copyright notice and this permission notice shall be
15 +included in all copies or substantial portions of the Software.
16 +
17 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +# accepts
2 +
3 +[![NPM Version][npm-version-image]][npm-url]
4 +[![NPM Downloads][npm-downloads-image]][npm-url]
5 +[![Node.js Version][node-version-image]][node-version-url]
6 +[![Build Status][travis-image]][travis-url]
7 +[![Test Coverage][coveralls-image]][coveralls-url]
8 +
9 +Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
10 +Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
11 +
12 +In addition to negotiator, it allows:
13 +
14 +- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
15 + as well as `('text/html', 'application/json')`.
16 +- Allows type shorthands such as `json`.
17 +- Returns `false` when no types match
18 +- Treats non-existent headers as `*`
19 +
20 +## Installation
21 +
22 +This is a [Node.js](https://nodejs.org/en/) module available through the
23 +[npm registry](https://www.npmjs.com/). Installation is done using the
24 +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
25 +
26 +```sh
27 +$ npm install accepts
28 +```
29 +
30 +## API
31 +
32 +<!-- eslint-disable no-unused-vars -->
33 +
34 +```js
35 +var accepts = require('accepts')
36 +```
37 +
38 +### accepts(req)
39 +
40 +Create a new `Accepts` object for the given `req`.
41 +
42 +#### .charset(charsets)
43 +
44 +Return the first accepted charset. If nothing in `charsets` is accepted,
45 +then `false` is returned.
46 +
47 +#### .charsets()
48 +
49 +Return the charsets that the request accepts, in the order of the client's
50 +preference (most preferred first).
51 +
52 +#### .encoding(encodings)
53 +
54 +Return the first accepted encoding. If nothing in `encodings` is accepted,
55 +then `false` is returned.
56 +
57 +#### .encodings()
58 +
59 +Return the encodings that the request accepts, in the order of the client's
60 +preference (most preferred first).
61 +
62 +#### .language(languages)
63 +
64 +Return the first accepted language. If nothing in `languages` is accepted,
65 +then `false` is returned.
66 +
67 +#### .languages()
68 +
69 +Return the languages that the request accepts, in the order of the client's
70 +preference (most preferred first).
71 +
72 +#### .type(types)
73 +
74 +Return the first accepted type (and it is returned as the same text as what
75 +appears in the `types` array). If nothing in `types` is accepted, then `false`
76 +is returned.
77 +
78 +The `types` array can contain full MIME types or file extensions. Any value
79 +that is not a full MIME types is passed to `require('mime-types').lookup`.
80 +
81 +#### .types()
82 +
83 +Return the types that the request accepts, in the order of the client's
84 +preference (most preferred first).
85 +
86 +## Examples
87 +
88 +### Simple type negotiation
89 +
90 +This simple example shows how to use `accepts` to return a different typed
91 +respond body based on what the client wants to accept. The server lists it's
92 +preferences in order and will get back the best match between the client and
93 +server.
94 +
95 +```js
96 +var accepts = require('accepts')
97 +var http = require('http')
98 +
99 +function app (req, res) {
100 + var accept = accepts(req)
101 +
102 + // the order of this list is significant; should be server preferred order
103 + switch (accept.type(['json', 'html'])) {
104 + case 'json':
105 + res.setHeader('Content-Type', 'application/json')
106 + res.write('{"hello":"world!"}')
107 + break
108 + case 'html':
109 + res.setHeader('Content-Type', 'text/html')
110 + res.write('<b>hello, world!</b>')
111 + break
112 + default:
113 + // the fallback is text/plain, so no need to specify it above
114 + res.setHeader('Content-Type', 'text/plain')
115 + res.write('hello, world!')
116 + break
117 + }
118 +
119 + res.end()
120 +}
121 +
122 +http.createServer(app).listen(3000)
123 +```
124 +
125 +You can test this out with the cURL program:
126 +```sh
127 +curl -I -H'Accept: text/html' http://localhost:3000/
128 +```
129 +
130 +## License
131 +
132 +[MIT](LICENSE)
133 +
134 +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
135 +[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
136 +[node-version-image]: https://badgen.net/npm/node/accepts
137 +[node-version-url]: https://nodejs.org/en/download
138 +[npm-downloads-image]: https://badgen.net/npm/dm/accepts
139 +[npm-url]: https://npmjs.org/package/accepts
140 +[npm-version-image]: https://badgen.net/npm/v/accepts
141 +[travis-image]: https://badgen.net/travis/jshttp/accepts/master
142 +[travis-url]: https://travis-ci.org/jshttp/accepts
1 +/*!
2 + * accepts
3 + * Copyright(c) 2014 Jonathan Ong
4 + * Copyright(c) 2015 Douglas Christopher Wilson
5 + * MIT Licensed
6 + */
7 +
8 +'use strict'
9 +
10 +/**
11 + * Module dependencies.
12 + * @private
13 + */
14 +
15 +var Negotiator = require('negotiator')
16 +var mime = require('mime-types')
17 +
18 +/**
19 + * Module exports.
20 + * @public
21 + */
22 +
23 +module.exports = Accepts
24 +
25 +/**
26 + * Create a new Accepts object for the given req.
27 + *
28 + * @param {object} req
29 + * @public
30 + */
31 +
32 +function Accepts (req) {
33 + if (!(this instanceof Accepts)) {
34 + return new Accepts(req)
35 + }
36 +
37 + this.headers = req.headers
38 + this.negotiator = new Negotiator(req)
39 +}
40 +
41 +/**
42 + * Check if the given `type(s)` is acceptable, returning
43 + * the best match when true, otherwise `undefined`, in which
44 + * case you should respond with 406 "Not Acceptable".
45 + *
46 + * The `type` value may be a single mime type string
47 + * such as "application/json", the extension name
48 + * such as "json" or an array `["json", "html", "text/plain"]`. When a list
49 + * or array is given the _best_ match, if any is returned.
50 + *
51 + * Examples:
52 + *
53 + * // Accept: text/html
54 + * this.types('html');
55 + * // => "html"
56 + *
57 + * // Accept: text/*, application/json
58 + * this.types('html');
59 + * // => "html"
60 + * this.types('text/html');
61 + * // => "text/html"
62 + * this.types('json', 'text');
63 + * // => "json"
64 + * this.types('application/json');
65 + * // => "application/json"
66 + *
67 + * // Accept: text/*, application/json
68 + * this.types('image/png');
69 + * this.types('png');
70 + * // => undefined
71 + *
72 + * // Accept: text/*;q=.5, application/json
73 + * this.types(['html', 'json']);
74 + * this.types('html', 'json');
75 + * // => "json"
76 + *
77 + * @param {String|Array} types...
78 + * @return {String|Array|Boolean}
79 + * @public
80 + */
81 +
82 +Accepts.prototype.type =
83 +Accepts.prototype.types = function (types_) {
84 + var types = types_
85 +
86 + // support flattened arguments
87 + if (types && !Array.isArray(types)) {
88 + types = new Array(arguments.length)
89 + for (var i = 0; i < types.length; i++) {
90 + types[i] = arguments[i]
91 + }
92 + }
93 +
94 + // no types, return all requested types
95 + if (!types || types.length === 0) {
96 + return this.negotiator.mediaTypes()
97 + }
98 +
99 + // no accept header, return first given type
100 + if (!this.headers.accept) {
101 + return types[0]
102 + }
103 +
104 + var mimes = types.map(extToMime)
105 + var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
106 + var first = accepts[0]
107 +
108 + return first
109 + ? types[mimes.indexOf(first)]
110 + : false
111 +}
112 +
113 +/**
114 + * Return accepted encodings or best fit based on `encodings`.
115 + *
116 + * Given `Accept-Encoding: gzip, deflate`
117 + * an array sorted by quality is returned:
118 + *
119 + * ['gzip', 'deflate']
120 + *
121 + * @param {String|Array} encodings...
122 + * @return {String|Array}
123 + * @public
124 + */
125 +
126 +Accepts.prototype.encoding =
127 +Accepts.prototype.encodings = function (encodings_) {
128 + var encodings = encodings_
129 +
130 + // support flattened arguments
131 + if (encodings && !Array.isArray(encodings)) {
132 + encodings = new Array(arguments.length)
133 + for (var i = 0; i < encodings.length; i++) {
134 + encodings[i] = arguments[i]
135 + }
136 + }
137 +
138 + // no encodings, return all requested encodings
139 + if (!encodings || encodings.length === 0) {
140 + return this.negotiator.encodings()
141 + }
142 +
143 + return this.negotiator.encodings(encodings)[0] || false
144 +}
145 +
146 +/**
147 + * Return accepted charsets or best fit based on `charsets`.
148 + *
149 + * Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
150 + * an array sorted by quality is returned:
151 + *
152 + * ['utf-8', 'utf-7', 'iso-8859-1']
153 + *
154 + * @param {String|Array} charsets...
155 + * @return {String|Array}
156 + * @public
157 + */
158 +
159 +Accepts.prototype.charset =
160 +Accepts.prototype.charsets = function (charsets_) {
161 + var charsets = charsets_
162 +
163 + // support flattened arguments
164 + if (charsets && !Array.isArray(charsets)) {
165 + charsets = new Array(arguments.length)
166 + for (var i = 0; i < charsets.length; i++) {
167 + charsets[i] = arguments[i]
168 + }
169 + }
170 +
171 + // no charsets, return all requested charsets
172 + if (!charsets || charsets.length === 0) {
173 + return this.negotiator.charsets()
174 + }
175 +
176 + return this.negotiator.charsets(charsets)[0] || false
177 +}
178 +
179 +/**
180 + * Return accepted languages or best fit based on `langs`.
181 + *
182 + * Given `Accept-Language: en;q=0.8, es, pt`
183 + * an array sorted by quality is returned:
184 + *
185 + * ['es', 'pt', 'en']
186 + *
187 + * @param {String|Array} langs...
188 + * @return {Array|String}
189 + * @public
190 + */
191 +
192 +Accepts.prototype.lang =
193 +Accepts.prototype.langs =
194 +Accepts.prototype.language =
195 +Accepts.prototype.languages = function (languages_) {
196 + var languages = languages_
197 +
198 + // support flattened arguments
199 + if (languages && !Array.isArray(languages)) {
200 + languages = new Array(arguments.length)
201 + for (var i = 0; i < languages.length; i++) {
202 + languages[i] = arguments[i]
203 + }
204 + }
205 +
206 + // no languages, return all requested languages
207 + if (!languages || languages.length === 0) {
208 + return this.negotiator.languages()
209 + }
210 +
211 + return this.negotiator.languages(languages)[0] || false
212 +}
213 +
214 +/**
215 + * Convert extnames to mime.
216 + *
217 + * @param {String} type
218 + * @return {String}
219 + * @private
220 + */
221 +
222 +function extToMime (type) {
223 + return type.indexOf('/') === -1
224 + ? mime.lookup(type)
225 + : type
226 +}
227 +
228 +/**
229 + * Check if mime is valid.
230 + *
231 + * @param {String} type
232 + * @return {String}
233 + * @private
234 + */
235 +
236 +function validMime (type) {
237 + return typeof type === 'string'
238 +}
1 +{
2 + "_from": "accepts@~1.3.5",
3 + "_id": "accepts@1.3.7",
4 + "_inBundle": false,
5 + "_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
6 + "_location": "/accepts",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "accepts@~1.3.5",
12 + "name": "accepts",
13 + "escapedName": "accepts",
14 + "rawSpec": "~1.3.5",
15 + "saveSpec": null,
16 + "fetchSpec": "~1.3.5"
17 + },
18 + "_requiredBy": [
19 + "/express"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
22 + "_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd",
23 + "_spec": "accepts@~1.3.5",
24 + "_where": "C:\\Users\\gther\\Desktop\\projects\\capston2\\node_modules\\express",
25 + "bugs": {
26 + "url": "https://github.com/jshttp/accepts/issues"
27 + },
28 + "bundleDependencies": false,
29 + "contributors": [
30 + {
31 + "name": "Douglas Christopher Wilson",
32 + "email": "doug@somethingdoug.com"
33 + },
34 + {
35 + "name": "Jonathan Ong",
36 + "email": "me@jongleberry.com",
37 + "url": "http://jongleberry.com"
38 + }
39 + ],
40 + "dependencies": {
41 + "mime-types": "~2.1.24",
42 + "negotiator": "0.6.2"
43 + },
44 + "deprecated": false,
45 + "description": "Higher-level content negotiation",
46 + "devDependencies": {
47 + "deep-equal": "1.0.1",
48 + "eslint": "5.16.0",
49 + "eslint-config-standard": "12.0.0",
50 + "eslint-plugin-import": "2.17.2",
51 + "eslint-plugin-markdown": "1.0.0",
52 + "eslint-plugin-node": "8.0.1",
53 + "eslint-plugin-promise": "4.1.1",
54 + "eslint-plugin-standard": "4.0.0",
55 + "mocha": "6.1.4",
56 + "nyc": "14.0.0"
57 + },
58 + "engines": {
59 + "node": ">= 0.6"
60 + },
61 + "files": [
62 + "LICENSE",
63 + "HISTORY.md",
64 + "index.js"
65 + ],
66 + "homepage": "https://github.com/jshttp/accepts#readme",
67 + "keywords": [
68 + "content",
69 + "negotiation",
70 + "accept",
71 + "accepts"
72 + ],
73 + "license": "MIT",
74 + "name": "accepts",
75 + "repository": {
76 + "type": "git",
77 + "url": "git+https://github.com/jshttp/accepts.git"
78 + },
79 + "scripts": {
80 + "lint": "eslint --plugin markdown --ext js,md .",
81 + "test": "mocha --reporter spec --check-leaks --bail test/",
82 + "test-cov": "nyc --reporter=html --reporter=text npm test",
83 + "test-travis": "nyc --reporter=text npm test"
84 + },
85 + "version": "1.3.7"
86 +}
1 +{
2 + "node":true,
3 + "strict":true
4 +}
1 +.git*
2 +test/
3 +test-browser/
4 +build/
5 +.travis.yml
6 +*.swp
7 +Makefile
1 +Copyright (C) 2014-2016 Kevin Beaty
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
1 +## Any Promise
2 +
3 +[![Build Status](https://secure.travis-ci.org/kevinbeaty/any-promise.svg)](http://travis-ci.org/kevinbeaty/any-promise)
4 +
5 +Let your library support any ES 2015 (ES6) compatible `Promise` and leave the choice to application authors. The application can *optionally* register its preferred `Promise` implementation and it will be exported when requiring `any-promise` from library code.
6 +
7 +If no preference is registered, defaults to the global `Promise` for newer Node.js versions. The browser version defaults to the window `Promise`, so polyfill or register as necessary.
8 +
9 +### Usage with global Promise:
10 +
11 +Assuming the global `Promise` is the desired implementation:
12 +
13 +```bash
14 +# Install any libraries depending on any-promise
15 +$ npm install mz
16 +```
17 +
18 +The installed libraries will use global Promise by default.
19 +
20 +```js
21 +// in library
22 +var Promise = require('any-promise') // the global Promise
23 +
24 +function promiseReturningFunction(){
25 + return new Promise(function(resolve, reject){...})
26 +}
27 +```
28 +
29 +### Usage with registration:
30 +
31 +Assuming `bluebird` is the desired Promise implementation:
32 +
33 +```bash
34 +# Install preferred promise library
35 +$ npm install bluebird
36 +# Install any-promise to allow registration
37 +$ npm install any-promise
38 +# Install any libraries you would like to use depending on any-promise
39 +$ npm install mz
40 +```
41 +
42 +Register your preference in the application entry point before any other `require` of packages that load `any-promise`:
43 +
44 +```javascript
45 +// top of application index.js or other entry point
46 +require('any-promise/register/bluebird')
47 +
48 +// -or- Equivalent to above, but allows customization of Promise library
49 +require('any-promise/register')('bluebird', {Promise: require('bluebird')})
50 +```
51 +
52 +Now that the implementation is registered, you can use any package depending on `any-promise`:
53 +
54 +
55 +```javascript
56 +var fsp = require('mz/fs') // mz/fs will use registered bluebird promises
57 +var Promise = require('any-promise') // the registered bluebird promise
58 +```
59 +
60 +It is safe to call `register` multiple times, but it must always be with the same implementation.
61 +
62 +Again, registration is *optional*. It should only be called by the application user if overriding the global `Promise` implementation is desired.
63 +
64 +### Optional Application Registration
65 +
66 +As an application author, you can *optionally* register a preferred `Promise` implementation on application startup (before any call to `require('any-promise')`:
67 +
68 +You must register your preference before any call to `require('any-promise')` (by you or required packages), and only one implementation can be registered. Typically, this registration would occur at the top of the application entry point.
69 +
70 +
71 +#### Registration shortcuts
72 +
73 +If you are using a known `Promise` implementation, you can register your preference with a shortcut:
74 +
75 +
76 +```js
77 +require('any-promise/register/bluebird')
78 +// -or-
79 +import 'any-promise/register/q';
80 +```
81 +
82 +Shortcut registration is the preferred registration method as it works in the browser and Node.js. It is also convenient for using with `import` and many test runners, that offer a `--require` flag:
83 +
84 +```
85 +$ ava --require=any-promise/register/bluebird test.js
86 +```
87 +
88 +Current known implementations include `bluebird`, `q`, `when`, `rsvp`, `es6-promise`, `promise`, `native-promise-only`, `pinkie`, `vow` and `lie`. If you are not using a known implementation, you can use another registration method described below.
89 +
90 +
91 +#### Basic Registration
92 +
93 +As an alternative to registration shortcuts, you can call the `register` function with the preferred `Promise` implementation. The benefit of this approach is that a `Promise` library can be required by name without being a known implementation. This approach does NOT work in the browser. To use `any-promise` in the browser use either registration shortcuts or specify the `Promise` constructor using advanced registration (see below).
94 +
95 +```javascript
96 +require('any-promise/register')('when')
97 +// -or- require('any-promise/register')('any other ES6 compatible library (known or otherwise)')
98 +```
99 +
100 +This registration method will try to detect the `Promise` constructor from requiring the specified implementation. If you would like to specify your own constructor, see advanced registration.
101 +
102 +
103 +#### Advanced Registration
104 +
105 +To use the browser version, you should either install a polyfill or explicitly register the `Promise` constructor:
106 +
107 +```javascript
108 +require('any-promise/register')('bluebird', {Promise: require('bluebird')})
109 +```
110 +
111 +This could also be used for registering a custom `Promise` implementation or subclass.
112 +
113 +Your preference will be registered globally, allowing a single registration even if multiple versions of `any-promise` are installed in the NPM dependency tree or are using multiple bundled JavaScript files in the browser. You can bypass this global registration in options:
114 +
115 +
116 +```javascript
117 +require('../register')('es6-promise', {Promise: require('es6-promise').Promise, global: false})
118 +```
119 +
120 +### Library Usage
121 +
122 +To use any `Promise` constructor, simply require it:
123 +
124 +```javascript
125 +var Promise = require('any-promise');
126 +
127 +return Promise
128 + .all([xf, f, init, coll])
129 + .then(fn);
130 +
131 +
132 +return new Promise(function(resolve, reject){
133 + try {
134 + resolve(item);
135 + } catch(e){
136 + reject(e);
137 + }
138 +});
139 +
140 +```
141 +
142 +Except noted below, libraries using `any-promise` should only use [documented](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) functions as there is no guarantee which implementation will be chosen by the application author. Libraries should never call `register`, only the application user should call if desired.
143 +
144 +
145 +#### Advanced Library Usage
146 +
147 +If your library needs to branch code based on the registered implementation, you can retrieve it using `var impl = require('any-promise/implementation')`, where `impl` will be the package name (`"bluebird"`, `"when"`, etc.) if registered, `"global.Promise"` if using the global version on Node.js, or `"window.Promise"` if using the browser version. You should always include a default case, as there is no guarantee what package may be registered.
148 +
149 +
150 +### Support for old Node.js versions
151 +
152 +Node.js versions prior to `v0.12` may have contained buggy versions of the global `Promise`. For this reason, the global `Promise` is not loaded automatically for these old versions. If using `any-promise` in Node.js versions versions `<= v0.12`, the user should register a desired implementation.
153 +
154 +If an implementation is not registered, `any-promise` will attempt to discover an installed `Promise` implementation. If no implementation can be found, an error will be thrown on `require('any-promise')`. While the auto-discovery usually avoids errors, it is non-deterministic. It is recommended that the user always register a preferred implementation for older Node.js versions.
155 +
156 +This auto-discovery is only available for Node.jS versions prior to `v0.12`. Any newer versions will always default to the global `Promise` implementation.
157 +
158 +### Related
159 +
160 +- [any-observable](https://github.com/sindresorhus/any-observable) - `any-promise` for Observables.
161 +
1 +declare var implementation: string;
2 +
3 +export = implementation;
1 +module.exports = require('./register')().implementation
1 +declare class Promise <R> implements Promise.Thenable <R> {
2 + /**
3 + * If you call resolve in the body of the callback passed to the constructor,
4 + * your promise is fulfilled with result object passed to resolve.
5 + * If you call reject your promise is rejected with the object passed to resolve.
6 + * For consistency and debugging (eg stack traces), obj should be an instanceof Error.
7 + * Any errors thrown in the constructor callback will be implicitly passed to reject().
8 + */
9 + constructor (callback: (resolve : (value?: R | Promise.Thenable<R>) => void, reject: (error?: any) => void) => void);
10 +
11 + /**
12 + * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
13 + * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
14 + * Both callbacks have a single parameter , the fulfillment value or rejection reason.
15 + * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
16 + * If an error is thrown in the callback, the returned promise rejects with that error.
17 + *
18 + * @param onFulfilled called when/if "promise" resolves
19 + * @param onRejected called when/if "promise" rejects
20 + */
21 + then <U> (onFulfilled?: (value: R) => U | Promise.Thenable<U>, onRejected?: (error: any) => U | Promise.Thenable<U>): Promise<U>;
22 + then <U> (onFulfilled?: (value: R) => U | Promise.Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
23 +
24 + /**
25 + * Sugar for promise.then(undefined, onRejected)
26 + *
27 + * @param onRejected called when/if "promise" rejects
28 + */
29 + catch <U> (onRejected?: (error: any) => U | Promise.Thenable<U>): Promise<U>;
30 +
31 + /**
32 + * Make a new promise from the thenable.
33 + * A thenable is promise-like in as far as it has a "then" method.
34 + */
35 + static resolve (): Promise<void>;
36 + static resolve <R> (value: R | Promise.Thenable<R>): Promise<R>;
37 +
38 + /**
39 + * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
40 + */
41 + static reject <R> (error: any): Promise<R>;
42 +
43 + /**
44 + * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
45 + * the array passed to all can be a mixture of promise-like objects and other objects.
46 + * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
47 + */
48 + static all <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>, T8 | Promise.Thenable<T8>, T9 | Promise.Thenable<T9>, T10 | Promise.Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
49 + static all <T1, T2, T3, T4, T5, T6, T7, T8, T9> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>, T8 | Promise.Thenable<T8>, T9 | Promise.Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
50 + static all <T1, T2, T3, T4, T5, T6, T7, T8> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>, T8 | Promise.Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
51 + static all <T1, T2, T3, T4, T5, T6, T7> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
52 + static all <T1, T2, T3, T4, T5, T6> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
53 + static all <T1, T2, T3, T4, T5> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
54 + static all <T1, T2, T3, T4> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>]): Promise<[T1, T2, T3, T4]>;
55 + static all <T1, T2, T3> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>]): Promise<[T1, T2, T3]>;
56 + static all <T1, T2> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>]): Promise<[T1, T2]>;
57 + static all <T1> (values: [T1 | Promise.Thenable<T1>]): Promise<[T1]>;
58 + static all <TAll> (values: Array<TAll | Promise.Thenable<TAll>>): Promise<TAll[]>;
59 +
60 + /**
61 + * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
62 + */
63 + static race <R> (promises: (R | Promise.Thenable<R>)[]): Promise<R>;
64 +}
65 +
66 +declare namespace Promise {
67 + export interface Thenable <R> {
68 + then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
69 + then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
70 + }
71 +}
72 +
73 +export = Promise;
1 +module.exports = require('./register')().Promise
1 +"use strict"
2 + // global key for user preferred registration
3 +var REGISTRATION_KEY = '@@any-promise/REGISTRATION',
4 + // Prior registration (preferred or detected)
5 + registered = null
6 +
7 +/**
8 + * Registers the given implementation. An implementation must
9 + * be registered prior to any call to `require("any-promise")`,
10 + * typically on application load.
11 + *
12 + * If called with no arguments, will return registration in
13 + * following priority:
14 + *
15 + * For Node.js:
16 + *
17 + * 1. Previous registration
18 + * 2. global.Promise if node.js version >= 0.12
19 + * 3. Auto detected promise based on first sucessful require of
20 + * known promise libraries. Note this is a last resort, as the
21 + * loaded library is non-deterministic. node.js >= 0.12 will
22 + * always use global.Promise over this priority list.
23 + * 4. Throws error.
24 + *
25 + * For Browser:
26 + *
27 + * 1. Previous registration
28 + * 2. window.Promise
29 + * 3. Throws error.
30 + *
31 + * Options:
32 + *
33 + * Promise: Desired Promise constructor
34 + * global: Boolean - Should the registration be cached in a global variable to
35 + * allow cross dependency/bundle registration? (default true)
36 + */
37 +module.exports = function(root, loadImplementation){
38 + return function register(implementation, opts){
39 + implementation = implementation || null
40 + opts = opts || {}
41 + // global registration unless explicitly {global: false} in options (default true)
42 + var registerGlobal = opts.global !== false;
43 +
44 + // load any previous global registration
45 + if(registered === null && registerGlobal){
46 + registered = root[REGISTRATION_KEY] || null
47 + }
48 +
49 + if(registered !== null
50 + && implementation !== null
51 + && registered.implementation !== implementation){
52 + // Throw error if attempting to redefine implementation
53 + throw new Error('any-promise already defined as "'+registered.implementation+
54 + '". You can only register an implementation before the first '+
55 + ' call to require("any-promise") and an implementation cannot be changed')
56 + }
57 +
58 + if(registered === null){
59 + // use provided implementation
60 + if(implementation !== null && typeof opts.Promise !== 'undefined'){
61 + registered = {
62 + Promise: opts.Promise,
63 + implementation: implementation
64 + }
65 + } else {
66 + // require implementation if implementation is specified but not provided
67 + registered = loadImplementation(implementation)
68 + }
69 +
70 + if(registerGlobal){
71 + // register preference globally in case multiple installations
72 + root[REGISTRATION_KEY] = registered
73 + }
74 + }
75 +
76 + return registered
77 + }
78 +}
1 +"use strict";
2 +try {
3 + module.exports = require('./register')().Promise || null
4 +} catch(e) {
5 + module.exports = null
6 +}
1 +{
2 + "_from": "any-promise@^1.3.0",
3 + "_id": "any-promise@1.3.0",
4 + "_inBundle": false,
5 + "_integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=",
6 + "_location": "/any-promise",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "any-promise@^1.3.0",
12 + "name": "any-promise",
13 + "escapedName": "any-promise",
14 + "rawSpec": "^1.3.0",
15 + "saveSpec": null,
16 + "fetchSpec": "^1.3.0"
17 + },
18 + "_requiredBy": [
19 + "/retry-as-promised"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
22 + "_shasum": "abc6afeedcea52e809cdc0376aed3ce39635d17f",
23 + "_spec": "any-promise@^1.3.0",
24 + "_where": "C:\\Users\\gther\\Desktop\\projects\\capston2\\node_modules\\retry-as-promised",
25 + "author": {
26 + "name": "Kevin Beaty"
27 + },
28 + "browser": {
29 + "./register.js": "./register-shim.js"
30 + },
31 + "bugs": {
32 + "url": "https://github.com/kevinbeaty/any-promise/issues"
33 + },
34 + "bundleDependencies": false,
35 + "dependencies": {},
36 + "deprecated": false,
37 + "description": "Resolve any installed ES6 compatible promise",
38 + "devDependencies": {
39 + "ava": "^0.14.0",
40 + "bluebird": "^3.0.0",
41 + "es6-promise": "^3.0.0",
42 + "is-promise": "^2.0.0",
43 + "lie": "^3.0.0",
44 + "mocha": "^2.0.0",
45 + "native-promise-only": "^0.8.0",
46 + "phantomjs-prebuilt": "^2.0.0",
47 + "pinkie": "^2.0.0",
48 + "promise": "^7.0.0",
49 + "q": "^1.0.0",
50 + "rsvp": "^3.0.0",
51 + "vow": "^0.4.0",
52 + "when": "^3.0.0",
53 + "zuul": "^3.0.0"
54 + },
55 + "homepage": "http://github.com/kevinbeaty/any-promise",
56 + "keywords": [
57 + "promise",
58 + "es6"
59 + ],
60 + "license": "MIT",
61 + "main": "index.js",
62 + "name": "any-promise",
63 + "repository": {
64 + "type": "git",
65 + "url": "git+https://github.com/kevinbeaty/any-promise.git"
66 + },
67 + "scripts": {
68 + "test": "ava"
69 + },
70 + "typings": "index.d.ts",
71 + "version": "1.3.0"
72 +}
1 +"use strict";
2 +module.exports = require('./loader')(window, loadImplementation)
3 +
4 +/**
5 + * Browser specific loadImplementation. Always uses `window.Promise`
6 + *
7 + * To register a custom implementation, must register with `Promise` option.
8 + */
9 +function loadImplementation(){
10 + if(typeof window.Promise === 'undefined'){
11 + throw new Error("any-promise browser requires a polyfill or explicit registration"+
12 + " e.g: require('any-promise/register/bluebird')")
13 + }
14 + return {
15 + Promise: window.Promise,
16 + implementation: 'window.Promise'
17 + }
18 +}
1 +import Promise = require('./index');
2 +
3 +declare function register (module?: string, options?: register.Options): register.Register;
4 +
5 +declare namespace register {
6 + export interface Register {
7 + Promise: typeof Promise;
8 + implementation: string;
9 + }
10 +
11 + export interface Options {
12 + Promise?: typeof Promise;
13 + global?: boolean
14 + }
15 +}
16 +
17 +export = register;
1 +"use strict"
2 +module.exports = require('./loader')(global, loadImplementation);
3 +
4 +/**
5 + * Node.js version of loadImplementation.
6 + *
7 + * Requires the given implementation and returns the registration
8 + * containing {Promise, implementation}
9 + *
10 + * If implementation is undefined or global.Promise, loads it
11 + * Otherwise uses require
12 + */
13 +function loadImplementation(implementation){
14 + var impl = null
15 +
16 + if(shouldPreferGlobalPromise(implementation)){
17 + // if no implementation or env specified use global.Promise
18 + impl = {
19 + Promise: global.Promise,
20 + implementation: 'global.Promise'
21 + }
22 + } else if(implementation){
23 + // if implementation specified, require it
24 + var lib = require(implementation)
25 + impl = {
26 + Promise: lib.Promise || lib,
27 + implementation: implementation
28 + }
29 + } else {
30 + // try to auto detect implementation. This is non-deterministic
31 + // and should prefer other branches, but this is our last chance
32 + // to load something without throwing error
33 + impl = tryAutoDetect()
34 + }
35 +
36 + if(impl === null){
37 + throw new Error('Cannot find any-promise implementation nor'+
38 + ' global.Promise. You must install polyfill or call'+
39 + ' require("any-promise/register") with your preferred'+
40 + ' implementation, e.g. require("any-promise/register/bluebird")'+
41 + ' on application load prior to any require("any-promise").')
42 + }
43 +
44 + return impl
45 +}
46 +
47 +/**
48 + * Determines if the global.Promise should be preferred if an implementation
49 + * has not been registered.
50 + */
51 +function shouldPreferGlobalPromise(implementation){
52 + if(implementation){
53 + return implementation === 'global.Promise'
54 + } else if(typeof global.Promise !== 'undefined'){
55 + // Load global promise if implementation not specified
56 + // Versions < 0.11 did not have global Promise
57 + // Do not use for version < 0.12 as version 0.11 contained buggy versions
58 + var version = (/v(\d+)\.(\d+)\.(\d+)/).exec(process.version)
59 + return !(version && +version[1] == 0 && +version[2] < 12)
60 + }
61 +
62 + // do not have global.Promise or another implementation was specified
63 + return false
64 +}
65 +
66 +/**
67 + * Look for common libs as last resort there is no guarantee that
68 + * this will return a desired implementation or even be deterministic.
69 + * The priority is also nearly arbitrary. We are only doing this
70 + * for older versions of Node.js <0.12 that do not have a reasonable
71 + * global.Promise implementation and we the user has not registered
72 + * the preference. This preserves the behavior of any-promise <= 0.1
73 + * and may be deprecated or removed in the future
74 + */
75 +function tryAutoDetect(){
76 + var libs = [
77 + "es6-promise",
78 + "promise",
79 + "native-promise-only",
80 + "bluebird",
81 + "rsvp",
82 + "when",
83 + "q",
84 + "pinkie",
85 + "lie",
86 + "vow"]
87 + var i = 0, len = libs.length
88 + for(; i < len; i++){
89 + try {
90 + return loadImplementation(libs[i])
91 + } catch(e){}
92 + }
93 + return null
94 +}
1 +'use strict';
2 +require('../register')('bluebird', {Promise: require('bluebird')})
1 +'use strict';
2 +require('../register')('es6-promise', {Promise: require('es6-promise').Promise})
1 +'use strict';
2 +require('../register')('lie', {Promise: require('lie')})
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.