이태화

web crawling practice

Showing 1000 changed files with 4654 additions and 4 deletions

Too many changes to show.

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

...@@ -12,11 +12,8 @@ app.use(router); ...@@ -12,11 +12,8 @@ app.use(router);
12 12
13 const indexRouter = require('./routes/root'); 13 const indexRouter = require('./routes/root');
14 14
15 -
16 router.get('/', indexRouter); 15 router.get('/', indexRouter);
17 16
18 -
19 -
20 app.listen(PORT,function(err){ 17 app.listen(PORT,function(err){
21 if(err){ 18 if(err){
22 console.log(err); 19 console.log(err);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
16 import item from './imfoItem.vue' 16 import item from './imfoItem.vue'
17 17
18 export default { 18 export default {
19 - name: 'App', 19 + name: 'imfoList',
20 components: { 20 components: {
21 'item': item 21 'item': item
22 } 22 }
......
1 +const express = require("express");
2 +const App = express();
3 +const axios = require("axios");
4 +const cheerio = require("cheerio");
5 +
6 +App.get('/',function(req,res){
7 + res.send('hello');
8 +})
9 +
10 +var getHTML = async function(){
11 + try{
12 + return await axios.get("http://software.khu.ac.kr/board5/bbs/board.php?bo_table=05_01&page=1");
13 + } catch(e){
14 + console.log(e);
15 + }
16 +}
17 +
18 +getHTML().then(function(HTML){
19 + var list = [];
20 + var $ = cheerio.load(HTML.data);
21 + var titleList = $('tr');
22 + titleList.each(function(i, elem){
23 + list[i] = {
24 + title: $(this).find(".bo_tit").text().replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/(^\s*)|(\s*$)/gi, "")
25 + }
26 + })
27 + for(var i = 0; i < list.length;i++){
28 + console.log(list[i]);
29 + }
30 +
31 +
32 +}
33 +);
34 +
35 +
36 +App.listen(80)
...\ No newline at end of file ...\ No newline at end of file
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../is-ci/bin.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../is-ci/bin.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\is-ci\bin.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../is-ci/bin.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../is-ci/bin.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../mime/cli.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../mime/cli.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@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/../nodemon/bin/nodemon.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../nodemon/bin/nodemon.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%\..\nodemon\bin\nodemon.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../touch/bin/nodetouch.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../touch/bin/nodetouch.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\touch\bin\nodetouch.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../nopt/bin/nopt.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\nopt\bin\nopt.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../nopt/bin/nopt.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../rc/cli.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../rc/cli.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\rc\cli.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../rc/cli.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../rc/cli.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../semver/bin/semver" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../semver/bin/semver" "$@"
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" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../semver/bin/semver" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../semver/bin/semver" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +/// <reference types="node" />
2 +/// <reference lib="es2016" />
3 +/// <reference lib="es2017.sharedmemory" />
4 +/// <reference lib="esnext.asynciterable" />
5 +/// <reference lib="dom" />
6 +declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
7 +declare type Primitive = null | undefined | string | number | boolean | Symbol;
8 +export interface ArrayLike {
9 + length: number;
10 +}
11 +export interface Class<T = unknown> {
12 + new (...args: any[]): T;
13 +}
14 +declare type DomElement = object & {
15 + nodeType: 1;
16 + nodeName: string;
17 +};
18 +declare type NodeStream = object & {
19 + pipe: Function;
20 +};
21 +export declare const enum TypeName {
22 + null = "null",
23 + boolean = "boolean",
24 + undefined = "undefined",
25 + string = "string",
26 + number = "number",
27 + symbol = "symbol",
28 + Function = "Function",
29 + GeneratorFunction = "GeneratorFunction",
30 + AsyncFunction = "AsyncFunction",
31 + Observable = "Observable",
32 + Array = "Array",
33 + Buffer = "Buffer",
34 + Object = "Object",
35 + RegExp = "RegExp",
36 + Date = "Date",
37 + Error = "Error",
38 + Map = "Map",
39 + Set = "Set",
40 + WeakMap = "WeakMap",
41 + WeakSet = "WeakSet",
42 + Int8Array = "Int8Array",
43 + Uint8Array = "Uint8Array",
44 + Uint8ClampedArray = "Uint8ClampedArray",
45 + Int16Array = "Int16Array",
46 + Uint16Array = "Uint16Array",
47 + Int32Array = "Int32Array",
48 + Uint32Array = "Uint32Array",
49 + Float32Array = "Float32Array",
50 + Float64Array = "Float64Array",
51 + ArrayBuffer = "ArrayBuffer",
52 + SharedArrayBuffer = "SharedArrayBuffer",
53 + DataView = "DataView",
54 + Promise = "Promise",
55 + URL = "URL"
56 +}
57 +declare function is(value: unknown): TypeName;
58 +declare namespace is {
59 + const undefined: (value: unknown) => value is undefined;
60 + const string: (value: unknown) => value is string;
61 + const number: (value: unknown) => value is number;
62 + const function_: (value: unknown) => value is Function;
63 + const null_: (value: unknown) => value is null;
64 + const class_: (value: unknown) => value is Class<unknown>;
65 + const boolean: (value: unknown) => value is boolean;
66 + const symbol: (value: unknown) => value is Symbol;
67 + const numericString: (value: unknown) => boolean;
68 + const array: (arg: any) => arg is any[];
69 + const buffer: (input: unknown) => input is Buffer;
70 + const nullOrUndefined: (value: unknown) => value is null | undefined;
71 + const object: (value: unknown) => value is object;
72 + const iterable: (value: unknown) => value is IterableIterator<unknown>;
73 + const asyncIterable: (value: unknown) => value is AsyncIterableIterator<unknown>;
74 + const generator: (value: unknown) => value is Generator;
75 + const nativePromise: (value: unknown) => value is Promise<unknown>;
76 + const promise: (value: unknown) => value is Promise<unknown>;
77 + const generatorFunction: (value: unknown) => value is GeneratorFunction;
78 + const asyncFunction: (value: unknown) => value is Function;
79 + const boundFunction: (value: unknown) => value is Function;
80 + const regExp: (value: unknown) => value is RegExp;
81 + const date: (value: unknown) => value is Date;
82 + const error: (value: unknown) => value is Error;
83 + const map: (value: unknown) => value is Map<unknown, unknown>;
84 + const set: (value: unknown) => value is Set<unknown>;
85 + const weakMap: (value: unknown) => value is WeakMap<object, unknown>;
86 + const weakSet: (value: unknown) => value is WeakSet<object>;
87 + const int8Array: (value: unknown) => value is Int8Array;
88 + const uint8Array: (value: unknown) => value is Uint8Array;
89 + const uint8ClampedArray: (value: unknown) => value is Uint8ClampedArray;
90 + const int16Array: (value: unknown) => value is Int16Array;
91 + const uint16Array: (value: unknown) => value is Uint16Array;
92 + const int32Array: (value: unknown) => value is Int32Array;
93 + const uint32Array: (value: unknown) => value is Uint32Array;
94 + const float32Array: (value: unknown) => value is Float32Array;
95 + const float64Array: (value: unknown) => value is Float64Array;
96 + const arrayBuffer: (value: unknown) => value is ArrayBuffer;
97 + const sharedArrayBuffer: (value: unknown) => value is SharedArrayBuffer;
98 + const dataView: (value: unknown) => value is DataView;
99 + const directInstanceOf: <T>(instance: unknown, klass: Class<T>) => instance is T;
100 + const urlInstance: (value: unknown) => value is URL;
101 + const urlString: (value: unknown) => boolean;
102 + const truthy: (value: unknown) => boolean;
103 + const falsy: (value: unknown) => boolean;
104 + const nan: (value: unknown) => boolean;
105 + const primitive: (value: unknown) => value is Primitive;
106 + const integer: (value: unknown) => value is number;
107 + const safeInteger: (value: unknown) => value is number;
108 + const plainObject: (value: unknown) => boolean;
109 + const typedArray: (value: unknown) => value is TypedArray;
110 + const arrayLike: (value: unknown) => value is ArrayLike;
111 + const inRange: (value: number, range: number | number[]) => boolean;
112 + const domElement: (value: unknown) => value is DomElement;
113 + const observable: (value: unknown) => boolean;
114 + const nodeStream: (value: unknown) => value is NodeStream;
115 + const infinite: (value: unknown) => boolean;
116 + const even: (value: number) => boolean;
117 + const odd: (value: number) => boolean;
118 + const emptyArray: (value: unknown) => boolean;
119 + const nonEmptyArray: (value: unknown) => boolean;
120 + const emptyString: (value: unknown) => boolean;
121 + const nonEmptyString: (value: unknown) => boolean;
122 + const emptyStringOrWhitespace: (value: unknown) => boolean;
123 + const emptyObject: (value: unknown) => boolean;
124 + const nonEmptyObject: (value: unknown) => boolean;
125 + const emptySet: (value: unknown) => boolean;
126 + const nonEmptySet: (value: unknown) => boolean;
127 + const emptyMap: (value: unknown) => boolean;
128 + const nonEmptyMap: (value: unknown) => boolean;
129 + const any: (predicate: unknown, ...values: unknown[]) => boolean;
130 + const all: (predicate: unknown, ...values: unknown[]) => boolean;
131 +}
132 +export default is;
This diff is collapsed. Click to expand it.
1 +MIT License
2 +
3 +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 +
7 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 +
9 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +{
2 + "_from": "@sindresorhus/is@^0.14.0",
3 + "_id": "@sindresorhus/is@0.14.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==",
6 + "_location": "/@sindresorhus/is",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@sindresorhus/is@^0.14.0",
12 + "name": "@sindresorhus/is",
13 + "escapedName": "@sindresorhus%2fis",
14 + "scope": "@sindresorhus",
15 + "rawSpec": "^0.14.0",
16 + "saveSpec": null,
17 + "fetchSpec": "^0.14.0"
18 + },
19 + "_requiredBy": [
20 + "/got"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
23 + "_shasum": "9fb3a3cf3132328151f353de4632e01e52102bea",
24 + "_spec": "@sindresorhus/is@^0.14.0",
25 + "_where": "C:\\Users\\worro\\OneDrive\\Desktop\\openSourceSoftware\\webcrawling-practice\\node_modules\\got",
26 + "author": {
27 + "name": "Sindre Sorhus",
28 + "email": "sindresorhus@gmail.com",
29 + "url": "sindresorhus.com"
30 + },
31 + "bugs": {
32 + "url": "https://github.com/sindresorhus/is/issues"
33 + },
34 + "bundleDependencies": false,
35 + "deprecated": false,
36 + "description": "Type check values: `is.string('🦄') //=> true`",
37 + "devDependencies": {
38 + "@sindresorhus/tsconfig": "^0.1.0",
39 + "@types/jsdom": "^11.12.0",
40 + "@types/node": "^10.12.10",
41 + "@types/tempy": "^0.2.0",
42 + "@types/zen-observable": "^0.8.0",
43 + "ava": "^0.25.0",
44 + "del-cli": "^1.1.0",
45 + "jsdom": "^11.6.2",
46 + "rxjs": "^6.3.3",
47 + "tempy": "^0.2.1",
48 + "tslint": "^5.9.1",
49 + "tslint-xo": "^0.10.0",
50 + "typescript": "^3.2.1",
51 + "zen-observable": "^0.8.8"
52 + },
53 + "engines": {
54 + "node": ">=6"
55 + },
56 + "files": [
57 + "dist"
58 + ],
59 + "homepage": "https://github.com/sindresorhus/is#readme",
60 + "keywords": [
61 + "type",
62 + "types",
63 + "is",
64 + "check",
65 + "checking",
66 + "validate",
67 + "validation",
68 + "utility",
69 + "util",
70 + "typeof",
71 + "instanceof",
72 + "object",
73 + "assert",
74 + "assertion",
75 + "test",
76 + "kind",
77 + "primitive",
78 + "verify",
79 + "compare"
80 + ],
81 + "license": "MIT",
82 + "main": "dist/index.js",
83 + "name": "@sindresorhus/is",
84 + "repository": {
85 + "type": "git",
86 + "url": "git+https://github.com/sindresorhus/is.git"
87 + },
88 + "scripts": {
89 + "build": "del dist && tsc",
90 + "lint": "tslint --format stylish --project .",
91 + "prepublish": "npm run build && del dist/tests",
92 + "test": "npm run lint && npm run build && ava dist/tests"
93 + },
94 + "types": "dist/index.d.ts",
95 + "version": "0.14.0"
96 +}
This diff is collapsed. Click to expand it.
1 +MIT License
2 +
3 +Copyright (c) 2018 Szymon Marczak
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 +# http-timer
2 +> Timings for HTTP requests
3 +
4 +[![Build Status](https://travis-ci.org/szmarczak/http-timer.svg?branch=master)](https://travis-ci.org/szmarczak/http-timer)
5 +[![Coverage Status](https://coveralls.io/repos/github/szmarczak/http-timer/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http-timer?branch=master)
6 +[![install size](https://packagephobia.now.sh/badge?p=@szmarczak/http-timer)](https://packagephobia.now.sh/result?p=@szmarczak/http-timer)
7 +
8 +Inspired by the [`request` package](https://github.com/request/request).
9 +
10 +## Usage
11 +```js
12 +'use strict';
13 +const https = require('https');
14 +const timer = require('@szmarczak/http-timer');
15 +
16 +const request = https.get('https://httpbin.org/anything');
17 +const timings = timer(request);
18 +
19 +request.on('response', response => {
20 + response.on('data', () => {}); // Consume the data somehow
21 + response.on('end', () => {
22 + console.log(timings);
23 + });
24 +});
25 +
26 +// { start: 1535708511443,
27 +// socket: 1535708511444,
28 +// lookup: 1535708511444,
29 +// connect: 1535708511582,
30 +// upload: 1535708511887,
31 +// response: 1535708512037,
32 +// end: 1535708512040,
33 +// phases:
34 +// { wait: 1,
35 +// dns: 0,
36 +// tcp: 138,
37 +// request: 305,
38 +// firstByte: 150,
39 +// download: 3,
40 +// total: 597 } }
41 +```
42 +
43 +## API
44 +
45 +### timer(request)
46 +
47 +Returns: `Object`
48 +
49 +- `start` - Time when the request started.
50 +- `socket` - Time when a socket was assigned to the request.
51 +- `lookup` - Time when the DNS lookup finished.
52 +- `connect` - Time when the socket successfully connected.
53 +- `upload` - Time when the request finished uploading.
54 +- `response` - Time when the request fired the `response` event.
55 +- `end` - Time when the response fired the `end` event.
56 +- `error` - Time when the request fired the `error` event.
57 +- `phases`
58 + - `wait` - `timings.socket - timings.start`
59 + - `dns` - `timings.lookup - timings.socket`
60 + - `tcp` - `timings.connect - timings.lookup`
61 + - `request` - `timings.upload - timings.connect`
62 + - `firstByte` - `timings.response - timings.upload`
63 + - `download` - `timings.end - timings.response`
64 + - `total` - `timings.end - timings.start` or `timings.error - timings.start`
65 +
66 +**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
67 +
68 +## License
69 +
70 +MIT
1 +{
2 + "_from": "@szmarczak/http-timer@^1.1.2",
3 + "_id": "@szmarczak/http-timer@1.1.2",
4 + "_inBundle": false,
5 + "_integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==",
6 + "_location": "/@szmarczak/http-timer",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@szmarczak/http-timer@^1.1.2",
12 + "name": "@szmarczak/http-timer",
13 + "escapedName": "@szmarczak%2fhttp-timer",
14 + "scope": "@szmarczak",
15 + "rawSpec": "^1.1.2",
16 + "saveSpec": null,
17 + "fetchSpec": "^1.1.2"
18 + },
19 + "_requiredBy": [
20 + "/got"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz",
23 + "_shasum": "b1665e2c461a2cd92f4c1bbf50d5454de0d4b421",
24 + "_spec": "@szmarczak/http-timer@^1.1.2",
25 + "_where": "C:\\Users\\worro\\OneDrive\\Desktop\\openSourceSoftware\\webcrawling-practice\\node_modules\\got",
26 + "author": {
27 + "name": "Szymon Marczak"
28 + },
29 + "bugs": {
30 + "url": "https://github.com/szmarczak/http-timer/issues"
31 + },
32 + "bundleDependencies": false,
33 + "dependencies": {
34 + "defer-to-connect": "^1.0.1"
35 + },
36 + "deprecated": false,
37 + "description": "Timings for HTTP requests",
38 + "devDependencies": {
39 + "ava": "^0.25.0",
40 + "coveralls": "^3.0.2",
41 + "nyc": "^12.0.2",
42 + "p-event": "^2.1.0",
43 + "xo": "^0.22.0"
44 + },
45 + "engines": {
46 + "node": ">=6"
47 + },
48 + "files": [
49 + "source"
50 + ],
51 + "homepage": "https://github.com/szmarczak/http-timer#readme",
52 + "keywords": [
53 + "http",
54 + "https",
55 + "timer",
56 + "timings"
57 + ],
58 + "license": "MIT",
59 + "main": "source",
60 + "name": "@szmarczak/http-timer",
61 + "repository": {
62 + "type": "git",
63 + "url": "git+https://github.com/szmarczak/http-timer.git"
64 + },
65 + "scripts": {
66 + "coveralls": "nyc report --reporter=text-lcov | coveralls",
67 + "test": "xo && nyc ava"
68 + },
69 + "version": "1.1.2",
70 + "xo": {
71 + "rules": {
72 + "unicorn/filename-case": "camelCase"
73 + }
74 + }
75 +}
1 +'use strict';
2 +const deferToConnect = require('defer-to-connect');
3 +
4 +module.exports = request => {
5 + const timings = {
6 + start: Date.now(),
7 + socket: null,
8 + lookup: null,
9 + connect: null,
10 + upload: null,
11 + response: null,
12 + end: null,
13 + error: null,
14 + phases: {
15 + wait: null,
16 + dns: null,
17 + tcp: null,
18 + request: null,
19 + firstByte: null,
20 + download: null,
21 + total: null
22 + }
23 + };
24 +
25 + const handleError = origin => {
26 + const emit = origin.emit.bind(origin);
27 + origin.emit = (event, ...args) => {
28 + // Catches the `error` event
29 + if (event === 'error') {
30 + timings.error = Date.now();
31 + timings.phases.total = timings.error - timings.start;
32 +
33 + origin.emit = emit;
34 + }
35 +
36 + // Saves the original behavior
37 + return emit(event, ...args);
38 + };
39 + };
40 +
41 + let uploadFinished = false;
42 + const onUpload = () => {
43 + timings.upload = Date.now();
44 + timings.phases.request = timings.upload - timings.connect;
45 + };
46 +
47 + handleError(request);
48 +
49 + request.once('socket', socket => {
50 + timings.socket = Date.now();
51 + timings.phases.wait = timings.socket - timings.start;
52 +
53 + const lookupListener = () => {
54 + timings.lookup = Date.now();
55 + timings.phases.dns = timings.lookup - timings.socket;
56 + };
57 +
58 + socket.once('lookup', lookupListener);
59 +
60 + deferToConnect(socket, () => {
61 + timings.connect = Date.now();
62 +
63 + if (timings.lookup === null) {
64 + socket.removeListener('lookup', lookupListener);
65 + timings.lookup = timings.connect;
66 + timings.phases.dns = timings.lookup - timings.socket;
67 + }
68 +
69 + timings.phases.tcp = timings.connect - timings.lookup;
70 +
71 + if (uploadFinished && !timings.upload) {
72 + onUpload();
73 + }
74 + });
75 + });
76 +
77 + request.once('finish', () => {
78 + uploadFinished = true;
79 +
80 + if (timings.connect) {
81 + onUpload();
82 + }
83 + });
84 +
85 + request.once('response', response => {
86 + timings.response = Date.now();
87 + timings.phases.firstByte = timings.response - timings.upload;
88 +
89 + handleError(response);
90 +
91 + response.once('end', () => {
92 + timings.end = Date.now();
93 + timings.phases.download = timings.end - timings.response;
94 + timings.phases.total = timings.end - timings.start;
95 + });
96 + });
97 +
98 + return timings;
99 +};
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: Mon, 26 Oct 2020 22:58:09 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 + stackStartFn?: Function;
25 + });
26 + }
27 +
28 + class CallTracker {
29 + calls(exact?: number): () => void;
30 + calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
31 + report(): CallTrackerReportInformation[];
32 + verify(): void;
33 + }
34 + export interface CallTrackerReportInformation {
35 + message: string;
36 + /** The actual number of times the function was called. */
37 + actual: number;
38 + /** The number of times the function was expected to be called. */
39 + expected: number;
40 + /** The name of the function that is wrapped. */
41 + operator: string;
42 + /** A stack trace of the function. */
43 + stack: object;
44 + }
45 +
46 + type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error;
47 +
48 + function fail(message?: string | Error): never;
49 + /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
50 + function fail(
51 + actual: any,
52 + expected: any,
53 + message?: string | Error,
54 + operator?: string,
55 + stackStartFn?: Function,
56 + ): never;
57 + function ok(value: any, message?: string | Error): asserts value;
58 + /** @deprecated since v9.9.0 - use strictEqual() instead. */
59 + function equal(actual: any, expected: any, message?: string | Error): void;
60 + /** @deprecated since v9.9.0 - use notStrictEqual() instead. */
61 + function notEqual(actual: any, expected: any, message?: string | Error): void;
62 + /** @deprecated since v9.9.0 - use deepStrictEqual() instead. */
63 + function deepEqual(actual: any, expected: any, message?: string | Error): void;
64 + /** @deprecated since v9.9.0 - use notDeepStrictEqual() instead. */
65 + function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
66 + function strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
67 + function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
68 + function deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
69 + function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
70 +
71 + function throws(block: () => any, message?: string | Error): void;
72 + function throws(block: () => any, error: AssertPredicate, message?: string | Error): void;
73 + function doesNotThrow(block: () => any, message?: string | Error): void;
74 + function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void;
75 +
76 + function ifError(value: any): asserts value is null | undefined;
77 +
78 + function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
79 + function rejects(
80 + block: (() => Promise<any>) | Promise<any>,
81 + error: AssertPredicate,
82 + message?: string | Error,
83 + ): Promise<void>;
84 + function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
85 + function doesNotReject(
86 + block: (() => Promise<any>) | Promise<any>,
87 + error: RegExp | Function,
88 + message?: string | Error,
89 + ): Promise<void>;
90 +
91 + function match(value: string, regExp: RegExp, message?: string | Error): void;
92 + function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
93 +
94 + const strict: Omit<
95 + typeof assert,
96 + | 'strict'
97 + | 'deepEqual'
98 + | 'notDeepEqual'
99 + | 'equal'
100 + | 'notEqual'
101 + | 'ok'
102 + | 'strictEqual'
103 + | 'deepStrictEqual'
104 + | 'ifError'
105 + > & {
106 + (value: any, message?: string | Error): asserts value;
107 + strict: typeof strict;
108 + deepEqual: typeof deepStrictEqual;
109 + notDeepEqual: typeof notDeepStrictEqual;
110 + equal: typeof strictEqual;
111 + notEqual: typeof notStrictEqual;
112 + ok(value: any, message?: string | Error): asserts value;
113 + strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
114 + deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
115 + ifError(value: any): asserts value is null | undefined;
116 + };
117 + }
118 +
119 + export = assert;
120 +}
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 +// tslint:disable-next-line:no-bad-reference
17 +/// <reference path="ts3.6/base.d.ts" />
18 +
19 +// TypeScript 3.7-specific augmentations:
20 +/// <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.5",
4 + "_inBundle": false,
5 + "_integrity": "sha512-H5Wn24s/ZOukBmDn03nnGTp18A60ny9AmCwnEcgJiTgSGsCO7k+NWP7zjCCbhlcnVCoI+co52dUAt9GMhOSULw==",
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 + "/parse5"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.5.tgz",
23 + "_shasum": "e92d3b8f76583efa26c1a63a21c9d3c1143daa29",
24 + "_spec": "@types/node@*",
25 + "_where": "C:\\Users\\worro\\OneDrive\\Desktop\\openSourceSoftware\\webcrawling-practice\\node_modules\\parse5",
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.2",
222 + "types": "index.d.ts",
223 + "typesPublisherContentHash": "206a5a1941c97b04fbffd53f14102a1ca47f991778959646c5dc8df1b2e6abd6",
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.5"
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 + function assert(value: any, message?: string | Error): void;
3 + namespace assert {
4 + class AssertionError implements Error {
5 + name: string;
6 + message: string;
7 + actual: any;
8 + expected: any;
9 + operator: string;
10 + generatedMessage: boolean;
11 + code: 'ERR_ASSERTION';
12 +
13 + constructor(options?: {
14 + message?: string;
15 + actual?: any;
16 + expected?: any;
17 + operator?: string;
18 + stackStartFn?: Function;
19 + });
20 + }
21 +
22 + type AssertPredicate = RegExp | (new () => object) | ((thrown: any) => boolean) | object | Error;
23 +
24 + function fail(message?: string | Error): never;
25 + /** @deprecated since v10.0.0 - use `fail([message])` or other assert functions instead. */
26 + function fail(
27 + actual: any,
28 + expected: any,
29 + message?: string | Error,
30 + operator?: string,
31 + stackStartFn?: Function,
32 + ): never;
33 + function ok(value: any, message?: string | Error): void;
34 + /** @deprecated since v9.9.0 - use `strictEqual()` instead. */
35 + function equal(actual: any, expected: any, message?: string | Error): void;
36 + /** @deprecated since v9.9.0 - use `notStrictEqual()` instead. */
37 + function notEqual(actual: any, expected: any, message?: string | Error): void;
38 + /** @deprecated since v9.9.0 - use `deepStrictEqual()` instead. */
39 + function deepEqual(actual: any, expected: any, message?: string | Error): void;
40 + /** @deprecated since v9.9.0 - use `notDeepStrictEqual()` instead. */
41 + function notDeepEqual(actual: any, expected: any, message?: string | Error): void;
42 + function strictEqual(actual: any, expected: any, message?: string | Error): void;
43 + function notStrictEqual(actual: any, expected: any, message?: string | Error): void;
44 + function deepStrictEqual(actual: any, expected: any, message?: string | Error): void;
45 + function notDeepStrictEqual(actual: any, expected: any, message?: string | Error): void;
46 +
47 + function throws(block: () => any, message?: string | Error): void;
48 + function throws(block: () => any, error: AssertPredicate, message?: string | Error): void;
49 + function doesNotThrow(block: () => any, message?: string | Error): void;
50 + function doesNotThrow(block: () => any, error: RegExp | Function, message?: string | Error): void;
51 +
52 + function ifError(value: any): void;
53 +
54 + function rejects(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
55 + function rejects(
56 + block: (() => Promise<any>) | Promise<any>,
57 + error: AssertPredicate,
58 + message?: string | Error,
59 + ): Promise<void>;
60 + function doesNotReject(block: (() => Promise<any>) | Promise<any>, message?: string | Error): Promise<void>;
61 + function doesNotReject(
62 + block: (() => Promise<any>) | Promise<any>,
63 + error: RegExp | Function,
64 + message?: string | Error,
65 + ): Promise<void>;
66 +
67 + function match(value: string, regExp: RegExp, message?: string | Error): void;
68 + function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
69 +
70 + const strict: typeof assert;
71 + }
72 +
73 + export = assert;
74 +}
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 +// tslint:disable-next-line:no-bad-reference
17 +/// <reference path="../ts3.4/base.d.ts" />
18 +
19 +// TypeScript 3.5-specific augmentations:
20 +/// <reference path="../globals.global.d.ts" />
21 +
22 +// TypeScript 3.5-specific augmentations:
23 +/// <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 +// tslint:disable-next-line:no-bad-reference
8 +/// <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.
1 +This software is dual-licensed under the ISC and MIT licenses.
2 +You may use this software under EITHER of the following licenses.
3 +
4 +----------
5 +
6 +The ISC License
7 +
8 +Copyright (c) Isaac Z. Schlueter and Contributors
9 +
10 +Permission to use, copy, modify, and/or distribute this software for any
11 +purpose with or without fee is hereby granted, provided that the above
12 +copyright notice and this permission notice appear in all copies.
13 +
14 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15 +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17 +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
20 +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 +
22 +----------
23 +
24 +Copyright Isaac Z. Schlueter and Contributors
25 +All rights reserved.
26 +
27 +Permission is hereby granted, free of charge, to any person
28 +obtaining a copy of this software and associated documentation
29 +files (the "Software"), to deal in the Software without
30 +restriction, including without limitation the rights to use,
31 +copy, modify, merge, publish, distribute, sublicense, and/or sell
32 +copies of the Software, and to permit persons to whom the
33 +Software is furnished to do so, subject to the following
34 +conditions:
35 +
36 +The above copyright notice and this permission notice shall be
37 +included in all copies or substantial portions of the Software.
38 +
39 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
41 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
43 +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46 +OTHER DEALINGS IN THE SOFTWARE.
1 +# abbrev-js
2 +
3 +Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
4 +
5 +Usage:
6 +
7 + var abbrev = require("abbrev");
8 + abbrev("foo", "fool", "folding", "flop");
9 +
10 + // returns:
11 + { fl: 'flop'
12 + , flo: 'flop'
13 + , flop: 'flop'
14 + , fol: 'folding'
15 + , fold: 'folding'
16 + , foldi: 'folding'
17 + , foldin: 'folding'
18 + , folding: 'folding'
19 + , foo: 'foo'
20 + , fool: 'fool'
21 + }
22 +
23 +This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
1 +module.exports = exports = abbrev.abbrev = abbrev
2 +
3 +abbrev.monkeyPatch = monkeyPatch
4 +
5 +function monkeyPatch () {
6 + Object.defineProperty(Array.prototype, 'abbrev', {
7 + value: function () { return abbrev(this) },
8 + enumerable: false, configurable: true, writable: true
9 + })
10 +
11 + Object.defineProperty(Object.prototype, 'abbrev', {
12 + value: function () { return abbrev(Object.keys(this)) },
13 + enumerable: false, configurable: true, writable: true
14 + })
15 +}
16 +
17 +function abbrev (list) {
18 + if (arguments.length !== 1 || !Array.isArray(list)) {
19 + list = Array.prototype.slice.call(arguments, 0)
20 + }
21 + for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
22 + args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
23 + }
24 +
25 + // sort them lexicographically, so that they're next to their nearest kin
26 + args = args.sort(lexSort)
27 +
28 + // walk through each, seeing how much it has in common with the next and previous
29 + var abbrevs = {}
30 + , prev = ""
31 + for (var i = 0, l = args.length ; i < l ; i ++) {
32 + var current = args[i]
33 + , next = args[i + 1] || ""
34 + , nextMatches = true
35 + , prevMatches = true
36 + if (current === next) continue
37 + for (var j = 0, cl = current.length ; j < cl ; j ++) {
38 + var curChar = current.charAt(j)
39 + nextMatches = nextMatches && curChar === next.charAt(j)
40 + prevMatches = prevMatches && curChar === prev.charAt(j)
41 + if (!nextMatches && !prevMatches) {
42 + j ++
43 + break
44 + }
45 + }
46 + prev = current
47 + if (j === cl) {
48 + abbrevs[current] = current
49 + continue
50 + }
51 + for (var a = current.substr(0, j) ; j <= cl ; j ++) {
52 + abbrevs[a] = current
53 + a += current.charAt(j)
54 + }
55 + }
56 + return abbrevs
57 +}
58 +
59 +function lexSort (a, b) {
60 + return a === b ? 0 : a > b ? 1 : -1
61 +}
1 +{
2 + "_from": "abbrev@1",
3 + "_id": "abbrev@1.1.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
6 + "_location": "/abbrev",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "abbrev@1",
12 + "name": "abbrev",
13 + "escapedName": "abbrev",
14 + "rawSpec": "1",
15 + "saveSpec": null,
16 + "fetchSpec": "1"
17 + },
18 + "_requiredBy": [
19 + "/nopt"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
22 + "_shasum": "f8f2c887ad10bf67f634f005b6987fed3179aac8",
23 + "_spec": "abbrev@1",
24 + "_where": "C:\\Users\\worro\\OneDrive\\Desktop\\openSourceSoftware\\webcrawling-practice\\node_modules\\nopt",
25 + "author": {
26 + "name": "Isaac Z. Schlueter",
27 + "email": "i@izs.me"
28 + },
29 + "bugs": {
30 + "url": "https://github.com/isaacs/abbrev-js/issues"
31 + },
32 + "bundleDependencies": false,
33 + "deprecated": false,
34 + "description": "Like ruby's abbrev module, but in js",
35 + "devDependencies": {
36 + "tap": "^10.1"
37 + },
38 + "files": [
39 + "abbrev.js"
40 + ],
41 + "homepage": "https://github.com/isaacs/abbrev-js#readme",
42 + "license": "ISC",
43 + "main": "abbrev.js",
44 + "name": "abbrev",
45 + "repository": {
46 + "type": "git",
47 + "url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
48 + },
49 + "scripts": {
50 + "postpublish": "git push origin --all; git push origin --tags",
51 + "postversion": "npm publish",
52 + "preversion": "npm test",
53 + "test": "tap test.js --100"
54 + },
55 + "version": "1.1.1"
56 +}
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.7",
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.7",
12 + "name": "accepts",
13 + "escapedName": "accepts",
14 + "rawSpec": "~1.3.7",
15 + "saveSpec": null,
16 + "fetchSpec": "~1.3.7"
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.7",
24 + "_where": "C:\\Users\\worro\\OneDrive\\Desktop\\openSourceSoftware\\webcrawling-practice\\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 +# Change Log
2 +
3 +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 +
5 +<a name="3.0.0"></a>
6 +# [3.0.0](https://github.com/nexdrew/ansi-align/compare/v2.0.0...v3.0.0) (2018-12-17)
7 +
8 +
9 +### Bug Fixes
10 +
11 +* **package:** update string-width to version 3.0.0 ([#50](https://github.com/nexdrew/ansi-align/issues/50)) ([67f0d8f](https://github.com/nexdrew/ansi-align/commit/67f0d8f))
12 +
13 +
14 +### BREAKING CHANGES
15 +
16 +* **package:** Node 4 no longer supported, please update to Node 6+ or use ansi-align@2.0.0
17 +
18 +
19 +
20 +<a name="2.0.0"></a>
21 +# [2.0.0](https://github.com/nexdrew/ansi-align/compare/v1.1.0...v2.0.0) (2017-05-01)
22 +
23 +
24 +### Features
25 +
26 +* ES2015ify, dropping support for Node <4 ([#30](https://github.com/nexdrew/ansi-align/issues/30)) ([7b43f48](https://github.com/nexdrew/ansi-align/commit/7b43f48))
27 +
28 +
29 +### BREAKING CHANGES
30 +
31 +* Node 0.10 or 0.12 no longer supported, please update to Node 4+ or use ansi-align@1.1.0
32 +
33 +
34 +
35 +<a name="1.1.0"></a>
36 +# [1.1.0](https://github.com/nexdrew/ansi-align/compare/v1.0.0...v1.1.0) (2016-06-06)
37 +
38 +
39 +### Features
40 +
41 +* support left-alignment as no-op ([#3](https://github.com/nexdrew/ansi-align/issues/3)) ([e581db6](https://github.com/nexdrew/ansi-align/commit/e581db6))
42 +
43 +
44 +
45 +<a name="1.0.0"></a>
46 +# 1.0.0 (2016-04-30)
47 +
48 +
49 +### Features
50 +
51 +* initial commit ([1914d90](https://github.com/nexdrew/ansi-align/commit/1914d90))
1 +Copyright (c) 2016, Contributors
2 +
3 +Permission to use, copy, modify, and/or distribute this software for any purpose
4 +with or without fee is hereby granted, provided that the above copyright notice
5 +and this permission notice appear in all copies.
6 +
7 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8 +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9 +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10 +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11 +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12 +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13 +THIS SOFTWARE.
1 +# ansi-align
2 +
3 +> align-text with ANSI support for CLIs
4 +
5 +[![Build Status](https://travis-ci.org/nexdrew/ansi-align.svg?branch=master)](https://travis-ci.org/nexdrew/ansi-align)
6 +[![Coverage Status](https://coveralls.io/repos/github/nexdrew/ansi-align/badge.svg?branch=master)](https://coveralls.io/github/nexdrew/ansi-align?branch=master)
7 +[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
8 +[![Greenkeeper badge](https://badges.greenkeeper.io/nexdrew/ansi-align.svg)](https://greenkeeper.io/)
9 +
10 +Easily center- or right- align a block of text, carefully ignoring ANSI escape codes.
11 +
12 +E.g. turn this:
13 +
14 +<img width="281" alt="ansi text block no alignment :(" src="https://cloud.githubusercontent.com/assets/1929625/14937509/7c3076dc-0ed7-11e6-8c16-4f6a4ccc8346.png">
15 +
16 +Into this:
17 +
18 +<img width="278" alt="ansi text block center aligned!" src="https://cloud.githubusercontent.com/assets/1929625/14937510/7c3ca0b0-0ed7-11e6-8f0a-541ca39b6e0a.png">
19 +
20 +## Install
21 +
22 +```sh
23 +npm install --save ansi-align
24 +```
25 +
26 +```js
27 +var ansiAlign = require('ansi-align')
28 +```
29 +
30 +## API
31 +
32 +### `ansiAlign(text, [opts])`
33 +
34 +Align the given text per the line with the greatest [`string-width`](https://github.com/sindresorhus/string-width), returning a new string (or array).
35 +
36 +#### Arguments
37 +
38 +- `text`: required, string or array
39 +
40 + The text to align. If a string is given, it will be split using either the `opts.split` value or `'\n'` by default. If an array is given, a different array of modified strings will be returned.
41 +
42 +- `opts`: optional, object
43 +
44 + Options to change behavior, see below.
45 +
46 +#### Options
47 +
48 +- `opts.align`: string, default `'center'`
49 +
50 + The alignment mode. Use `'center'` for center-alignment, `'right'` for right-alignment, or `'left'` for left-alignment. Note that the given `text` is assumed to be left-aligned already, so specifying `align: 'left'` just returns the `text` as is (no-op).
51 +
52 +- `opts.split`: string or RegExp, default `'\n'`
53 +
54 + The separator to use when splitting the text. Only used if text is given as a string.
55 +
56 +- `opts.pad`: string, default `' '`
57 +
58 + The value used to left-pad (prepend to) lines of lesser width. Will be repeated as necessary to adjust alignment to the line with the greatest width.
59 +
60 +### `ansiAlign.center(text)`
61 +
62 +Alias for `ansiAlign(text, { align: 'center' })`.
63 +
64 +### `ansiAlign.right(text)`
65 +
66 +Alias for `ansiAlign(text, { align: 'right' })`.
67 +
68 +### `ansiAlign.left(text)`
69 +
70 +Alias for `ansiAlign(text, { align: 'left' })`, which is a no-op.
71 +
72 +## Similar Packages
73 +
74 +- [`center-align`](https://github.com/jonschlinkert/center-align): Very close to this package, except it doesn't support ANSI codes.
75 +- [`left-pad`](https://github.com/camwest/left-pad): Great for left-padding but does not support center alignment or ANSI codes.
76 +- Pretty much anything by the [chalk](https://github.com/chalk) team
77 +
78 +## License
79 +
80 +ISC © Contributors
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff 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 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 is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.