unknown

chatRoute

Showing 273 changed files with 4764 additions and 7 deletions
1 -var express = require('express') 1 +// 설치한 express 모듈 불러오기
2 -var app = express() 2 +const express = require('express')
3 +
4 +// 설치한 socket.io 모듈 불러오기
5 +const socket = require('socket.io')
6 +
7 +// Node.js 기본 내장 모듈 불러오기
8 +const http = require('http')
9 +const fs = require('fs')
10 +
11 +// express 객체 생성
12 +const app = express()
13 +
14 +// express http 서버 생성
15 +const server = http.createServer(app)
16 +
17 +// 생성된 서버를 socket.io에 바인딩
18 +const io = socket(server)
19 +
3 var bodyParser = require('body-parser') 20 var bodyParser = require('body-parser')
4 var router = require('./router/index') 21 var router = require('./router/index')
5 var passport = require('passport') 22 var passport = require('passport')
...@@ -17,6 +34,7 @@ app.use("/views", express.static(__dirname + "/views")) ...@@ -17,6 +34,7 @@ app.use("/views", express.static(__dirname + "/views"))
17 app.use("/css", express.static(__dirname + "/css")); 34 app.use("/css", express.static(__dirname + "/css"));
18 app.use("/assets", express.static(__dirname + "/assets")); 35 app.use("/assets", express.static(__dirname + "/assets"));
19 app.use("/js", express.static(__dirname + "/js")); 36 app.use("/js", express.static(__dirname + "/js"));
37 +app.use("/chat", express.static(__dirname+ "/chat"));
20 app.set('view engine', 'ejs') 38 app.set('view engine', 'ejs')
21 39
22 app.use(session({ 40 app.use(session({
...@@ -30,6 +48,40 @@ app.use(passport.session()) ...@@ -30,6 +48,40 @@ app.use(passport.session())
30 app.use(flash()) 48 app.use(flash())
31 app.use(router) // router 정의 49 app.use(router) // router 정의
32 50
33 -app.listen(PORT, function(){ 51 +// Socket.io
52 +io.sockets.on('connection', function(socket) {
53 +
54 + /* 새로운 유저가 접속했을 경우 다른 소켓에게도 알려줌 */
55 + socket.on('newUser', function(name) {
56 + console.log(name + ' 님이 접속하였습니다.')
57 +
58 + /* 소켓에 이름 저장해두기 */
59 + socket.name = name
60 +
61 + /* 모든 소켓에게 전송 */
62 + io.sockets.emit('update', {type: 'connect', name: 'SERVER', message: name + '님이 접속하였습니다.'})
63 + })
64 +
65 + /* 전송한 메시지 받기 */
66 + socket.on('message', function(data) {
67 + /* 받은 데이터에 누가 보냈는지 이름을 추가 */
68 + data.name = socket.name
69 +
70 + console.log(data)
71 +
72 + /* 보낸 사람을 제외한 나머지 유저에게 메시지 전송 */
73 + socket.broadcast.emit('update', data);
74 + })
75 +
76 + /* 접속 종료 */
77 + socket.on('disconnect', function() {
78 + console.log(socket.name + '님이 나가셨습니다.')
79 +
80 + /* 나가는 사람을 제외한 나머지 유저에게 메시지 전송 */
81 + socket.broadcast.emit('update', {type: 'disconnect', name: 'SERVER', message: socket.name + '님이 나가셨습니다.'});
82 + })
83 +})
84 +
85 +server.listen(PORT, function(){
34 console.log("서버를 구동합니다.(Port: "+PORT+")"); 86 console.log("서버를 구동합니다.(Port: "+PORT+")");
35 }); 87 });
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -6,10 +6,10 @@ module.exports=function(){ ...@@ -6,10 +6,10 @@ module.exports=function(){
6 init: function(){ 6 init: function(){
7 return mysql.createConnection({ 7 return mysql.createConnection({
8 host:'localhost', 8 host:'localhost',
9 - port:'3306', 9 + port:3306,
10 user:'root', 10 user:'root',
11 password:'', 11 password:'',
12 - database:'singer_composer' 12 + database:'userdb'
13 // host:config.host, 13 // host:config.host,
14 // port:config.port, 14 // port:config.port,
15 // user:config.user, 15 // user:config.user,
......
...@@ -2,10 +2,10 @@ module.exports=(function(){ ...@@ -2,10 +2,10 @@ module.exports=(function(){
2 return{ 2 return{
3 board:{ 3 board:{
4 host:'localhost', 4 host:'localhost',
5 - port:'3306', 5 + port:3306,
6 user:'root', 6 user:'root',
7 password:'', 7 password:'',
8 - database:'singer_composer' 8 + database:'userdb'
9 }, 9 },
10 example: { 10 example: {
11 host: '', 11 host: '',
......
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 + "_from": "@types/component-emitter@^1.2.10",
3 + "_id": "@types/component-emitter@1.2.11",
4 + "_inBundle": false,
5 + "_integrity": "sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ==",
6 + "_location": "/@types/component-emitter",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@types/component-emitter@^1.2.10",
12 + "name": "@types/component-emitter",
13 + "escapedName": "@types%2fcomponent-emitter",
14 + "scope": "@types",
15 + "rawSpec": "^1.2.10",
16 + "saveSpec": null,
17 + "fetchSpec": "^1.2.10"
18 + },
19 + "_requiredBy": [
20 + "/socket.io-parser"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
23 + "_shasum": "50d47d42b347253817a39709fef03ce66a108506",
24 + "_spec": "@types/component-emitter@^1.2.10",
25 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\socket.io-parser",
26 + "bugs": {
27 + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
28 + },
29 + "bundleDependencies": false,
30 + "contributors": [
31 + {
32 + "name": "Peter Snider",
33 + "url": "https://github.com/psnider"
34 + }
35 + ],
36 + "dependencies": {},
37 + "deprecated": false,
38 + "description": "TypeScript definitions for component-emitter",
39 + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/component-emitter",
40 + "license": "MIT",
41 + "main": "",
42 + "name": "@types/component-emitter",
43 + "repository": {
44 + "type": "git",
45 + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
46 + "directory": "types/component-emitter"
47 + },
48 + "scripts": {},
49 + "typeScriptVersion": "3.7",
50 + "types": "index.d.ts",
51 + "typesPublisherContentHash": "d86d217b63101effae1228ebbfe02ac682ee4eb8abd6fc0dcc9948a4b6fdf572",
52 + "version": "1.2.11"
53 +}
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 + "_from": "@types/cookie@^0.4.1",
3 + "_id": "@types/cookie@0.4.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
6 + "_location": "/@types/cookie",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@types/cookie@^0.4.1",
12 + "name": "@types/cookie",
13 + "escapedName": "@types%2fcookie",
14 + "scope": "@types",
15 + "rawSpec": "^0.4.1",
16 + "saveSpec": null,
17 + "fetchSpec": "^0.4.1"
18 + },
19 + "_requiredBy": [
20 + "/engine.io"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
23 + "_shasum": "bfd02c1f2224567676c1545199f87c3a861d878d",
24 + "_spec": "@types/cookie@^0.4.1",
25 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\engine.io",
26 + "bugs": {
27 + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
28 + },
29 + "bundleDependencies": false,
30 + "contributors": [
31 + {
32 + "name": "Pine Mizune",
33 + "url": "https://github.com/pine"
34 + },
35 + {
36 + "name": "Piotr Błażejewicz",
37 + "url": "https://github.com/peterblazejewicz"
38 + }
39 + ],
40 + "dependencies": {},
41 + "deprecated": false,
42 + "description": "TypeScript definitions for cookie",
43 + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie",
44 + "license": "MIT",
45 + "main": "",
46 + "name": "@types/cookie",
47 + "repository": {
48 + "type": "git",
49 + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
50 + "directory": "types/cookie"
51 + },
52 + "scripts": {},
53 + "typeScriptVersion": "3.6",
54 + "types": "index.d.ts",
55 + "typesPublisherContentHash": "7d4a6dd505c896319459ae131b5fa8fc0a2ed25552db53dac87946119bb21559",
56 + "version": "0.4.1"
57 +}
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 + "_from": "@types/cors@^2.8.12",
3 + "_id": "@types/cors@2.8.12",
4 + "_inBundle": false,
5 + "_integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==",
6 + "_location": "/@types/cors",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@types/cors@^2.8.12",
12 + "name": "@types/cors",
13 + "escapedName": "@types%2fcors",
14 + "scope": "@types",
15 + "rawSpec": "^2.8.12",
16 + "saveSpec": null,
17 + "fetchSpec": "^2.8.12"
18 + },
19 + "_requiredBy": [
20 + "/engine.io"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz",
23 + "_shasum": "6b2c510a7ad7039e98e7b8d3d6598f4359e5c080",
24 + "_spec": "@types/cors@^2.8.12",
25 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\engine.io",
26 + "bugs": {
27 + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
28 + },
29 + "bundleDependencies": false,
30 + "contributors": [
31 + {
32 + "name": "Alan Plum",
33 + "url": "https://github.com/pluma"
34 + },
35 + {
36 + "name": "Gaurav Sharma",
37 + "url": "https://github.com/gtpan77"
38 + }
39 + ],
40 + "dependencies": {},
41 + "deprecated": false,
42 + "description": "TypeScript definitions for cors",
43 + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors",
44 + "license": "MIT",
45 + "main": "",
46 + "name": "@types/cors",
47 + "repository": {
48 + "type": "git",
49 + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
50 + "directory": "types/cors"
51 + },
52 + "scripts": {},
53 + "typeScriptVersion": "3.6",
54 + "types": "index.d.ts",
55 + "typesPublisherContentHash": "53ea51a6543d58d3c1b9035a9c361d8f06d7be01973be2895820b2fb7ad9563a",
56 + "version": "2.8.12"
57 +}
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: Mon, 08 Nov 2021 21:31:28 GMT
12 + * Dependencies: none
13 + * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
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), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), and [wafuwafu13](https://github.com/wafuwafu13).
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/v16.9.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 = (name: string, message: unknown) => 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 + * Register a message handler to subscribe to this channel. This message handler
94 + * will be run synchronously whenever a message is published to the channel. Any
95 + * errors thrown in the message handler will trigger an `'uncaughtException'`.
96 + *
97 + * ```js
98 + * import diagnostics_channel from 'diagnostics_channel';
99 + *
100 + * const channel = diagnostics_channel.channel('my-channel');
101 + *
102 + * channel.subscribe((message, name) => {
103 + * // Received data
104 + * });
105 + * ```
106 + * @since v15.1.0, v14.17.0
107 + * @param onMessage The handler to receive channel messages
108 + */
109 + subscribe(onMessage: ChannelListener): void;
110 + /**
111 + * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
112 + *
113 + * ```js
114 + * import diagnostics_channel from 'diagnostics_channel';
115 + *
116 + * const channel = diagnostics_channel.channel('my-channel');
117 + *
118 + * function onMessage(message, name) {
119 + * // Received data
120 + * }
121 + *
122 + * channel.subscribe(onMessage);
123 + *
124 + * channel.unsubscribe(onMessage);
125 + * ```
126 + * @since v15.1.0, v14.17.0
127 + * @param onMessage The previous subscribed handler to remove
128 + */
129 + unsubscribe(onMessage: ChannelListener): void;
130 + }
131 +}
132 +declare module 'node:diagnostics_channel' {
133 + export * from 'diagnostics_channel';
134 +}
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/v16.9.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 +* *
105 +* GLOBAL INTERFACES *
106 +* *
107 +*-----------------------------------------------*/
108 +declare namespace NodeJS {
109 + interface CallSite {
110 + /**
111 + * Value of "this"
112 + */
113 + getThis(): unknown;
114 +
115 + /**
116 + * Type of "this" as a string.
117 + * This is the name of the function stored in the constructor field of
118 + * "this", if available. Otherwise the object's [[Class]] internal
119 + * property.
120 + */
121 + getTypeName(): string | null;
122 +
123 + /**
124 + * Current function
125 + */
126 + getFunction(): Function | undefined;
127 +
128 + /**
129 + * Name of the current function, typically its name property.
130 + * If a name property is not available an attempt will be made to try
131 + * to infer a name from the function's context.
132 + */
133 + getFunctionName(): string | null;
134 +
135 + /**
136 + * Name of the property [of "this" or one of its prototypes] that holds
137 + * the current function
138 + */
139 + getMethodName(): string | null;
140 +
141 + /**
142 + * Name of the script [if this function was defined in a script]
143 + */
144 + getFileName(): string | null;
145 +
146 + /**
147 + * Current line number [if this function was defined in a script]
148 + */
149 + getLineNumber(): number | null;
150 +
151 + /**
152 + * Current column number [if this function was defined in a script]
153 + */
154 + getColumnNumber(): number | null;
155 +
156 + /**
157 + * A call site object representing the location where eval was called
158 + * [if this function was created using a call to eval]
159 + */
160 + getEvalOrigin(): string | undefined;
161 +
162 + /**
163 + * Is this a toplevel invocation, that is, is "this" the global object?
164 + */
165 + isToplevel(): boolean;
166 +
167 + /**
168 + * Does this call take place in code defined by a call to eval?
169 + */
170 + isEval(): boolean;
171 +
172 + /**
173 + * Is this call in native V8 code?
174 + */
175 + isNative(): boolean;
176 +
177 + /**
178 + * Is this a constructor call?
179 + */
180 + isConstructor(): boolean;
181 + }
182 +
183 + interface ErrnoException extends Error {
184 + errno?: number | undefined;
185 + code?: string | undefined;
186 + path?: string | undefined;
187 + syscall?: string | undefined;
188 + }
189 +
190 + interface ReadableStream extends EventEmitter {
191 + readable: boolean;
192 + read(size?: number): string | Buffer;
193 + setEncoding(encoding: BufferEncoding): this;
194 + pause(): this;
195 + resume(): this;
196 + isPaused(): boolean;
197 + pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
198 + unpipe(destination?: WritableStream): this;
199 + unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
200 + wrap(oldStream: ReadableStream): this;
201 + [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
202 + }
203 +
204 + interface WritableStream extends EventEmitter {
205 + writable: boolean;
206 + write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
207 + write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
208 + end(cb?: () => void): void;
209 + end(data: string | Uint8Array, cb?: () => void): void;
210 + end(str: string, encoding?: BufferEncoding, cb?: () => void): void;
211 + }
212 +
213 + interface ReadWriteStream extends ReadableStream, WritableStream { }
214 +
215 + interface RefCounted {
216 + ref(): this;
217 + unref(): this;
218 + }
219 +
220 + type TypedArray =
221 + | Uint8Array
222 + | Uint8ClampedArray
223 + | Uint16Array
224 + | Uint32Array
225 + | Int8Array
226 + | Int16Array
227 + | Int32Array
228 + | BigUint64Array
229 + | BigInt64Array
230 + | Float32Array
231 + | Float64Array;
232 + type ArrayBufferView = TypedArray | DataView;
233 +
234 + interface Require {
235 + (id: string): any;
236 + resolve: RequireResolve;
237 + cache: Dict<NodeModule>;
238 + /**
239 + * @deprecated
240 + */
241 + extensions: RequireExtensions;
242 + main: Module | undefined;
243 + }
244 +
245 + interface RequireResolve {
246 + (id: string, options?: { paths?: string[] | undefined; }): string;
247 + paths(request: string): string[] | null;
248 + }
249 +
250 + interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
251 + '.js': (m: Module, filename: string) => any;
252 + '.json': (m: Module, filename: string) => any;
253 + '.node': (m: Module, filename: string) => any;
254 + }
255 + interface Module {
256 + /**
257 + * `true` if the module is running during the Node.js preload
258 + */
259 + isPreloading: boolean;
260 + exports: any;
261 + require: Require;
262 + id: string;
263 + filename: string;
264 + loaded: boolean;
265 + /** @deprecated since 14.6.0 Please use `require.main` and `module.children` instead. */
266 + parent: Module | null | undefined;
267 + children: Module[];
268 + /**
269 + * @since 11.14.0
270 + *
271 + * The directory name of the module. This is usually the same as the path.dirname() of the module.id.
272 + */
273 + path: string;
274 + paths: string[];
275 + }
276 +
277 + interface Dict<T> {
278 + [key: string]: T | undefined;
279 + }
280 +
281 + interface ReadOnlyDict<T> {
282 + readonly [key: string]: T | undefined;
283 + }
284 +}
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 16.11
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 +// Surasak Chaisurin <https://github.com/Ryan-Willpower>
37 +// Piotr Błażejewicz <https://github.com/peterblazejewicz>
38 +// Anna Henningsen <https://github.com/addaleax>
39 +// Victor Perin <https://github.com/victorperin>
40 +// Yongsheng Zhang <https://github.com/ZYSzys>
41 +// NodeJS Contributors <https://github.com/NodeJS>
42 +// Linus Unnebäck <https://github.com/LinusU>
43 +// wafuwafu13 <https://github.com/wafuwafu13>
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 + "_from": "@types/node@>=10.0.0",
3 + "_id": "@types/node@16.11.7",
4 + "_inBundle": false,
5 + "_integrity": "sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==",
6 + "_location": "/@types/node",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@types/node@>=10.0.0",
12 + "name": "@types/node",
13 + "escapedName": "@types%2fnode",
14 + "scope": "@types",
15 + "rawSpec": ">=10.0.0",
16 + "saveSpec": null,
17 + "fetchSpec": ">=10.0.0"
18 + },
19 + "_requiredBy": [
20 + "/engine.io"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.7.tgz",
23 + "_shasum": "36820945061326978c42a01e56b61cd223dfdc42",
24 + "_spec": "@types/node@>=10.0.0",
25 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\engine.io",
26 + "bugs": {
27 + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
28 + },
29 + "bundleDependencies": false,
30 + "contributors": [
31 + {
32 + "name": "Microsoft TypeScript",
33 + "url": "https://github.com/Microsoft"
34 + },
35 + {
36 + "name": "DefinitelyTyped",
37 + "url": "https://github.com/DefinitelyTyped"
38 + },
39 + {
40 + "name": "Alberto Schiabel",
41 + "url": "https://github.com/jkomyno"
42 + },
43 + {
44 + "name": "Alvis HT Tang",
45 + "url": "https://github.com/alvis"
46 + },
47 + {
48 + "name": "Andrew Makarov",
49 + "url": "https://github.com/r3nya"
50 + },
51 + {
52 + "name": "Benjamin Toueg",
53 + "url": "https://github.com/btoueg"
54 + },
55 + {
56 + "name": "Chigozirim C.",
57 + "url": "https://github.com/smac89"
58 + },
59 + {
60 + "name": "David Junger",
61 + "url": "https://github.com/touffy"
62 + },
63 + {
64 + "name": "Deividas Bakanas",
65 + "url": "https://github.com/DeividasBakanas"
66 + },
67 + {
68 + "name": "Eugene Y. Q. Shen",
69 + "url": "https://github.com/eyqs"
70 + },
71 + {
72 + "name": "Hannes Magnusson",
73 + "url": "https://github.com/Hannes-Magnusson-CK"
74 + },
75 + {
76 + "name": "Huw",
77 + "url": "https://github.com/hoo29"
78 + },
79 + {
80 + "name": "Kelvin Jin",
81 + "url": "https://github.com/kjin"
82 + },
83 + {
84 + "name": "Klaus Meinhardt",
85 + "url": "https://github.com/ajafff"
86 + },
87 + {
88 + "name": "Lishude",
89 + "url": "https://github.com/islishude"
90 + },
91 + {
92 + "name": "Mariusz Wiktorczyk",
93 + "url": "https://github.com/mwiktorczyk"
94 + },
95 + {
96 + "name": "Mohsen Azimi",
97 + "url": "https://github.com/mohsen1"
98 + },
99 + {
100 + "name": "Nicolas Even",
101 + "url": "https://github.com/n-e"
102 + },
103 + {
104 + "name": "Nikita Galkin",
105 + "url": "https://github.com/galkin"
106 + },
107 + {
108 + "name": "Parambir Singh",
109 + "url": "https://github.com/parambirs"
110 + },
111 + {
112 + "name": "Sebastian Silbermann",
113 + "url": "https://github.com/eps1lon"
114 + },
115 + {
116 + "name": "Simon Schick",
117 + "url": "https://github.com/SimonSchick"
118 + },
119 + {
120 + "name": "Thomas den Hollander",
121 + "url": "https://github.com/ThomasdenH"
122 + },
123 + {
124 + "name": "Wilco Bakker",
125 + "url": "https://github.com/WilcoBakker"
126 + },
127 + {
128 + "name": "wwwy3y3",
129 + "url": "https://github.com/wwwy3y3"
130 + },
131 + {
132 + "name": "Samuel Ainsworth",
133 + "url": "https://github.com/samuela"
134 + },
135 + {
136 + "name": "Kyle Uehlein",
137 + "url": "https://github.com/kuehlein"
138 + },
139 + {
140 + "name": "Thanik Bhongbhibhat",
141 + "url": "https://github.com/bhongy"
142 + },
143 + {
144 + "name": "Marcin Kopacz",
145 + "url": "https://github.com/chyzwar"
146 + },
147 + {
148 + "name": "Trivikram Kamat",
149 + "url": "https://github.com/trivikr"
150 + },
151 + {
152 + "name": "Junxiao Shi",
153 + "url": "https://github.com/yoursunny"
154 + },
155 + {
156 + "name": "Ilia Baryshnikov",
157 + "url": "https://github.com/qwelias"
158 + },
159 + {
160 + "name": "ExE Boss",
161 + "url": "https://github.com/ExE-Boss"
162 + },
163 + {
164 + "name": "Surasak Chaisurin",
165 + "url": "https://github.com/Ryan-Willpower"
166 + },
167 + {
168 + "name": "Piotr Błażejewicz",
169 + "url": "https://github.com/peterblazejewicz"
170 + },
171 + {
172 + "name": "Anna Henningsen",
173 + "url": "https://github.com/addaleax"
174 + },
175 + {
176 + "name": "Victor Perin",
177 + "url": "https://github.com/victorperin"
178 + },
179 + {
180 + "name": "Yongsheng Zhang",
181 + "url": "https://github.com/ZYSzys"
182 + },
183 + {
184 + "name": "NodeJS Contributors",
185 + "url": "https://github.com/NodeJS"
186 + },
187 + {
188 + "name": "Linus Unnebäck",
189 + "url": "https://github.com/LinusU"
190 + },
191 + {
192 + "name": "wafuwafu13",
193 + "url": "https://github.com/wafuwafu13"
194 + }
195 + ],
196 + "dependencies": {},
197 + "deprecated": false,
198 + "description": "TypeScript definitions for Node.js",
199 + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
200 + "license": "MIT",
201 + "main": "",
202 + "name": "@types/node",
203 + "repository": {
204 + "type": "git",
205 + "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
206 + "directory": "types/node"
207 + },
208 + "scripts": {},
209 + "typeScriptVersion": "3.7",
210 + "types": "index.d.ts",
211 + "typesPublisherContentHash": "f35526242fcaf9fa8ad50a3aadb0bb8c2e9aba5a332ca0523451167ec6a19f2e",
212 + "version": "16.11.7"
213 +}
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/v16.9.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 +}
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/v16.9.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/v16.9.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 +}
1 +declare module 'stream/web' {
2 + // stub module, pending copy&paste from .d.ts or manual impl
3 +}
4 +declare module 'node:stream/web' {
5 + export * from 'stream/web';
6 +}
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/v16.9.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/v16.9.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): 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): 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): 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/v16.9.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/v16.9.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/v16.9.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 +# Changelog
2 +
3 +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 +
5 +## [1.0.1](https://github.com/niklasvh/base64-arraybuffer/compare/v1.0.0...v1.0.1) (2021-08-10)
6 +
7 +
8 +### fix
9 +
10 +* make lib loadable on ie9 (#30) ([a618d14](https://github.com/niklasvh/base64-arraybuffer/commit/a618d14d323f4eb230321a3609bfbc9f23f430c0)), closes [#30](https://github.com/niklasvh/base64-arraybuffer/issues/30)
11 +
12 +
13 +
14 +# [1.0.0](https://github.com/niklasvh/base64-arraybuffer/compare/v0.2.0...v1.0.0) (2021-08-10)
15 +
16 +
17 +### docs
18 +
19 +* update readme (#29) ([0a0253d](https://github.com/niklasvh/base64-arraybuffer/commit/0a0253dcc2e3f01a1f6d04fa81d578f714fce27f)), closes [#29](https://github.com/niklasvh/base64-arraybuffer/issues/29)
1 +Copyright (c) 2012 Niklas von Hertzen
2 +
3 +Permission is hereby granted, free of charge, to any person
4 +obtaining a copy of this software and associated documentation
5 +files (the "Software"), to deal in the Software without
6 +restriction, including without limitation the rights to use,
7 +copy, modify, merge, publish, distribute, sublicense, and/or sell
8 +copies of the Software, and to permit persons to whom the
9 +Software is furnished to do so, subject to the following
10 +conditions:
11 +
12 +The above copyright notice and this permission notice shall be
13 +included in all copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 +OTHER DEALINGS IN THE SOFTWARE.
1 +# base64-arraybuffer
2 +
3 +![CI](https://github.com/niklasvh/base64-arraybuffer/workflows/CI/badge.svg?branch=master)
4 +[![NPM Downloads](https://img.shields.io/npm/dm/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer)
5 +[![NPM Version](https://img.shields.io/npm/v/base64-arraybuffer.svg)](https://www.npmjs.org/package/base64-arraybuffer)
6 +
7 +Encode/decode base64 data into ArrayBuffers
8 +
9 +### Installing
10 +You can install the module via npm:
11 +
12 + npm install base64-arraybuffer
13 +
14 +## API
15 +The library encodes and decodes base64 to and from ArrayBuffers
16 +
17 + - __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string
18 + - __decode(str)__ - Decodes base64 string to `ArrayBuffer`
19 +
20 +### Testing
21 +You can run the test suite with:
22 +
23 + npm test
24 +
25 +## License
26 +Copyright (c) 2012 Niklas von Hertzen
27 +Licensed under the MIT license.
1 +/*
2 + * base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
3 + * Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
4 + * Released under MIT License
5 + */
6 +var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
7 +// Use a lookup table to find the index.
8 +var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
9 +for (var i = 0; i < chars.length; i++) {
10 + lookup[chars.charCodeAt(i)] = i;
11 +}
12 +var encode = function (arraybuffer) {
13 + var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
14 + for (i = 0; i < len; i += 3) {
15 + base64 += chars[bytes[i] >> 2];
16 + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
17 + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
18 + base64 += chars[bytes[i + 2] & 63];
19 + }
20 + if (len % 3 === 2) {
21 + base64 = base64.substring(0, base64.length - 1) + '=';
22 + }
23 + else if (len % 3 === 1) {
24 + base64 = base64.substring(0, base64.length - 2) + '==';
25 + }
26 + return base64;
27 +};
28 +var decode = function (base64) {
29 + var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
30 + if (base64[base64.length - 1] === '=') {
31 + bufferLength--;
32 + if (base64[base64.length - 2] === '=') {
33 + bufferLength--;
34 + }
35 + }
36 + var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
37 + for (i = 0; i < len; i += 4) {
38 + encoded1 = lookup[base64.charCodeAt(i)];
39 + encoded2 = lookup[base64.charCodeAt(i + 1)];
40 + encoded3 = lookup[base64.charCodeAt(i + 2)];
41 + encoded4 = lookup[base64.charCodeAt(i + 3)];
42 + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
43 + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
44 + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
45 + }
46 + return arraybuffer;
47 +};
48 +
49 +export { decode, encode };
50 +//# sourceMappingURL=base64-arraybuffer.es5.js.map
1 +{"version":3,"file":"base64-arraybuffer.es5.js","sources":["../../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAAA,IAAM,KAAK,GAAG,kEAAkE,CAAC;AAEjF;AACA,IAAM,MAAM,GAAG,OAAO,UAAU,KAAK,WAAW,GAAG,EAAE,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACnC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACnC;IAEY,MAAM,GAAG,UAAC,WAAwB;IAC3C,IAAI,KAAK,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,EACnC,CAAC,EACD,GAAG,GAAG,KAAK,CAAC,MAAM,EAClB,MAAM,GAAG,EAAE,CAAC;IAEhB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;KACtC;IAED,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;QACf,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;KACzD;SAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;QACtB,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;KAC1D;IAED,OAAO,MAAM,CAAC;AAClB,EAAE;IAEW,MAAM,GAAG,UAAC,MAAc;IACjC,IAAI,YAAY,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,EACnC,GAAG,GAAG,MAAM,CAAC,MAAM,EACnB,CAAC,EACD,CAAC,GAAG,CAAC,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,CAAC;IAEb,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;QACnC,YAAY,EAAE,CAAC;QACf,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;YACnC,YAAY,EAAE,CAAC;SAClB;KACJ;IAED,IAAM,WAAW,GAAG,IAAI,WAAW,CAAC,YAAY,CAAC,EAC7C,KAAK,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAExC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;QACzB,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC5C,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC5C,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAE5C,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC;QAC/C,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,EAAE,KAAK,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC;QACtD,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,KAAK,CAAC,KAAK,QAAQ,GAAG,EAAE,CAAC,CAAC;KACxD;IAED,OAAO,WAAW,CAAC;AACvB;;;;"}
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
3 + * Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
4 + * Released under MIT License
5 + */
6 +(function (global, factory) {
7 + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
8 + typeof define === 'function' && define.amd ? define(['exports'], factory) :
9 + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['base64-arraybuffer'] = {}));
10 +}(this, (function (exports) { 'use strict';
11 +
12 + var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
13 + // Use a lookup table to find the index.
14 + var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
15 + for (var i = 0; i < chars.length; i++) {
16 + lookup[chars.charCodeAt(i)] = i;
17 + }
18 + var encode = function (arraybuffer) {
19 + var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
20 + for (i = 0; i < len; i += 3) {
21 + base64 += chars[bytes[i] >> 2];
22 + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
23 + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
24 + base64 += chars[bytes[i + 2] & 63];
25 + }
26 + if (len % 3 === 2) {
27 + base64 = base64.substring(0, base64.length - 1) + '=';
28 + }
29 + else if (len % 3 === 1) {
30 + base64 = base64.substring(0, base64.length - 2) + '==';
31 + }
32 + return base64;
33 + };
34 + var decode = function (base64) {
35 + var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
36 + if (base64[base64.length - 1] === '=') {
37 + bufferLength--;
38 + if (base64[base64.length - 2] === '=') {
39 + bufferLength--;
40 + }
41 + }
42 + var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
43 + for (i = 0; i < len; i += 4) {
44 + encoded1 = lookup[base64.charCodeAt(i)];
45 + encoded2 = lookup[base64.charCodeAt(i + 1)];
46 + encoded3 = lookup[base64.charCodeAt(i + 2)];
47 + encoded4 = lookup[base64.charCodeAt(i + 3)];
48 + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
49 + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
50 + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
51 + }
52 + return arraybuffer;
53 + };
54 +
55 + exports.decode = decode;
56 + exports.encode = encode;
57 +
58 + Object.defineProperty(exports, '__esModule', { value: true });
59 +
60 +})));
61 +//# sourceMappingURL=base64-arraybuffer.umd.js.map
1 +{"version":3,"file":"base64-arraybuffer.umd.js","sources":["../../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;IAAA,IAAM,KAAK,GAAG,kEAAkE,CAAC;IAEjF;IACA,IAAM,MAAM,GAAG,OAAO,UAAU,KAAK,WAAW,GAAG,EAAE,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;KACnC;QAEY,MAAM,GAAG,UAAC,WAAwB;QAC3C,IAAI,KAAK,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,EACnC,CAAC,EACD,GAAG,GAAG,KAAK,CAAC,MAAM,EAClB,MAAM,GAAG,EAAE,CAAC;QAEhB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC7D,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;SACtC;QAED,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;YACf,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;SACzD;aAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;YACtB,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;SAC1D;QAED,OAAO,MAAM,CAAC;IAClB,EAAE;QAEW,MAAM,GAAG,UAAC,MAAc;QACjC,IAAI,YAAY,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,EACnC,GAAG,GAAG,MAAM,CAAC,MAAM,EACnB,CAAC,EACD,CAAC,GAAG,CAAC,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,CAAC;QAEb,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;YACnC,YAAY,EAAE,CAAC;YACf,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;gBACnC,YAAY,EAAE,CAAC;aAClB;SACJ;QAED,IAAM,WAAW,GAAG,IAAI,WAAW,CAAC,YAAY,CAAC,EAC7C,KAAK,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;QAExC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;YACzB,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YACxC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC5C,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC5C,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAE5C,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC;YAC/C,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,EAAE,KAAK,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC;YACtD,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,KAAK,CAAC,KAAK,QAAQ,GAAG,EAAE,CAAC,CAAC;SACxD;QAED,OAAO,WAAW,CAAC;IACvB;;;;;;;;;;;"}
...\ No newline at end of file ...\ No newline at end of file
1 +"use strict";
2 +Object.defineProperty(exports, "__esModule", { value: true });
3 +exports.decode = exports.encode = void 0;
4 +var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
5 +// Use a lookup table to find the index.
6 +var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
7 +for (var i = 0; i < chars.length; i++) {
8 + lookup[chars.charCodeAt(i)] = i;
9 +}
10 +var encode = function (arraybuffer) {
11 + var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
12 + for (i = 0; i < len; i += 3) {
13 + base64 += chars[bytes[i] >> 2];
14 + base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
15 + base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
16 + base64 += chars[bytes[i + 2] & 63];
17 + }
18 + if (len % 3 === 2) {
19 + base64 = base64.substring(0, base64.length - 1) + '=';
20 + }
21 + else if (len % 3 === 1) {
22 + base64 = base64.substring(0, base64.length - 2) + '==';
23 + }
24 + return base64;
25 +};
26 +exports.encode = encode;
27 +var decode = function (base64) {
28 + var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
29 + if (base64[base64.length - 1] === '=') {
30 + bufferLength--;
31 + if (base64[base64.length - 2] === '=') {
32 + bufferLength--;
33 + }
34 + }
35 + var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
36 + for (i = 0; i < len; i += 4) {
37 + encoded1 = lookup[base64.charCodeAt(i)];
38 + encoded2 = lookup[base64.charCodeAt(i + 1)];
39 + encoded3 = lookup[base64.charCodeAt(i + 2)];
40 + encoded4 = lookup[base64.charCodeAt(i + 3)];
41 + bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
42 + bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
43 + bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
44 + }
45 + return arraybuffer;
46 +};
47 +exports.decode = decode;
48 +//# sourceMappingURL=index.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,IAAM,KAAK,GAAG,kEAAkE,CAAC;AAEjF,wCAAwC;AACxC,IAAM,MAAM,GAAG,OAAO,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACnC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACnC;AAEM,IAAM,MAAM,GAAG,UAAC,WAAwB;IAC3C,IAAI,KAAK,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,EACnC,CAAC,EACD,GAAG,GAAG,KAAK,CAAC,MAAM,EAClB,MAAM,GAAG,EAAE,CAAC;IAEhB,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;KACtC;IAED,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;QACf,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;KACzD;SAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE;QACtB,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;KAC1D;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AApBW,QAAA,MAAM,UAoBjB;AAEK,IAAM,MAAM,GAAG,UAAC,MAAc;IACjC,IAAI,YAAY,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,EACnC,GAAG,GAAG,MAAM,CAAC,MAAM,EACnB,CAAC,EACD,CAAC,GAAG,CAAC,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,CAAC;IAEb,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;QACnC,YAAY,EAAE,CAAC;QACf,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;YACnC,YAAY,EAAE,CAAC;SAClB;KACJ;IAED,IAAM,WAAW,GAAG,IAAI,WAAW,CAAC,YAAY,CAAC,EAC7C,KAAK,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAExC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;QACzB,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC5C,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC5C,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAE5C,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;QAC/C,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;QACtD,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;KACxD;IAED,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAhCW,QAAA,MAAM,UAgCjB"}
...\ No newline at end of file ...\ No newline at end of file
1 +export declare const encode: (arraybuffer: ArrayBuffer) => string;
2 +export declare const decode: (base64: string) => ArrayBuffer;
1 +{
2 + "_from": "base64-arraybuffer@~1.0.1",
3 + "_id": "base64-arraybuffer@1.0.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-vFIUq7FdLtjZMhATwDul5RZWv2jpXQ09Pd6jcVEOvIsqCWTRFD/ONHNfyOS8dA/Ippi5dsIgpyKWKZaAKZltbA==",
6 + "_location": "/base64-arraybuffer",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "base64-arraybuffer@~1.0.1",
12 + "name": "base64-arraybuffer",
13 + "escapedName": "base64-arraybuffer",
14 + "rawSpec": "~1.0.1",
15 + "saveSpec": null,
16 + "fetchSpec": "~1.0.1"
17 + },
18 + "_requiredBy": [
19 + "/engine.io-parser"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.1.tgz",
22 + "_shasum": "87bd13525626db4a9838e00a508c2b73efcf348c",
23 + "_spec": "base64-arraybuffer@~1.0.1",
24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\engine.io-parser",
25 + "author": {
26 + "name": "Niklas von Hertzen",
27 + "email": "niklasvh@gmail.com",
28 + "url": "https://hertzen.com"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/niklasvh/base64-arraybuffer/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "Encode/decode base64 data into ArrayBuffers",
36 + "devDependencies": {
37 + "@rollup/plugin-commonjs": "^19.0.0",
38 + "@rollup/plugin-node-resolve": "^13.0.0",
39 + "@rollup/plugin-typescript": "^8.2.1",
40 + "@types/mocha": "^8.2.2",
41 + "@types/node": "^16.0.0",
42 + "mocha": "9.0.2",
43 + "prettier": "^2.3.2",
44 + "rimraf": "3.0.2",
45 + "rollup": "^2.52.7",
46 + "rollup-plugin-json": "^4.0.0",
47 + "rollup-plugin-sourcemaps": "^0.6.3",
48 + "standard-version": "^9.3.0",
49 + "ts-node": "^10.0.0",
50 + "tslib": "^2.3.0",
51 + "tslint": "^6.1.3",
52 + "tslint-config-prettier": "^1.18.0",
53 + "typescript": "^4.3.5"
54 + },
55 + "engines": {
56 + "node": ">= 0.6.0"
57 + },
58 + "homepage": "https://github.com/niklasvh/base64-arraybuffer",
59 + "keywords": [],
60 + "license": "MIT",
61 + "main": "dist/base64-arraybuffer.umd.js",
62 + "module": "dist/base64-arraybuffer.es5.js",
63 + "name": "base64-arraybuffer",
64 + "repository": {
65 + "type": "git",
66 + "url": "git+https://github.com/niklasvh/base64-arraybuffer.git"
67 + },
68 + "scripts": {
69 + "build": "tsc --module commonjs && rollup -c rollup.config.ts",
70 + "format": "prettier --write \"{src,test}/**/*.ts\"",
71 + "lint": "tslint -c tslint.json --project tsconfig.json -t codeFrame src/**/*.ts test/**/*.ts",
72 + "mocha": "mocha --require ts-node/register test/*.ts",
73 + "prebuild": "rimraf dist/",
74 + "release": "standard-version",
75 + "test": "npm run lint && npm run mocha"
76 + },
77 + "typings": "dist/types/index.d.ts",
78 + "version": "1.0.1"
79 +}
1 +import resolve from '@rollup/plugin-node-resolve';
2 +import commonjs from '@rollup/plugin-commonjs';
3 +import sourceMaps from 'rollup-plugin-sourcemaps';
4 +import typescript from '@rollup/plugin-typescript';
5 +import json from 'rollup-plugin-json';
6 +
7 +const pkg = require('./package.json');
8 +
9 +const banner = `/*
10 + * ${pkg.name} ${pkg.version} <${pkg.homepage}>
11 + * Copyright (c) ${(new Date()).getFullYear()} ${pkg.author.name} <${pkg.author.url}>
12 + * Released under ${pkg.license} License
13 + */`;
14 +
15 +export default {
16 + input: `src/index.ts`,
17 + output: [
18 + { file: pkg.main, name: pkg.name, format: 'umd', banner, sourcemap: true },
19 + { file: pkg.module, format: 'esm', banner, sourcemap: true },
20 + ],
21 + external: [],
22 + watch: {
23 + include: 'src/**',
24 + },
25 + plugins: [
26 + // Allow node_modules resolution, so you can use 'external' to control
27 + // which external modules to include in the bundle
28 + // https://github.com/rollup/rollup-plugin-node-resolve#usage
29 + resolve(),
30 + // Allow json resolution
31 + json(),
32 + // Compile TypeScript files
33 + typescript(),
34 + // Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
35 + commonjs(),
36 +
37 + // Resolve source maps to the original source
38 + sourceMaps(),
39 + ],
40 +}
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 + "_from": "base64id@~2.0.0",
3 + "_id": "base64id@2.0.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
6 + "_location": "/base64id",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "base64id@~2.0.0",
12 + "name": "base64id",
13 + "escapedName": "base64id",
14 + "rawSpec": "~2.0.0",
15 + "saveSpec": null,
16 + "fetchSpec": "~2.0.0"
17 + },
18 + "_requiredBy": [
19 + "/engine.io",
20 + "/socket.io"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
23 + "_shasum": "2770ac6bc47d312af97a8bf9a634342e0cd25cb6",
24 + "_spec": "base64id@~2.0.0",
25 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\socket.io",
26 + "author": {
27 + "name": "Kristian Faeldt",
28 + "email": "faeldt_kristian@cyberagent.co.jp"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/faeldt/base64id/issues"
32 + },
33 + "bundleDependencies": false,
34 + "deprecated": false,
35 + "description": "Generates a base64 id",
36 + "engines": {
37 + "node": "^4.5.0 || >= 5.9"
38 + },
39 + "homepage": "https://github.com/faeldt/base64id#readme",
40 + "license": "MIT",
41 + "main": "./lib/base64id.js",
42 + "name": "base64id",
43 + "repository": {
44 + "type": "git",
45 + "url": "git+https://github.com/faeldt/base64id.git"
46 + },
47 + "version": "2.0.0"
48 +}
1 +
2 +1.3.0 / 2018-04-15
3 +==================
4 +
5 + * removed bower support
6 + * expose emitter on `exports`
7 + * prevent de-optimization from using `arguments`
8 +
9 +1.2.1 / 2016-04-18
10 +==================
11 +
12 + * enable client side use
13 +
14 +1.2.0 / 2014-02-12
15 +==================
16 +
17 + * prefix events with `$` to support object prototype method names
18 +
19 +1.1.3 / 2014-06-20
20 +==================
21 +
22 + * republish for npm
23 + * add LICENSE file
24 +
25 +1.1.2 / 2014-02-10
26 +==================
27 +
28 + * package: rename to "component-emitter"
29 + * package: update "main" and "component" fields
30 + * Add license to Readme (same format as the other components)
31 + * created .npmignore
32 + * travis stuff
33 +
34 +1.1.1 / 2013-12-01
35 +==================
36 +
37 + * fix .once adding .on to the listener
38 + * docs: Emitter#off()
39 + * component: add `.repo` prop
40 +
41 +1.1.0 / 2013-10-20
42 +==================
43 +
44 + * add `.addEventListener()` and `.removeEventListener()` aliases
45 +
46 +1.0.1 / 2013-06-27
47 +==================
48 +
49 + * add support for legacy ie
50 +
51 +1.0.0 / 2013-02-26
52 +==================
53 +
54 + * add `.off()` support for removing all listeners
55 +
56 +0.0.6 / 2012-10-08
57 +==================
58 +
59 + * add `this._callbacks` initialization to prevent funky gotcha
60 +
61 +0.0.5 / 2012-09-07
62 +==================
63 +
64 + * fix `Emitter.call(this)` usage
65 +
66 +0.0.3 / 2012-07-11
67 +==================
68 +
69 + * add `.listeners()`
70 + * rename `.has()` to `.hasListeners()`
71 +
72 +0.0.2 / 2012-06-28
73 +==================
74 +
75 + * fix `.off()` with `.once()`-registered callbacks
1 +(The MIT License)
2 +
3 +Copyright (c) 2014 Component contributors <dev@component.io>
4 +
5 +Permission is hereby granted, free of charge, to any person
6 +obtaining a copy of this software and associated documentation
7 +files (the "Software"), to deal in the Software without
8 +restriction, including without limitation the rights to use,
9 +copy, modify, merge, publish, distribute, sublicense, and/or sell
10 +copies of the Software, and to permit persons to whom the
11 +Software is furnished to do so, subject to the following
12 +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
19 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 +OTHER DEALINGS IN THE SOFTWARE.
1 +# Emitter [![Build Status](https://travis-ci.org/component/emitter.png)](https://travis-ci.org/component/emitter)
2 +
3 + Event emitter component.
4 +
5 +## Installation
6 +
7 +```
8 +$ component install component/emitter
9 +```
10 +
11 +## API
12 +
13 +### Emitter(obj)
14 +
15 + The `Emitter` may also be used as a mixin. For example
16 + a "plain" object may become an emitter, or you may
17 + extend an existing prototype.
18 +
19 + As an `Emitter` instance:
20 +
21 +```js
22 +var Emitter = require('emitter');
23 +var emitter = new Emitter;
24 +emitter.emit('something');
25 +```
26 +
27 + As a mixin:
28 +
29 +```js
30 +var Emitter = require('emitter');
31 +var user = { name: 'tobi' };
32 +Emitter(user);
33 +
34 +user.emit('im a user');
35 +```
36 +
37 + As a prototype mixin:
38 +
39 +```js
40 +var Emitter = require('emitter');
41 +Emitter(User.prototype);
42 +```
43 +
44 +### Emitter#on(event, fn)
45 +
46 + Register an `event` handler `fn`.
47 +
48 +### Emitter#once(event, fn)
49 +
50 + Register a single-shot `event` handler `fn`,
51 + removed immediately after it is invoked the
52 + first time.
53 +
54 +### Emitter#off(event, fn)
55 +
56 + * Pass `event` and `fn` to remove a listener.
57 + * Pass `event` to remove all listeners on that event.
58 + * Pass nothing to remove all listeners on all events.
59 +
60 +### Emitter#emit(event, ...)
61 +
62 + Emit an `event` with variable option args.
63 +
64 +### Emitter#listeners(event)
65 +
66 + Return an array of callbacks, or an empty array.
67 +
68 +### Emitter#hasListeners(event)
69 +
70 + Check if this emitter has `event` handlers.
71 +
72 +## License
73 +
74 +MIT
1 +
2 +/**
3 + * Expose `Emitter`.
4 + */
5 +
6 +if (typeof module !== 'undefined') {
7 + module.exports = Emitter;
8 +}
9 +
10 +/**
11 + * Initialize a new `Emitter`.
12 + *
13 + * @api public
14 + */
15 +
16 +function Emitter(obj) {
17 + if (obj) return mixin(obj);
18 +};
19 +
20 +/**
21 + * Mixin the emitter properties.
22 + *
23 + * @param {Object} obj
24 + * @return {Object}
25 + * @api private
26 + */
27 +
28 +function mixin(obj) {
29 + for (var key in Emitter.prototype) {
30 + obj[key] = Emitter.prototype[key];
31 + }
32 + return obj;
33 +}
34 +
35 +/**
36 + * Listen on the given `event` with `fn`.
37 + *
38 + * @param {String} event
39 + * @param {Function} fn
40 + * @return {Emitter}
41 + * @api public
42 + */
43 +
44 +Emitter.prototype.on =
45 +Emitter.prototype.addEventListener = function(event, fn){
46 + this._callbacks = this._callbacks || {};
47 + (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
48 + .push(fn);
49 + return this;
50 +};
51 +
52 +/**
53 + * Adds an `event` listener that will be invoked a single
54 + * time then automatically removed.
55 + *
56 + * @param {String} event
57 + * @param {Function} fn
58 + * @return {Emitter}
59 + * @api public
60 + */
61 +
62 +Emitter.prototype.once = function(event, fn){
63 + function on() {
64 + this.off(event, on);
65 + fn.apply(this, arguments);
66 + }
67 +
68 + on.fn = fn;
69 + this.on(event, on);
70 + return this;
71 +};
72 +
73 +/**
74 + * Remove the given callback for `event` or all
75 + * registered callbacks.
76 + *
77 + * @param {String} event
78 + * @param {Function} fn
79 + * @return {Emitter}
80 + * @api public
81 + */
82 +
83 +Emitter.prototype.off =
84 +Emitter.prototype.removeListener =
85 +Emitter.prototype.removeAllListeners =
86 +Emitter.prototype.removeEventListener = function(event, fn){
87 + this._callbacks = this._callbacks || {};
88 +
89 + // all
90 + if (0 == arguments.length) {
91 + this._callbacks = {};
92 + return this;
93 + }
94 +
95 + // specific event
96 + var callbacks = this._callbacks['$' + event];
97 + if (!callbacks) return this;
98 +
99 + // remove all handlers
100 + if (1 == arguments.length) {
101 + delete this._callbacks['$' + event];
102 + return this;
103 + }
104 +
105 + // remove specific handler
106 + var cb;
107 + for (var i = 0; i < callbacks.length; i++) {
108 + cb = callbacks[i];
109 + if (cb === fn || cb.fn === fn) {
110 + callbacks.splice(i, 1);
111 + break;
112 + }
113 + }
114 +
115 + // Remove event specific arrays for event types that no
116 + // one is subscribed for to avoid memory leak.
117 + if (callbacks.length === 0) {
118 + delete this._callbacks['$' + event];
119 + }
120 +
121 + return this;
122 +};
123 +
124 +/**
125 + * Emit `event` with the given args.
126 + *
127 + * @param {String} event
128 + * @param {Mixed} ...
129 + * @return {Emitter}
130 + */
131 +
132 +Emitter.prototype.emit = function(event){
133 + this._callbacks = this._callbacks || {};
134 +
135 + var args = new Array(arguments.length - 1)
136 + , callbacks = this._callbacks['$' + event];
137 +
138 + for (var i = 1; i < arguments.length; i++) {
139 + args[i - 1] = arguments[i];
140 + }
141 +
142 + if (callbacks) {
143 + callbacks = callbacks.slice(0);
144 + for (var i = 0, len = callbacks.length; i < len; ++i) {
145 + callbacks[i].apply(this, args);
146 + }
147 + }
148 +
149 + return this;
150 +};
151 +
152 +/**
153 + * Return array of callbacks for `event`.
154 + *
155 + * @param {String} event
156 + * @return {Array}
157 + * @api public
158 + */
159 +
160 +Emitter.prototype.listeners = function(event){
161 + this._callbacks = this._callbacks || {};
162 + return this._callbacks['$' + event] || [];
163 +};
164 +
165 +/**
166 + * Check if this emitter has `event` handlers.
167 + *
168 + * @param {String} event
169 + * @return {Boolean}
170 + * @api public
171 + */
172 +
173 +Emitter.prototype.hasListeners = function(event){
174 + return !! this.listeners(event).length;
175 +};
1 +{
2 + "_from": "component-emitter@~1.3.0",
3 + "_id": "component-emitter@1.3.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==",
6 + "_location": "/component-emitter",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "component-emitter@~1.3.0",
12 + "name": "component-emitter",
13 + "escapedName": "component-emitter",
14 + "rawSpec": "~1.3.0",
15 + "saveSpec": null,
16 + "fetchSpec": "~1.3.0"
17 + },
18 + "_requiredBy": [
19 + "/socket.io-parser"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
22 + "_shasum": "16e4070fba8ae29b679f2215853ee181ab2eabc0",
23 + "_spec": "component-emitter@~1.3.0",
24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\socket.io-parser",
25 + "bugs": {
26 + "url": "https://github.com/component/emitter/issues"
27 + },
28 + "bundleDependencies": false,
29 + "component": {
30 + "scripts": {
31 + "emitter/index.js": "index.js"
32 + }
33 + },
34 + "deprecated": false,
35 + "description": "Event emitter",
36 + "devDependencies": {
37 + "mocha": "*",
38 + "should": "*"
39 + },
40 + "files": [
41 + "index.js",
42 + "LICENSE"
43 + ],
44 + "homepage": "https://github.com/component/emitter#readme",
45 + "license": "MIT",
46 + "main": "index.js",
47 + "name": "component-emitter",
48 + "repository": {
49 + "type": "git",
50 + "url": "git+https://github.com/component/emitter.git"
51 + },
52 + "scripts": {
53 + "test": "make test"
54 + },
55 + "version": "1.3.0"
56 +}
1 +# contributing to `cors`
2 +
3 +CORS is a node.js package for providing a [connect](http://www.senchalabs.org/connect/)/[express](http://expressjs.com/) middleware that can be used to enable [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) with various options. Learn more about the project in [the README](README.md).
4 +
5 +## The CORS Spec
6 +
7 +[http://www.w3.org/TR/cors/](http://www.w3.org/TR/cors/)
8 +
9 +## Pull Requests Welcome
10 +
11 +* Include `'use strict';` in every javascript file.
12 +* 2 space indentation.
13 +* Please run the testing steps below before submitting.
14 +
15 +## Testing
16 +
17 +```bash
18 +$ npm install
19 +$ npm test
20 +```
21 +
22 +## Interactive Testing Harness
23 +
24 +[http://node-cors-client.herokuapp.com](http://node-cors-client.herokuapp.com)
25 +
26 +Related git repositories:
27 +
28 +* [https://github.com/TroyGoode/node-cors-server](https://github.com/TroyGoode/node-cors-server)
29 +* [https://github.com/TroyGoode/node-cors-client](https://github.com/TroyGoode/node-cors-client)
30 +
31 +## License
32 +
33 +[MIT License](http://www.opensource.org/licenses/mit-license.php)
1 +2.8.5 / 2018-11-04
2 +==================
3 +
4 + * Fix setting `maxAge` option to `0`
5 +
6 +2.8.4 / 2017-07-12
7 +==================
8 +
9 + * Work-around Safari bug in default pre-flight response
10 +
11 +2.8.3 / 2017-03-29
12 +==================
13 +
14 + * Fix error when options delegate missing `methods` option
15 +
16 +2.8.2 / 2017-03-28
17 +==================
18 +
19 + * Fix error when frozen options are passed
20 + * Send "Vary: Origin" when using regular expressions
21 + * Send "Vary: Access-Control-Request-Headers" when dynamic `allowedHeaders`
22 +
23 +2.8.1 / 2016-09-08
24 +==================
25 +
26 +This release only changed documentation.
27 +
28 +2.8.0 / 2016-08-23
29 +==================
30 +
31 + * Add `optionsSuccessStatus` option
32 +
33 +2.7.2 / 2016-08-23
34 +==================
35 +
36 + * Fix error when Node.js running in strict mode
37 +
38 +2.7.1 / 2015-05-28
39 +==================
40 +
41 + * Move module into expressjs organization
42 +
43 +2.7.0 / 2015-05-28
44 +==================
45 +
46 + * Allow array of matching condition as `origin` option
47 + * Allow regular expression as `origin` option
48 +
49 +2.6.1 / 2015-05-28
50 +==================
51 +
52 + * Update `license` in package.json
53 +
54 +2.6.0 / 2015-04-27
55 +==================
56 +
57 + * Add `preflightContinue` option
58 + * Fix "Vary: Origin" header added for "*"
1 +(The MIT License)
2 +
3 +Copyright (c) 2013 Troy Goode <troygoode@gmail.com>
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 +# cors
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 +CORS is a node.js package for providing a [Connect](http://www.senchalabs.org/connect/)/[Express](http://expressjs.com/) middleware that can be used to enable [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) with various options.
9 +
10 +**[Follow me (@troygoode) on Twitter!](https://twitter.com/intent/user?screen_name=troygoode)**
11 +
12 +* [Installation](#installation)
13 +* [Usage](#usage)
14 + * [Simple Usage](#simple-usage-enable-all-cors-requests)
15 + * [Enable CORS for a Single Route](#enable-cors-for-a-single-route)
16 + * [Configuring CORS](#configuring-cors)
17 + * [Configuring CORS Asynchronously](#configuring-cors-asynchronously)
18 + * [Enabling CORS Pre-Flight](#enabling-cors-pre-flight)
19 +* [Configuration Options](#configuration-options)
20 +* [Demo](#demo)
21 +* [License](#license)
22 +* [Author](#author)
23 +
24 +## Installation
25 +
26 +This is a [Node.js](https://nodejs.org/en/) module available through the
27 +[npm registry](https://www.npmjs.com/). Installation is done using the
28 +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
29 +
30 +```sh
31 +$ npm install cors
32 +```
33 +
34 +## Usage
35 +
36 +### Simple Usage (Enable *All* CORS Requests)
37 +
38 +```javascript
39 +var express = require('express')
40 +var cors = require('cors')
41 +var app = express()
42 +
43 +app.use(cors())
44 +
45 +app.get('/products/:id', function (req, res, next) {
46 + res.json({msg: 'This is CORS-enabled for all origins!'})
47 +})
48 +
49 +app.listen(80, function () {
50 + console.log('CORS-enabled web server listening on port 80')
51 +})
52 +```
53 +
54 +### Enable CORS for a Single Route
55 +
56 +```javascript
57 +var express = require('express')
58 +var cors = require('cors')
59 +var app = express()
60 +
61 +app.get('/products/:id', cors(), function (req, res, next) {
62 + res.json({msg: 'This is CORS-enabled for a Single Route'})
63 +})
64 +
65 +app.listen(80, function () {
66 + console.log('CORS-enabled web server listening on port 80')
67 +})
68 +```
69 +
70 +### Configuring CORS
71 +
72 +```javascript
73 +var express = require('express')
74 +var cors = require('cors')
75 +var app = express()
76 +
77 +var corsOptions = {
78 + origin: 'http://example.com',
79 + optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
80 +}
81 +
82 +app.get('/products/:id', cors(corsOptions), function (req, res, next) {
83 + res.json({msg: 'This is CORS-enabled for only example.com.'})
84 +})
85 +
86 +app.listen(80, function () {
87 + console.log('CORS-enabled web server listening on port 80')
88 +})
89 +```
90 +
91 +### Configuring CORS w/ Dynamic Origin
92 +
93 +```javascript
94 +var express = require('express')
95 +var cors = require('cors')
96 +var app = express()
97 +
98 +var whitelist = ['http://example1.com', 'http://example2.com']
99 +var corsOptions = {
100 + origin: function (origin, callback) {
101 + if (whitelist.indexOf(origin) !== -1) {
102 + callback(null, true)
103 + } else {
104 + callback(new Error('Not allowed by CORS'))
105 + }
106 + }
107 +}
108 +
109 +app.get('/products/:id', cors(corsOptions), function (req, res, next) {
110 + res.json({msg: 'This is CORS-enabled for a whitelisted domain.'})
111 +})
112 +
113 +app.listen(80, function () {
114 + console.log('CORS-enabled web server listening on port 80')
115 +})
116 +```
117 +
118 +If you do not want to block REST tools or server-to-server requests,
119 +add a `!origin` check in the origin function like so:
120 +
121 +```javascript
122 +var corsOptions = {
123 + origin: function (origin, callback) {
124 + if (whitelist.indexOf(origin) !== -1 || !origin) {
125 + callback(null, true)
126 + } else {
127 + callback(new Error('Not allowed by CORS'))
128 + }
129 + }
130 +}
131 +```
132 +
133 +### Enabling CORS Pre-Flight
134 +
135 +Certain CORS requests are considered 'complex' and require an initial
136 +`OPTIONS` request (called the "pre-flight request"). An example of a
137 +'complex' CORS request is one that uses an HTTP verb other than
138 +GET/HEAD/POST (such as DELETE) or that uses custom headers. To enable
139 +pre-flighting, you must add a new OPTIONS handler for the route you want
140 +to support:
141 +
142 +```javascript
143 +var express = require('express')
144 +var cors = require('cors')
145 +var app = express()
146 +
147 +app.options('/products/:id', cors()) // enable pre-flight request for DELETE request
148 +app.del('/products/:id', cors(), function (req, res, next) {
149 + res.json({msg: 'This is CORS-enabled for all origins!'})
150 +})
151 +
152 +app.listen(80, function () {
153 + console.log('CORS-enabled web server listening on port 80')
154 +})
155 +```
156 +
157 +You can also enable pre-flight across-the-board like so:
158 +
159 +```javascript
160 +app.options('*', cors()) // include before other routes
161 +```
162 +
163 +### Configuring CORS Asynchronously
164 +
165 +```javascript
166 +var express = require('express')
167 +var cors = require('cors')
168 +var app = express()
169 +
170 +var whitelist = ['http://example1.com', 'http://example2.com']
171 +var corsOptionsDelegate = function (req, callback) {
172 + var corsOptions;
173 + if (whitelist.indexOf(req.header('Origin')) !== -1) {
174 + corsOptions = { origin: true } // reflect (enable) the requested origin in the CORS response
175 + } else {
176 + corsOptions = { origin: false } // disable CORS for this request
177 + }
178 + callback(null, corsOptions) // callback expects two parameters: error and options
179 +}
180 +
181 +app.get('/products/:id', cors(corsOptionsDelegate), function (req, res, next) {
182 + res.json({msg: 'This is CORS-enabled for a whitelisted domain.'})
183 +})
184 +
185 +app.listen(80, function () {
186 + console.log('CORS-enabled web server listening on port 80')
187 +})
188 +```
189 +
190 +## Configuration Options
191 +
192 +* `origin`: Configures the **Access-Control-Allow-Origin** CORS header. Possible values:
193 + - `Boolean` - set `origin` to `true` to reflect the [request origin](http://tools.ietf.org/html/draft-abarth-origin-09), as defined by `req.header('Origin')`, or set it to `false` to disable CORS.
194 + - `String` - set `origin` to a specific origin. For example if you set it to `"http://example.com"` only requests from "http://example.com" will be allowed.
195 + - `RegExp` - set `origin` to a regular expression pattern which will be used to test the request origin. If it's a match, the request origin will be reflected. For example the pattern `/example\.com$/` will reflect any request that is coming from an origin ending with "example.com".
196 + - `Array` - set `origin` to an array of valid origins. Each origin can be a `String` or a `RegExp`. For example `["http://example1.com", /\.example2\.com$/]` will accept any request from "http://example1.com" or from a subdomain of "example2.com".
197 + - `Function` - set `origin` to a function implementing some custom logic. The function takes the request origin as the first parameter and a callback (which expects the signature `err [object], allow [bool]`) as the second.
198 +* `methods`: Configures the **Access-Control-Allow-Methods** CORS header. Expects a comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: `['GET', 'PUT', 'POST']`).
199 +* `allowedHeaders`: Configures the **Access-Control-Allow-Headers** CORS header. Expects a comma-delimited string (ex: 'Content-Type,Authorization') or an array (ex: `['Content-Type', 'Authorization']`). If not specified, defaults to reflecting the headers specified in the request's **Access-Control-Request-Headers** header.
200 +* `exposedHeaders`: Configures the **Access-Control-Expose-Headers** CORS header. Expects a comma-delimited string (ex: 'Content-Range,X-Content-Range') or an array (ex: `['Content-Range', 'X-Content-Range']`). If not specified, no custom headers are exposed.
201 +* `credentials`: Configures the **Access-Control-Allow-Credentials** CORS header. Set to `true` to pass the header, otherwise it is omitted.
202 +* `maxAge`: Configures the **Access-Control-Max-Age** CORS header. Set to an integer to pass the header, otherwise it is omitted.
203 +* `preflightContinue`: Pass the CORS preflight response to the next handler.
204 +* `optionsSuccessStatus`: Provides a status code to use for successful `OPTIONS` requests, since some legacy browsers (IE11, various SmartTVs) choke on `204`.
205 +
206 +The default configuration is the equivalent of:
207 +
208 +```json
209 +{
210 + "origin": "*",
211 + "methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
212 + "preflightContinue": false,
213 + "optionsSuccessStatus": 204
214 +}
215 +```
216 +
217 +For details on the effect of each CORS header, read [this](http://www.html5rocks.com/en/tutorials/cors/) article on HTML5 Rocks.
218 +
219 +## Demo
220 +
221 +A demo that illustrates CORS working (and not working) using jQuery is available here: [http://node-cors-client.herokuapp.com/](http://node-cors-client.herokuapp.com/)
222 +
223 +Code for that demo can be found here:
224 +
225 +* Client: [https://github.com/TroyGoode/node-cors-client](https://github.com/TroyGoode/node-cors-client)
226 +* Server: [https://github.com/TroyGoode/node-cors-server](https://github.com/TroyGoode/node-cors-server)
227 +
228 +## License
229 +
230 +[MIT License](http://www.opensource.org/licenses/mit-license.php)
231 +
232 +## Author
233 +
234 +[Troy Goode](https://github.com/TroyGoode) ([troygoode@gmail.com](mailto:troygoode@gmail.com))
235 +
236 +[coveralls-image]: https://img.shields.io/coveralls/expressjs/cors/master.svg
237 +[coveralls-url]: https://coveralls.io/r/expressjs/cors?branch=master
238 +[downloads-image]: https://img.shields.io/npm/dm/cors.svg
239 +[downloads-url]: https://npmjs.org/package/cors
240 +[npm-image]: https://img.shields.io/npm/v/cors.svg
241 +[npm-url]: https://npmjs.org/package/cors
242 +[travis-image]: https://img.shields.io/travis/expressjs/cors/master.svg
243 +[travis-url]: https://travis-ci.org/expressjs/cors
1 +(function () {
2 +
3 + 'use strict';
4 +
5 + var assign = require('object-assign');
6 + var vary = require('vary');
7 +
8 + var defaults = {
9 + origin: '*',
10 + methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
11 + preflightContinue: false,
12 + optionsSuccessStatus: 204
13 + };
14 +
15 + function isString(s) {
16 + return typeof s === 'string' || s instanceof String;
17 + }
18 +
19 + function isOriginAllowed(origin, allowedOrigin) {
20 + if (Array.isArray(allowedOrigin)) {
21 + for (var i = 0; i < allowedOrigin.length; ++i) {
22 + if (isOriginAllowed(origin, allowedOrigin[i])) {
23 + return true;
24 + }
25 + }
26 + return false;
27 + } else if (isString(allowedOrigin)) {
28 + return origin === allowedOrigin;
29 + } else if (allowedOrigin instanceof RegExp) {
30 + return allowedOrigin.test(origin);
31 + } else {
32 + return !!allowedOrigin;
33 + }
34 + }
35 +
36 + function configureOrigin(options, req) {
37 + var requestOrigin = req.headers.origin,
38 + headers = [],
39 + isAllowed;
40 +
41 + if (!options.origin || options.origin === '*') {
42 + // allow any origin
43 + headers.push([{
44 + key: 'Access-Control-Allow-Origin',
45 + value: '*'
46 + }]);
47 + } else if (isString(options.origin)) {
48 + // fixed origin
49 + headers.push([{
50 + key: 'Access-Control-Allow-Origin',
51 + value: options.origin
52 + }]);
53 + headers.push([{
54 + key: 'Vary',
55 + value: 'Origin'
56 + }]);
57 + } else {
58 + isAllowed = isOriginAllowed(requestOrigin, options.origin);
59 + // reflect origin
60 + headers.push([{
61 + key: 'Access-Control-Allow-Origin',
62 + value: isAllowed ? requestOrigin : false
63 + }]);
64 + headers.push([{
65 + key: 'Vary',
66 + value: 'Origin'
67 + }]);
68 + }
69 +
70 + return headers;
71 + }
72 +
73 + function configureMethods(options) {
74 + var methods = options.methods;
75 + if (methods.join) {
76 + methods = options.methods.join(','); // .methods is an array, so turn it into a string
77 + }
78 + return {
79 + key: 'Access-Control-Allow-Methods',
80 + value: methods
81 + };
82 + }
83 +
84 + function configureCredentials(options) {
85 + if (options.credentials === true) {
86 + return {
87 + key: 'Access-Control-Allow-Credentials',
88 + value: 'true'
89 + };
90 + }
91 + return null;
92 + }
93 +
94 + function configureAllowedHeaders(options, req) {
95 + var allowedHeaders = options.allowedHeaders || options.headers;
96 + var headers = [];
97 +
98 + if (!allowedHeaders) {
99 + allowedHeaders = req.headers['access-control-request-headers']; // .headers wasn't specified, so reflect the request headers
100 + headers.push([{
101 + key: 'Vary',
102 + value: 'Access-Control-Request-Headers'
103 + }]);
104 + } else if (allowedHeaders.join) {
105 + allowedHeaders = allowedHeaders.join(','); // .headers is an array, so turn it into a string
106 + }
107 + if (allowedHeaders && allowedHeaders.length) {
108 + headers.push([{
109 + key: 'Access-Control-Allow-Headers',
110 + value: allowedHeaders
111 + }]);
112 + }
113 +
114 + return headers;
115 + }
116 +
117 + function configureExposedHeaders(options) {
118 + var headers = options.exposedHeaders;
119 + if (!headers) {
120 + return null;
121 + } else if (headers.join) {
122 + headers = headers.join(','); // .headers is an array, so turn it into a string
123 + }
124 + if (headers && headers.length) {
125 + return {
126 + key: 'Access-Control-Expose-Headers',
127 + value: headers
128 + };
129 + }
130 + return null;
131 + }
132 +
133 + function configureMaxAge(options) {
134 + var maxAge = (typeof options.maxAge === 'number' || options.maxAge) && options.maxAge.toString()
135 + if (maxAge && maxAge.length) {
136 + return {
137 + key: 'Access-Control-Max-Age',
138 + value: maxAge
139 + };
140 + }
141 + return null;
142 + }
143 +
144 + function applyHeaders(headers, res) {
145 + for (var i = 0, n = headers.length; i < n; i++) {
146 + var header = headers[i];
147 + if (header) {
148 + if (Array.isArray(header)) {
149 + applyHeaders(header, res);
150 + } else if (header.key === 'Vary' && header.value) {
151 + vary(res, header.value);
152 + } else if (header.value) {
153 + res.setHeader(header.key, header.value);
154 + }
155 + }
156 + }
157 + }
158 +
159 + function cors(options, req, res, next) {
160 + var headers = [],
161 + method = req.method && req.method.toUpperCase && req.method.toUpperCase();
162 +
163 + if (method === 'OPTIONS') {
164 + // preflight
165 + headers.push(configureOrigin(options, req));
166 + headers.push(configureCredentials(options, req));
167 + headers.push(configureMethods(options, req));
168 + headers.push(configureAllowedHeaders(options, req));
169 + headers.push(configureMaxAge(options, req));
170 + headers.push(configureExposedHeaders(options, req));
171 + applyHeaders(headers, res);
172 +
173 + if (options.preflightContinue) {
174 + next();
175 + } else {
176 + // Safari (and potentially other browsers) need content-length 0,
177 + // for 204 or they just hang waiting for a body
178 + res.statusCode = options.optionsSuccessStatus;
179 + res.setHeader('Content-Length', '0');
180 + res.end();
181 + }
182 + } else {
183 + // actual response
184 + headers.push(configureOrigin(options, req));
185 + headers.push(configureCredentials(options, req));
186 + headers.push(configureExposedHeaders(options, req));
187 + applyHeaders(headers, res);
188 + next();
189 + }
190 + }
191 +
192 + function middlewareWrapper(o) {
193 + // if options are static (either via defaults or custom options passed in), wrap in a function
194 + var optionsCallback = null;
195 + if (typeof o === 'function') {
196 + optionsCallback = o;
197 + } else {
198 + optionsCallback = function (req, cb) {
199 + cb(null, o);
200 + };
201 + }
202 +
203 + return function corsMiddleware(req, res, next) {
204 + optionsCallback(req, function (err, options) {
205 + if (err) {
206 + next(err);
207 + } else {
208 + var corsOptions = assign({}, defaults, options);
209 + var originCallback = null;
210 + if (corsOptions.origin && typeof corsOptions.origin === 'function') {
211 + originCallback = corsOptions.origin;
212 + } else if (corsOptions.origin) {
213 + originCallback = function (origin, cb) {
214 + cb(null, corsOptions.origin);
215 + };
216 + }
217 +
218 + if (originCallback) {
219 + originCallback(req.headers.origin, function (err2, origin) {
220 + if (err2 || !origin) {
221 + next(err2);
222 + } else {
223 + corsOptions.origin = origin;
224 + cors(corsOptions, req, res, next);
225 + }
226 + });
227 + } else {
228 + next();
229 + }
230 + }
231 + });
232 + };
233 + }
234 +
235 + // can pass either an options hash, an options delegate, or nothing
236 + module.exports = middlewareWrapper;
237 +
238 +}());
1 +{
2 + "_from": "cors@~2.8.5",
3 + "_id": "cors@2.8.5",
4 + "_inBundle": false,
5 + "_integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
6 + "_location": "/cors",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "cors@~2.8.5",
12 + "name": "cors",
13 + "escapedName": "cors",
14 + "rawSpec": "~2.8.5",
15 + "saveSpec": null,
16 + "fetchSpec": "~2.8.5"
17 + },
18 + "_requiredBy": [
19 + "/engine.io"
20 + ],
21 + "_resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
22 + "_shasum": "eac11da51592dd86b9f06f6e7ac293b3df875d29",
23 + "_spec": "cors@~2.8.5",
24 + "_where": "C:\\Users\\bshoo\\Desktop\\OSS\\Singer-Composer\\node_modules\\engine.io",
25 + "author": {
26 + "name": "Troy Goode",
27 + "email": "troygoode@gmail.com",
28 + "url": "https://github.com/troygoode/"
29 + },
30 + "bugs": {
31 + "url": "https://github.com/expressjs/cors/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "object-assign": "^4",
36 + "vary": "^1"
37 + },
38 + "deprecated": false,
39 + "description": "Node.js CORS middleware",
40 + "devDependencies": {
41 + "after": "0.8.2",
42 + "eslint": "2.13.1",
43 + "express": "4.16.3",
44 + "mocha": "5.2.0",
45 + "nyc": "13.1.0",
46 + "supertest": "3.3.0"
47 + },
48 + "engines": {
49 + "node": ">= 0.10"
50 + },
51 + "files": [
52 + "lib/index.js",
53 + "CONTRIBUTING.md",
54 + "HISTORY.md",
55 + "LICENSE",
56 + "README.md"
57 + ],
58 + "homepage": "https://github.com/expressjs/cors#readme",
59 + "keywords": [
60 + "cors",
61 + "express",
62 + "connect",
63 + "middleware"
64 + ],
65 + "license": "MIT",
66 + "main": "./lib/index.js",
67 + "name": "cors",
68 + "repository": {
69 + "type": "git",
70 + "url": "git+https://github.com/expressjs/cors.git"
71 + },
72 + "scripts": {
73 + "lint": "eslint lib test",
74 + "test": "npm run lint && nyc --reporter=html --reporter=text mocha --require test/support/env"
75 + },
76 + "version": "2.8.5"
77 +}
1 +## [5.0.2](https://github.com/socketio/engine.io-parser/compare/5.0.1...5.0.2) (2021-11-14)
2 +
3 +
4 +### Bug Fixes
5 +
6 +* add package name in nested package.json ([7e27159](https://github.com/socketio/engine.io-parser/commit/7e271596c3305fb4e4a9fbdcc7fd442e8ff71200))
7 +* fix vite build for CommonJS users ([5f22ed0](https://github.com/socketio/engine.io-parser/commit/5f22ed0527cc80aa0cac415dfd12db2f94f0a855))
8 +
9 +
10 +
11 +## [5.0.1](https://github.com/socketio/engine.io-parser/compare/5.0.0...5.0.1) (2021-10-15)
12 +
13 +
14 +### Bug Fixes
15 +
16 +* fix vite build ([900346e](https://github.com/socketio/engine.io-parser/commit/900346ea34ddc178d80eaabc8ea516d929457855))
17 +
18 +
19 +
20 +# [5.0.0](https://github.com/socketio/engine.io-parser/compare/4.0.3...5.0.0) (2021-10-04)
21 +
22 +This release includes the migration to TypeScript. The major bump is due to the new "exports" field in the package.json file.
23 +
24 +See also: https://nodejs.org/api/packages.html#packages_package_entry_points
25 +
26 +## [4.0.3](https://github.com/socketio/engine.io-parser/compare/4.0.2...4.0.3) (2021-08-29)
27 +
28 +
29 +### Bug Fixes
30 +
31 +* respect the offset and length of TypedArray objects ([6d7dd76](https://github.com/socketio/engine.io-parser/commit/6d7dd76130690afda6c214d5c04305d2bbc4eb4d))
32 +
33 +
34 +## [4.0.2](https://github.com/socketio/engine.io-parser/compare/4.0.1...4.0.2) (2020-12-07)
35 +
36 +
37 +### Bug Fixes
38 +
39 +* add base64-arraybuffer as prod dependency ([2ccdeb2](https://github.com/socketio/engine.io-parser/commit/2ccdeb277955bed8742a29f2dcbbf57ca95eb12a))
40 +
41 +
42 +## [2.2.1](https://github.com/socketio/engine.io-parser/compare/2.2.0...2.2.1) (2020-09-30)
43 +
44 +
45 +## [4.0.1](https://github.com/socketio/engine.io-parser/compare/4.0.0...4.0.1) (2020-09-10)
46 +
47 +
48 +### Bug Fixes
49 +
50 +* use a terser-compatible representation of the separator ([886f9ea](https://github.com/socketio/engine.io-parser/commit/886f9ea7c4e717573152c31320f6fb6c6664061b))
51 +
52 +
53 +# [4.0.0](https://github.com/socketio/engine.io-parser/compare/v4.0.0-alpha.1...4.0.0) (2020-09-08)
54 +
55 +This major release contains the necessary changes for the version 4 of the Engine.IO protocol. More information about the new version can be found [there](https://github.com/socketio/engine.io-protocol#difference-between-v3-and-v4).
56 +
57 +Encoding changes between v3 and v4:
58 +
59 +- encodePacket with string
60 + - input: `{ type: "message", data: "hello" }`
61 + - output in v3: `"4hello"`
62 + - output in v4: `"4hello"`
63 +
64 +- encodePacket with binary
65 + - input: `{ type: 'message', data: <Buffer 01 02 03> }`
66 + - output in v3: `<Buffer 04 01 02 03>`
67 + - output in v4: `<Buffer 01 02 03>`
68 +
69 +- encodePayload with strings
70 + - input: `[ { type: 'message', data: 'hello' }, { type: 'message', data: '€€€' } ]`
71 + - output in v3: `"6:4hello4:4€€€"`
72 + - output in v4: `"4hello\x1e4€€€"`
73 +
74 +- encodePayload with string and binary
75 + - input: `[ { type: 'message', data: 'hello' }, { type: 'message', data: <Buffer 01 02 03> } ]`
76 + - output in v3: `<Buffer 00 06 ff 34 68 65 6c 6c 6f 01 04 ff 04 01 02 03>`
77 + - output in v4: `"4hello\x1ebAQID"`
78 +
79 +Please note that the parser is now dependency-free! This should help reduce the size of the browser bundle.
80 +
81 +### Bug Fixes
82 +
83 +* keep track of the buffer initial length ([8edf2d1](https://github.com/socketio/engine.io-parser/commit/8edf2d1478026da442f519c2d2521af43ba01832))
84 +
85 +
86 +### Features
87 +
88 +* restore the upgrade mechanism ([6efedfa](https://github.com/socketio/engine.io-parser/commit/6efedfa0f3048506a4ba99e70674ddf4c0732e0c))
89 +
90 +
91 +
92 +# [4.0.0-alpha.1](https://github.com/socketio/engine.io-parser/compare/v4.0.0-alpha.0...v4.0.0-alpha.1) (2020-05-19)
93 +
94 +
95 +### Features
96 +
97 +* implement the version 4 of the protocol ([cab7db0](https://github.com/socketio/engine.io-parser/commit/cab7db0404e0a69f86a05ececd62c8c31f4d97d5))
98 +
99 +
100 +
101 +# [4.0.0-alpha.0](https://github.com/socketio/engine.io-parser/compare/2.2.0...v4.0.0-alpha.0) (2020-02-04)
102 +
103 +
104 +### Bug Fixes
105 +
106 +* properly decode binary packets ([5085373](https://github.com/socketio/engine.io-parser/commit/50853738e0c6c16f9cee0d7887651155f4b78240))
107 +
108 +
109 +### Features
110 +
111 +* remove packet type when encoding binary packets ([a947ae5](https://github.com/socketio/engine.io-parser/commit/a947ae59a2844e4041db58ff36b270d1528b3bee))
112 +
113 +
114 +### BREAKING CHANGES
115 +
116 +* the packet containing binary data will now be sent without any transformation
117 +
118 +Protocol v3: { type: 'message', data: <Buffer 01 02 03> } => <Buffer 04 01 02 03>
119 +Protocol v4: { type: 'message', data: <Buffer 01 02 03> } => <Buffer 01 02 03>
120 +
121 +
122 +
123 +# [2.2.0](https://github.com/socketio/engine.io-parser/compare/2.1.3...2.2.0) (2019-09-13)
124 +
125 +
126 +* [refactor] Use `Buffer.allocUnsafe` instead of `new Buffer` (#104) ([aedf8eb](https://github.com/socketio/engine.io-parser/commit/aedf8eb29e8bf6aeb5c6cc68965d986c4c958ae2)), closes [#104](https://github.com/socketio/engine.io-parser/issues/104)
127 +
128 +
129 +### BREAKING CHANGES
130 +
131 +* drop support for Node.js 4 (since Buffer.allocUnsafe was added in v5.10.0)
132 +
133 +Reference: https://nodejs.org/docs/latest/api/buffer.html#buffer_class_method_buffer_allocunsafe_size
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff 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 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 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.