Jumi Yang

Update gitignore

Showing 1000 changed files with 197 additions and 4633 deletions

Too many changes to show.

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

...@@ -39,7 +39,7 @@ bower_components ...@@ -39,7 +39,7 @@ bower_components
39 build/Release 39 build/Release
40 40
41 # Dependency directories 41 # Dependency directories
42 -.node_modules/ 42 +**node_modules/
43 jspm_packages/ 43 jspm_packages/
44 44
45 # Snowpack dependency directory (https://snowpack.dev/) 45 # Snowpack dependency directory (https://snowpack.dev/)
......
1 +* {
2 + margin: 0;
3 + padding: 0;
4 +}
5 +
6 +html, body {
7 + height : 100%;
8 +}
9 +
10 +.wrapper {
11 + height : 100%;
12 + width: 100%;
13 + display: flex;
14 + flex-direction: column;
15 + overflow: hidden;
16 +}
17 +
18 +.user-container {
19 + background: #a9bdce;
20 + flex: 1;
21 + display: flex;
22 + justify-content: flex-start;
23 + align-items: center;
24 + padding: 0.5rem;
25 +}
26 +
27 +.user-container label {
28 + font-size : 14px;
29 + margin-right : 1rem;
30 +}
31 +
32 +.user-container input {
33 + border-radius: 3px;
34 + border: none;
35 + height: 100%;
36 +}
37 +
38 +.display-container {
39 + background: #b2c7d9;
40 + flex : 12;
41 + overflow-y:scroll;
42 +}
43 +
44 +.input-container {
45 + flex:1;
46 + display:flex;
47 + justify-content: stretch;
48 + align-items: stretch;
49 +}
50 +
51 +.input-container span {
52 + display: flex;
53 + justify-content: flex-start;
54 + align-items:center;
55 + padding: 0.3rem;
56 + width: 100%;
57 +}
58 +
59 +.chatting-input {
60 + font-size:12px;
61 + height:100%;
62 + flex:8;
63 + border:none;
64 +}
65 +
66 +.send-button {
67 + flex:1;
68 + background: #ffeb33;
69 + border:none;
70 + height:100%;
71 + border-radius:3px;
72 +}
73 +
74 +.chatting-list li {
75 + width:90%;
76 + padding:0.3rem;
77 + display:flex;
78 + justify-content: flex-start;
79 + align-items:flex-end;
80 + margin-top:0.5rem;
81 +}
82 +
83 +.profile {
84 + display: flex;
85 + flex-direction: column;
86 + align-items: center;
87 + justify-content: center;
88 + flex: 1;
89 +}
90 +
91 +.profile .user {
92 + font-size: 10px;
93 + margin-bottom: 0.3rem;
94 +}
95 +
96 +.profile .image {
97 + border-radius: 50%;
98 + object-fit: cover;
99 + width: 50px;
100 + height: 50px;
101 +}
102 +
103 +.message {
104 + border-radius: 5px;
105 + padding: 0.5rem;
106 + font-size: 12px;
107 + margin: 0 5px;
108 + flex: 7;
109 +}
110 +
111 +.time {
112 + font-size: 10px;
113 + margin: 0 5px;
114 +}
115 +
116 +.sent {
117 + flex-direction: row-reverse;
118 + float: right;
119 +}
120 +
121 +.sent .message {
122 + background: #ffeb33;
123 +}
124 +
125 +.received .message {
126 + background: #fff;
127 +}
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html lang="en">
3 +<head>
4 + <meta charset="UTF-8">
5 + <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 + <title>Document</title>
8 + <link rel="stylesheet" href="css/style.css">
9 +</head>
10 +<body>
11 + <div class="wrapper">
12 + <div class="user-container">
13 + <lable for="nickname">대화명</lable>
14 + <input type="text" id="nickname">
15 + </div>
16 + <div class="display-container">
17 + <ul class="chatting-list">
18 + <li class="sent">
19 + <span class="profile">
20 + <span class="user">깔깔</span>
21 + <img class="image" src="https://placeimg.com/50/50/any" alt="any">
22 + </span>
23 + <span class="message">그래 반가워</span>
24 + <span class="time">오후 2:10</span>
25 + </li>
26 + <li class="received">
27 + <span class="profile">
28 + <span class="user">깔깔</span>
29 + <img class="image" src="https://placeimg.com/50/50/any" alt="any">
30 + </span>
31 + <span class="message">그래 반가워</span>
32 + <span class="time">오후 2:10</span>
33 + </li>
34 + </ul>
35 + </div>
36 + <div class="input-container">
37 + <span>
38 + <input type="text" class="chatting-input">
39 + <button class="send-button">전송</button>
40 + </span>
41 + </div>
42 + </div>
43 +
44 + <!-- <script src="/socket.io/socket.io.js"></script>
45 + <script src="js/chat.js"></script> -->
46 +</body>
47 +</html>
...\ No newline at end of file ...\ No newline at end of file
1 +"use strict"
2 +const socket = io.connect("http://localhost:3000/", {transports:['websocket']});
3 +
4 +const nickname = document.querySelector("#nickname")
5 +const chatlist = document.querySelector(".chatting-list")
6 +const chatInput = document.querySelector(".chatting-input")
7 +const sendButton = document.querySelector(".send-button")
8 +
9 +sendButton.addEventListener("click", ()=>{
10 + const param = {
11 + name: nickname.value,
12 + msg: chatInput.value
13 + }
14 + socket.emit("chatting", param)
15 +});
16 +
17 +socket.on("chatting", (data)=>{
18 + const li = document.createElement("li");
19 + li.innerText = `${data.name}님이 - ${data.msg}`;
20 + chatlist.appendChild(li)
21 +})
22 +console.log(socket);
...\ 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 - exec "$basedir/node" "$basedir/../mime/cli.js" "$@"
10 -else
11 - exec node "$basedir/../mime/cli.js" "$@"
12 -fi
1 -@ECHO off
2 -GOTO start
3 -:find_dp0
4 -SET dp0=%~dp0
5 -EXIT /b
6 -:start
7 -SETLOCAL
8 -CALL :find_dp0
9 -
10 -IF EXIST "%dp0%\node.exe" (
11 - SET "_prog=%dp0%\node.exe"
12 -) ELSE (
13 - SET "_prog=node"
14 - SET PATHEXT=%PATHEXT:;.JS;=;%
15 -)
16 -
17 -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mime\cli.js" %*
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 - # Support pipeline input
13 - if ($MyInvocation.ExpectingInput) {
14 - $input | & "$basedir/node$exe" "$basedir/../mime/cli.js" $args
15 - } else {
16 - & "$basedir/node$exe" "$basedir/../mime/cli.js" $args
17 - }
18 - $ret=$LASTEXITCODE
19 -} else {
20 - # Support pipeline input
21 - if ($MyInvocation.ExpectingInput) {
22 - $input | & "node$exe" "$basedir/../mime/cli.js" $args
23 - } else {
24 - & "node$exe" "$basedir/../mime/cli.js" $args
25 - }
26 - $ret=$LASTEXITCODE
27 -}
28 -exit $ret
This diff is collapsed. Click to expand it.
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/component-emitter`
3 -
4 -# Summary
5 -This package contains type definitions for component-emitter (https://www.npmjs.com/package/component-emitter).
6 -
7 -# Details
8 -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/component-emitter.
9 -## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/component-emitter/index.d.ts)
10 -````ts
11 -// Type definitions for component-emitter v1.2.1
12 -// Project: https://www.npmjs.com/package/component-emitter
13 -// Definitions by: Peter Snider <https://github.com/psnider>
14 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
15 -
16 -// TypeScript Version: 2.2
17 -
18 -interface Emitter<Event = string> {
19 - on(event: Event, listener: Function): Emitter;
20 - once(event: Event, listener: Function): Emitter;
21 - off(event?: Event, listener?: Function): Emitter;
22 - emit(event: Event, ...args: any[]): Emitter;
23 - listeners(event: Event): Function[];
24 - hasListeners(event: Event): boolean;
25 - removeListener(event?: Event, listener?: Function): Emitter;
26 - removeEventListener(event?: Event, listener?: Function): Emitter;
27 - removeAllListeners(event?: Event): Emitter;
28 -}
29 -
30 -declare const Emitter: {
31 - (obj?: object): Emitter;
32 - new (obj?: object): Emitter;
33 -};
34 -
35 -export = Emitter;
36 -
37 -````
38 -
39 -### Additional Details
40 - * Last updated: Thu, 14 Oct 2021 19:01:31 GMT
41 - * Dependencies: none
42 - * Global values: none
43 -
44 -# Credits
45 -These definitions were written by [Peter Snider](https://github.com/psnider).
1 -// Type definitions for component-emitter v1.2.1
2 -// Project: https://www.npmjs.com/package/component-emitter
3 -// Definitions by: Peter Snider <https://github.com/psnider>
4 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5 -
6 -// TypeScript Version: 2.2
7 -
8 -interface Emitter<Event = string> {
9 - on(event: Event, listener: Function): Emitter;
10 - once(event: Event, listener: Function): Emitter;
11 - off(event?: Event, listener?: Function): Emitter;
12 - emit(event: Event, ...args: any[]): Emitter;
13 - listeners(event: Event): Function[];
14 - hasListeners(event: Event): boolean;
15 - removeListener(event?: Event, listener?: Function): Emitter;
16 - removeEventListener(event?: Event, listener?: Function): Emitter;
17 - removeAllListeners(event?: Event): Emitter;
18 -}
19 -
20 -declare const Emitter: {
21 - (obj?: object): Emitter;
22 - new (obj?: object): Emitter;
23 -};
24 -
25 -export = Emitter;
1 -{
2 - "name": "@types/component-emitter",
3 - "version": "1.2.11",
4 - "description": "TypeScript definitions for component-emitter",
5 - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/component-emitter",
6 - "license": "MIT",
7 - "contributors": [
8 - {
9 - "name": "Peter Snider",
10 - "url": "https://github.com/psnider",
11 - "githubUsername": "psnider"
12 - }
13 - ],
14 - "main": "",
15 - "types": "index.d.ts",
16 - "repository": {
17 - "type": "git",
18 - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
19 - "directory": "types/component-emitter"
20 - },
21 - "scripts": {},
22 - "dependencies": {},
23 - "typesPublisherContentHash": "d86d217b63101effae1228ebbfe02ac682ee4eb8abd6fc0dcc9948a4b6fdf572",
24 - "typeScriptVersion": "3.7"
25 -}
...\ No newline at end of file ...\ No newline at end of file
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/cookie`
3 -
4 -# Summary
5 -This package contains type definitions for cookie (https://github.com/jshttp/cookie).
6 -
7 -# Details
8 -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie.
9 -
10 -### Additional Details
11 - * Last updated: Tue, 06 Jul 2021 20:32:30 GMT
12 - * Dependencies: none
13 - * Global values: none
14 -
15 -# Credits
16 -These definitions were written by [Pine Mizune](https://github.com/pine), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
1 -// Type definitions for cookie 0.4
2 -// Project: https://github.com/jshttp/cookie
3 -// Definitions by: Pine Mizune <https://github.com/pine>
4 -// Piotr Błażejewicz <https://github.com/peterblazejewicz>
5 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6 -
7 -/**
8 - * Basic HTTP cookie parser and serializer for HTTP servers.
9 - */
10 -
11 -/**
12 - * Additional serialization options
13 - */
14 -export interface CookieSerializeOptions {
15 - /**
16 - * Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3|Domain Set-Cookie attribute}. By default, no
17 - * domain is set, and most clients will consider the cookie to apply to only
18 - * the current domain.
19 - */
20 - domain?: string | undefined;
21 -
22 - /**
23 - * Specifies a function that will be used to encode a cookie's value. Since
24 - * value of a cookie has a limited character set (and must be a simple
25 - * string), this function can be used to encode a value into a string suited
26 - * for a cookie's value.
27 - *
28 - * The default function is the global `encodeURIComponent`, which will
29 - * encode a JavaScript string into UTF-8 byte sequences and then URL-encode
30 - * any that fall outside of the cookie range.
31 - */
32 - encode?(value: string): string;
33 -
34 - /**
35 - * Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1|`Expires` `Set-Cookie` attribute}. By default,
36 - * no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete
37 - * it on a condition like exiting a web browser application.
38 - *
39 - * *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
40 - * states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
41 - * possible not all clients by obey this, so if both are set, they should
42 - * point to the same date and time.
43 - */
44 - expires?: Date | undefined;
45 - /**
46 - * Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6|`HttpOnly` `Set-Cookie` attribute}.
47 - * When truthy, the `HttpOnly` attribute is set, otherwise it is not. By
48 - * default, the `HttpOnly` attribute is not set.
49 - *
50 - * *Note* be careful when setting this to true, as compliant clients will
51 - * not allow client-side JavaScript to see the cookie in `document.cookie`.
52 - */
53 - httpOnly?: boolean | undefined;
54 - /**
55 - * Specifies the number (in seconds) to be the value for the `Max-Age`
56 - * `Set-Cookie` attribute. The given number will be converted to an integer
57 - * by rounding down. By default, no maximum age is set.
58 - *
59 - * *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
60 - * states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
61 - * possible not all clients by obey this, so if both are set, they should
62 - * point to the same date and time.
63 - */
64 - maxAge?: number | undefined;
65 - /**
66 - * Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}.
67 - * By default, the path is considered the "default path".
68 - */
69 - path?: string | undefined;
70 - /**
71 - * Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}.
72 - *
73 - * - `true` will set the `SameSite` attribute to `Strict` for strict same
74 - * site enforcement.
75 - * - `false` will not set the `SameSite` attribute.
76 - * - `'lax'` will set the `SameSite` attribute to Lax for lax same site
77 - * enforcement.
78 - * - `'strict'` will set the `SameSite` attribute to Strict for strict same
79 - * site enforcement.
80 - * - `'none'` will set the SameSite attribute to None for an explicit
81 - * cross-site cookie.
82 - *
83 - * More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}.
84 - *
85 - * *note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.
86 - */
87 - sameSite?: true | false | 'lax' | 'strict' | 'none' | undefined;
88 - /**
89 - * Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5|`Secure` `Set-Cookie` attribute}. When truthy, the
90 - * `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
91 - *
92 - * *Note* be careful when setting this to `true`, as compliant clients will
93 - * not send the cookie back to the server in the future if the browser does
94 - * not have an HTTPS connection.
95 - */
96 - secure?: boolean | undefined;
97 -}
98 -
99 -/**
100 - * Additional parsing options
101 - */
102 -export interface CookieParseOptions {
103 - /**
104 - * Specifies a function that will be used to decode a cookie's value. Since
105 - * the value of a cookie has a limited character set (and must be a simple
106 - * string), this function can be used to decode a previously-encoded cookie
107 - * value into a JavaScript string or other object.
108 - *
109 - * The default function is the global `decodeURIComponent`, which will decode
110 - * any URL-encoded sequences into their byte representations.
111 - *
112 - * *Note* if an error is thrown from this function, the original, non-decoded
113 - * cookie value will be returned as the cookie's value.
114 - */
115 - decode?(value: string): string;
116 -}
117 -
118 -/**
119 - * Parse an HTTP Cookie header string and returning an object of all cookie
120 - * name-value pairs.
121 - *
122 - * @param str the string representing a `Cookie` header value
123 - * @param [options] object containing parsing options
124 - */
125 -export function parse(str: string, options?: CookieParseOptions): { [key: string]: string };
126 -
127 -/**
128 - * Serialize a cookie name-value pair into a `Set-Cookie` header string.
129 - *
130 - * @param name the name for the cookie
131 - * @param value value to set the cookie to
132 - * @param [options] object containing serialization options
133 - * @throws {TypeError} when `maxAge` options is invalid
134 - */
135 -export function serialize(name: string, value: string, options?: CookieSerializeOptions): string;
1 -{
2 - "name": "@types/cookie",
3 - "version": "0.4.1",
4 - "description": "TypeScript definitions for cookie",
5 - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie",
6 - "license": "MIT",
7 - "contributors": [
8 - {
9 - "name": "Pine Mizune",
10 - "url": "https://github.com/pine",
11 - "githubUsername": "pine"
12 - },
13 - {
14 - "name": "Piotr Błażejewicz",
15 - "url": "https://github.com/peterblazejewicz",
16 - "githubUsername": "peterblazejewicz"
17 - }
18 - ],
19 - "main": "",
20 - "types": "index.d.ts",
21 - "repository": {
22 - "type": "git",
23 - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
24 - "directory": "types/cookie"
25 - },
26 - "scripts": {},
27 - "dependencies": {},
28 - "typesPublisherContentHash": "7d4a6dd505c896319459ae131b5fa8fc0a2ed25552db53dac87946119bb21559",
29 - "typeScriptVersion": "3.6"
30 -}
...\ No newline at end of file ...\ No newline at end of file
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/cors`
3 -
4 -# Summary
5 -This package contains type definitions for cors (https://github.com/expressjs/cors/).
6 -
7 -# Details
8 -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors.
9 -## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors/index.d.ts)
10 -````ts
11 -// Type definitions for cors 2.8
12 -// Project: https://github.com/expressjs/cors/
13 -// Definitions by: Alan Plum <https://github.com/pluma>
14 -// Gaurav Sharma <https://github.com/gtpan77>
15 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
16 -// TypeScript Version: 2.3
17 -
18 -import { IncomingHttpHeaders } from 'http';
19 -
20 -type StaticOrigin = boolean | string | RegExp | (boolean | string | RegExp)[];
21 -
22 -type CustomOrigin = (requestOrigin: string | undefined, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
23 -
24 -declare namespace e {
25 - interface CorsRequest {
26 - method?: string | undefined;
27 - headers: IncomingHttpHeaders;
28 - }
29 - interface CorsOptions {
30 - /**
31 - * @default '*''
32 - */
33 - origin?: StaticOrigin | CustomOrigin | undefined;
34 - /**
35 - * @default 'GET,HEAD,PUT,PATCH,POST,DELETE'
36 - */
37 - methods?: string | string[] | undefined;
38 - allowedHeaders?: string | string[] | undefined;
39 - exposedHeaders?: string | string[] | undefined;
40 - credentials?: boolean | undefined;
41 - maxAge?: number | undefined;
42 - /**
43 - * @default false
44 - */
45 - preflightContinue?: boolean | undefined;
46 - /**
47 - * @default 204
48 - */
49 - optionsSuccessStatus?: number | undefined;
50 - }
51 - type CorsOptionsDelegate<T extends CorsRequest = CorsRequest> = (
52 - req: T,
53 - callback: (err: Error | null, options?: CorsOptions) => void,
54 - ) => void;
55 -}
56 -
57 -declare function e<T extends e.CorsRequest = e.CorsRequest>(
58 - options?: e.CorsOptions | e.CorsOptionsDelegate<T>,
59 -): (
60 - req: T,
61 - res: {
62 - statusCode?: number | undefined;
63 - setHeader(key: string, value: string): any;
64 - end(): any;
65 - },
66 - next: (err?: any) => any,
67 -) => void;
68 -export = e;
69 -
70 -````
71 -
72 -### Additional Details
73 - * Last updated: Fri, 09 Jul 2021 07:31:29 GMT
74 - * Dependencies: none
75 - * Global values: none
76 -
77 -# Credits
78 -These definitions were written by [Alan Plum](https://github.com/pluma), and [Gaurav Sharma](https://github.com/gtpan77).
1 -// Type definitions for cors 2.8
2 -// Project: https://github.com/expressjs/cors/
3 -// Definitions by: Alan Plum <https://github.com/pluma>
4 -// Gaurav Sharma <https://github.com/gtpan77>
5 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6 -// TypeScript Version: 2.3
7 -
8 -import { IncomingHttpHeaders } from 'http';
9 -
10 -type StaticOrigin = boolean | string | RegExp | (boolean | string | RegExp)[];
11 -
12 -type CustomOrigin = (requestOrigin: string | undefined, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
13 -
14 -declare namespace e {
15 - interface CorsRequest {
16 - method?: string | undefined;
17 - headers: IncomingHttpHeaders;
18 - }
19 - interface CorsOptions {
20 - /**
21 - * @default '*''
22 - */
23 - origin?: StaticOrigin | CustomOrigin | undefined;
24 - /**
25 - * @default 'GET,HEAD,PUT,PATCH,POST,DELETE'
26 - */
27 - methods?: string | string[] | undefined;
28 - allowedHeaders?: string | string[] | undefined;
29 - exposedHeaders?: string | string[] | undefined;
30 - credentials?: boolean | undefined;
31 - maxAge?: number | undefined;
32 - /**
33 - * @default false
34 - */
35 - preflightContinue?: boolean | undefined;
36 - /**
37 - * @default 204
38 - */
39 - optionsSuccessStatus?: number | undefined;
40 - }
41 - type CorsOptionsDelegate<T extends CorsRequest = CorsRequest> = (
42 - req: T,
43 - callback: (err: Error | null, options?: CorsOptions) => void,
44 - ) => void;
45 -}
46 -
47 -declare function e<T extends e.CorsRequest = e.CorsRequest>(
48 - options?: e.CorsOptions | e.CorsOptionsDelegate<T>,
49 -): (
50 - req: T,
51 - res: {
52 - statusCode?: number | undefined;
53 - setHeader(key: string, value: string): any;
54 - end(): any;
55 - },
56 - next: (err?: any) => any,
57 -) => void;
58 -export = e;
1 -{
2 - "name": "@types/cors",
3 - "version": "2.8.12",
4 - "description": "TypeScript definitions for cors",
5 - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors",
6 - "license": "MIT",
7 - "contributors": [
8 - {
9 - "name": "Alan Plum",
10 - "url": "https://github.com/pluma",
11 - "githubUsername": "pluma"
12 - },
13 - {
14 - "name": "Gaurav Sharma",
15 - "url": "https://github.com/gtpan77",
16 - "githubUsername": "gtpan77"
17 - }
18 - ],
19 - "main": "",
20 - "types": "index.d.ts",
21 - "repository": {
22 - "type": "git",
23 - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
24 - "directory": "types/cors"
25 - },
26 - "scripts": {},
27 - "dependencies": {},
28 - "typesPublisherContentHash": "53ea51a6543d58d3c1b9035a9c361d8f06d7be01973be2895820b2fb7ad9563a",
29 - "typeScriptVersion": "3.6"
30 -}
...\ No newline at end of file ...\ No newline at end of file
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 (https://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: Fri, 03 Jun 2022 13:01:31 GMT
12 - * Dependencies: none
13 - * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
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), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), and [Matteo Collina](https://github.com/mcollina).
This diff is collapsed. Click to expand it.
1 -declare module 'assert/strict' {
2 - import { strict } from 'node:assert';
3 - export = strict;
4 -}
5 -declare module 'node:assert/strict' {
6 - import { strict } from 'node:assert';
7 - export = strict;
8 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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 'node:os';
4 - import { constants as cryptoConstants } from 'node:crypto';
5 - import { constants as fsConstants } from 'node:fs';
6 -
7 - const exp: typeof osConstants.errno &
8 - typeof osConstants.priority &
9 - SignalConstants &
10 - typeof cryptoConstants &
11 - typeof fsConstants;
12 - export = exp;
13 -}
14 -
15 -declare module 'node:constants' {
16 - import constants = require('constants');
17 - export = constants;
18 -}
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
1 -/**
2 - * The `diagnostics_channel` module provides an API to create named channels
3 - * to report arbitrary message data for diagnostics purposes.
4 - *
5 - * It can be accessed using:
6 - *
7 - * ```js
8 - * import diagnostics_channel from 'diagnostics_channel';
9 - * ```
10 - *
11 - * It is intended that a module writer wanting to report diagnostics messages
12 - * will create one or many top-level channels to report messages through.
13 - * Channels may also be acquired at runtime but it is not encouraged
14 - * due to the additional overhead of doing so. Channels may be exported for
15 - * convenience, but as long as the name is known it can be acquired anywhere.
16 - *
17 - * If you intend for your module to produce diagnostics data for others to
18 - * consume it is recommended that you include documentation of what named
19 - * channels are used along with the shape of the message data. Channel names
20 - * should generally include the module name to avoid collisions with data from
21 - * other modules.
22 - * @experimental
23 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/diagnostics_channel.js)
24 - */
25 -declare module 'diagnostics_channel' {
26 - /**
27 - * Check if there are active subscribers to the named channel. This is helpful if
28 - * the message you want to send might be expensive to prepare.
29 - *
30 - * This API is optional but helpful when trying to publish messages from very
31 - * performance-sensitive code.
32 - *
33 - * ```js
34 - * import diagnostics_channel from 'diagnostics_channel';
35 - *
36 - * if (diagnostics_channel.hasSubscribers('my-channel')) {
37 - * // There are subscribers, prepare and publish message
38 - * }
39 - * ```
40 - * @since v15.1.0, v14.17.0
41 - * @param name The channel name
42 - * @return If there are active subscribers
43 - */
44 - function hasSubscribers(name: string): boolean;
45 - /**
46 - * This is the primary entry-point for anyone wanting to interact with a named
47 - * channel. It produces a channel object which is optimized to reduce overhead at
48 - * publish time as much as possible.
49 - *
50 - * ```js
51 - * import diagnostics_channel from 'diagnostics_channel';
52 - *
53 - * const channel = diagnostics_channel.channel('my-channel');
54 - * ```
55 - * @since v15.1.0, v14.17.0
56 - * @param name The channel name
57 - * @return The named channel object
58 - */
59 - function channel(name: string): Channel;
60 - type ChannelListener = (message: unknown, name: string) => void;
61 - /**
62 - * The class `Channel` represents an individual named channel within the data
63 - * pipeline. It is use to track subscribers and to publish messages when there
64 - * are subscribers present. It exists as a separate object to avoid channel
65 - * lookups at publish time, enabling very fast publish speeds and allowing
66 - * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
67 - * with `new Channel(name)` is not supported.
68 - * @since v15.1.0, v14.17.0
69 - */
70 - class Channel {
71 - readonly name: string;
72 - /**
73 - * Check if there are active subscribers to this channel. This is helpful if
74 - * the message you want to send might be expensive to prepare.
75 - *
76 - * This API is optional but helpful when trying to publish messages from very
77 - * performance-sensitive code.
78 - *
79 - * ```js
80 - * import diagnostics_channel from 'diagnostics_channel';
81 - *
82 - * const channel = diagnostics_channel.channel('my-channel');
83 - *
84 - * if (channel.hasSubscribers) {
85 - * // There are subscribers, prepare and publish message
86 - * }
87 - * ```
88 - * @since v15.1.0, v14.17.0
89 - */
90 - readonly hasSubscribers: boolean;
91 - private constructor(name: string);
92 - /**
93 - * Publish a message to any subscribers to the channel. This will
94 - * trigger message handlers synchronously so they will execute within
95 - * the same context.
96 - *
97 - * ```js
98 - * import diagnostics_channel from 'diagnostics_channel';
99 - *
100 - * const channel = diagnostics_channel.channel('my-channel');
101 - *
102 - * channel.publish({
103 - * some: 'message'
104 - * });
105 - * ```
106 - * @since v15.1.0, v14.17.0
107 - * @param message The message to send to the channel subscribers
108 - */
109 - publish(message: unknown): void;
110 - /**
111 - * Register a message handler to subscribe to this channel. This message handler
112 - * will be run synchronously whenever a message is published to the channel. Any
113 - * errors thrown in the message handler will trigger an `'uncaughtException'`.
114 - *
115 - * ```js
116 - * import diagnostics_channel from 'diagnostics_channel';
117 - *
118 - * const channel = diagnostics_channel.channel('my-channel');
119 - *
120 - * channel.subscribe((message, name) => {
121 - * // Received data
122 - * });
123 - * ```
124 - * @since v15.1.0, v14.17.0
125 - * @param onMessage The handler to receive channel messages
126 - */
127 - subscribe(onMessage: ChannelListener): void;
128 - /**
129 - * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
130 - *
131 - * ```js
132 - * import diagnostics_channel from 'diagnostics_channel';
133 - *
134 - * const channel = diagnostics_channel.channel('my-channel');
135 - *
136 - * function onMessage(message, name) {
137 - * // Received data
138 - * }
139 - *
140 - * channel.subscribe(onMessage);
141 - *
142 - * channel.unsubscribe(onMessage);
143 - * ```
144 - * @since v15.1.0, v14.17.0
145 - * @param onMessage The previous subscribed handler to remove
146 - */
147 - unsubscribe(onMessage: ChannelListener): void;
148 - }
149 -}
150 -declare module 'node:diagnostics_channel' {
151 - export * from 'diagnostics_channel';
152 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 -/**
2 - * **This module is pending deprecation.** Once a replacement API has been
3 - * finalized, this module will be fully deprecated. Most developers should**not** have cause to use this module. Users who absolutely must have
4 - * the functionality that domains provide may rely on it for the time being
5 - * but should expect to have to migrate to a different solution
6 - * in the future.
7 - *
8 - * Domains provide a way to handle multiple different IO operations as a
9 - * single group. If any of the event emitters or callbacks registered to a
10 - * domain emit an `'error'` event, or throw an error, then the domain object
11 - * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
12 - * exit immediately with an error code.
13 - * @deprecated Since v1.4.2 - Deprecated
14 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/domain.js)
15 - */
16 -declare module 'domain' {
17 - import EventEmitter = require('node:events');
18 - /**
19 - * The `Domain` class encapsulates the functionality of routing errors and
20 - * uncaught exceptions to the active `Domain` object.
21 - *
22 - * To handle the errors that it catches, listen to its `'error'` event.
23 - */
24 - class Domain extends EventEmitter {
25 - /**
26 - * An array of timers and event emitters that have been explicitly added
27 - * to the domain.
28 - */
29 - members: Array<EventEmitter | NodeJS.Timer>;
30 - /**
31 - * The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly
32 - * pushes the domain onto the domain
33 - * stack managed by the domain module (see {@link exit} for details on the
34 - * domain stack). The call to `enter()` delimits the beginning of a chain of
35 - * asynchronous calls and I/O operations bound to a domain.
36 - *
37 - * Calling `enter()` changes only the active domain, and does not alter the domain
38 - * itself. `enter()` and `exit()` can be called an arbitrary number of times on a
39 - * single domain.
40 - */
41 - enter(): void;
42 - /**
43 - * The `exit()` method exits the current domain, popping it off the domain stack.
44 - * Any time execution is going to switch to the context of a different chain of
45 - * asynchronous calls, it's important to ensure that the current domain is exited.
46 - * The call to `exit()` delimits either the end of or an interruption to the chain
47 - * of asynchronous calls and I/O operations bound to a domain.
48 - *
49 - * If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain.
50 - *
51 - * Calling `exit()` changes only the active domain, and does not alter the domain
52 - * itself. `enter()` and `exit()` can be called an arbitrary number of times on a
53 - * single domain.
54 - */
55 - exit(): void;
56 - /**
57 - * Run the supplied function in the context of the domain, implicitly
58 - * binding all event emitters, timers, and lowlevel requests that are
59 - * created in that context. Optionally, arguments can be passed to
60 - * the function.
61 - *
62 - * This is the most basic way to use a domain.
63 - *
64 - * ```js
65 - * const domain = require('domain');
66 - * const fs = require('fs');
67 - * const d = domain.create();
68 - * d.on('error', (er) => {
69 - * console.error('Caught error!', er);
70 - * });
71 - * d.run(() => {
72 - * process.nextTick(() => {
73 - * setTimeout(() => { // Simulating some various async stuff
74 - * fs.open('non-existent file', 'r', (er, fd) => {
75 - * if (er) throw er;
76 - * // proceed...
77 - * });
78 - * }, 100);
79 - * });
80 - * });
81 - * ```
82 - *
83 - * In this example, the `d.on('error')` handler will be triggered, rather
84 - * than crashing the program.
85 - */
86 - run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
87 - /**
88 - * Explicitly adds an emitter to the domain. If any event handlers called by
89 - * the emitter throw an error, or if the emitter emits an `'error'` event, it
90 - * will be routed to the domain's `'error'` event, just like with implicit
91 - * binding.
92 - *
93 - * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by
94 - * the domain `'error'` handler.
95 - *
96 - * If the Timer or `EventEmitter` was already bound to a domain, it is removed
97 - * from that one, and bound to this one instead.
98 - * @param emitter emitter or timer to be added to the domain
99 - */
100 - add(emitter: EventEmitter | NodeJS.Timer): void;
101 - /**
102 - * The opposite of {@link add}. Removes domain handling from the
103 - * specified emitter.
104 - * @param emitter emitter or timer to be removed from the domain
105 - */
106 - remove(emitter: EventEmitter | NodeJS.Timer): void;
107 - /**
108 - * The returned function will be a wrapper around the supplied callback
109 - * function. When the returned function is called, any errors that are
110 - * thrown will be routed to the domain's `'error'` event.
111 - *
112 - * ```js
113 - * const d = domain.create();
114 - *
115 - * function readSomeFile(filename, cb) {
116 - * fs.readFile(filename, 'utf8', d.bind((er, data) => {
117 - * // If this throws, it will also be passed to the domain.
118 - * return cb(er, data ? JSON.parse(data) : null);
119 - * }));
120 - * }
121 - *
122 - * d.on('error', (er) => {
123 - * // An error occurred somewhere. If we throw it now, it will crash the program
124 - * // with the normal line number and stack message.
125 - * });
126 - * ```
127 - * @param callback The callback function
128 - * @return The bound function
129 - */
130 - bind<T extends Function>(callback: T): T;
131 - /**
132 - * This method is almost identical to {@link bind}. However, in
133 - * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function.
134 - *
135 - * In this way, the common `if (err) return callback(err);` pattern can be replaced
136 - * with a single error handler in a single place.
137 - *
138 - * ```js
139 - * const d = domain.create();
140 - *
141 - * function readSomeFile(filename, cb) {
142 - * fs.readFile(filename, 'utf8', d.intercept((data) => {
143 - * // Note, the first argument is never passed to the
144 - * // callback since it is assumed to be the 'Error' argument
145 - * // and thus intercepted by the domain.
146 - *
147 - * // If this throws, it will also be passed to the domain
148 - * // so the error-handling logic can be moved to the 'error'
149 - * // event on the domain instead of being repeated throughout
150 - * // the program.
151 - * return cb(null, JSON.parse(data));
152 - * }));
153 - * }
154 - *
155 - * d.on('error', (er) => {
156 - * // An error occurred somewhere. If we throw it now, it will crash the program
157 - * // with the normal line number and stack message.
158 - * });
159 - * ```
160 - * @param callback The callback function
161 - * @return The intercepted function
162 - */
163 - intercept<T extends Function>(callback: T): T;
164 - }
165 - function create(): Domain;
166 -}
167 -declare module 'node:domain' {
168 - export * from 'domain';
169 -}
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.
1 -// Declare "static" methods in Error
2 -interface ErrorConstructor {
3 - /** Create .stack property on a target object */
4 - captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5 -
6 - /**
7 - * Optional override for formatting stack traces
8 - *
9 - * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
10 - */
11 - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
12 -
13 - stackTraceLimit: number;
14 -}
15 -
16 -/*-----------------------------------------------*
17 - * *
18 - * GLOBAL *
19 - * *
20 - ------------------------------------------------*/
21 -
22 -// For backwards compability
23 -interface NodeRequire extends NodeJS.Require { }
24 -interface RequireResolve extends NodeJS.RequireResolve { }
25 -interface NodeModule extends NodeJS.Module { }
26 -
27 -declare var process: NodeJS.Process;
28 -declare var console: Console;
29 -
30 -declare var __filename: string;
31 -declare var __dirname: string;
32 -
33 -declare var require: NodeRequire;
34 -declare var module: NodeModule;
35 -
36 -// Same as module.exports
37 -declare var exports: any;
38 -
39 -/**
40 - * Only available if `--expose-gc` is passed to the process.
41 - */
42 -declare var gc: undefined | (() => void);
43 -
44 -//#region borrowed
45 -// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
46 -/** A controller object that allows you to abort one or more DOM requests as and when desired. */
47 -interface AbortController {
48 - /**
49 - * Returns the AbortSignal object associated with this object.
50 - */
51 -
52 - readonly signal: AbortSignal;
53 - /**
54 - * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
55 - */
56 - abort(): void;
57 -}
58 -
59 -/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
60 -interface AbortSignal {
61 - /**
62 - * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
63 - */
64 - readonly aborted: boolean;
65 -}
66 -
67 -declare var AbortController: {
68 - prototype: AbortController;
69 - new(): AbortController;
70 -};
71 -
72 -declare var AbortSignal: {
73 - prototype: AbortSignal;
74 - new(): AbortSignal;
75 - // TODO: Add abort() static
76 -};
77 -//#endregion borrowed
78 -
79 -//#region ArrayLike.at()
80 -interface RelativeIndexable<T> {
81 - /**
82 - * Takes an integer value and returns the item at that index,
83 - * allowing for positive and negative integers.
84 - * Negative integers count back from the last item in the array.
85 - */
86 - at(index: number): T | undefined;
87 -}
88 -interface String extends RelativeIndexable<string> {}
89 -interface Array<T> extends RelativeIndexable<T> {}
90 -interface Int8Array extends RelativeIndexable<number> {}
91 -interface Uint8Array extends RelativeIndexable<number> {}
92 -interface Uint8ClampedArray extends RelativeIndexable<number> {}
93 -interface Int16Array extends RelativeIndexable<number> {}
94 -interface Uint16Array extends RelativeIndexable<number> {}
95 -interface Int32Array extends RelativeIndexable<number> {}
96 -interface Uint32Array extends RelativeIndexable<number> {}
97 -interface Float32Array extends RelativeIndexable<number> {}
98 -interface Float64Array extends RelativeIndexable<number> {}
99 -interface BigInt64Array extends RelativeIndexable<bigint> {}
100 -interface BigUint64Array extends RelativeIndexable<bigint> {}
101 -//#endregion ArrayLike.at() end
102 -
103 -/**
104 - * @since v17.0.0
105 - *
106 - * Creates a deep clone of an object.
107 - */
108 -declare function structuredClone<T>(
109 - value: T,
110 - transfer?: { transfer: ReadonlyArray<import('worker_threads').TransferListItem> },
111 -): T;
112 -
113 -/*----------------------------------------------*
114 -* *
115 -* GLOBAL INTERFACES *
116 -* *
117 -*-----------------------------------------------*/
118 -declare namespace NodeJS {
119 - interface CallSite {
120 - /**
121 - * Value of "this"
122 - */
123 - getThis(): unknown;
124 -
125 - /**
126 - * Type of "this" as a string.
127 - * This is the name of the function stored in the constructor field of
128 - * "this", if available. Otherwise the object's [[Class]] internal
129 - * property.
130 - */
131 - getTypeName(): string | null;
132 -
133 - /**
134 - * Current function
135 - */
136 - getFunction(): Function | undefined;
137 -
138 - /**
139 - * Name of the current function, typically its name property.
140 - * If a name property is not available an attempt will be made to try
141 - * to infer a name from the function's context.
142 - */
143 - getFunctionName(): string | null;
144 -
145 - /**
146 - * Name of the property [of "this" or one of its prototypes] that holds
147 - * the current function
148 - */
149 - getMethodName(): string | null;
150 -
151 - /**
152 - * Name of the script [if this function was defined in a script]
153 - */
154 - getFileName(): string | null;
155 -
156 - /**
157 - * Current line number [if this function was defined in a script]
158 - */
159 - getLineNumber(): number | null;
160 -
161 - /**
162 - * Current column number [if this function was defined in a script]
163 - */
164 - getColumnNumber(): number | null;
165 -
166 - /**
167 - * A call site object representing the location where eval was called
168 - * [if this function was created using a call to eval]
169 - */
170 - getEvalOrigin(): string | undefined;
171 -
172 - /**
173 - * Is this a toplevel invocation, that is, is "this" the global object?
174 - */
175 - isToplevel(): boolean;
176 -
177 - /**
178 - * Does this call take place in code defined by a call to eval?
179 - */
180 - isEval(): boolean;
181 -
182 - /**
183 - * Is this call in native V8 code?
184 - */
185 - isNative(): boolean;
186 -
187 - /**
188 - * Is this a constructor call?
189 - */
190 - isConstructor(): boolean;
191 - }
192 -
193 - interface ErrnoException extends Error {
194 - errno?: number | undefined;
195 - code?: string | undefined;
196 - path?: string | undefined;
197 - syscall?: string | undefined;
198 - }
199 -
200 - interface ReadableStream extends EventEmitter {
201 - readable: boolean;
202 - read(size?: number): string | Buffer;
203 - setEncoding(encoding: BufferEncoding): this;
204 - pause(): this;
205 - resume(): this;
206 - isPaused(): boolean;
207 - pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
208 - unpipe(destination?: WritableStream): this;
209 - unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
210 - wrap(oldStream: ReadableStream): this;
211 - [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
212 - }
213 -
214 - interface WritableStream extends EventEmitter {
215 - writable: boolean;
216 - write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
217 - write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
218 - end(cb?: () => void): this;
219 - end(data: string | Uint8Array, cb?: () => void): this;
220 - end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
221 - }
222 -
223 - interface ReadWriteStream extends ReadableStream, WritableStream { }
224 -
225 - interface RefCounted {
226 - ref(): this;
227 - unref(): this;
228 - }
229 -
230 - type TypedArray =
231 - | Uint8Array
232 - | Uint8ClampedArray
233 - | Uint16Array
234 - | Uint32Array
235 - | Int8Array
236 - | Int16Array
237 - | Int32Array
238 - | BigUint64Array
239 - | BigInt64Array
240 - | Float32Array
241 - | Float64Array;
242 - type ArrayBufferView = TypedArray | DataView;
243 -
244 - interface Require {
245 - (id: string): any;
246 - resolve: RequireResolve;
247 - cache: Dict<NodeModule>;
248 - /**
249 - * @deprecated
250 - */
251 - extensions: RequireExtensions;
252 - main: Module | undefined;
253 - }
254 -
255 - interface RequireResolve {
256 - (id: string, options?: { paths?: string[] | undefined; }): string;
257 - paths(request: string): string[] | null;
258 - }
259 -
260 - interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
261 - '.js': (m: Module, filename: string) => any;
262 - '.json': (m: Module, filename: string) => any;
263 - '.node': (m: Module, filename: string) => any;
264 - }
265 - interface Module {
266 - /**
267 - * `true` if the module is running during the Node.js preload
268 - */
269 - isPreloading: boolean;
270 - exports: any;
271 - require: Require;
272 - id: string;
273 - filename: string;
274 - loaded: boolean;
275 - /** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
276 - parent: Module | null | undefined;
277 - children: Module[];
278 - /**
279 - * @since v11.14.0
280 - *
281 - * The directory name of the module. This is usually the same as the path.dirname() of the module.id.
282 - */
283 - path: string;
284 - paths: string[];
285 - }
286 -
287 - interface Dict<T> {
288 - [key: string]: T | undefined;
289 - }
290 -
291 - interface ReadOnlyDict<T> {
292 - readonly [key: string]: T | undefined;
293 - }
294 -}
1 -declare var global: typeof globalThis;
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.
1 -// Type definitions for non-npm package Node.js 17.0
2 -// Project: https://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 -// Alvis HT Tang <https://github.com/alvis>
7 -// Andrew Makarov <https://github.com/r3nya>
8 -// Benjamin Toueg <https://github.com/btoueg>
9 -// Chigozirim C. <https://github.com/smac89>
10 -// David Junger <https://github.com/touffy>
11 -// Deividas Bakanas <https://github.com/DeividasBakanas>
12 -// Eugene Y. Q. Shen <https://github.com/eyqs>
13 -// Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>
14 -// Huw <https://github.com/hoo29>
15 -// Kelvin Jin <https://github.com/kjin>
16 -// Klaus Meinhardt <https://github.com/ajafff>
17 -// Lishude <https://github.com/islishude>
18 -// Mariusz Wiktorczyk <https://github.com/mwiktorczyk>
19 -// Mohsen Azimi <https://github.com/mohsen1>
20 -// Nicolas Even <https://github.com/n-e>
21 -// Nikita Galkin <https://github.com/galkin>
22 -// Parambir Singh <https://github.com/parambirs>
23 -// Sebastian Silbermann <https://github.com/eps1lon>
24 -// Simon Schick <https://github.com/SimonSchick>
25 -// Thomas den Hollander <https://github.com/ThomasdenH>
26 -// Wilco Bakker <https://github.com/WilcoBakker>
27 -// wwwy3y3 <https://github.com/wwwy3y3>
28 -// Samuel Ainsworth <https://github.com/samuela>
29 -// Kyle Uehlein <https://github.com/kuehlein>
30 -// Thanik Bhongbhibhat <https://github.com/bhongy>
31 -// Marcin Kopacz <https://github.com/chyzwar>
32 -// Trivikram Kamat <https://github.com/trivikr>
33 -// Junxiao Shi <https://github.com/yoursunny>
34 -// Ilia Baryshnikov <https://github.com/qwelias>
35 -// ExE Boss <https://github.com/ExE-Boss>
36 -// Piotr Błażejewicz <https://github.com/peterblazejewicz>
37 -// Anna Henningsen <https://github.com/addaleax>
38 -// Victor Perin <https://github.com/victorperin>
39 -// Yongsheng Zhang <https://github.com/ZYSzys>
40 -// NodeJS Contributors <https://github.com/NodeJS>
41 -// Linus Unnebäck <https://github.com/LinusU>
42 -// wafuwafu13 <https://github.com/wafuwafu13>
43 -// Matteo Collina <https://github.com/mcollina>
44 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
45 -
46 -/**
47 - * License for programmatically and manually incorporated
48 - * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
49 - *
50 - * Copyright Node.js contributors. All rights reserved.
51 - * Permission is hereby granted, free of charge, to any person obtaining a copy
52 - * of this software and associated documentation files (the "Software"), to
53 - * deal in the Software without restriction, including without limitation the
54 - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
55 - * sell copies of the Software, and to permit persons to whom the Software is
56 - * furnished to do so, subject to the following conditions:
57 - *
58 - * The above copyright notice and this permission notice shall be included in
59 - * all copies or substantial portions of the Software.
60 - *
61 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
66 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
67 - * IN THE SOFTWARE.
68 - */
69 -
70 -// NOTE: These definitions support NodeJS and TypeScript 3.7+.
71 -
72 -// Reference required types from the default lib:
73 -/// <reference lib="es2020" />
74 -/// <reference lib="esnext.asynciterable" />
75 -/// <reference lib="esnext.intl" />
76 -/// <reference lib="esnext.bigint" />
77 -
78 -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
79 -/// <reference path="assert.d.ts" />
80 -/// <reference path="assert/strict.d.ts" />
81 -/// <reference path="globals.d.ts" />
82 -/// <reference path="async_hooks.d.ts" />
83 -/// <reference path="buffer.d.ts" />
84 -/// <reference path="child_process.d.ts" />
85 -/// <reference path="cluster.d.ts" />
86 -/// <reference path="console.d.ts" />
87 -/// <reference path="constants.d.ts" />
88 -/// <reference path="crypto.d.ts" />
89 -/// <reference path="dgram.d.ts" />
90 -/// <reference path="diagnostics_channel.d.ts" />
91 -/// <reference path="dns.d.ts" />
92 -/// <reference path="dns/promises.d.ts" />
93 -/// <reference path="dns/promises.d.ts" />
94 -/// <reference path="domain.d.ts" />
95 -/// <reference path="events.d.ts" />
96 -/// <reference path="fs.d.ts" />
97 -/// <reference path="fs/promises.d.ts" />
98 -/// <reference path="http.d.ts" />
99 -/// <reference path="http2.d.ts" />
100 -/// <reference path="https.d.ts" />
101 -/// <reference path="inspector.d.ts" />
102 -/// <reference path="module.d.ts" />
103 -/// <reference path="net.d.ts" />
104 -/// <reference path="os.d.ts" />
105 -/// <reference path="path.d.ts" />
106 -/// <reference path="perf_hooks.d.ts" />
107 -/// <reference path="process.d.ts" />
108 -/// <reference path="punycode.d.ts" />
109 -/// <reference path="querystring.d.ts" />
110 -/// <reference path="readline.d.ts" />
111 -/// <reference path="repl.d.ts" />
112 -/// <reference path="stream.d.ts" />
113 -/// <reference path="stream/promises.d.ts" />
114 -/// <reference path="stream/consumers.d.ts" />
115 -/// <reference path="stream/web.d.ts" />
116 -/// <reference path="string_decoder.d.ts" />
117 -/// <reference path="timers.d.ts" />
118 -/// <reference path="timers/promises.d.ts" />
119 -/// <reference path="tls.d.ts" />
120 -/// <reference path="trace_events.d.ts" />
121 -/// <reference path="tty.d.ts" />
122 -/// <reference path="url.d.ts" />
123 -/// <reference path="util.d.ts" />
124 -/// <reference path="v8.d.ts" />
125 -/// <reference path="vm.d.ts" />
126 -/// <reference path="wasi.d.ts" />
127 -/// <reference path="worker_threads.d.ts" />
128 -/// <reference path="zlib.d.ts" />
129 -
130 -/// <reference path="globals.global.d.ts" />
This diff could not be displayed because it is too large.
1 -/**
2 - * @since v0.3.7
3 - */
4 -declare module 'module' {
5 - import { URL } from 'node:url';
6 - namespace Module {
7 - /**
8 - * The `module.syncBuiltinESMExports()` method updates all the live bindings for
9 - * builtin `ES Modules` to match the properties of the `CommonJS` exports. It
10 - * does not add or remove exported names from the `ES Modules`.
11 - *
12 - * ```js
13 - * const fs = require('fs');
14 - * const assert = require('assert');
15 - * const { syncBuiltinESMExports } = require('module');
16 - *
17 - * fs.readFile = newAPI;
18 - *
19 - * delete fs.readFileSync;
20 - *
21 - * function newAPI() {
22 - * // ...
23 - * }
24 - *
25 - * fs.newAPI = newAPI;
26 - *
27 - * syncBuiltinESMExports();
28 - *
29 - * import('fs').then((esmFS) => {
30 - * // It syncs the existing readFile property with the new value
31 - * assert.strictEqual(esmFS.readFile, newAPI);
32 - * // readFileSync has been deleted from the required fs
33 - * assert.strictEqual('readFileSync' in fs, false);
34 - * // syncBuiltinESMExports() does not remove readFileSync from esmFS
35 - * assert.strictEqual('readFileSync' in esmFS, true);
36 - * // syncBuiltinESMExports() does not add names
37 - * assert.strictEqual(esmFS.newAPI, undefined);
38 - * });
39 - * ```
40 - * @since v12.12.0
41 - */
42 - function syncBuiltinESMExports(): void;
43 - /**
44 - * `path` is the resolved path for the file for which a corresponding source map
45 - * should be fetched.
46 - * @since v13.7.0, v12.17.0
47 - */
48 - function findSourceMap(path: string, error?: Error): SourceMap;
49 - interface SourceMapPayload {
50 - file: string;
51 - version: number;
52 - sources: string[];
53 - sourcesContent: string[];
54 - names: string[];
55 - mappings: string;
56 - sourceRoot: string;
57 - }
58 - interface SourceMapping {
59 - generatedLine: number;
60 - generatedColumn: number;
61 - originalSource: string;
62 - originalLine: number;
63 - originalColumn: number;
64 - }
65 - /**
66 - * @since v13.7.0, v12.17.0
67 - */
68 - class SourceMap {
69 - /**
70 - * Getter for the payload used to construct the `SourceMap` instance.
71 - */
72 - readonly payload: SourceMapPayload;
73 - constructor(payload: SourceMapPayload);
74 - /**
75 - * Given a line number and column number in the generated source file, returns
76 - * an object representing the position in the original file. The object returned
77 - * consists of the following keys:
78 - */
79 - findEntry(line: number, column: number): SourceMapping;
80 - }
81 - }
82 - interface Module extends NodeModule {}
83 - class Module {
84 - static runMain(): void;
85 - static wrap(code: string): string;
86 - static createRequire(path: string | URL): NodeRequire;
87 - static builtinModules: string[];
88 - static Module: typeof Module;
89 - constructor(id: string, parent?: Module);
90 - }
91 - global {
92 - interface ImportMeta {
93 - url: string;
94 - /**
95 - * @experimental
96 - * This feature is only available with the `--experimental-import-meta-resolve`
97 - * command flag enabled.
98 - *
99 - * Provides a module-relative resolution function scoped to each module, returning
100 - * the URL string.
101 - *
102 - * @param specified The module specifier to resolve relative to `parent`.
103 - * @param parent The absolute parent module URL to resolve from. If none
104 - * is specified, the value of `import.meta.url` is used as the default.
105 - */
106 - resolve?(specified: string, parent?: string | URL): Promise<string>;
107 - }
108 - }
109 - export = Module;
110 -}
111 -declare module 'node:module' {
112 - import module = require('module');
113 - export = module;
114 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 -{
2 - "name": "@types/node",
3 - "version": "17.0.39",
4 - "description": "TypeScript definitions for Node.js",
5 - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6 - "license": "MIT",
7 - "contributors": [
8 - {
9 - "name": "Microsoft TypeScript",
10 - "url": "https://github.com/Microsoft",
11 - "githubUsername": "Microsoft"
12 - },
13 - {
14 - "name": "DefinitelyTyped",
15 - "url": "https://github.com/DefinitelyTyped",
16 - "githubUsername": "DefinitelyTyped"
17 - },
18 - {
19 - "name": "Alberto Schiabel",
20 - "url": "https://github.com/jkomyno",
21 - "githubUsername": "jkomyno"
22 - },
23 - {
24 - "name": "Alvis HT Tang",
25 - "url": "https://github.com/alvis",
26 - "githubUsername": "alvis"
27 - },
28 - {
29 - "name": "Andrew Makarov",
30 - "url": "https://github.com/r3nya",
31 - "githubUsername": "r3nya"
32 - },
33 - {
34 - "name": "Benjamin Toueg",
35 - "url": "https://github.com/btoueg",
36 - "githubUsername": "btoueg"
37 - },
38 - {
39 - "name": "Chigozirim C.",
40 - "url": "https://github.com/smac89",
41 - "githubUsername": "smac89"
42 - },
43 - {
44 - "name": "David Junger",
45 - "url": "https://github.com/touffy",
46 - "githubUsername": "touffy"
47 - },
48 - {
49 - "name": "Deividas Bakanas",
50 - "url": "https://github.com/DeividasBakanas",
51 - "githubUsername": "DeividasBakanas"
52 - },
53 - {
54 - "name": "Eugene Y. Q. Shen",
55 - "url": "https://github.com/eyqs",
56 - "githubUsername": "eyqs"
57 - },
58 - {
59 - "name": "Hannes Magnusson",
60 - "url": "https://github.com/Hannes-Magnusson-CK",
61 - "githubUsername": "Hannes-Magnusson-CK"
62 - },
63 - {
64 - "name": "Huw",
65 - "url": "https://github.com/hoo29",
66 - "githubUsername": "hoo29"
67 - },
68 - {
69 - "name": "Kelvin Jin",
70 - "url": "https://github.com/kjin",
71 - "githubUsername": "kjin"
72 - },
73 - {
74 - "name": "Klaus Meinhardt",
75 - "url": "https://github.com/ajafff",
76 - "githubUsername": "ajafff"
77 - },
78 - {
79 - "name": "Lishude",
80 - "url": "https://github.com/islishude",
81 - "githubUsername": "islishude"
82 - },
83 - {
84 - "name": "Mariusz Wiktorczyk",
85 - "url": "https://github.com/mwiktorczyk",
86 - "githubUsername": "mwiktorczyk"
87 - },
88 - {
89 - "name": "Mohsen Azimi",
90 - "url": "https://github.com/mohsen1",
91 - "githubUsername": "mohsen1"
92 - },
93 - {
94 - "name": "Nicolas Even",
95 - "url": "https://github.com/n-e",
96 - "githubUsername": "n-e"
97 - },
98 - {
99 - "name": "Nikita Galkin",
100 - "url": "https://github.com/galkin",
101 - "githubUsername": "galkin"
102 - },
103 - {
104 - "name": "Parambir Singh",
105 - "url": "https://github.com/parambirs",
106 - "githubUsername": "parambirs"
107 - },
108 - {
109 - "name": "Sebastian Silbermann",
110 - "url": "https://github.com/eps1lon",
111 - "githubUsername": "eps1lon"
112 - },
113 - {
114 - "name": "Simon Schick",
115 - "url": "https://github.com/SimonSchick",
116 - "githubUsername": "SimonSchick"
117 - },
118 - {
119 - "name": "Thomas den Hollander",
120 - "url": "https://github.com/ThomasdenH",
121 - "githubUsername": "ThomasdenH"
122 - },
123 - {
124 - "name": "Wilco Bakker",
125 - "url": "https://github.com/WilcoBakker",
126 - "githubUsername": "WilcoBakker"
127 - },
128 - {
129 - "name": "wwwy3y3",
130 - "url": "https://github.com/wwwy3y3",
131 - "githubUsername": "wwwy3y3"
132 - },
133 - {
134 - "name": "Samuel Ainsworth",
135 - "url": "https://github.com/samuela",
136 - "githubUsername": "samuela"
137 - },
138 - {
139 - "name": "Kyle Uehlein",
140 - "url": "https://github.com/kuehlein",
141 - "githubUsername": "kuehlein"
142 - },
143 - {
144 - "name": "Thanik Bhongbhibhat",
145 - "url": "https://github.com/bhongy",
146 - "githubUsername": "bhongy"
147 - },
148 - {
149 - "name": "Marcin Kopacz",
150 - "url": "https://github.com/chyzwar",
151 - "githubUsername": "chyzwar"
152 - },
153 - {
154 - "name": "Trivikram Kamat",
155 - "url": "https://github.com/trivikr",
156 - "githubUsername": "trivikr"
157 - },
158 - {
159 - "name": "Junxiao Shi",
160 - "url": "https://github.com/yoursunny",
161 - "githubUsername": "yoursunny"
162 - },
163 - {
164 - "name": "Ilia Baryshnikov",
165 - "url": "https://github.com/qwelias",
166 - "githubUsername": "qwelias"
167 - },
168 - {
169 - "name": "ExE Boss",
170 - "url": "https://github.com/ExE-Boss",
171 - "githubUsername": "ExE-Boss"
172 - },
173 - {
174 - "name": "Piotr Błażejewicz",
175 - "url": "https://github.com/peterblazejewicz",
176 - "githubUsername": "peterblazejewicz"
177 - },
178 - {
179 - "name": "Anna Henningsen",
180 - "url": "https://github.com/addaleax",
181 - "githubUsername": "addaleax"
182 - },
183 - {
184 - "name": "Victor Perin",
185 - "url": "https://github.com/victorperin",
186 - "githubUsername": "victorperin"
187 - },
188 - {
189 - "name": "Yongsheng Zhang",
190 - "url": "https://github.com/ZYSzys",
191 - "githubUsername": "ZYSzys"
192 - },
193 - {
194 - "name": "NodeJS Contributors",
195 - "url": "https://github.com/NodeJS",
196 - "githubUsername": "NodeJS"
197 - },
198 - {
199 - "name": "Linus Unnebäck",
200 - "url": "https://github.com/LinusU",
201 - "githubUsername": "LinusU"
202 - },
203 - {
204 - "name": "wafuwafu13",
205 - "url": "https://github.com/wafuwafu13",
206 - "githubUsername": "wafuwafu13"
207 - },
208 - {
209 - "name": "Matteo Collina",
210 - "url": "https://github.com/mcollina",
211 - "githubUsername": "mcollina"
212 - }
213 - ],
214 - "main": "",
215 - "types": "index.d.ts",
216 - "repository": {
217 - "type": "git",
218 - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
219 - "directory": "types/node"
220 - },
221 - "scripts": {},
222 - "dependencies": {},
223 - "typesPublisherContentHash": "00f1dfb6e5a94cedae70d7698ad5bc42913c4de9bbe4415de9fe047fcdb25971",
224 - "typeScriptVersion": "3.9"
225 -}
...\ No newline at end of file ...\ No newline at end of file
1 -declare module 'path/posix' {
2 - import path = require('path');
3 - export = path;
4 -}
5 -declare module 'path/win32' {
6 - import path = require('path');
7 - export = path;
8 -}
9 -/**
10 - * The `path` module provides utilities for working with file and directory paths.
11 - * It can be accessed using:
12 - *
13 - * ```js
14 - * const path = require('path');
15 - * ```
16 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/path.js)
17 - */
18 -declare module 'path' {
19 - namespace path {
20 - /**
21 - * A parsed path object generated by path.parse() or consumed by path.format().
22 - */
23 - interface ParsedPath {
24 - /**
25 - * The root of the path such as '/' or 'c:\'
26 - */
27 - root: string;
28 - /**
29 - * The full directory path such as '/home/user/dir' or 'c:\path\dir'
30 - */
31 - dir: string;
32 - /**
33 - * The file name including extension (if any) such as 'index.html'
34 - */
35 - base: string;
36 - /**
37 - * The file extension (if any) such as '.html'
38 - */
39 - ext: string;
40 - /**
41 - * The file name without extension (if any) such as 'index'
42 - */
43 - name: string;
44 - }
45 - interface FormatInputPathObject {
46 - /**
47 - * The root of the path such as '/' or 'c:\'
48 - */
49 - root?: string | undefined;
50 - /**
51 - * The full directory path such as '/home/user/dir' or 'c:\path\dir'
52 - */
53 - dir?: string | undefined;
54 - /**
55 - * The file name including extension (if any) such as 'index.html'
56 - */
57 - base?: string | undefined;
58 - /**
59 - * The file extension (if any) such as '.html'
60 - */
61 - ext?: string | undefined;
62 - /**
63 - * The file name without extension (if any) such as 'index'
64 - */
65 - name?: string | undefined;
66 - }
67 - interface PlatformPath {
68 - /**
69 - * Normalize a string path, reducing '..' and '.' parts.
70 - * 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.
71 - *
72 - * @param p string path to normalize.
73 - */
74 - normalize(p: string): string;
75 - /**
76 - * Join all arguments together and normalize the resulting path.
77 - * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
78 - *
79 - * @param paths paths to join.
80 - */
81 - join(...paths: string[]): string;
82 - /**
83 - * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
84 - *
85 - * Starting from leftmost {from} parameter, resolves {to} to an absolute path.
86 - *
87 - * If {to} isn't already absolute, {from} arguments are prepended in right to left order,
88 - * until an absolute path is found. If after using all {from} paths still no absolute path is found,
89 - * the current working directory is used as well. The resulting path is normalized,
90 - * and trailing slashes are removed unless the path gets resolved to the root directory.
91 - *
92 - * @param pathSegments string paths to join. Non-string arguments are ignored.
93 - */
94 - resolve(...pathSegments: string[]): string;
95 - /**
96 - * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
97 - *
98 - * @param path path to test.
99 - */
100 - isAbsolute(p: string): boolean;
101 - /**
102 - * Solve the relative path from {from} to {to}.
103 - * 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.
104 - */
105 - relative(from: string, to: string): string;
106 - /**
107 - * Return the directory name of a path. Similar to the Unix dirname command.
108 - *
109 - * @param p the path to evaluate.
110 - */
111 - dirname(p: string): string;
112 - /**
113 - * Return the last portion of a path. Similar to the Unix basename command.
114 - * Often used to extract the file name from a fully qualified path.
115 - *
116 - * @param p the path to evaluate.
117 - * @param ext optionally, an extension to remove from the result.
118 - */
119 - basename(p: string, ext?: string): string;
120 - /**
121 - * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
122 - * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string
123 - *
124 - * @param p the path to evaluate.
125 - */
126 - extname(p: string): string;
127 - /**
128 - * The platform-specific file separator. '\\' or '/'.
129 - */
130 - readonly sep: string;
131 - /**
132 - * The platform-specific file delimiter. ';' or ':'.
133 - */
134 - readonly delimiter: string;
135 - /**
136 - * Returns an object from a path string - the opposite of format().
137 - *
138 - * @param pathString path to evaluate.
139 - */
140 - parse(p: string): ParsedPath;
141 - /**
142 - * Returns a path string from an object - the opposite of parse().
143 - *
144 - * @param pathString path to evaluate.
145 - */
146 - format(pP: FormatInputPathObject): string;
147 - /**
148 - * On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
149 - * If path is not a string, path will be returned without modifications.
150 - * This method is meaningful only on Windows system.
151 - * On POSIX systems, the method is non-operational and always returns path without modifications.
152 - */
153 - toNamespacedPath(path: string): string;
154 - /**
155 - * Posix specific pathing.
156 - * Same as parent object on posix.
157 - */
158 - readonly posix: PlatformPath;
159 - /**
160 - * Windows specific pathing.
161 - * Same as parent object on windows
162 - */
163 - readonly win32: PlatformPath;
164 - }
165 - }
166 - const path: path.PlatformPath;
167 - export = path;
168 -}
169 -declare module 'node:path' {
170 - import path = require('path');
171 - export = path;
172 -}
173 -declare module 'node:path/posix' {
174 - import path = require('path/posix');
175 - export = path;
176 -}
177 -declare module 'node:path/win32' {
178 - import path = require('path/win32');
179 - export = path;
180 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 -/**
2 - * **The version of the punycode module bundled in Node.js is being deprecated.**In a future major version of Node.js this module will be removed. Users
3 - * currently depending on the `punycode` module should switch to using the
4 - * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL
5 - * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`.
6 - *
7 - * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It
8 - * can be accessed using:
9 - *
10 - * ```js
11 - * const punycode = require('punycode');
12 - * ```
13 - *
14 - * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is
15 - * primarily intended for use in Internationalized Domain Names. Because host
16 - * names in URLs are limited to ASCII characters only, Domain Names that contain
17 - * non-ASCII characters must be converted into ASCII using the Punycode scheme.
18 - * For instance, the Japanese character that translates into the English word,`'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent
19 - * to `'example.com'`) is represented by Punycode as the ASCII string`'xn--fsq.com'`.
20 - *
21 - * The `punycode` module provides a simple implementation of the Punycode standard.
22 - *
23 - * The `punycode` module is a third-party dependency used by Node.js and
24 - * made available to developers as a convenience. Fixes or other modifications to
25 - * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
26 - * @deprecated Since v7.0.0 - Deprecated
27 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/punycode.js)
28 - */
29 -declare module 'punycode' {
30 - /**
31 - * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only
32 - * characters to the equivalent string of Unicode codepoints.
33 - *
34 - * ```js
35 - * punycode.decode('maana-pta'); // 'mañana'
36 - * punycode.decode('--dqo34k'); // '☃-⌘'
37 - * ```
38 - * @since v0.5.1
39 - */
40 - function decode(string: string): string;
41 - /**
42 - * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters.
43 - *
44 - * ```js
45 - * punycode.encode('mañana'); // 'maana-pta'
46 - * punycode.encode('☃-⌘'); // '--dqo34k'
47 - * ```
48 - * @since v0.5.1
49 - */
50 - function encode(string: string): string;
51 - /**
52 - * The `punycode.toUnicode()` method converts a string representing a domain name
53 - * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be
54 - * converted.
55 - *
56 - * ```js
57 - * // decode domain names
58 - * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com'
59 - * punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com'
60 - * punycode.toUnicode('example.com'); // 'example.com'
61 - * ```
62 - * @since v0.6.1
63 - */
64 - function toUnicode(domain: string): string;
65 - /**
66 - * The `punycode.toASCII()` method converts a Unicode string representing an
67 - * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the
68 - * domain name will be converted. Calling `punycode.toASCII()` on a string that
69 - * already only contains ASCII characters will have no effect.
70 - *
71 - * ```js
72 - * // encode domain names
73 - * punycode.toASCII('mañana.com'); // 'xn--maana-pta.com'
74 - * punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com'
75 - * punycode.toASCII('example.com'); // 'example.com'
76 - * ```
77 - * @since v0.6.1
78 - */
79 - function toASCII(domain: string): string;
80 - /**
81 - * @deprecated since v7.0.0
82 - * The version of the punycode module bundled in Node.js is being deprecated.
83 - * In a future major version of Node.js this module will be removed.
84 - * Users currently depending on the punycode module should switch to using
85 - * the userland-provided Punycode.js module instead.
86 - */
87 - const ucs2: ucs2;
88 - interface ucs2 {
89 - /**
90 - * @deprecated since v7.0.0
91 - * The version of the punycode module bundled in Node.js is being deprecated.
92 - * In a future major version of Node.js this module will be removed.
93 - * Users currently depending on the punycode module should switch to using
94 - * the userland-provided Punycode.js module instead.
95 - */
96 - decode(string: string): number[];
97 - /**
98 - * @deprecated since v7.0.0
99 - * The version of the punycode module bundled in Node.js is being deprecated.
100 - * In a future major version of Node.js this module will be removed.
101 - * Users currently depending on the punycode module should switch to using
102 - * the userland-provided Punycode.js module instead.
103 - */
104 - encode(codePoints: ReadonlyArray<number>): string;
105 - }
106 - /**
107 - * @deprecated since v7.0.0
108 - * The version of the punycode module bundled in Node.js is being deprecated.
109 - * In a future major version of Node.js this module will be removed.
110 - * Users currently depending on the punycode module should switch to using
111 - * the userland-provided Punycode.js module instead.
112 - */
113 - const version: string;
114 -}
115 -declare module 'node:punycode' {
116 - export * from 'punycode';
117 -}
1 -/**
2 - * The `querystring` module provides utilities for parsing and formatting URL
3 - * query strings. It can be accessed using:
4 - *
5 - * ```js
6 - * const querystring = require('querystring');
7 - * ```
8 - *
9 - * The `querystring` API is considered Legacy. While it is still maintained,
10 - * new code should use the `URLSearchParams` API instead.
11 - * @deprecated Legacy
12 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/querystring.js)
13 - */
14 -declare module 'querystring' {
15 - interface StringifyOptions {
16 - encodeURIComponent?: ((str: string) => string) | undefined;
17 - }
18 - interface ParseOptions {
19 - maxKeys?: number | undefined;
20 - decodeURIComponent?: ((str: string) => string) | undefined;
21 - }
22 - interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
23 - interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {}
24 - /**
25 - * The `querystring.stringify()` method produces a URL query string from a
26 - * given `obj` by iterating through the object's "own properties".
27 - *
28 - * It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
29 - * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
30 - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
31 - * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
32 - * [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
33 - * [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
34 - * [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
35 - * [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to
36 - * empty strings.
37 - *
38 - * ```js
39 - * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
40 - * // Returns 'foo=bar&#x26;baz=qux&#x26;baz=quux&#x26;corge='
41 - *
42 - * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
43 - * // Returns 'foo:bar;baz:qux'
44 - * ```
45 - *
46 - * By default, characters requiring percent-encoding within the query string will
47 - * be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified:
48 - *
49 - * ```js
50 - * // Assuming gbkEncodeURIComponent function already exists,
51 - *
52 - * querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
53 - * { encodeURIComponent: gbkEncodeURIComponent });
54 - * ```
55 - * @since v0.1.25
56 - * @param obj The object to serialize into a URL query string
57 - * @param [sep='&'] The substring used to delimit key and value pairs in the query string.
58 - * @param [eq='='] . The substring used to delimit keys and values in the query string.
59 - */
60 - function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
61 - /**
62 - * The `querystring.parse()` method parses a URL query string (`str`) into a
63 - * collection of key and value pairs.
64 - *
65 - * For example, the query string `'foo=bar&#x26;abc=xyz&#x26;abc=123'` is parsed into:
66 - *
67 - * ```js
68 - * {
69 - * foo: 'bar',
70 - * abc: ['xyz', '123']
71 - * }
72 - * ```
73 - *
74 - * The object returned by the `querystring.parse()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`,
75 - * `obj.hasOwnProperty()`, and others
76 - * are not defined and _will not work_.
77 - *
78 - * By default, percent-encoded characters within the query string will be assumed
79 - * to use UTF-8 encoding. If an alternative character encoding is used, then an
80 - * alternative `decodeURIComponent` option will need to be specified:
81 - *
82 - * ```js
83 - * // Assuming gbkDecodeURIComponent function already exists...
84 - *
85 - * querystring.parse('w=%D6%D0%CE%C4&#x26;foo=bar', null, null,
86 - * { decodeURIComponent: gbkDecodeURIComponent });
87 - * ```
88 - * @since v0.1.25
89 - * @param str The URL query string to parse
90 - * @param [sep='&'] The substring used to delimit key and value pairs in the query string.
91 - * @param [eq='='] . The substring used to delimit keys and values in the query string.
92 - */
93 - function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
94 - /**
95 - * The querystring.encode() function is an alias for querystring.stringify().
96 - */
97 - const encode: typeof stringify;
98 - /**
99 - * The querystring.decode() function is an alias for querystring.parse().
100 - */
101 - const decode: typeof parse;
102 - /**
103 - * The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL
104 - * query strings.
105 - *
106 - * The `querystring.escape()` method is used by `querystring.stringify()` and is
107 - * generally not expected to be used directly. It is exported primarily to allow
108 - * application code to provide a replacement percent-encoding implementation if
109 - * necessary by assigning `querystring.escape` to an alternative function.
110 - * @since v0.1.25
111 - */
112 - function escape(str: string): string;
113 - /**
114 - * The `querystring.unescape()` method performs decoding of URL percent-encoded
115 - * characters on the given `str`.
116 - *
117 - * The `querystring.unescape()` method is used by `querystring.parse()` and is
118 - * generally not expected to be used directly. It is exported primarily to allow
119 - * application code to provide a replacement decoding implementation if
120 - * necessary by assigning `querystring.unescape` to an alternative function.
121 - *
122 - * By default, the `querystring.unescape()` method will attempt to use the
123 - * JavaScript built-in `decodeURIComponent()` method to decode. If that fails,
124 - * a safer equivalent that does not throw on malformed URLs will be used.
125 - * @since v0.1.25
126 - */
127 - function unescape(str: string): string;
128 -}
129 -declare module 'node:querystring' {
130 - export * from 'querystring';
131 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 -// Duplicates of interface in lib.dom.ts.
2 -// Duplicated here rather than referencing lib.dom.ts because doing so causes lib.dom.ts to be loaded for "test-all"
3 -// Which in turn causes tests to pass that shouldn't pass.
4 -//
5 -// This interface is not, and should not be, exported.
6 -interface Blob {
7 - readonly size: number;
8 - readonly type: string;
9 - arrayBuffer(): Promise<ArrayBuffer>;
10 - slice(start?: number, end?: number, contentType?: string): Blob;
11 - stream(): NodeJS.ReadableStream;
12 - text(): Promise<string>;
13 -}
14 -declare module 'stream/consumers' {
15 - import { Readable } from 'node:stream';
16 - function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
17 - function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
18 - function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
19 - function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Blob>;
20 - function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
21 -}
22 -declare module 'node:stream/consumers' {
23 - export * from 'stream/consumers';
24 -}
1 -declare module 'stream/promises' {
2 - import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream';
3 - function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
4 - function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(source: A, destination: B, options?: PipelineOptions): PipelinePromise<B>;
5 - function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, B extends PipelineDestination<T1, any>>(
6 - source: A,
7 - transform1: T1,
8 - destination: B,
9 - options?: PipelineOptions
10 - ): PipelinePromise<B>;
11 - function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, T2 extends PipelineTransform<T1, any>, B extends PipelineDestination<T2, any>>(
12 - source: A,
13 - transform1: T1,
14 - transform2: T2,
15 - destination: B,
16 - options?: PipelineOptions
17 - ): PipelinePromise<B>;
18 - function pipeline<
19 - A extends PipelineSource<any>,
20 - T1 extends PipelineTransform<A, any>,
21 - T2 extends PipelineTransform<T1, any>,
22 - T3 extends PipelineTransform<T2, any>,
23 - B extends PipelineDestination<T3, any>
24 - >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise<B>;
25 - function pipeline<
26 - A extends PipelineSource<any>,
27 - T1 extends PipelineTransform<A, any>,
28 - T2 extends PipelineTransform<T1, any>,
29 - T3 extends PipelineTransform<T2, any>,
30 - T4 extends PipelineTransform<T3, any>,
31 - B extends PipelineDestination<T4, any>
32 - >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise<B>;
33 - function pipeline(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, options?: PipelineOptions): Promise<void>;
34 - function pipeline(
35 - stream1: NodeJS.ReadableStream,
36 - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
37 - ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
38 - ): Promise<void>;
39 -}
40 -declare module 'node:stream/promises' {
41 - export * from 'stream/promises';
42 -}
This diff is collapsed. Click to expand it.
1 -/**
2 - * The `string_decoder` module provides an API for decoding `Buffer` objects into
3 - * strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
4 - * characters. It can be accessed using:
5 - *
6 - * ```js
7 - * const { StringDecoder } = require('string_decoder');
8 - * ```
9 - *
10 - * The following example shows the basic use of the `StringDecoder` class.
11 - *
12 - * ```js
13 - * const { StringDecoder } = require('string_decoder');
14 - * const decoder = new StringDecoder('utf8');
15 - *
16 - * const cent = Buffer.from([0xC2, 0xA2]);
17 - * console.log(decoder.write(cent));
18 - *
19 - * const euro = Buffer.from([0xE2, 0x82, 0xAC]);
20 - * console.log(decoder.write(euro));
21 - * ```
22 - *
23 - * When a `Buffer` instance is written to the `StringDecoder` instance, an
24 - * internal buffer is used to ensure that the decoded string does not contain
25 - * any incomplete multibyte characters. These are held in the buffer until the
26 - * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called.
27 - *
28 - * In the following example, the three UTF-8 encoded bytes of the European Euro
29 - * symbol (`€`) are written over three separate operations:
30 - *
31 - * ```js
32 - * const { StringDecoder } = require('string_decoder');
33 - * const decoder = new StringDecoder('utf8');
34 - *
35 - * decoder.write(Buffer.from([0xE2]));
36 - * decoder.write(Buffer.from([0x82]));
37 - * console.log(decoder.end(Buffer.from([0xAC])));
38 - * ```
39 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/string_decoder.js)
40 - */
41 -declare module 'string_decoder' {
42 - class StringDecoder {
43 - constructor(encoding?: BufferEncoding);
44 - /**
45 - * Returns a decoded string, ensuring that any incomplete multibyte characters at
46 - * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the
47 - * returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`.
48 - * @since v0.1.99
49 - * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
50 - */
51 - write(buffer: Buffer): string;
52 - /**
53 - * Returns any remaining input stored in the internal buffer as a string. Bytes
54 - * representing incomplete UTF-8 and UTF-16 characters will be replaced with
55 - * substitution characters appropriate for the character encoding.
56 - *
57 - * If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input.
58 - * After `end()` is called, the `stringDecoder` object can be reused for new input.
59 - * @since v0.9.3
60 - * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
61 - */
62 - end(buffer?: Buffer): string;
63 - }
64 -}
65 -declare module 'node:string_decoder' {
66 - export * from 'string_decoder';
67 -}
1 -/**
2 - * The `timer` module exposes a global API for scheduling functions to
3 - * be called at some future period of time. Because the timer functions are
4 - * globals, there is no need to call `require('timers')` to use the API.
5 - *
6 - * The timer functions within Node.js implement a similar API as the timers API
7 - * provided by Web Browsers but use a different internal implementation that is
8 - * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
9 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/timers.js)
10 - */
11 -declare module 'timers' {
12 - import { Abortable } from 'node:events';
13 - import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';
14 - interface TimerOptions extends Abortable {
15 - /**
16 - * Set to `false` to indicate that the scheduled `Timeout`
17 - * should not require the Node.js event loop to remain active.
18 - * @default true
19 - */
20 - ref?: boolean | undefined;
21 - }
22 - let setTimeout: typeof global.setTimeout;
23 - let clearTimeout: typeof global.clearTimeout;
24 - let setInterval: typeof global.setInterval;
25 - let clearInterval: typeof global.clearInterval;
26 - let setImmediate: typeof global.setImmediate;
27 - let clearImmediate: typeof global.clearImmediate;
28 - global {
29 - namespace NodeJS {
30 - // compatibility with older typings
31 - interface Timer extends RefCounted {
32 - hasRef(): boolean;
33 - refresh(): this;
34 - [Symbol.toPrimitive](): number;
35 - }
36 - interface Immediate extends RefCounted {
37 - /**
38 - * If true, the `Immediate` object will keep the Node.js event loop active.
39 - * @since v11.0.0
40 - */
41 - hasRef(): boolean;
42 - _onImmediate: Function; // to distinguish it from the Timeout class
43 - }
44 - interface Timeout extends Timer {
45 - /**
46 - * If true, the `Timeout` object will keep the Node.js event loop active.
47 - * @since v11.0.0
48 - */
49 - hasRef(): boolean;
50 - /**
51 - * Sets the timer's start time to the current time, and reschedules the timer to
52 - * call its callback at the previously specified duration adjusted to the current
53 - * time. This is useful for refreshing a timer without allocating a new
54 - * JavaScript object.
55 - *
56 - * Using this on a timer that has already called its callback will reactivate the
57 - * timer.
58 - * @since v10.2.0
59 - * @return a reference to `timeout`
60 - */
61 - refresh(): this;
62 - [Symbol.toPrimitive](): number;
63 - }
64 - }
65 - function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
66 - // util.promisify no rest args compability
67 - // tslint:disable-next-line void-return
68 - function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
69 - namespace setTimeout {
70 - const __promisify__: typeof setTimeoutPromise;
71 - }
72 - function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
73 - function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
74 - // util.promisify no rest args compability
75 - // tslint:disable-next-line void-return
76 - function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
77 - namespace setInterval {
78 - const __promisify__: typeof setIntervalPromise;
79 - }
80 - function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
81 - function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
82 - // util.promisify no rest args compability
83 - // tslint:disable-next-line void-return
84 - function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
85 - namespace setImmediate {
86 - const __promisify__: typeof setImmediatePromise;
87 - }
88 - function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
89 - function queueMicrotask(callback: () => void): void;
90 - }
91 -}
92 -declare module 'node:timers' {
93 - export * from 'timers';
94 -}
1 -/**
2 - * The `timers/promises` API provides an alternative set of timer functions
3 - * that return `Promise` objects. The API is accessible via`require('timers/promises')`.
4 - *
5 - * ```js
6 - * import {
7 - * setTimeout,
8 - * setImmediate,
9 - * setInterval,
10 - * } from 'timers/promises';
11 - * ```
12 - * @since v15.0.0
13 - */
14 -declare module 'timers/promises' {
15 - import { TimerOptions } from 'node:timers';
16 - /**
17 - * ```js
18 - * import {
19 - * setTimeout,
20 - * } from 'timers/promises';
21 - *
22 - * const res = await setTimeout(100, 'result');
23 - *
24 - * console.log(res); // Prints 'result'
25 - * ```
26 - * @since v15.0.0
27 - * @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
28 - * @param value A value with which the promise is fulfilled.
29 - */
30 - function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
31 - /**
32 - * ```js
33 - * import {
34 - * setImmediate,
35 - * } from 'timers/promises';
36 - *
37 - * const res = await setImmediate('result');
38 - *
39 - * console.log(res); // Prints 'result'
40 - * ```
41 - * @since v15.0.0
42 - * @param value A value with which the promise is fulfilled.
43 - */
44 - function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
45 - /**
46 - * Returns an async iterator that generates values in an interval of `delay` ms.
47 - *
48 - * ```js
49 - * import {
50 - * setInterval,
51 - * } from 'timers/promises';
52 - *
53 - * const interval = 100;
54 - * for await (const startTime of setInterval(interval, Date.now())) {
55 - * const now = Date.now();
56 - * console.log(now);
57 - * if ((now - startTime) > 1000)
58 - * break;
59 - * }
60 - * console.log(Date.now());
61 - * ```
62 - * @since v15.9.0
63 - */
64 - function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
65 -}
66 -declare module 'node:timers/promises' {
67 - export * from 'timers/promises';
68 -}
This diff is collapsed. Click to expand it.
1 -/**
2 - * The `trace_events` module provides a mechanism to centralize tracing information
3 - * generated by V8, Node.js core, and userspace code.
4 - *
5 - * Tracing can be enabled with the `--trace-event-categories` command-line flag
6 - * or by using the `trace_events` module. The `--trace-event-categories` flag
7 - * accepts a list of comma-separated category names.
8 - *
9 - * The available categories are:
10 - *
11 - * * `node`: An empty placeholder.
12 - * * `node.async_hooks`: Enables capture of detailed `async_hooks` trace data.
13 - * The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
14 - * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
15 - * * `node.console`: Enables capture of `console.time()` and `console.count()`output.
16 - * * `node.dns.native`: Enables capture of trace data for DNS queries.
17 - * * `node.environment`: Enables capture of Node.js Environment milestones.
18 - * * `node.fs.sync`: Enables capture of trace data for file system sync methods.
19 - * * `node.perf`: Enables capture of `Performance API` measurements.
20 - * * `node.perf.usertiming`: Enables capture of only Performance API User Timing
21 - * measures and marks.
22 - * * `node.perf.timerify`: Enables capture of only Performance API timerify
23 - * measurements.
24 - * * `node.promises.rejections`: Enables capture of trace data tracking the number
25 - * of unhandled Promise rejections and handled-after-rejections.
26 - * * `node.vm.script`: Enables capture of trace data for the `vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
27 - * * `v8`: The `V8` events are GC, compiling, and execution related.
28 - *
29 - * By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
30 - *
31 - * ```bash
32 - * node --trace-event-categories v8,node,node.async_hooks server.js
33 - * ```
34 - *
35 - * Prior versions of Node.js required the use of the `--trace-events-enabled`flag to enable trace events. This requirement has been removed. However, the`--trace-events-enabled` flag _may_ still be
36 - * used and will enable the`node`, `node.async_hooks`, and `v8` trace event categories by default.
37 - *
38 - * ```bash
39 - * node --trace-events-enabled
40 - *
41 - * # is equivalent to
42 - *
43 - * node --trace-event-categories v8,node,node.async_hooks
44 - * ```
45 - *
46 - * Alternatively, trace events may be enabled using the `trace_events` module:
47 - *
48 - * ```js
49 - * const trace_events = require('trace_events');
50 - * const tracing = trace_events.createTracing({ categories: ['node.perf'] });
51 - * tracing.enable(); // Enable trace event capture for the 'node.perf' category
52 - *
53 - * // do work
54 - *
55 - * tracing.disable(); // Disable trace event capture for the 'node.perf' category
56 - * ```
57 - *
58 - * Running Node.js with tracing enabled will produce log files that can be opened
59 - * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
60 - *
61 - * The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can
62 - * be specified with `--trace-event-file-pattern` that accepts a template
63 - * string that supports `${rotation}` and `${pid}`:
64 - *
65 - * ```bash
66 - * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
67 - * ```
68 - *
69 - * The tracing system uses the same time source
70 - * as the one used by `process.hrtime()`.
71 - * However the trace-event timestamps are expressed in microseconds,
72 - * unlike `process.hrtime()` which returns nanoseconds.
73 - *
74 - * The features from this module are not available in `Worker` threads.
75 - * @experimental
76 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/trace_events.js)
77 - */
78 -declare module 'trace_events' {
79 - /**
80 - * The `Tracing` object is used to enable or disable tracing for sets of
81 - * categories. Instances are created using the
82 - * `trace_events.createTracing()` method.
83 - *
84 - * When created, the `Tracing` object is disabled. Calling the
85 - * `tracing.enable()` method adds the categories to the set of enabled trace
86 - * event categories. Calling `tracing.disable()` will remove the categories
87 - * from the set of enabled trace event categories.
88 - */
89 - interface Tracing {
90 - /**
91 - * A comma-separated list of the trace event categories covered by this
92 - * `Tracing` object.
93 - */
94 - readonly categories: string;
95 - /**
96 - * Disables this `Tracing` object.
97 - *
98 - * Only trace event categories _not_ covered by other enabled `Tracing`
99 - * objects and _not_ specified by the `--trace-event-categories` flag
100 - * will be disabled.
101 - */
102 - disable(): void;
103 - /**
104 - * Enables this `Tracing` object for the set of categories covered by
105 - * the `Tracing` object.
106 - */
107 - enable(): void;
108 - /**
109 - * `true` only if the `Tracing` object has been enabled.
110 - */
111 - readonly enabled: boolean;
112 - }
113 - interface CreateTracingOptions {
114 - /**
115 - * An array of trace category names. Values included in the array are
116 - * coerced to a string when possible. An error will be thrown if the
117 - * value cannot be coerced.
118 - */
119 - categories: string[];
120 - }
121 - /**
122 - * Creates and returns a `Tracing` object for the given set of `categories`.
123 - *
124 - * ```js
125 - * const trace_events = require('trace_events');
126 - * const categories = ['node.perf', 'node.async_hooks'];
127 - * const tracing = trace_events.createTracing({ categories });
128 - * tracing.enable();
129 - * // do stuff
130 - * tracing.disable();
131 - * ```
132 - * @since v10.0.0
133 - * @return .
134 - */
135 - function createTracing(options: CreateTracingOptions): Tracing;
136 - /**
137 - * Returns a comma-separated list of all currently-enabled trace event
138 - * categories. The current set of enabled trace event categories is determined
139 - * by the _union_ of all currently-enabled `Tracing` objects and any categories
140 - * enabled using the `--trace-event-categories` flag.
141 - *
142 - * Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console.
143 - *
144 - * ```js
145 - * const trace_events = require('trace_events');
146 - * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
147 - * const t2 = trace_events.createTracing({ categories: ['node.perf'] });
148 - * const t3 = trace_events.createTracing({ categories: ['v8'] });
149 - *
150 - * t1.enable();
151 - * t2.enable();
152 - *
153 - * console.log(trace_events.getEnabledCategories());
154 - * ```
155 - * @since v10.0.0
156 - */
157 - function getEnabledCategories(): string | undefined;
158 -}
159 -declare module 'node:trace_events' {
160 - export * from 'trace_events';
161 -}
1 -/**
2 - * The `tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes.
3 - * In most cases, it will not be necessary or possible to use this module directly.
4 - * However, it can be accessed using:
5 - *
6 - * ```js
7 - * const tty = require('tty');
8 - * ```
9 - *
10 - * When Node.js detects that it is being run with a text terminal ("TTY")
11 - * attached, `process.stdin` will, by default, be initialized as an instance of`tty.ReadStream` and both `process.stdout` and `process.stderr` will, by
12 - * default, be instances of `tty.WriteStream`. The preferred method of determining
13 - * whether Node.js is being run within a TTY context is to check that the value of
14 - * the `process.stdout.isTTY` property is `true`:
15 - *
16 - * ```console
17 - * $ node -p -e "Boolean(process.stdout.isTTY)"
18 - * true
19 - * $ node -p -e "Boolean(process.stdout.isTTY)" | cat
20 - * false
21 - * ```
22 - *
23 - * In most cases, there should be little to no reason for an application to
24 - * manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
25 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/tty.js)
26 - */
27 -declare module 'tty' {
28 - import * as net from 'node:net';
29 - /**
30 - * The `tty.isatty()` method returns `true` if the given `fd` is associated with
31 - * a TTY and `false` if it is not, including whenever `fd` is not a non-negative
32 - * integer.
33 - * @since v0.5.8
34 - * @param fd A numeric file descriptor
35 - */
36 - function isatty(fd: number): boolean;
37 - /**
38 - * Represents the readable side of a TTY. In normal circumstances `process.stdin` will be the only `tty.ReadStream` instance in a Node.js
39 - * process and there should be no reason to create additional instances.
40 - * @since v0.5.8
41 - */
42 - class ReadStream extends net.Socket {
43 - constructor(fd: number, options?: net.SocketConstructorOpts);
44 - /**
45 - * A `boolean` that is `true` if the TTY is currently configured to operate as a
46 - * raw device. Defaults to `false`.
47 - * @since v0.7.7
48 - */
49 - isRaw: boolean;
50 - /**
51 - * Allows configuration of `tty.ReadStream` so that it operates as a raw device.
52 - *
53 - * When in raw mode, input is always available character-by-character, not
54 - * including modifiers. Additionally, all special processing of characters by the
55 - * terminal is disabled, including echoing input characters.Ctrl+C will no longer cause a `SIGINT` when in this mode.
56 - * @since v0.7.7
57 - * @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw`
58 - * property will be set to the resulting mode.
59 - * @return The read stream instance.
60 - */
61 - setRawMode(mode: boolean): this;
62 - /**
63 - * A `boolean` that is always `true` for `tty.ReadStream` instances.
64 - * @since v0.5.8
65 - */
66 - isTTY: boolean;
67 - }
68 - /**
69 - * -1 - to the left from cursor
70 - * 0 - the entire line
71 - * 1 - to the right from cursor
72 - */
73 - type Direction = -1 | 0 | 1;
74 - /**
75 - * Represents the writable side of a TTY. In normal circumstances,`process.stdout` and `process.stderr` will be the only`tty.WriteStream` instances created for a Node.js process and there
76 - * should be no reason to create additional instances.
77 - * @since v0.5.8
78 - */
79 - class WriteStream extends net.Socket {
80 - constructor(fd: number);
81 - addListener(event: string, listener: (...args: any[]) => void): this;
82 - addListener(event: 'resize', listener: () => void): this;
83 - emit(event: string | symbol, ...args: any[]): boolean;
84 - emit(event: 'resize'): boolean;
85 - on(event: string, listener: (...args: any[]) => void): this;
86 - on(event: 'resize', listener: () => void): this;
87 - once(event: string, listener: (...args: any[]) => void): this;
88 - once(event: 'resize', listener: () => void): this;
89 - prependListener(event: string, listener: (...args: any[]) => void): this;
90 - prependListener(event: 'resize', listener: () => void): this;
91 - prependOnceListener(event: string, listener: (...args: any[]) => void): this;
92 - prependOnceListener(event: 'resize', listener: () => void): this;
93 - /**
94 - * `writeStream.clearLine()` clears the current line of this `WriteStream` in a
95 - * direction identified by `dir`.
96 - * @since v0.7.7
97 - * @param callback Invoked once the operation completes.
98 - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
99 - */
100 - clearLine(dir: Direction, callback?: () => void): boolean;
101 - /**
102 - * `writeStream.clearScreenDown()` clears this `WriteStream` from the current
103 - * cursor down.
104 - * @since v0.7.7
105 - * @param callback Invoked once the operation completes.
106 - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
107 - */
108 - clearScreenDown(callback?: () => void): boolean;
109 - /**
110 - * `writeStream.cursorTo()` moves this `WriteStream`'s cursor to the specified
111 - * position.
112 - * @since v0.7.7
113 - * @param callback Invoked once the operation completes.
114 - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
115 - */
116 - cursorTo(x: number, y?: number, callback?: () => void): boolean;
117 - cursorTo(x: number, callback: () => void): boolean;
118 - /**
119 - * `writeStream.moveCursor()` moves this `WriteStream`'s cursor _relative_ to its
120 - * current position.
121 - * @since v0.7.7
122 - * @param callback Invoked once the operation completes.
123 - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
124 - */
125 - moveCursor(dx: number, dy: number, callback?: () => void): boolean;
126 - /**
127 - * Returns:
128 - *
129 - * * `1` for 2,
130 - * * `4` for 16,
131 - * * `8` for 256,
132 - * * `24` for 16,777,216 colors supported.
133 - *
134 - * Use this to determine what colors the terminal supports. Due to the nature of
135 - * colors in terminals it is possible to either have false positives or false
136 - * negatives. It depends on process information and the environment variables that
137 - * may lie about what terminal is used.
138 - * It is possible to pass in an `env` object to simulate the usage of a specific
139 - * terminal. This can be useful to check how specific environment settings behave.
140 - *
141 - * To enforce a specific color support, use one of the below environment settings.
142 - *
143 - * * 2 colors: `FORCE_COLOR = 0` (Disables colors)
144 - * * 16 colors: `FORCE_COLOR = 1`
145 - * * 256 colors: `FORCE_COLOR = 2`
146 - * * 16,777,216 colors: `FORCE_COLOR = 3`
147 - *
148 - * Disabling color support is also possible by using the `NO_COLOR` and`NODE_DISABLE_COLORS` environment variables.
149 - * @since v9.9.0
150 - * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal.
151 - */
152 - getColorDepth(env?: object): number;
153 - /**
154 - * Returns `true` if the `writeStream` supports at least as many colors as provided
155 - * in `count`. Minimum support is 2 (black and white).
156 - *
157 - * This has the same false positives and negatives as described in `writeStream.getColorDepth()`.
158 - *
159 - * ```js
160 - * process.stdout.hasColors();
161 - * // Returns true or false depending on if `stdout` supports at least 16 colors.
162 - * process.stdout.hasColors(256);
163 - * // Returns true or false depending on if `stdout` supports at least 256 colors.
164 - * process.stdout.hasColors({ TMUX: '1' });
165 - * // Returns true.
166 - * process.stdout.hasColors(2 ** 24, { TMUX: '1' });
167 - * // Returns false (the environment setting pretends to support 2 ** 8 colors).
168 - * ```
169 - * @since v11.13.0, v10.16.0
170 - * @param [count=16] The number of colors that are requested (minimum 2).
171 - * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal.
172 - */
173 - hasColors(count?: number): boolean;
174 - hasColors(env?: object): boolean;
175 - hasColors(count: number, env?: object): boolean;
176 - /**
177 - * `writeStream.getWindowSize()` returns the size of the TTY
178 - * corresponding to this `WriteStream`. The array is of the type`[numColumns, numRows]` where `numColumns` and `numRows` represent the number
179 - * of columns and rows in the corresponding TTY.
180 - * @since v0.7.7
181 - */
182 - getWindowSize(): [number, number];
183 - /**
184 - * A `number` specifying the number of columns the TTY currently has. This property
185 - * is updated whenever the `'resize'` event is emitted.
186 - * @since v0.7.7
187 - */
188 - columns: number;
189 - /**
190 - * A `number` specifying the number of rows the TTY currently has. This property
191 - * is updated whenever the `'resize'` event is emitted.
192 - * @since v0.7.7
193 - */
194 - rows: number;
195 - /**
196 - * A `boolean` that is always `true`.
197 - * @since v0.5.8
198 - */
199 - isTTY: boolean;
200 - }
201 -}
202 -declare module 'node:tty' {
203 - export * from 'tty';
204 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 -/**
2 - * The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives sandboxed WebAssembly applications access to the
3 - * underlying operating system via a collection of POSIX-like functions.
4 - *
5 - * ```js
6 - * import { readFile } from 'fs/promises';
7 - * import { WASI } from 'wasi';
8 - * import { argv, env } from 'process';
9 - *
10 - * const wasi = new WASI({
11 - * args: argv,
12 - * env,
13 - * preopens: {
14 - * '/sandbox': '/some/real/path/that/wasm/can/access'
15 - * }
16 - * });
17 - *
18 - * // Some WASI binaries require:
19 - * // const importObject = { wasi_unstable: wasi.wasiImport };
20 - * const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
21 - *
22 - * const wasm = await WebAssembly.compile(
23 - * await readFile(new URL('./demo.wasm', import.meta.url))
24 - * );
25 - * const instance = await WebAssembly.instantiate(wasm, importObject);
26 - *
27 - * wasi.start(instance);
28 - * ```
29 - *
30 - * To run the above example, create a new WebAssembly text format file named`demo.wat`:
31 - *
32 - * ```text
33 - * (module
34 - * ;; Import the required fd_write WASI function which will write the given io vectors to stdout
35 - * ;; The function signature for fd_write is:
36 - * ;; (File Descriptor, *iovs, iovs_len, nwritten) -> Returns number of bytes written
37 - * (import "wasi_snapshot_preview1" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
38 - *
39 - * (memory 1)
40 - * (export "memory" (memory 0))
41 - *
42 - * ;; Write 'hello world\n' to memory at an offset of 8 bytes
43 - * ;; Note the trailing newline which is required for the text to appear
44 - * (data (i32.const 8) "hello world\n")
45 - *
46 - * (func $main (export "_start")
47 - * ;; Creating a new io vector within linear memory
48 - * (i32.store (i32.const 0) (i32.const 8)) ;; iov.iov_base - This is a pointer to the start of the 'hello world\n' string
49 - * (i32.store (i32.const 4) (i32.const 12)) ;; iov.iov_len - The length of the 'hello world\n' string
50 - *
51 - * (call $fd_write
52 - * (i32.const 1) ;; file_descriptor - 1 for stdout
53 - * (i32.const 0) ;; *iovs - The pointer to the iov array, which is stored at memory location 0
54 - * (i32.const 1) ;; iovs_len - We're printing 1 string stored in an iov - so one.
55 - * (i32.const 20) ;; nwritten - A place in memory to store the number of bytes written
56 - * )
57 - * drop ;; Discard the number of bytes written from the top of the stack
58 - * )
59 - * )
60 - * ```
61 - *
62 - * Use [wabt](https://github.com/WebAssembly/wabt) to compile `.wat` to `.wasm`
63 - *
64 - * ```console
65 - * $ wat2wasm demo.wat
66 - * ```
67 - *
68 - * The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
69 - * example to run.
70 - * @experimental
71 - * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/wasi.js)
72 - */
73 -declare module 'wasi' {
74 - interface WASIOptions {
75 - /**
76 - * An array of strings that the WebAssembly application will
77 - * see as command line arguments. The first argument is the virtual path to the
78 - * WASI command itself.
79 - */
80 - args?: string[] | undefined;
81 - /**
82 - * An object similar to `process.env` that the WebAssembly
83 - * application will see as its environment.
84 - */
85 - env?: object | undefined;
86 - /**
87 - * This object represents the WebAssembly application's
88 - * sandbox directory structure. The string keys of `preopens` are treated as
89 - * directories within the sandbox. The corresponding values in `preopens` are
90 - * the real paths to those directories on the host machine.
91 - */
92 - preopens?: NodeJS.Dict<string> | undefined;
93 - /**
94 - * By default, WASI applications terminate the Node.js
95 - * process via the `__wasi_proc_exit()` function. Setting this option to `true`
96 - * causes `wasi.start()` to return the exit code rather than terminate the
97 - * process.
98 - * @default false
99 - */
100 - returnOnExit?: boolean | undefined;
101 - /**
102 - * The file descriptor used as standard input in the WebAssembly application.
103 - * @default 0
104 - */
105 - stdin?: number | undefined;
106 - /**
107 - * The file descriptor used as standard output in the WebAssembly application.
108 - * @default 1
109 - */
110 - stdout?: number | undefined;
111 - /**
112 - * The file descriptor used as standard error in the WebAssembly application.
113 - * @default 2
114 - */
115 - stderr?: number | undefined;
116 - }
117 - /**
118 - * The `WASI` class provides the WASI system call API and additional convenience
119 - * methods for working with WASI-based applications. Each `WASI` instance
120 - * represents a distinct sandbox environment. For security purposes, each `WASI`instance must have its command-line arguments, environment variables, and
121 - * sandbox directory structure configured explicitly.
122 - * @since v13.3.0, v12.16.0
123 - */
124 - class WASI {
125 - constructor(options?: WASIOptions);
126 - /**
127 - * Attempt to begin execution of `instance` as a WASI command by invoking its`_start()` export. If `instance` does not contain a `_start()` export, or if`instance` contains an `_initialize()`
128 - * export, then an exception is thrown.
129 - *
130 - * `start()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`. If
131 - * `instance` does not have a `memory` export an exception is thrown.
132 - *
133 - * If `start()` is called more than once, an exception is thrown.
134 - * @since v13.3.0, v12.16.0
135 - */
136 - start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
137 - /**
138 - * Attempt to initialize `instance` as a WASI reactor by invoking its`_initialize()` export, if it is present. If `instance` contains a `_start()`export, then an exception is thrown.
139 - *
140 - * `initialize()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`.
141 - * If `instance` does not have a `memory` export an exception is thrown.
142 - *
143 - * If `initialize()` is called more than once, an exception is thrown.
144 - * @since v14.6.0, v12.19.0
145 - */
146 - initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
147 - /**
148 - * `wasiImport` is an object that implements the WASI system call API. This object
149 - * should be passed as the `wasi_snapshot_preview1` import during the instantiation
150 - * of a [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance).
151 - * @since v13.3.0, v12.16.0
152 - */
153 - readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
154 - }
155 -}
156 -declare module 'node:wasi' {
157 - export * from 'wasi';
158 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 -1.3.8 / 2022-02-02
2 -==================
3 -
4 - * deps: mime-types@~2.1.34
5 - - deps: mime-db@~1.51.0
6 - * deps: negotiator@0.6.3
7 -
8 -1.3.7 / 2019-04-29
9 -==================
10 -
11 - * deps: negotiator@0.6.2
12 - - Fix sorting charset, encoding, and language with extra parameters
13 -
14 -1.3.6 / 2019-04-28
15 -==================
16 -
17 - * deps: mime-types@~2.1.24
18 - - deps: mime-db@~1.40.0
19 -
20 -1.3.5 / 2018-02-28
21 -==================
22 -
23 - * deps: mime-types@~2.1.18
24 - - deps: mime-db@~1.33.0
25 -
26 -1.3.4 / 2017-08-22
27 -==================
28 -
29 - * deps: mime-types@~2.1.16
30 - - deps: mime-db@~1.29.0
31 -
32 -1.3.3 / 2016-05-02
33 -==================
34 -
35 - * deps: mime-types@~2.1.11
36 - - deps: mime-db@~1.23.0
37 - * deps: negotiator@0.6.1
38 - - perf: improve `Accept` parsing speed
39 - - perf: improve `Accept-Charset` parsing speed
40 - - perf: improve `Accept-Encoding` parsing speed
41 - - perf: improve `Accept-Language` parsing speed
42 -
43 -1.3.2 / 2016-03-08
44 -==================
45 -
46 - * deps: mime-types@~2.1.10
47 - - Fix extension of `application/dash+xml`
48 - - Update primary extension for `audio/mp4`
49 - - deps: mime-db@~1.22.0
50 -
51 -1.3.1 / 2016-01-19
52 -==================
53 -
54 - * deps: mime-types@~2.1.9
55 - - deps: mime-db@~1.21.0
56 -
57 -1.3.0 / 2015-09-29
58 -==================
59 -
60 - * deps: mime-types@~2.1.7
61 - - deps: mime-db@~1.19.0
62 - * deps: negotiator@0.6.0
63 - - Fix including type extensions in parameters in `Accept` parsing
64 - - Fix parsing `Accept` parameters with quoted equals
65 - - Fix parsing `Accept` parameters with quoted semicolons
66 - - Lazy-load modules from main entry point
67 - - perf: delay type concatenation until needed
68 - - perf: enable strict mode
69 - - perf: hoist regular expressions
70 - - perf: remove closures getting spec properties
71 - - perf: remove a closure from media type parsing
72 - - perf: remove property delete from media type parsing
73 -
74 -1.2.13 / 2015-09-06
75 -===================
76 -
77 - * deps: mime-types@~2.1.6
78 - - deps: mime-db@~1.18.0
79 -
80 -1.2.12 / 2015-07-30
81 -===================
82 -
83 - * deps: mime-types@~2.1.4
84 - - deps: mime-db@~1.16.0
85 -
86 -1.2.11 / 2015-07-16
87 -===================
88 -
89 - * deps: mime-types@~2.1.3
90 - - deps: mime-db@~1.15.0
91 -
92 -1.2.10 / 2015-07-01
93 -===================
94 -
95 - * deps: mime-types@~2.1.2
96 - - deps: mime-db@~1.14.0
97 -
98 -1.2.9 / 2015-06-08
99 -==================
100 -
101 - * deps: mime-types@~2.1.1
102 - - perf: fix deopt during mapping
103 -
104 -1.2.8 / 2015-06-07
105 -==================
106 -
107 - * deps: mime-types@~2.1.0
108 - - deps: mime-db@~1.13.0
109 - * perf: avoid argument reassignment & argument slice
110 - * perf: avoid negotiator recursive construction
111 - * perf: enable strict mode
112 - * perf: remove unnecessary bitwise operator
113 -
114 -1.2.7 / 2015-05-10
115 -==================
116 -
117 - * deps: negotiator@0.5.3
118 - - Fix media type parameter matching to be case-insensitive
119 -
120 -1.2.6 / 2015-05-07
121 -==================
122 -
123 - * deps: mime-types@~2.0.11
124 - - deps: mime-db@~1.9.1
125 - * deps: negotiator@0.5.2
126 - - Fix comparing media types with quoted values
127 - - Fix splitting media types with quoted commas
128 -
129 -1.2.5 / 2015-03-13
130 -==================
131 -
132 - * deps: mime-types@~2.0.10
133 - - deps: mime-db@~1.8.0
134 -
135 -1.2.4 / 2015-02-14
136 -==================
137 -
138 - * Support Node.js 0.6
139 - * deps: mime-types@~2.0.9
140 - - deps: mime-db@~1.7.0
141 - * deps: negotiator@0.5.1
142 - - Fix preference sorting to be stable for long acceptable lists
143 -
144 -1.2.3 / 2015-01-31
145 -==================
146 -
147 - * deps: mime-types@~2.0.8
148 - - deps: mime-db@~1.6.0
149 -
150 -1.2.2 / 2014-12-30
151 -==================
152 -
153 - * deps: mime-types@~2.0.7
154 - - deps: mime-db@~1.5.0
155 -
156 -1.2.1 / 2014-12-30
157 -==================
158 -
159 - * deps: mime-types@~2.0.5
160 - - deps: mime-db@~1.3.1
161 -
162 -1.2.0 / 2014-12-19
163 -==================
164 -
165 - * deps: negotiator@0.5.0
166 - - Fix list return order when large accepted list
167 - - Fix missing identity encoding when q=0 exists
168 - - Remove dynamic building of Negotiator class
169 -
170 -1.1.4 / 2014-12-10
171 -==================
172 -
173 - * deps: mime-types@~2.0.4
174 - - deps: mime-db@~1.3.0
175 -
176 -1.1.3 / 2014-11-09
177 -==================
178 -
179 - * deps: mime-types@~2.0.3
180 - - deps: mime-db@~1.2.0
181 -
182 -1.1.2 / 2014-10-14
183 -==================
184 -
185 - * deps: negotiator@0.4.9
186 - - Fix error when media type has invalid parameter
187 -
188 -1.1.1 / 2014-09-28
189 -==================
190 -
191 - * deps: mime-types@~2.0.2
192 - - deps: mime-db@~1.1.0
193 - * deps: negotiator@0.4.8
194 - - Fix all negotiations to be case-insensitive
195 - - Stable sort preferences of same quality according to client order
196 -
197 -1.1.0 / 2014-09-02
198 -==================
199 -
200 - * update `mime-types`
201 -
202 -1.0.7 / 2014-07-04
203 -==================
204 -
205 - * Fix wrong type returned from `type` when match after unknown extension
206 -
207 -1.0.6 / 2014-06-24
208 -==================
209 -
210 - * deps: negotiator@0.4.7
211 -
212 -1.0.5 / 2014-06-20
213 -==================
214 -
215 - * fix crash when unknown extension given
216 -
217 -1.0.4 / 2014-06-19
218 -==================
219 -
220 - * use `mime-types`
221 -
222 -1.0.3 / 2014-06-11
223 -==================
224 -
225 - * deps: negotiator@0.4.6
226 - - Order by specificity when quality is the same
227 -
228 -1.0.2 / 2014-05-29
229 -==================
230 -
231 - * Fix interpretation when header not in request
232 - * deps: pin negotiator@0.4.5
233 -
234 -1.0.1 / 2014-01-18
235 -==================
236 -
237 - * Identity encoding isn't always acceptable
238 - * deps: negotiator@~0.4.0
239 -
240 -1.0.0 / 2013-12-27
241 -==================
242 -
243 - * 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][github-actions-ci-image]][github-actions-ci-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 -```js
33 -var accepts = require('accepts')
34 -```
35 -
36 -### accepts(req)
37 -
38 -Create a new `Accepts` object for the given `req`.
39 -
40 -#### .charset(charsets)
41 -
42 -Return the first accepted charset. If nothing in `charsets` is accepted,
43 -then `false` is returned.
44 -
45 -#### .charsets()
46 -
47 -Return the charsets that the request accepts, in the order of the client's
48 -preference (most preferred first).
49 -
50 -#### .encoding(encodings)
51 -
52 -Return the first accepted encoding. If nothing in `encodings` is accepted,
53 -then `false` is returned.
54 -
55 -#### .encodings()
56 -
57 -Return the encodings that the request accepts, in the order of the client's
58 -preference (most preferred first).
59 -
60 -#### .language(languages)
61 -
62 -Return the first accepted language. If nothing in `languages` is accepted,
63 -then `false` is returned.
64 -
65 -#### .languages()
66 -
67 -Return the languages that the request accepts, in the order of the client's
68 -preference (most preferred first).
69 -
70 -#### .type(types)
71 -
72 -Return the first accepted type (and it is returned as the same text as what
73 -appears in the `types` array). If nothing in `types` is accepted, then `false`
74 -is returned.
75 -
76 -The `types` array can contain full MIME types or file extensions. Any value
77 -that is not a full MIME types is passed to `require('mime-types').lookup`.
78 -
79 -#### .types()
80 -
81 -Return the types that the request accepts, in the order of the client's
82 -preference (most preferred first).
83 -
84 -## Examples
85 -
86 -### Simple type negotiation
87 -
88 -This simple example shows how to use `accepts` to return a different typed
89 -respond body based on what the client wants to accept. The server lists it's
90 -preferences in order and will get back the best match between the client and
91 -server.
92 -
93 -```js
94 -var accepts = require('accepts')
95 -var http = require('http')
96 -
97 -function app (req, res) {
98 - var accept = accepts(req)
99 -
100 - // the order of this list is significant; should be server preferred order
101 - switch (accept.type(['json', 'html'])) {
102 - case 'json':
103 - res.setHeader('Content-Type', 'application/json')
104 - res.write('{"hello":"world!"}')
105 - break
106 - case 'html':
107 - res.setHeader('Content-Type', 'text/html')
108 - res.write('<b>hello, world!</b>')
109 - break
110 - default:
111 - // the fallback is text/plain, so no need to specify it above
112 - res.setHeader('Content-Type', 'text/plain')
113 - res.write('hello, world!')
114 - break
115 - }
116 -
117 - res.end()
118 -}
119 -
120 -http.createServer(app).listen(3000)
121 -```
122 -
123 -You can test this out with the cURL program:
124 -```sh
125 -curl -I -H'Accept: text/html' http://localhost:3000/
126 -```
127 -
128 -## License
129 -
130 -[MIT](LICENSE)
131 -
132 -[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
133 -[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
134 -[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
135 -[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
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
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 - "name": "accepts",
3 - "description": "Higher-level content negotiation",
4 - "version": "1.3.8",
5 - "contributors": [
6 - "Douglas Christopher Wilson <doug@somethingdoug.com>",
7 - "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
8 - ],
9 - "license": "MIT",
10 - "repository": "jshttp/accepts",
11 - "dependencies": {
12 - "mime-types": "~2.1.34",
13 - "negotiator": "0.6.3"
14 - },
15 - "devDependencies": {
16 - "deep-equal": "1.0.1",
17 - "eslint": "7.32.0",
18 - "eslint-config-standard": "14.1.1",
19 - "eslint-plugin-import": "2.25.4",
20 - "eslint-plugin-markdown": "2.2.1",
21 - "eslint-plugin-node": "11.1.0",
22 - "eslint-plugin-promise": "4.3.1",
23 - "eslint-plugin-standard": "4.1.0",
24 - "mocha": "9.2.0",
25 - "nyc": "15.1.0"
26 - },
27 - "files": [
28 - "LICENSE",
29 - "HISTORY.md",
30 - "index.js"
31 - ],
32 - "engines": {
33 - "node": ">= 0.6"
34 - },
35 - "scripts": {
36 - "lint": "eslint .",
37 - "test": "mocha --reporter spec --check-leaks --bail test/",
38 - "test-ci": "nyc --reporter=lcov --reporter=text npm test",
39 - "test-cov": "nyc --reporter=html --reporter=text npm test"
40 - },
41 - "keywords": [
42 - "content",
43 - "negotiation",
44 - "accept",
45 - "accepts"
46 - ]
47 -}
1 -The MIT License (MIT)
2 -
3 -Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)
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
13 -all 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
21 -THE SOFTWARE.
1 -# Array Flatten
2 -
3 -[![NPM version][npm-image]][npm-url]
4 -[![NPM downloads][downloads-image]][downloads-url]
5 -[![Build status][travis-image]][travis-url]
6 -[![Test coverage][coveralls-image]][coveralls-url]
7 -
8 -> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
9 -
10 -## Installation
11 -
12 -```
13 -npm install array-flatten --save
14 -```
15 -
16 -## Usage
17 -
18 -```javascript
19 -var flatten = require('array-flatten')
20 -
21 -flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
22 -//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
23 -
24 -flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
25 -//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
26 -
27 -(function () {
28 - flatten(arguments) //=> [1, 2, 3]
29 -})(1, [2, 3])
30 -```
31 -
32 -## License
33 -
34 -MIT
35 -
36 -[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
37 -[npm-url]: https://npmjs.org/package/array-flatten
38 -[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
39 -[downloads-url]: https://npmjs.org/package/array-flatten
40 -[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
41 -[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
42 -[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
43 -[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
1 -'use strict'
2 -
3 -/**
4 - * Expose `arrayFlatten`.
5 - */
6 -module.exports = arrayFlatten
7 -
8 -/**
9 - * Recursive flatten function with depth.
10 - *
11 - * @param {Array} array
12 - * @param {Array} result
13 - * @param {Number} depth
14 - * @return {Array}
15 - */
16 -function flattenWithDepth (array, result, depth) {
17 - for (var i = 0; i < array.length; i++) {
18 - var value = array[i]
19 -
20 - if (depth > 0 && Array.isArray(value)) {
21 - flattenWithDepth(value, result, depth - 1)
22 - } else {
23 - result.push(value)
24 - }
25 - }
26 -
27 - return result
28 -}
29 -
30 -/**
31 - * Recursive flatten function. Omitting depth is slightly faster.
32 - *
33 - * @param {Array} array
34 - * @param {Array} result
35 - * @return {Array}
36 - */
37 -function flattenForever (array, result) {
38 - for (var i = 0; i < array.length; i++) {
39 - var value = array[i]
40 -
41 - if (Array.isArray(value)) {
42 - flattenForever(value, result)
43 - } else {
44 - result.push(value)
45 - }
46 - }
47 -
48 - return result
49 -}
50 -
51 -/**
52 - * Flatten an array, with the ability to define a depth.
53 - *
54 - * @param {Array} array
55 - * @param {Number} depth
56 - * @return {Array}
57 - */
58 -function arrayFlatten (array, depth) {
59 - if (depth == null) {
60 - return flattenForever(array, [])
61 - }
62 -
63 - return flattenWithDepth(array, [], depth)
64 -}
1 -{
2 - "name": "array-flatten",
3 - "version": "1.1.1",
4 - "description": "Flatten an array of nested arrays into a single flat array",
5 - "main": "array-flatten.js",
6 - "files": [
7 - "array-flatten.js",
8 - "LICENSE"
9 - ],
10 - "scripts": {
11 - "test": "istanbul cover _mocha -- -R spec"
12 - },
13 - "repository": {
14 - "type": "git",
15 - "url": "git://github.com/blakeembrey/array-flatten.git"
16 - },
17 - "keywords": [
18 - "array",
19 - "flatten",
20 - "arguments",
21 - "depth"
22 - ],
23 - "author": {
24 - "name": "Blake Embrey",
25 - "email": "hello@blakeembrey.com",
26 - "url": "http://blakeembrey.me"
27 - },
28 - "license": "MIT",
29 - "bugs": {
30 - "url": "https://github.com/blakeembrey/array-flatten/issues"
31 - },
32 - "homepage": "https://github.com/blakeembrey/array-flatten",
33 - "devDependencies": {
34 - "istanbul": "^0.3.13",
35 - "mocha": "^2.2.4",
36 - "pre-commit": "^1.0.7",
37 - "standard": "^3.7.3"
38 - }
39 -}
1 -# [2.0.0](https://github.com/faeldt/base64id/compare/1.0.0...2.0.0) (2019-05-27)
2 -
3 -
4 -### Code Refactoring
5 -
6 -* **buffer:** replace deprecated Buffer constructor usage ([#11](https://github.com/faeldt/base64id/issues/11)) ([ccfba54](https://github.com/faeldt/base64id/commit/ccfba54))
7 -
8 -
9 -### BREAKING CHANGES
10 -
11 -* **buffer:** drop support for Node.js ≤ 4.4.x and 5.0.0 - 5.9.x
12 -
13 -See: https://nodejs.org/en/docs/guides/buffer-constructor-deprecation/
14 -
15 -
16 -
1 -(The MIT License)
2 -
3 -Copyright (c) 2012-2016 Kristian Faeldt <faeldt_kristian@cyberagent.co.jp>
4 -
5 -Permission is hereby granted, free of charge, to any person obtaining
6 -a copy of this software and associated documentation files (the
7 -'Software'), to deal in the Software without restriction, including
8 -without limitation the rights to use, copy, modify, merge, publish,
9 -distribute, sublicense, and/or sell copies of the Software, and to
10 -permit persons to whom the Software is furnished to do so, subject to
11 -the following conditions:
12 -
13 -The above copyright notice and this permission notice shall be
14 -included in all copies or substantial portions of the Software.
15 -
16 -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17 -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 -base64id
2 -========
3 -
4 -Node.js module that generates a base64 id.
5 -
6 -Uses crypto.randomBytes when available, falls back to unsafe methods for node.js <= 0.4.
7 -
8 -To increase performance, random bytes are buffered to minimize the number of synchronous calls to crypto.randomBytes.
9 -
10 -## Installation
11 -
12 - $ npm install base64id
13 -
14 -## Usage
15 -
16 - var base64id = require('base64id');
17 -
18 - var id = base64id.generateId();
1 -/*!
2 - * base64id v0.1.0
3 - */
4 -
5 -/**
6 - * Module dependencies
7 - */
8 -
9 -var crypto = require('crypto');
10 -
11 -/**
12 - * Constructor
13 - */
14 -
15 -var Base64Id = function() { };
16 -
17 -/**
18 - * Get random bytes
19 - *
20 - * Uses a buffer if available, falls back to crypto.randomBytes
21 - */
22 -
23 -Base64Id.prototype.getRandomBytes = function(bytes) {
24 -
25 - var BUFFER_SIZE = 4096
26 - var self = this;
27 -
28 - bytes = bytes || 12;
29 -
30 - if (bytes > BUFFER_SIZE) {
31 - return crypto.randomBytes(bytes);
32 - }
33 -
34 - var bytesInBuffer = parseInt(BUFFER_SIZE/bytes);
35 - var threshold = parseInt(bytesInBuffer*0.85);
36 -
37 - if (!threshold) {
38 - return crypto.randomBytes(bytes);
39 - }
40 -
41 - if (this.bytesBufferIndex == null) {
42 - this.bytesBufferIndex = -1;
43 - }
44 -
45 - if (this.bytesBufferIndex == bytesInBuffer) {
46 - this.bytesBuffer = null;
47 - this.bytesBufferIndex = -1;
48 - }
49 -
50 - // No buffered bytes available or index above threshold
51 - if (this.bytesBufferIndex == -1 || this.bytesBufferIndex > threshold) {
52 -
53 - if (!this.isGeneratingBytes) {
54 - this.isGeneratingBytes = true;
55 - crypto.randomBytes(BUFFER_SIZE, function(err, bytes) {
56 - self.bytesBuffer = bytes;
57 - self.bytesBufferIndex = 0;
58 - self.isGeneratingBytes = false;
59 - });
60 - }
61 -
62 - // Fall back to sync call when no buffered bytes are available
63 - if (this.bytesBufferIndex == -1) {
64 - return crypto.randomBytes(bytes);
65 - }
66 - }
67 -
68 - var result = this.bytesBuffer.slice(bytes*this.bytesBufferIndex, bytes*(this.bytesBufferIndex+1));
69 - this.bytesBufferIndex++;
70 -
71 - return result;
72 -}
73 -
74 -/**
75 - * Generates a base64 id
76 - *
77 - * (Original version from socket.io <http://socket.io>)
78 - */
79 -
80 -Base64Id.prototype.generateId = function () {
81 - var rand = Buffer.alloc(15); // multiple of 3 for base64
82 - if (!rand.writeInt32BE) {
83 - return Math.abs(Math.random() * Math.random() * Date.now() | 0).toString()
84 - + Math.abs(Math.random() * Math.random() * Date.now() | 0).toString();
85 - }
86 - this.sequenceNumber = (this.sequenceNumber + 1) | 0;
87 - rand.writeInt32BE(this.sequenceNumber, 11);
88 - if (crypto.randomBytes) {
89 - this.getRandomBytes(12).copy(rand);
90 - } else {
91 - // not secure for node 0.4
92 - [0, 4, 8].forEach(function(i) {
93 - rand.writeInt32BE(Math.random() * Math.pow(2, 32) | 0, i);
94 - });
95 - }
96 - return rand.toString('base64').replace(/\//g, '_').replace(/\+/g, '-');
97 -};
98 -
99 -/**
100 - * Export
101 - */
102 -
103 -exports = module.exports = new Base64Id();
1 -{
2 - "name": "base64id"
3 - , "version": "2.0.0"
4 - , "license": "MIT"
5 - , "description": "Generates a base64 id"
6 - , "author": "Kristian Faeldt <faeldt_kristian@cyberagent.co.jp>"
7 - , "repository": {
8 - "type": "git"
9 - , "url": "https://github.com/faeldt/base64id.git"
10 - }
11 - , "main": "./lib/base64id.js"
12 - , "engines": { "node": "^4.5.0 || >= 5.9" }
13 -}
This diff is collapsed. Click to expand it.
1 -(The MIT License)
2 -
3 -Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
4 -Copyright (c) 2014-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.
This diff is collapsed. Click to expand it.
1 -# Security Policies and Procedures
2 -
3 -## Reporting a Bug
4 -
5 -The Express team and community take all security bugs seriously. Thank you
6 -for improving the security of Express. We appreciate your efforts and
7 -responsible disclosure and will make every effort to acknowledge your
8 -contributions.
9 -
10 -Report security bugs by emailing the current owner(s) of `body-parser`. This
11 -information can be found in the npm registry using the command
12 -`npm owner ls body-parser`.
13 -If unsure or unable to get the information from the above, open an issue
14 -in the [project issue tracker](https://github.com/expressjs/body-parser/issues)
15 -asking for the current contact information.
16 -
17 -To ensure the timely response to your report, please ensure that the entirety
18 -of the report is contained within the email body and not solely behind a web
19 -link or an attachment.
20 -
21 -At least one owner will acknowledge your email within 48 hours, and will send a
22 -more detailed response within 48 hours indicating the next steps in handling
23 -your report. After the initial reply to your report, the owners will
24 -endeavor to keep you informed of the progress towards a fix and full
25 -announcement, and may ask for additional information or guidance.
1 -/*!
2 - * body-parser
3 - * Copyright(c) 2014-2015 Douglas Christopher Wilson
4 - * MIT Licensed
5 - */
6 -
7 -'use strict'
8 -
9 -/**
10 - * Module dependencies.
11 - * @private
12 - */
13 -
14 -var deprecate = require('depd')('body-parser')
15 -
16 -/**
17 - * Cache of loaded parsers.
18 - * @private
19 - */
20 -
21 -var parsers = Object.create(null)
22 -
23 -/**
24 - * @typedef Parsers
25 - * @type {function}
26 - * @property {function} json
27 - * @property {function} raw
28 - * @property {function} text
29 - * @property {function} urlencoded
30 - */
31 -
32 -/**
33 - * Module exports.
34 - * @type {Parsers}
35 - */
36 -
37 -exports = module.exports = deprecate.function(bodyParser,
38 - 'bodyParser: use individual json/urlencoded middlewares')
39 -
40 -/**
41 - * JSON parser.
42 - * @public
43 - */
44 -
45 -Object.defineProperty(exports, 'json', {
46 - configurable: true,
47 - enumerable: true,
48 - get: createParserGetter('json')
49 -})
50 -
51 -/**
52 - * Raw parser.
53 - * @public
54 - */
55 -
56 -Object.defineProperty(exports, 'raw', {
57 - configurable: true,
58 - enumerable: true,
59 - get: createParserGetter('raw')
60 -})
61 -
62 -/**
63 - * Text parser.
64 - * @public
65 - */
66 -
67 -Object.defineProperty(exports, 'text', {
68 - configurable: true,
69 - enumerable: true,
70 - get: createParserGetter('text')
71 -})
72 -
73 -/**
74 - * URL-encoded parser.
75 - * @public
76 - */
77 -
78 -Object.defineProperty(exports, 'urlencoded', {
79 - configurable: true,
80 - enumerable: true,
81 - get: createParserGetter('urlencoded')
82 -})
83 -
84 -/**
85 - * Create a middleware to parse json and urlencoded bodies.
86 - *
87 - * @param {object} [options]
88 - * @return {function}
89 - * @deprecated
90 - * @public
91 - */
92 -
93 -function bodyParser (options) {
94 - var opts = {}
95 -
96 - // exclude type option
97 - if (options) {
98 - for (var prop in options) {
99 - if (prop !== 'type') {
100 - opts[prop] = options[prop]
101 - }
102 - }
103 - }
104 -
105 - var _urlencoded = exports.urlencoded(opts)
106 - var _json = exports.json(opts)
107 -
108 - return function bodyParser (req, res, next) {
109 - _json(req, res, function (err) {
110 - if (err) return next(err)
111 - _urlencoded(req, res, next)
112 - })
113 - }
114 -}
115 -
116 -/**
117 - * Create a getter for loading a parser.
118 - * @private
119 - */
120 -
121 -function createParserGetter (name) {
122 - return function get () {
123 - return loadParser(name)
124 - }
125 -}
126 -
127 -/**
128 - * Load a parser module.
129 - * @private
130 - */
131 -
132 -function loadParser (parserName) {
133 - var parser = parsers[parserName]
134 -
135 - if (parser !== undefined) {
136 - return parser
137 - }
138 -
139 - // this uses a switch for static require analysis
140 - switch (parserName) {
141 - case 'json':
142 - parser = require('./lib/types/json')
143 - break
144 - case 'raw':
145 - parser = require('./lib/types/raw')
146 - break
147 - case 'text':
148 - parser = require('./lib/types/text')
149 - break
150 - case 'urlencoded':
151 - parser = require('./lib/types/urlencoded')
152 - break
153 - }
154 -
155 - // store to prevent invoking require()
156 - return (parsers[parserName] = parser)
157 -}
1 -/*!
2 - * body-parser
3 - * Copyright(c) 2014-2015 Douglas Christopher Wilson
4 - * MIT Licensed
5 - */
6 -
7 -'use strict'
8 -
9 -/**
10 - * Module dependencies.
11 - * @private
12 - */
13 -
14 -var createError = require('http-errors')
15 -var destroy = require('destroy')
16 -var getBody = require('raw-body')
17 -var iconv = require('iconv-lite')
18 -var onFinished = require('on-finished')
19 -var unpipe = require('unpipe')
20 -var zlib = require('zlib')
21 -
22 -/**
23 - * Module exports.
24 - */
25 -
26 -module.exports = read
27 -
28 -/**
29 - * Read a request into a buffer and parse.
30 - *
31 - * @param {object} req
32 - * @param {object} res
33 - * @param {function} next
34 - * @param {function} parse
35 - * @param {function} debug
36 - * @param {object} options
37 - * @private
38 - */
39 -
40 -function read (req, res, next, parse, debug, options) {
41 - var length
42 - var opts = options
43 - var stream
44 -
45 - // flag as parsed
46 - req._body = true
47 -
48 - // read options
49 - var encoding = opts.encoding !== null
50 - ? opts.encoding
51 - : null
52 - var verify = opts.verify
53 -
54 - try {
55 - // get the content stream
56 - stream = contentstream(req, debug, opts.inflate)
57 - length = stream.length
58 - stream.length = undefined
59 - } catch (err) {
60 - return next(err)
61 - }
62 -
63 - // set raw-body options
64 - opts.length = length
65 - opts.encoding = verify
66 - ? null
67 - : encoding
68 -
69 - // assert charset is supported
70 - if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
71 - return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
72 - charset: encoding.toLowerCase(),
73 - type: 'charset.unsupported'
74 - }))
75 - }
76 -
77 - // read body
78 - debug('read body')
79 - getBody(stream, opts, function (error, body) {
80 - if (error) {
81 - var _error
82 -
83 - if (error.type === 'encoding.unsupported') {
84 - // echo back charset
85 - _error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
86 - charset: encoding.toLowerCase(),
87 - type: 'charset.unsupported'
88 - })
89 - } else {
90 - // set status code on error
91 - _error = createError(400, error)
92 - }
93 -
94 - // unpipe from stream and destroy
95 - if (stream !== req) {
96 - unpipe(req)
97 - destroy(stream, true)
98 - }
99 -
100 - // read off entire request
101 - dump(req, function onfinished () {
102 - next(createError(400, _error))
103 - })
104 - return
105 - }
106 -
107 - // verify
108 - if (verify) {
109 - try {
110 - debug('verify body')
111 - verify(req, res, body, encoding)
112 - } catch (err) {
113 - next(createError(403, err, {
114 - body: body,
115 - type: err.type || 'entity.verify.failed'
116 - }))
117 - return
118 - }
119 - }
120 -
121 - // parse
122 - var str = body
123 - try {
124 - debug('parse body')
125 - str = typeof body !== 'string' && encoding !== null
126 - ? iconv.decode(body, encoding)
127 - : body
128 - req.body = parse(str)
129 - } catch (err) {
130 - next(createError(400, err, {
131 - body: str,
132 - type: err.type || 'entity.parse.failed'
133 - }))
134 - return
135 - }
136 -
137 - next()
138 - })
139 -}
140 -
141 -/**
142 - * Get the content stream of the request.
143 - *
144 - * @param {object} req
145 - * @param {function} debug
146 - * @param {boolean} [inflate=true]
147 - * @return {object}
148 - * @api private
149 - */
150 -
151 -function contentstream (req, debug, inflate) {
152 - var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
153 - var length = req.headers['content-length']
154 - var stream
155 -
156 - debug('content-encoding "%s"', encoding)
157 -
158 - if (inflate === false && encoding !== 'identity') {
159 - throw createError(415, 'content encoding unsupported', {
160 - encoding: encoding,
161 - type: 'encoding.unsupported'
162 - })
163 - }
164 -
165 - switch (encoding) {
166 - case 'deflate':
167 - stream = zlib.createInflate()
168 - debug('inflate body')
169 - req.pipe(stream)
170 - break
171 - case 'gzip':
172 - stream = zlib.createGunzip()
173 - debug('gunzip body')
174 - req.pipe(stream)
175 - break
176 - case 'identity':
177 - stream = req
178 - stream.length = length
179 - break
180 - default:
181 - throw createError(415, 'unsupported content encoding "' + encoding + '"', {
182 - encoding: encoding,
183 - type: 'encoding.unsupported'
184 - })
185 - }
186 -
187 - return stream
188 -}
189 -
190 -/**
191 - * Dump the contents of a request.
192 - *
193 - * @param {object} req
194 - * @param {function} callback
195 - * @api private
196 - */
197 -
198 -function dump (req, callback) {
199 - if (onFinished.isFinished(req)) {
200 - callback(null)
201 - } else {
202 - onFinished(req, callback)
203 - req.resume()
204 - }
205 -}
1 -/*!
2 - * body-parser
3 - * Copyright(c) 2014 Jonathan Ong
4 - * Copyright(c) 2014-2015 Douglas Christopher Wilson
5 - * MIT Licensed
6 - */
7 -
8 -'use strict'
9 -
10 -/**
11 - * Module dependencies.
12 - * @private
13 - */
14 -
15 -var bytes = require('bytes')
16 -var contentType = require('content-type')
17 -var createError = require('http-errors')
18 -var debug = require('debug')('body-parser:json')
19 -var read = require('../read')
20 -var typeis = require('type-is')
21 -
22 -/**
23 - * Module exports.
24 - */
25 -
26 -module.exports = json
27 -
28 -/**
29 - * RegExp to match the first non-space in a string.
30 - *
31 - * Allowed whitespace is defined in RFC 7159:
32 - *
33 - * ws = *(
34 - * %x20 / ; Space
35 - * %x09 / ; Horizontal tab
36 - * %x0A / ; Line feed or New line
37 - * %x0D ) ; Carriage return
38 - */
39 -
40 -var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
41 -
42 -/**
43 - * Create a middleware to parse JSON bodies.
44 - *
45 - * @param {object} [options]
46 - * @return {function}
47 - * @public
48 - */
49 -
50 -function json (options) {
51 - var opts = options || {}
52 -
53 - var limit = typeof opts.limit !== 'number'
54 - ? bytes.parse(opts.limit || '100kb')
55 - : opts.limit
56 - var inflate = opts.inflate !== false
57 - var reviver = opts.reviver
58 - var strict = opts.strict !== false
59 - var type = opts.type || 'application/json'
60 - var verify = opts.verify || false
61 -
62 - if (verify !== false && typeof verify !== 'function') {
63 - throw new TypeError('option verify must be function')
64 - }
65 -
66 - // create the appropriate type checking function
67 - var shouldParse = typeof type !== 'function'
68 - ? typeChecker(type)
69 - : type
70 -
71 - function parse (body) {
72 - if (body.length === 0) {
73 - // special-case empty json body, as it's a common client-side mistake
74 - // TODO: maybe make this configurable or part of "strict" option
75 - return {}
76 - }
77 -
78 - if (strict) {
79 - var first = firstchar(body)
80 -
81 - if (first !== '{' && first !== '[') {
82 - debug('strict violation')
83 - throw createStrictSyntaxError(body, first)
84 - }
85 - }
86 -
87 - try {
88 - debug('parse json')
89 - return JSON.parse(body, reviver)
90 - } catch (e) {
91 - throw normalizeJsonSyntaxError(e, {
92 - message: e.message,
93 - stack: e.stack
94 - })
95 - }
96 - }
97 -
98 - return function jsonParser (req, res, next) {
99 - if (req._body) {
100 - debug('body already parsed')
101 - next()
102 - return
103 - }
104 -
105 - req.body = req.body || {}
106 -
107 - // skip requests without bodies
108 - if (!typeis.hasBody(req)) {
109 - debug('skip empty body')
110 - next()
111 - return
112 - }
113 -
114 - debug('content-type %j', req.headers['content-type'])
115 -
116 - // determine if request should be parsed
117 - if (!shouldParse(req)) {
118 - debug('skip parsing')
119 - next()
120 - return
121 - }
122 -
123 - // assert charset per RFC 7159 sec 8.1
124 - var charset = getCharset(req) || 'utf-8'
125 - if (charset.slice(0, 4) !== 'utf-') {
126 - debug('invalid charset')
127 - next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
128 - charset: charset,
129 - type: 'charset.unsupported'
130 - }))
131 - return
132 - }
133 -
134 - // read
135 - read(req, res, next, parse, debug, {
136 - encoding: charset,
137 - inflate: inflate,
138 - limit: limit,
139 - verify: verify
140 - })
141 - }
142 -}
143 -
144 -/**
145 - * Create strict violation syntax error matching native error.
146 - *
147 - * @param {string} str
148 - * @param {string} char
149 - * @return {Error}
150 - * @private
151 - */
152 -
153 -function createStrictSyntaxError (str, char) {
154 - var index = str.indexOf(char)
155 - var partial = index !== -1
156 - ? str.substring(0, index) + '#'
157 - : ''
158 -
159 - try {
160 - JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
161 - } catch (e) {
162 - return normalizeJsonSyntaxError(e, {
163 - message: e.message.replace('#', char),
164 - stack: e.stack
165 - })
166 - }
167 -}
168 -
169 -/**
170 - * Get the first non-whitespace character in a string.
171 - *
172 - * @param {string} str
173 - * @return {function}
174 - * @private
175 - */
176 -
177 -function firstchar (str) {
178 - var match = FIRST_CHAR_REGEXP.exec(str)
179 -
180 - return match
181 - ? match[1]
182 - : undefined
183 -}
184 -
185 -/**
186 - * Get the charset of a request.
187 - *
188 - * @param {object} req
189 - * @api private
190 - */
191 -
192 -function getCharset (req) {
193 - try {
194 - return (contentType.parse(req).parameters.charset || '').toLowerCase()
195 - } catch (e) {
196 - return undefined
197 - }
198 -}
199 -
200 -/**
201 - * Normalize a SyntaxError for JSON.parse.
202 - *
203 - * @param {SyntaxError} error
204 - * @param {object} obj
205 - * @return {SyntaxError}
206 - */
207 -
208 -function normalizeJsonSyntaxError (error, obj) {
209 - var keys = Object.getOwnPropertyNames(error)
210 -
211 - for (var i = 0; i < keys.length; i++) {
212 - var key = keys[i]
213 - if (key !== 'stack' && key !== 'message') {
214 - delete error[key]
215 - }
216 - }
217 -
218 - // replace stack before message for Node.js 0.10 and below
219 - error.stack = obj.stack.replace(error.message, obj.message)
220 - error.message = obj.message
221 -
222 - return error
223 -}
224 -
225 -/**
226 - * Get the simple type checker.
227 - *
228 - * @param {string} type
229 - * @return {function}
230 - */
231 -
232 -function typeChecker (type) {
233 - return function checkType (req) {
234 - return Boolean(typeis(req, type))
235 - }
236 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff 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 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 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 could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
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 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.