├── LICENSE ├── README.md ├── index.js ├── manifest.json ├── node_modules ├── .package-lock.json ├── @types │ ├── component-emitter │ │ ├── LICENSE │ │ ├── README.md │ │ ├── index.d.ts │ │ └── package.json │ ├── cookie │ │ ├── LICENSE │ │ ├── README.md │ │ ├── index.d.ts │ │ └── package.json │ ├── cors │ │ ├── LICENSE │ │ ├── README.md │ │ ├── index.d.ts │ │ └── package.json │ └── node │ │ ├── LICENSE │ │ ├── README.md │ │ ├── assert.d.ts │ │ ├── async_hooks.d.ts │ │ ├── base.d.ts │ │ ├── buffer.d.ts │ │ ├── child_process.d.ts │ │ ├── cluster.d.ts │ │ ├── console.d.ts │ │ ├── constants.d.ts │ │ ├── crypto.d.ts │ │ ├── dgram.d.ts │ │ ├── dns.d.ts │ │ ├── domain.d.ts │ │ ├── events.d.ts │ │ ├── fs.d.ts │ │ ├── fs │ │ └── promises.d.ts │ │ ├── globals.d.ts │ │ ├── globals.global.d.ts │ │ ├── http.d.ts │ │ ├── http2.d.ts │ │ ├── https.d.ts │ │ ├── index.d.ts │ │ ├── inspector.d.ts │ │ ├── module.d.ts │ │ ├── net.d.ts │ │ ├── os.d.ts │ │ ├── package.json │ │ ├── path.d.ts │ │ ├── perf_hooks.d.ts │ │ ├── process.d.ts │ │ ├── punycode.d.ts │ │ ├── querystring.d.ts │ │ ├── readline.d.ts │ │ ├── repl.d.ts │ │ ├── stream.d.ts │ │ ├── string_decoder.d.ts │ │ ├── timers.d.ts │ │ ├── tls.d.ts │ │ ├── trace_events.d.ts │ │ ├── ts3.6 │ │ ├── assert.d.ts │ │ ├── base.d.ts │ │ └── index.d.ts │ │ ├── tty.d.ts │ │ ├── url.d.ts │ │ ├── util.d.ts │ │ ├── v8.d.ts │ │ ├── vm.d.ts │ │ ├── wasi.d.ts │ │ ├── worker_threads.d.ts │ │ └── zlib.d.ts ├── accepts │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── base64-arraybuffer │ ├── .npmignore │ ├── .travis.yml │ ├── LICENSE-MIT │ ├── README.md │ ├── lib │ │ └── base64-arraybuffer.js │ └── package.json ├── base64id │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── lib │ │ └── base64id.js │ └── package.json ├── component-emitter │ ├── History.md │ ├── LICENSE │ ├── Readme.md │ ├── index.js │ └── package.json ├── cookie │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── cors │ ├── CONTRIBUTING.md │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── lib │ │ └── index.js │ └── package.json ├── debug │ ├── LICENSE │ ├── README.md │ ├── package.json │ └── src │ │ ├── browser.js │ │ ├── common.js │ │ ├── index.js │ │ └── node.js ├── engine.io-parser │ ├── CHANGELOG.md │ ├── LICENSE │ ├── Readme.md │ ├── lib │ │ ├── commons.js │ │ ├── decodePacket.browser.js │ │ ├── decodePacket.js │ │ ├── encodePacket.browser.js │ │ ├── encodePacket.js │ │ └── index.js │ └── package.json ├── engine.io │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── lib │ │ ├── engine.io.js │ │ ├── parser-v3 │ │ │ ├── index.js │ │ │ └── utf8.js │ │ ├── server.js │ │ ├── socket.js │ │ ├── transport.js │ │ └── transports │ │ │ ├── index.js │ │ │ ├── polling-jsonp.js │ │ │ ├── polling.js │ │ │ └── websocket.js │ └── package.json ├── mime-db │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── db.json │ ├── index.js │ └── package.json ├── mime-types │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── ms │ ├── index.js │ ├── license.md │ ├── package.json │ └── readme.md ├── negotiator │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── lib │ │ ├── charset.js │ │ ├── encoding.js │ │ ├── language.js │ │ └── mediaType.js │ └── package.json ├── object-assign │ ├── index.js │ ├── license │ ├── package.json │ └── readme.md ├── socket.io-adapter │ ├── CHANGELOG.md │ ├── LICENSE │ ├── Readme.md │ ├── dist │ │ ├── index.d.ts │ │ └── index.js │ └── package.json ├── socket.io-parser │ ├── CHANGELOG.md │ ├── LICENSE │ ├── Readme.md │ ├── dist │ │ ├── binary.d.ts │ │ ├── binary.js │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── is-binary.d.ts │ │ └── is-binary.js │ └── package.json ├── socket.io │ ├── CHANGELOG.md │ ├── LICENSE │ ├── Readme.md │ ├── client-dist │ │ ├── socket.io.js │ │ ├── socket.io.js.map │ │ ├── socket.io.min.js │ │ ├── socket.io.min.js.map │ │ ├── socket.io.msgpack.min.js │ │ └── socket.io.msgpack.min.js.map │ ├── dist │ │ ├── broadcast-operator.d.ts │ │ ├── broadcast-operator.js │ │ ├── client.d.ts │ │ ├── client.js │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── namespace.d.ts │ │ ├── namespace.js │ │ ├── parent-namespace.d.ts │ │ ├── parent-namespace.js │ │ ├── socket.d.ts │ │ ├── socket.js │ │ ├── typed-events.d.ts │ │ └── typed-events.js │ ├── package.json │ └── wrapper.mjs ├── vary │ ├── HISTORY.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json └── ws │ ├── LICENSE │ ├── README.md │ ├── browser.js │ ├── index.js │ ├── lib │ ├── buffer-util.js │ ├── constants.js │ ├── event-target.js │ ├── extension.js │ ├── limiter.js │ ├── permessage-deflate.js │ ├── receiver.js │ ├── sender.js │ ├── stream.js │ ├── validation.js │ ├── websocket-server.js │ └── websocket.js │ └── package.json ├── package-lock.json ├── package.json └── src ├── activity.js └── sideload.js /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 pog who? 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Currently broken; unstable/crashing under normal use, would not recommend 2 | ## PreMiD Powercord 3 | 4 | Gives you the abilty to use premid when you launch discord without installing and running the external bloated electron tray process for an overweight IPC-Websocket bridge. 5 | 6 | Based on code from the PreMiD app & custom-rpc 7 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { Plugin } = require('powercord/entities'); 2 | const activity = require('./src/activity'); 3 | 4 | module.exports = class PreMID extends Plugin { 5 | startPlugin() { activity.init() } 6 | 7 | pluginWillUnload() { activity.destroy(); } 8 | }; 9 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Premid Powercord", 3 | "version": "1.1.0", 4 | "description": "Gives you the abilty to use premid when you launch discord without installing and running the external bloated electron tray process for an overweight IPC-Websocket bridge", 5 | "author": "MulverineX#0001", 6 | "license": "MIT" 7 | } 8 | -------------------------------------------------------------------------------- /node_modules/@types/component-emitter/LICENSE: -------------------------------------------------------------------------------- 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 22 | -------------------------------------------------------------------------------- /node_modules/@types/component-emitter/README.md: -------------------------------------------------------------------------------- 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 | 10 | ### Additional Details 11 | * Last updated: Wed, 09 Sep 2020 21:18:32 GMT 12 | * Dependencies: none 13 | * Global values: none 14 | 15 | # Credits 16 | These definitions were written by [Peter Snider](https://github.com/psnider). 17 | -------------------------------------------------------------------------------- /node_modules/@types/component-emitter/index.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for component-emitter v1.2.1 2 | // Project: https://www.npmjs.com/package/component-emitter 3 | // Definitions by: Peter Snider 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | 6 | // TypeScript Version: 2.2 7 | 8 | interface Emitter { 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 | } 16 | 17 | declare const Emitter: { 18 | (obj?: object): Emitter; 19 | new (obj?: object): Emitter; 20 | }; 21 | 22 | export = Emitter; 23 | -------------------------------------------------------------------------------- /node_modules/@types/component-emitter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@types/component-emitter", 3 | "version": "1.2.10", 4 | "description": "TypeScript definitions for component-emitter", 5 | "license": "MIT", 6 | "contributors": [ 7 | { 8 | "name": "Peter Snider", 9 | "url": "https://github.com/psnider", 10 | "githubUsername": "psnider" 11 | } 12 | ], 13 | "main": "", 14 | "types": "index.d.ts", 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", 18 | "directory": "types/component-emitter" 19 | }, 20 | "scripts": {}, 21 | "dependencies": {}, 22 | "typesPublisherContentHash": "446bfc6b04cc0bdf3afbaa65ac393c5c9056ab15d158199b96d266059c762403", 23 | "typeScriptVersion": "3.1" 24 | } -------------------------------------------------------------------------------- /node_modules/@types/cookie/LICENSE: -------------------------------------------------------------------------------- 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 22 | -------------------------------------------------------------------------------- /node_modules/@types/cookie/README.md: -------------------------------------------------------------------------------- 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: Wed, 13 May 2020 15:49:11 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). 17 | -------------------------------------------------------------------------------- /node_modules/@types/cookie/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@types/cookie", 3 | "version": "0.4.0", 4 | "description": "TypeScript definitions for cookie", 5 | "license": "MIT", 6 | "contributors": [ 7 | { 8 | "name": "Pine Mizune", 9 | "url": "https://github.com/pine", 10 | "githubUsername": "pine" 11 | }, 12 | { 13 | "name": "Piotr Błażejewicz", 14 | "url": "https://github.com/peterblazejewicz", 15 | "githubUsername": "peterblazejewicz" 16 | } 17 | ], 18 | "main": "", 19 | "types": "index.d.ts", 20 | "repository": { 21 | "type": "git", 22 | "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", 23 | "directory": "types/cookie" 24 | }, 25 | "scripts": {}, 26 | "dependencies": {}, 27 | "typesPublisherContentHash": "16f378b41a83402d78b875cb82a69c45ef888ee03788db1e6bcd4515daca6aab", 28 | "typeScriptVersion": "2.9" 29 | } -------------------------------------------------------------------------------- /node_modules/@types/cors/LICENSE: -------------------------------------------------------------------------------- 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 22 | -------------------------------------------------------------------------------- /node_modules/@types/cors/README.md: -------------------------------------------------------------------------------- 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 | 10 | ### Additional Details 11 | * Last updated: Sun, 14 Feb 2021 07:16:16 GMT 12 | * Dependencies: none 13 | * Global values: none 14 | 15 | # Credits 16 | These definitions were written by [Alan Plum](https://github.com/pluma), and [Gaurav Sharma](https://github.com/gtpan77). 17 | -------------------------------------------------------------------------------- /node_modules/@types/cors/index.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for cors 2.8 2 | // Project: https://github.com/expressjs/cors/ 3 | // Definitions by: Alan Plum 4 | // Gaurav Sharma 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 | (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; 17 | headers: IncomingHttpHeaders; 18 | } 19 | interface CorsOptions { 20 | /** 21 | * @default '*'' 22 | */ 23 | origin?: StaticOrigin | CustomOrigin; 24 | /** 25 | * @default 'GET,HEAD,PUT,PATCH,POST,DELETE' 26 | */ 27 | methods?: string | string[]; 28 | allowedHeaders?: string | string[]; 29 | exposedHeaders?: string | string[]; 30 | credentials?: boolean; 31 | maxAge?: number; 32 | /** 33 | * @default false 34 | */ 35 | preflightContinue?: boolean; 36 | /** 37 | * @default 204 38 | */ 39 | optionsSuccessStatus?: number; 40 | } 41 | type CorsOptionsDelegate = ( 42 | req: T, 43 | callback: (err: Error | null, options?: CorsOptions) => void, 44 | ) => void; 45 | } 46 | 47 | declare function e( 48 | options?: e.CorsOptions | e.CorsOptionsDelegate, 49 | ): ( 50 | req: T, 51 | res: { 52 | statusCode?: number; 53 | setHeader(key: string, value: string): any; 54 | end(): any; 55 | }, 56 | next: (err?: any) => any, 57 | ) => void; 58 | export = e; 59 | -------------------------------------------------------------------------------- /node_modules/@types/cors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@types/cors", 3 | "version": "2.8.10", 4 | "description": "TypeScript definitions for cors", 5 | "license": "MIT", 6 | "contributors": [ 7 | { 8 | "name": "Alan Plum", 9 | "url": "https://github.com/pluma", 10 | "githubUsername": "pluma" 11 | }, 12 | { 13 | "name": "Gaurav Sharma", 14 | "url": "https://github.com/gtpan77", 15 | "githubUsername": "gtpan77" 16 | } 17 | ], 18 | "main": "", 19 | "types": "index.d.ts", 20 | "repository": { 21 | "type": "git", 22 | "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", 23 | "directory": "types/cors" 24 | }, 25 | "scripts": {}, 26 | "dependencies": {}, 27 | "typesPublisherContentHash": "211c1b2df33cf0e3701aaff798ccb87f0a813d275560208db31cee05483ae4d3", 28 | "typeScriptVersion": "3.4" 29 | } -------------------------------------------------------------------------------- /node_modules/@types/node/LICENSE: -------------------------------------------------------------------------------- 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 22 | -------------------------------------------------------------------------------- /node_modules/@types/node/README.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | > `npm install --save @types/node` 3 | 4 | # Summary 5 | This package contains type definitions for Node.js (http://nodejs.org/). 6 | 7 | # Details 8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node. 9 | 10 | ### Additional Details 11 | * Last updated: Thu, 15 Apr 2021 17:31:22 GMT 12 | * Dependencies: none 13 | * Global values: `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout` 14 | 15 | # Credits 16 | These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Bruno Scheufler](https://github.com/brunoscheufler), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Surasak Chaisurin](https://github.com/Ryan-Willpower), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Jason Kwok](https://github.com/JasonHK), [Victor Perin](https://github.com/victorperin), and [Yongsheng Zhang](https://github.com/ZYSzys). 17 | -------------------------------------------------------------------------------- /node_modules/@types/node/base.d.ts: -------------------------------------------------------------------------------- 1 | // NOTE: These definitions support NodeJS and TypeScript 3.7. 2 | 3 | // NOTE: TypeScript version-specific augmentations can be found in the following paths: 4 | // - ~/base.d.ts - Shared definitions common to all TypeScript versions 5 | // - ~/index.d.ts - Definitions specific to TypeScript 2.1 6 | // - ~/ts3.7/base.d.ts - Definitions specific to TypeScript 3.7 7 | // - ~/ts3.7/index.d.ts - Definitions specific to TypeScript 3.7 with assert pulled in 8 | 9 | // Reference required types from the default lib: 10 | /// 11 | /// 12 | /// 13 | /// 14 | 15 | // Base definitions for all NodeJS modules that are not specific to any version of TypeScript: 16 | /// 17 | 18 | // TypeScript 3.7-specific augmentations: 19 | /// 20 | -------------------------------------------------------------------------------- /node_modules/@types/node/buffer.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:buffer' { 2 | export * from 'buffer'; 3 | } 4 | 5 | declare module 'buffer' { 6 | export const INSPECT_MAX_BYTES: number; 7 | export const kMaxLength: number; 8 | export const kStringMaxLength: number; 9 | export const constants: { 10 | MAX_LENGTH: number; 11 | MAX_STRING_LENGTH: number; 12 | }; 13 | const BuffType: typeof Buffer; 14 | 15 | export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary"; 16 | 17 | export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; 18 | 19 | export const SlowBuffer: { 20 | /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */ 21 | new(size: number): Buffer; 22 | prototype: Buffer; 23 | }; 24 | 25 | export { BuffType as Buffer }; 26 | } 27 | -------------------------------------------------------------------------------- /node_modules/@types/node/constants.d.ts: -------------------------------------------------------------------------------- 1 | /** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ 2 | declare module 'node:constants' { 3 | import exp = require('constants'); 4 | export = exp; 5 | } 6 | 7 | /** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ 8 | declare module 'constants' { 9 | import { constants as osConstants, SignalConstants } from 'node:os'; 10 | import { constants as cryptoConstants } from 'node:crypto'; 11 | import { constants as fsConstants } from 'node:fs'; 12 | 13 | const exp: typeof osConstants.errno & 14 | typeof osConstants.priority & 15 | SignalConstants & 16 | typeof cryptoConstants & 17 | typeof fsConstants; 18 | export = exp; 19 | } 20 | -------------------------------------------------------------------------------- /node_modules/@types/node/domain.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:domain' { 2 | export * from 'domain'; 3 | } 4 | 5 | declare module 'domain' { 6 | import EventEmitter = require('node:events'); 7 | 8 | global { 9 | namespace NodeJS { 10 | interface Domain extends EventEmitter { 11 | run(fn: (...args: any[]) => T, ...args: any[]): T; 12 | add(emitter: EventEmitter | Timer): void; 13 | remove(emitter: EventEmitter | Timer): void; 14 | bind(cb: T): T; 15 | intercept(cb: T): T; 16 | } 17 | } 18 | } 19 | 20 | interface Domain extends NodeJS.Domain {} 21 | class Domain extends EventEmitter { 22 | members: Array; 23 | enter(): void; 24 | exit(): void; 25 | } 26 | 27 | function create(): Domain; 28 | } 29 | -------------------------------------------------------------------------------- /node_modules/@types/node/events.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:events' { 2 | import EventEmitter = require('events'); 3 | export = EventEmitter; 4 | } 5 | 6 | declare module 'events' { 7 | interface EventEmitterOptions { 8 | /** 9 | * Enables automatic capturing of promise rejection. 10 | */ 11 | captureRejections?: boolean; 12 | } 13 | 14 | interface NodeEventTarget { 15 | once(event: string | symbol, listener: (...args: any[]) => void): this; 16 | } 17 | 18 | interface DOMEventTarget { 19 | addEventListener(event: string, listener: (...args: any[]) => void, opts?: { once: boolean }): any; 20 | } 21 | 22 | interface EventEmitter extends NodeJS.EventEmitter {} 23 | class EventEmitter { 24 | constructor(options?: EventEmitterOptions); 25 | 26 | static once(emitter: NodeEventTarget, event: string | symbol): Promise; 27 | static once(emitter: DOMEventTarget, event: string): Promise; 28 | static on(emitter: NodeJS.EventEmitter, event: string): AsyncIterableIterator; 29 | 30 | /** @deprecated since v4.0.0 */ 31 | static listenerCount(emitter: NodeJS.EventEmitter, event: string | symbol): number; 32 | 33 | /** 34 | * This symbol shall be used to install a listener for only monitoring `'error'` 35 | * events. Listeners installed using this symbol are called before the regular 36 | * `'error'` listeners are called. 37 | * 38 | * Installing a listener using this symbol does not change the behavior once an 39 | * `'error'` event is emitted, therefore the process will still crash if no 40 | * regular `'error'` listener is installed. 41 | */ 42 | static readonly errorMonitor: unique symbol; 43 | static readonly captureRejectionSymbol: unique symbol; 44 | 45 | /** 46 | * Sets or gets the default captureRejection value for all emitters. 47 | */ 48 | // TODO: These should be described using static getter/setter pairs: 49 | static captureRejections: boolean; 50 | static defaultMaxListeners: number; 51 | } 52 | 53 | import internal = require('events'); 54 | namespace EventEmitter { 55 | // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4 56 | export { internal as EventEmitter }; 57 | } 58 | 59 | global { 60 | namespace NodeJS { 61 | interface EventEmitter { 62 | addListener(event: string | symbol, listener: (...args: any[]) => void): this; 63 | on(event: string | symbol, listener: (...args: any[]) => void): this; 64 | once(event: string | symbol, listener: (...args: any[]) => void): this; 65 | removeListener(event: string | symbol, listener: (...args: any[]) => void): this; 66 | off(event: string | symbol, listener: (...args: any[]) => void): this; 67 | removeAllListeners(event?: string | symbol): this; 68 | setMaxListeners(n: number): this; 69 | getMaxListeners(): number; 70 | listeners(event: string | symbol): Function[]; 71 | rawListeners(event: string | symbol): Function[]; 72 | emit(event: string | symbol, ...args: any[]): boolean; 73 | listenerCount(event: string | symbol): number; 74 | // Added in Node 6... 75 | prependListener(event: string | symbol, listener: (...args: any[]) => void): this; 76 | prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; 77 | eventNames(): Array; 78 | } 79 | } 80 | } 81 | 82 | export = EventEmitter; 83 | } 84 | -------------------------------------------------------------------------------- /node_modules/@types/node/globals.global.d.ts: -------------------------------------------------------------------------------- 1 | declare var global: NodeJS.Global & typeof globalThis; 2 | -------------------------------------------------------------------------------- /node_modules/@types/node/https.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:https' { 2 | export * from 'https'; 3 | } 4 | 5 | declare module 'https' { 6 | import * as tls from 'node:tls'; 7 | import * as http from 'node:http'; 8 | import { URL } from 'node:url'; 9 | 10 | type ServerOptions = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; 11 | 12 | type RequestOptions = http.RequestOptions & tls.SecureContextOptions & { 13 | rejectUnauthorized?: boolean; // Defaults to true 14 | servername?: string; // SNI TLS Extension 15 | }; 16 | 17 | interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { 18 | rejectUnauthorized?: boolean; 19 | maxCachedSessions?: number; 20 | } 21 | 22 | class Agent extends http.Agent { 23 | constructor(options?: AgentOptions); 24 | options: AgentOptions; 25 | } 26 | 27 | interface Server extends http.HttpBase {} 28 | class Server extends tls.Server { 29 | constructor(requestListener?: http.RequestListener); 30 | constructor(options: ServerOptions, requestListener?: http.RequestListener); 31 | } 32 | 33 | function createServer(requestListener?: http.RequestListener): Server; 34 | function createServer(options: ServerOptions, requestListener?: http.RequestListener): Server; 35 | function request(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; 36 | function request(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; 37 | function get(options: RequestOptions | string | URL, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; 38 | function get(url: string | URL, options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; 39 | let globalAgent: Agent; 40 | } 41 | -------------------------------------------------------------------------------- /node_modules/@types/node/index.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for non-npm package Node.js 14.14 2 | // Project: http://nodejs.org/ 3 | // Definitions by: Microsoft TypeScript 4 | // DefinitelyTyped 5 | // Alberto Schiabel 6 | // Alvis HT Tang 7 | // Andrew Makarov 8 | // Benjamin Toueg 9 | // Bruno Scheufler 10 | // Chigozirim C. 11 | // David Junger 12 | // Deividas Bakanas 13 | // Eugene Y. Q. Shen 14 | // Hannes Magnusson 15 | // Hoàng Văn Khải 16 | // Huw 17 | // Kelvin Jin 18 | // Klaus Meinhardt 19 | // Lishude 20 | // Mariusz Wiktorczyk 21 | // Mohsen Azimi 22 | // Nicolas Even 23 | // Nikita Galkin 24 | // Parambir Singh 25 | // Sebastian Silbermann 26 | // Simon Schick 27 | // Thomas den Hollander 28 | // Wilco Bakker 29 | // wwwy3y3 30 | // Samuel Ainsworth 31 | // Kyle Uehlein 32 | // Thanik Bhongbhibhat 33 | // Marcin Kopacz 34 | // Trivikram Kamat 35 | // Minh Son Nguyen 36 | // Junxiao Shi 37 | // Ilia Baryshnikov 38 | // ExE Boss 39 | // Surasak Chaisurin 40 | // Piotr Błażejewicz 41 | // Anna Henningsen 42 | // Jason Kwok 43 | // Victor Perin 44 | // Yongsheng Zhang 45 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 46 | 47 | // NOTE: These definitions support NodeJS and TypeScript 3.7. 48 | // Typically type modifications should be made in base.d.ts instead of here 49 | 50 | /// 51 | 52 | // NOTE: TypeScript version-specific augmentations can be found in the following paths: 53 | // - ~/base.d.ts - Shared definitions common to all TypeScript versions 54 | // - ~/index.d.ts - Definitions specific to TypeScript 2.8 55 | // - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5 56 | 57 | // NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides 58 | // within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions 59 | // prior to TypeScript 3.5, so the older definitions will be found here. 60 | -------------------------------------------------------------------------------- /node_modules/@types/node/module.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:module' { 2 | import Module = require('module'); 3 | export = Module; 4 | } 5 | 6 | declare module 'module' { 7 | import { URL } from 'node:url'; 8 | namespace Module { 9 | /** 10 | * Updates all the live bindings for builtin ES Modules to match the properties of the CommonJS exports. 11 | * It does not add or remove exported names from the ES Modules. 12 | */ 13 | function syncBuiltinESMExports(): void; 14 | 15 | function findSourceMap(path: string, error?: Error): SourceMap; 16 | interface SourceMapPayload { 17 | file: string; 18 | version: number; 19 | sources: string[]; 20 | sourcesContent: string[]; 21 | names: string[]; 22 | mappings: string; 23 | sourceRoot: string; 24 | } 25 | 26 | interface SourceMapping { 27 | generatedLine: number; 28 | generatedColumn: number; 29 | originalSource: string; 30 | originalLine: number; 31 | originalColumn: number; 32 | } 33 | 34 | class SourceMap { 35 | readonly payload: SourceMapPayload; 36 | constructor(payload: SourceMapPayload); 37 | findEntry(line: number, column: number): SourceMapping; 38 | } 39 | } 40 | interface Module extends NodeModule {} 41 | class Module { 42 | static runMain(): void; 43 | static wrap(code: string): string; 44 | 45 | /** 46 | * @deprecated Deprecated since: v12.2.0. Please use createRequire() instead. 47 | */ 48 | static createRequireFromPath(path: string): NodeRequire; 49 | static createRequire(path: string | URL): NodeRequire; 50 | static builtinModules: string[]; 51 | 52 | static Module: typeof Module; 53 | 54 | constructor(id: string, parent?: Module); 55 | } 56 | export = Module; 57 | } 58 | -------------------------------------------------------------------------------- /node_modules/@types/node/punycode.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @deprecated since v7.0.0 3 | * The version of the punycode module bundled in Node.js is being deprecated. 4 | * In a future major version of Node.js this module will be removed. 5 | * Users currently depending on the punycode module should switch to using 6 | * the userland-provided Punycode.js module instead. 7 | */ 8 | declare module 'node:punycode' { 9 | export * from 'punycode'; 10 | } 11 | 12 | /** 13 | * @deprecated since v7.0.0 14 | * The version of the punycode module bundled in Node.js is being deprecated. 15 | * In a future major version of Node.js this module will be removed. 16 | * Users currently depending on the punycode module should switch to using 17 | * the userland-provided Punycode.js module instead. 18 | */ 19 | declare module 'punycode' { 20 | /** 21 | * @deprecated since v7.0.0 22 | * The version of the punycode module bundled in Node.js is being deprecated. 23 | * In a future major version of Node.js this module will be removed. 24 | * Users currently depending on the punycode module should switch to using 25 | * the userland-provided Punycode.js module instead. 26 | */ 27 | function decode(string: string): string; 28 | /** 29 | * @deprecated since v7.0.0 30 | * The version of the punycode module bundled in Node.js is being deprecated. 31 | * In a future major version of Node.js this module will be removed. 32 | * Users currently depending on the punycode module should switch to using 33 | * the userland-provided Punycode.js module instead. 34 | */ 35 | function encode(string: string): string; 36 | /** 37 | * @deprecated since v7.0.0 38 | * The version of the punycode module bundled in Node.js is being deprecated. 39 | * In a future major version of Node.js this module will be removed. 40 | * Users currently depending on the punycode module should switch to using 41 | * the userland-provided Punycode.js module instead. 42 | */ 43 | function toUnicode(domain: string): string; 44 | /** 45 | * @deprecated since v7.0.0 46 | * The version of the punycode module bundled in Node.js is being deprecated. 47 | * In a future major version of Node.js this module will be removed. 48 | * Users currently depending on the punycode module should switch to using 49 | * the userland-provided Punycode.js module instead. 50 | */ 51 | function toASCII(domain: string): string; 52 | /** 53 | * @deprecated since v7.0.0 54 | * The version of the punycode module bundled in Node.js is being deprecated. 55 | * In a future major version of Node.js this module will be removed. 56 | * Users currently depending on the punycode module should switch to using 57 | * the userland-provided Punycode.js module instead. 58 | */ 59 | const ucs2: ucs2; 60 | interface ucs2 { 61 | /** 62 | * @deprecated since v7.0.0 63 | * The version of the punycode module bundled in Node.js is being deprecated. 64 | * In a future major version of Node.js this module will be removed. 65 | * Users currently depending on the punycode module should switch to using 66 | * the userland-provided Punycode.js module instead. 67 | */ 68 | decode(string: string): number[]; 69 | /** 70 | * @deprecated since v7.0.0 71 | * The version of the punycode module bundled in Node.js is being deprecated. 72 | * In a future major version of Node.js this module will be removed. 73 | * Users currently depending on the punycode module should switch to using 74 | * the userland-provided Punycode.js module instead. 75 | */ 76 | encode(codePoints: ReadonlyArray): string; 77 | } 78 | /** 79 | * @deprecated since v7.0.0 80 | * The version of the punycode module bundled in Node.js is being deprecated. 81 | * In a future major version of Node.js this module will be removed. 82 | * Users currently depending on the punycode module should switch to using 83 | * the userland-provided Punycode.js module instead. 84 | */ 85 | const version: string; 86 | } 87 | -------------------------------------------------------------------------------- /node_modules/@types/node/querystring.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:querystring' { 2 | export * from 'querystring'; 3 | } 4 | 5 | declare module 'querystring' { 6 | interface StringifyOptions { 7 | encodeURIComponent?: (str: string) => string; 8 | } 9 | 10 | interface ParseOptions { 11 | maxKeys?: number; 12 | decodeURIComponent?: (str: string) => string; 13 | } 14 | 15 | interface ParsedUrlQuery extends NodeJS.Dict { } 16 | 17 | interface ParsedUrlQueryInput extends NodeJS.Dict | ReadonlyArray | ReadonlyArray | null> { 18 | } 19 | 20 | function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; 21 | function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; 22 | /** 23 | * The querystring.encode() function is an alias for querystring.stringify(). 24 | */ 25 | const encode: typeof stringify; 26 | /** 27 | * The querystring.decode() function is an alias for querystring.parse(). 28 | */ 29 | const decode: typeof parse; 30 | function escape(str: string): string; 31 | function unescape(str: string): string; 32 | } 33 | -------------------------------------------------------------------------------- /node_modules/@types/node/string_decoder.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:string_decoder' { 2 | export * from 'string_decoder'; 3 | } 4 | 5 | declare module 'string_decoder' { 6 | class StringDecoder { 7 | constructor(encoding?: BufferEncoding); 8 | write(buffer: Buffer): string; 9 | end(buffer?: Buffer): string; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /node_modules/@types/node/timers.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:timers' { 2 | export * from 'timers'; 3 | } 4 | 5 | declare module 'timers' { 6 | function setTimeout(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout; 7 | namespace setTimeout { 8 | function __promisify__(ms: number): Promise; 9 | function __promisify__(ms: number, value: T): Promise; 10 | } 11 | function clearTimeout(timeoutId: NodeJS.Timeout): void; 12 | function setInterval(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout; 13 | function clearInterval(intervalId: NodeJS.Timeout): void; 14 | function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate; 15 | namespace setImmediate { 16 | function __promisify__(): Promise; 17 | function __promisify__(value: T): Promise; 18 | } 19 | function clearImmediate(immediateId: NodeJS.Immediate): void; 20 | } 21 | -------------------------------------------------------------------------------- /node_modules/@types/node/trace_events.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:trace_events' { 2 | export * from 'trace_events'; 3 | } 4 | 5 | declare module 'trace_events' { 6 | /** 7 | * The `Tracing` object is used to enable or disable tracing for sets of 8 | * categories. Instances are created using the 9 | * `trace_events.createTracing()` method. 10 | * 11 | * When created, the `Tracing` object is disabled. Calling the 12 | * `tracing.enable()` method adds the categories to the set of enabled trace 13 | * event categories. Calling `tracing.disable()` will remove the categories 14 | * from the set of enabled trace event categories. 15 | */ 16 | interface Tracing { 17 | /** 18 | * A comma-separated list of the trace event categories covered by this 19 | * `Tracing` object. 20 | */ 21 | readonly categories: string; 22 | 23 | /** 24 | * Disables this `Tracing` object. 25 | * 26 | * Only trace event categories _not_ covered by other enabled `Tracing` 27 | * objects and _not_ specified by the `--trace-event-categories` flag 28 | * will be disabled. 29 | */ 30 | disable(): void; 31 | 32 | /** 33 | * Enables this `Tracing` object for the set of categories covered by 34 | * the `Tracing` object. 35 | */ 36 | enable(): void; 37 | 38 | /** 39 | * `true` only if the `Tracing` object has been enabled. 40 | */ 41 | readonly enabled: boolean; 42 | } 43 | 44 | interface CreateTracingOptions { 45 | /** 46 | * An array of trace category names. Values included in the array are 47 | * coerced to a string when possible. An error will be thrown if the 48 | * value cannot be coerced. 49 | */ 50 | categories: string[]; 51 | } 52 | 53 | /** 54 | * Creates and returns a Tracing object for the given set of categories. 55 | */ 56 | function createTracing(options: CreateTracingOptions): Tracing; 57 | 58 | /** 59 | * Returns a comma-separated list of all currently-enabled trace event 60 | * categories. The current set of enabled trace event categories is 61 | * determined by the union of all currently-enabled `Tracing` objects and 62 | * any categories enabled using the `--trace-event-categories` flag. 63 | */ 64 | function getEnabledCategories(): string | undefined; 65 | } 66 | -------------------------------------------------------------------------------- /node_modules/@types/node/ts3.6/base.d.ts: -------------------------------------------------------------------------------- 1 | // NOTE: These definitions support NodeJS and TypeScript 3.6 and earlier. 2 | 3 | // NOTE: TypeScript version-specific augmentations can be found in the following paths: 4 | // - ~/base.d.ts - Shared definitions common to all TypeScript versions 5 | // - ~/index.d.ts - Definitions specific to TypeScript 3.7 and above 6 | // - ~/ts3.5/base.d.ts - Definitions specific to TypeScript 3.6 and earlier 7 | // - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.6 and earlier with assert pulled in 8 | 9 | // Reference required types from the default lib: 10 | /// 11 | /// 12 | /// 13 | /// 14 | 15 | // Base definitions for all NodeJS modules that are not specific to any version of TypeScript: 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | /// 26 | /// 27 | /// 28 | /// 29 | /// 30 | /// 31 | /// 32 | /// 33 | /// 34 | /// 35 | /// 36 | /// 37 | /// 38 | /// 39 | /// 40 | /// 41 | /// 42 | /// 43 | /// 44 | /// 45 | /// 46 | /// 47 | /// 48 | /// 49 | /// 50 | /// 51 | /// 52 | /// 53 | /// 54 | /// 55 | /// 56 | 57 | // TypeScript 3.5-specific augmentations: 58 | /// 59 | 60 | // TypeScript 3.5-specific augmentations: 61 | /// 62 | -------------------------------------------------------------------------------- /node_modules/@types/node/ts3.6/index.d.ts: -------------------------------------------------------------------------------- 1 | // NOTE: These definitions support NodeJS and TypeScript 3.5 - 3.6. 2 | // This is required to enable typing assert in ts3.7 without causing errors 3 | // Typically type modifications should be made in base.d.ts instead of here 4 | 5 | /// 6 | 7 | /// 8 | -------------------------------------------------------------------------------- /node_modules/@types/node/tty.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:tty' { 2 | export * from 'tty'; 3 | } 4 | 5 | declare module 'tty' { 6 | import * as net from 'node:net'; 7 | 8 | function isatty(fd: number): boolean; 9 | class ReadStream extends net.Socket { 10 | constructor(fd: number, options?: net.SocketConstructorOpts); 11 | isRaw: boolean; 12 | setRawMode(mode: boolean): this; 13 | isTTY: boolean; 14 | } 15 | /** 16 | * -1 - to the left from cursor 17 | * 0 - the entire line 18 | * 1 - to the right from cursor 19 | */ 20 | type Direction = -1 | 0 | 1; 21 | class WriteStream extends net.Socket { 22 | constructor(fd: number); 23 | addListener(event: string, listener: (...args: any[]) => void): this; 24 | addListener(event: "resize", listener: () => void): this; 25 | 26 | emit(event: string | symbol, ...args: any[]): boolean; 27 | emit(event: "resize"): boolean; 28 | 29 | on(event: string, listener: (...args: any[]) => void): this; 30 | on(event: "resize", listener: () => void): this; 31 | 32 | once(event: string, listener: (...args: any[]) => void): this; 33 | once(event: "resize", listener: () => void): this; 34 | 35 | prependListener(event: string, listener: (...args: any[]) => void): this; 36 | prependListener(event: "resize", listener: () => void): this; 37 | 38 | prependOnceListener(event: string, listener: (...args: any[]) => void): this; 39 | prependOnceListener(event: "resize", listener: () => void): this; 40 | 41 | /** 42 | * Clears the current line of this WriteStream in a direction identified by `dir`. 43 | */ 44 | clearLine(dir: Direction, callback?: () => void): boolean; 45 | /** 46 | * Clears this `WriteStream` from the current cursor down. 47 | */ 48 | clearScreenDown(callback?: () => void): boolean; 49 | /** 50 | * Moves this WriteStream's cursor to the specified position. 51 | */ 52 | cursorTo(x: number, y?: number, callback?: () => void): boolean; 53 | cursorTo(x: number, callback: () => void): boolean; 54 | /** 55 | * Moves this WriteStream's cursor relative to its current position. 56 | */ 57 | moveCursor(dx: number, dy: number, callback?: () => void): boolean; 58 | /** 59 | * @default `process.env` 60 | */ 61 | getColorDepth(env?: {}): number; 62 | hasColors(depth?: number): boolean; 63 | hasColors(env?: {}): boolean; 64 | hasColors(depth: number, env?: {}): boolean; 65 | getWindowSize(): [number, number]; 66 | columns: number; 67 | rows: number; 68 | isTTY: boolean; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /node_modules/@types/node/wasi.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'node:wasi' { 2 | export * from 'wasi'; 3 | } 4 | 5 | declare module 'wasi' { 6 | interface WASIOptions { 7 | /** 8 | * An array of strings that the WebAssembly application will 9 | * see as command line arguments. The first argument is the virtual path to the 10 | * WASI command itself. 11 | */ 12 | args?: string[]; 13 | 14 | /** 15 | * An object similar to `process.env` that the WebAssembly 16 | * application will see as its environment. 17 | */ 18 | env?: object; 19 | 20 | /** 21 | * This object represents the WebAssembly application's 22 | * sandbox directory structure. The string keys of `preopens` are treated as 23 | * directories within the sandbox. The corresponding values in `preopens` are 24 | * the real paths to those directories on the host machine. 25 | */ 26 | preopens?: NodeJS.Dict; 27 | 28 | /** 29 | * By default, WASI applications terminate the Node.js 30 | * process via the `__wasi_proc_exit()` function. Setting this option to `true` 31 | * causes `wasi.start()` to return the exit code rather than terminate the 32 | * process. 33 | * @default false 34 | */ 35 | returnOnExit?: boolean; 36 | 37 | /** 38 | * The file descriptor used as standard input in the WebAssembly application. 39 | * @default 0 40 | */ 41 | stdin?: number; 42 | 43 | /** 44 | * The file descriptor used as standard output in the WebAssembly application. 45 | * @default 1 46 | */ 47 | stdout?: number; 48 | 49 | /** 50 | * The file descriptor used as standard error in the WebAssembly application. 51 | * @default 2 52 | */ 53 | stderr?: number; 54 | } 55 | 56 | class WASI { 57 | constructor(options?: WASIOptions); 58 | /** 59 | * 60 | * Attempt to begin execution of `instance` by invoking its `_start()` export. 61 | * If `instance` does not contain a `_start()` export, then `start()` attempts to 62 | * invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports 63 | * is present on `instance`, then `start()` does nothing. 64 | * 65 | * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named 66 | * `memory`. If `instance` does not have a `memory` export an exception is thrown. 67 | * 68 | * If `start()` is called more than once, an exception is thrown. 69 | */ 70 | start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib. 71 | 72 | /** 73 | * Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present. 74 | * If `instance` contains a `_start()` export, then an exception is thrown. 75 | * 76 | * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named 77 | * `memory`. If `instance` does not have a `memory` export an exception is thrown. 78 | * 79 | * If `initialize()` is called more than once, an exception is thrown. 80 | */ 81 | initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib. 82 | 83 | /** 84 | * Is an object that implements the WASI system call API. This object 85 | * should be passed as the `wasi_snapshot_preview1` import during the instantiation of a 86 | * [`WebAssembly.Instance`][]. 87 | */ 88 | readonly wasiImport: NodeJS.Dict; // TODO: Narrow to DOM types 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /node_modules/accepts/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Jonathan Ong 4 | Copyright (c) 2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /node_modules/accepts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "accepts", 3 | "description": "Higher-level content negotiation", 4 | "version": "1.3.7", 5 | "contributors": [ 6 | "Douglas Christopher Wilson ", 7 | "Jonathan Ong (http://jongleberry.com)" 8 | ], 9 | "license": "MIT", 10 | "repository": "jshttp/accepts", 11 | "dependencies": { 12 | "mime-types": "~2.1.24", 13 | "negotiator": "0.6.2" 14 | }, 15 | "devDependencies": { 16 | "deep-equal": "1.0.1", 17 | "eslint": "5.16.0", 18 | "eslint-config-standard": "12.0.0", 19 | "eslint-plugin-import": "2.17.2", 20 | "eslint-plugin-markdown": "1.0.0", 21 | "eslint-plugin-node": "8.0.1", 22 | "eslint-plugin-promise": "4.1.1", 23 | "eslint-plugin-standard": "4.0.0", 24 | "mocha": "6.1.4", 25 | "nyc": "14.0.0" 26 | }, 27 | "files": [ 28 | "LICENSE", 29 | "HISTORY.md", 30 | "index.js" 31 | ], 32 | "engines": { 33 | "node": ">= 0.6" 34 | }, 35 | "scripts": { 36 | "lint": "eslint --plugin markdown --ext js,md .", 37 | "test": "mocha --reporter spec --check-leaks --bail test/", 38 | "test-cov": "nyc --reporter=html --reporter=text npm test", 39 | "test-travis": "nyc --reporter=text npm test" 40 | }, 41 | "keywords": [ 42 | "content", 43 | "negotiation", 44 | "accept", 45 | "accepts" 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /node_modules/base64-arraybuffer/.npmignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | Gruntfile.js 3 | /test/ 4 | -------------------------------------------------------------------------------- /node_modules/base64-arraybuffer/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.12' 4 | - iojs-1 5 | - iojs-2 6 | - iojs-3 7 | - '4.1' 8 | before_script: 9 | - npm install 10 | before_install: npm install -g npm@'>=2.13.5' 11 | deploy: 12 | provider: npm 13 | email: niklasvh@gmail.com 14 | api_key: 15 | secure: oHV9ArprTj5WOk7MP1UF7QMJ70huXw+y7xXb5wF4+V2H8Hyfa5TfE0DiOmqrube1WXTeH1FLgq54shp/sJWi47Hkg/GyeoB5NnsPhYEaJkaON9UG5blML+ODiNVsEnq/1kNBQ8e0+0JItMPLGySKyFmuZ3yflulXKS8O88mfINo= 16 | on: 17 | tags: true 18 | branch: master 19 | repo: niklasvh/base64-arraybuffer 20 | -------------------------------------------------------------------------------- /node_modules/base64-arraybuffer/LICENSE-MIT: -------------------------------------------------------------------------------- 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. 23 | -------------------------------------------------------------------------------- /node_modules/base64-arraybuffer/README.md: -------------------------------------------------------------------------------- 1 | # base64-arraybuffer 2 | 3 | [![Build Status](https://travis-ci.org/niklasvh/base64-arraybuffer.png)](https://travis-ci.org/niklasvh/base64-arraybuffer) 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 | ## Getting Started 10 | Install the module with: `npm install base64-arraybuffer` 11 | 12 | ## API 13 | The library encodes and decodes base64 to and from ArrayBuffers 14 | 15 | - __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string 16 | - __decode(str)__ - Decodes base64 string to `ArrayBuffer` 17 | 18 | ## License 19 | Copyright (c) 2012 Niklas von Hertzen 20 | Licensed under the MIT license. 21 | -------------------------------------------------------------------------------- /node_modules/base64-arraybuffer/lib/base64-arraybuffer.js: -------------------------------------------------------------------------------- 1 | /* 2 | * base64-arraybuffer 3 | * https://github.com/niklasvh/base64-arraybuffer 4 | * 5 | * Copyright (c) 2012 Niklas von Hertzen 6 | * Licensed under the MIT license. 7 | */ 8 | (function(chars){ 9 | "use strict"; 10 | 11 | exports.encode = function(arraybuffer) { 12 | var bytes = new Uint8Array(arraybuffer), 13 | i, len = bytes.length, base64 = ""; 14 | 15 | for (i = 0; i < len; i+=3) { 16 | base64 += chars[bytes[i] >> 2]; 17 | base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; 18 | base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; 19 | base64 += chars[bytes[i + 2] & 63]; 20 | } 21 | 22 | if ((len % 3) === 2) { 23 | base64 = base64.substring(0, base64.length - 1) + "="; 24 | } else if (len % 3 === 1) { 25 | base64 = base64.substring(0, base64.length - 2) + "=="; 26 | } 27 | 28 | return base64; 29 | }; 30 | 31 | exports.decode = function(base64) { 32 | var bufferLength = base64.length * 0.75, 33 | len = base64.length, i, p = 0, 34 | encoded1, encoded2, encoded3, encoded4; 35 | 36 | if (base64[base64.length - 1] === "=") { 37 | bufferLength--; 38 | if (base64[base64.length - 2] === "=") { 39 | bufferLength--; 40 | } 41 | } 42 | 43 | var arraybuffer = new ArrayBuffer(bufferLength), 44 | bytes = new Uint8Array(arraybuffer); 45 | 46 | for (i = 0; i < len; i+=4) { 47 | encoded1 = chars.indexOf(base64[i]); 48 | encoded2 = chars.indexOf(base64[i+1]); 49 | encoded3 = chars.indexOf(base64[i+2]); 50 | encoded4 = chars.indexOf(base64[i+3]); 51 | 52 | bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); 53 | bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); 54 | bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); 55 | } 56 | 57 | return arraybuffer; 58 | }; 59 | })("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"); 60 | -------------------------------------------------------------------------------- /node_modules/base64-arraybuffer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base64-arraybuffer", 3 | "description": "Encode/decode base64 data into ArrayBuffers", 4 | "version": "0.1.4", 5 | "homepage": "https://github.com/niklasvh/base64-arraybuffer", 6 | "author": { 7 | "name": "Niklas von Hertzen", 8 | "email": "niklasvh@gmail.com", 9 | "url": "http://hertzen.com" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/niklasvh/base64-arraybuffer" 14 | }, 15 | "bugs": { 16 | "url": "https://github.com/niklasvh/base64-arraybuffer/issues" 17 | }, 18 | "licenses": [ 19 | { 20 | "type": "MIT", 21 | "url": "https://github.com/niklasvh/base64-arraybuffer/blob/master/LICENSE-MIT" 22 | } 23 | ], 24 | "main": "lib/base64-arraybuffer", 25 | "engines": { 26 | "node": ">= 0.6.0" 27 | }, 28 | "scripts": { 29 | "test": "grunt nodeunit" 30 | }, 31 | "devDependencies": { 32 | "grunt": "^0.4.5", 33 | "grunt-cli": "^0.1.13", 34 | "grunt-contrib-jshint": "^0.11.2", 35 | "grunt-contrib-nodeunit": "^0.4.1", 36 | "grunt-contrib-watch": "^0.6.1" 37 | }, 38 | "keywords": [] 39 | } 40 | -------------------------------------------------------------------------------- /node_modules/base64id/CHANGELOG.md: -------------------------------------------------------------------------------- 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 | 17 | -------------------------------------------------------------------------------- /node_modules/base64id/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012-2016 Kristian Faeldt 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. 23 | -------------------------------------------------------------------------------- /node_modules/base64id/README.md: -------------------------------------------------------------------------------- 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(); 19 | -------------------------------------------------------------------------------- /node_modules/base64id/lib/base64id.js: -------------------------------------------------------------------------------- 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 ) 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(); 104 | -------------------------------------------------------------------------------- /node_modules/base64id/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "base64id" 3 | , "version": "2.0.0" 4 | , "license": "MIT" 5 | , "description": "Generates a base64 id" 6 | , "author": "Kristian Faeldt " 7 | , "repository": { 8 | "type": "git" 9 | , "url": "https://github.com/faeldt/base64id.git" 10 | } 11 | , "main": "./lib/base64id.js" 12 | , "engines": { "node": "^4.5.0 || >= 5.9" } 13 | } 14 | -------------------------------------------------------------------------------- /node_modules/component-emitter/History.md: -------------------------------------------------------------------------------- 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 76 | -------------------------------------------------------------------------------- /node_modules/component-emitter/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Component contributors 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. 25 | -------------------------------------------------------------------------------- /node_modules/component-emitter/Readme.md: -------------------------------------------------------------------------------- 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 75 | -------------------------------------------------------------------------------- /node_modules/component-emitter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "component-emitter", 3 | "description": "Event emitter", 4 | "version": "1.3.0", 5 | "license": "MIT", 6 | "devDependencies": { 7 | "mocha": "*", 8 | "should": "*" 9 | }, 10 | "component": { 11 | "scripts": { 12 | "emitter/index.js": "index.js" 13 | } 14 | }, 15 | "main": "index.js", 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/component/emitter.git" 19 | }, 20 | "scripts": { 21 | "test": "make test" 22 | }, 23 | "files": [ 24 | "index.js", 25 | "LICENSE" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /node_modules/cookie/HISTORY.md: -------------------------------------------------------------------------------- 1 | 0.4.1 / 2020-04-21 2 | ================== 3 | 4 | * Fix `maxAge` option to reject invalid values 5 | 6 | 0.4.0 / 2019-05-15 7 | ================== 8 | 9 | * Add `SameSite=None` support 10 | 11 | 0.3.1 / 2016-05-26 12 | ================== 13 | 14 | * Fix `sameSite: true` to work with draft-7 clients 15 | - `true` now sends `SameSite=Strict` instead of `SameSite` 16 | 17 | 0.3.0 / 2016-05-26 18 | ================== 19 | 20 | * Add `sameSite` option 21 | - Replaces `firstPartyOnly` option, never implemented by browsers 22 | * Improve error message when `encode` is not a function 23 | * Improve error message when `expires` is not a `Date` 24 | 25 | 0.2.4 / 2016-05-20 26 | ================== 27 | 28 | * perf: enable strict mode 29 | * perf: use for loop in parse 30 | * perf: use string concatination for serialization 31 | 32 | 0.2.3 / 2015-10-25 33 | ================== 34 | 35 | * Fix cookie `Max-Age` to never be a floating point number 36 | 37 | 0.2.2 / 2015-09-17 38 | ================== 39 | 40 | * Fix regression when setting empty cookie value 41 | - Ease the new restriction, which is just basic header-level validation 42 | * Fix typo in invalid value errors 43 | 44 | 0.2.1 / 2015-09-17 45 | ================== 46 | 47 | * Throw on invalid values provided to `serialize` 48 | - Ensures the resulting string is a valid HTTP header value 49 | 50 | 0.2.0 / 2015-08-13 51 | ================== 52 | 53 | * Add `firstPartyOnly` option 54 | * Throw better error for invalid argument to parse 55 | * perf: hoist regular expression 56 | 57 | 0.1.5 / 2015-09-17 58 | ================== 59 | 60 | * Fix regression when setting empty cookie value 61 | - Ease the new restriction, which is just basic header-level validation 62 | * Fix typo in invalid value errors 63 | 64 | 0.1.4 / 2015-09-17 65 | ================== 66 | 67 | * Throw better error for invalid argument to parse 68 | * Throw on invalid values provided to `serialize` 69 | - Ensures the resulting string is a valid HTTP header value 70 | 71 | 0.1.3 / 2015-05-19 72 | ================== 73 | 74 | * Reduce the scope of try-catch deopt 75 | * Remove argument reassignments 76 | 77 | 0.1.2 / 2014-04-16 78 | ================== 79 | 80 | * Remove unnecessary files from npm package 81 | 82 | 0.1.1 / 2014-02-23 83 | ================== 84 | 85 | * Fix bad parse when cookie value contained a comma 86 | * Fix support for `maxAge` of `0` 87 | 88 | 0.1.0 / 2013-05-01 89 | ================== 90 | 91 | * Add `decode` option 92 | * Add `encode` option 93 | 94 | 0.0.6 / 2013-04-08 95 | ================== 96 | 97 | * Ignore cookie parts missing `=` 98 | 99 | 0.0.5 / 2012-10-29 100 | ================== 101 | 102 | * Return raw cookie value if value unescape errors 103 | 104 | 0.0.4 / 2012-06-21 105 | ================== 106 | 107 | * Use encode/decodeURIComponent for cookie encoding/decoding 108 | - Improve server/client interoperability 109 | 110 | 0.0.3 / 2012-06-06 111 | ================== 112 | 113 | * Only escape special characters per the cookie RFC 114 | 115 | 0.0.2 / 2012-06-01 116 | ================== 117 | 118 | * Fix `maxAge` option to not throw error 119 | 120 | 0.0.1 / 2012-05-28 121 | ================== 122 | 123 | * Add more tests 124 | 125 | 0.0.0 / 2012-05-28 126 | ================== 127 | 128 | * Initial release 129 | -------------------------------------------------------------------------------- /node_modules/cookie/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012-2014 Roman Shtylman 4 | Copyright (c) 2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | -------------------------------------------------------------------------------- /node_modules/cookie/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cookie", 3 | "description": "HTTP server cookie parsing and serialization", 4 | "version": "0.4.1", 5 | "author": "Roman Shtylman ", 6 | "contributors": [ 7 | "Douglas Christopher Wilson " 8 | ], 9 | "license": "MIT", 10 | "keywords": [ 11 | "cookie", 12 | "cookies" 13 | ], 14 | "repository": "jshttp/cookie", 15 | "devDependencies": { 16 | "beautify-benchmark": "0.2.4", 17 | "benchmark": "2.1.4", 18 | "eslint": "6.8.0", 19 | "eslint-plugin-markdown": "1.0.2", 20 | "mocha": "7.1.1", 21 | "nyc": "15.0.1" 22 | }, 23 | "files": [ 24 | "HISTORY.md", 25 | "LICENSE", 26 | "README.md", 27 | "index.js" 28 | ], 29 | "engines": { 30 | "node": ">= 0.6" 31 | }, 32 | "scripts": { 33 | "bench": "node benchmark/index.js", 34 | "lint": "eslint --plugin markdown --ext js,md .", 35 | "test": "mocha --reporter spec --bail --check-leaks --ui qunit test/", 36 | "test-ci": "nyc --reporter=text npm test", 37 | "test-cov": "nyc --reporter=html --reporter=text npm test", 38 | "version": "node scripts/version-history.js && git add HISTORY.md" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /node_modules/cors/CONTRIBUTING.md: -------------------------------------------------------------------------------- 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) 34 | -------------------------------------------------------------------------------- /node_modules/cors/HISTORY.md: -------------------------------------------------------------------------------- 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 "*" 59 | -------------------------------------------------------------------------------- /node_modules/cors/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2013 Troy Goode 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. 23 | -------------------------------------------------------------------------------- /node_modules/cors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cors", 3 | "description": "Node.js CORS middleware", 4 | "version": "2.8.5", 5 | "author": "Troy Goode (https://github.com/troygoode/)", 6 | "license": "MIT", 7 | "keywords": [ 8 | "cors", 9 | "express", 10 | "connect", 11 | "middleware" 12 | ], 13 | "repository": "expressjs/cors", 14 | "main": "./lib/index.js", 15 | "dependencies": { 16 | "object-assign": "^4", 17 | "vary": "^1" 18 | }, 19 | "devDependencies": { 20 | "after": "0.8.2", 21 | "eslint": "2.13.1", 22 | "express": "4.16.3", 23 | "mocha": "5.2.0", 24 | "nyc": "13.1.0", 25 | "supertest": "3.3.0" 26 | }, 27 | "files": [ 28 | "lib/index.js", 29 | "CONTRIBUTING.md", 30 | "HISTORY.md", 31 | "LICENSE", 32 | "README.md" 33 | ], 34 | "engines": { 35 | "node": ">= 0.10" 36 | }, 37 | "scripts": { 38 | "test": "npm run lint && nyc --reporter=html --reporter=text mocha --require test/support/env", 39 | "lint": "eslint lib test" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /node_modules/debug/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 TJ Holowaychuk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 6 | and associated documentation files (the 'Software'), to deal in the Software without restriction, 7 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 9 | subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial 12 | portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 15 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 17 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 18 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | -------------------------------------------------------------------------------- /node_modules/debug/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debug", 3 | "version": "4.3.1", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/visionmedia/debug.git" 7 | }, 8 | "description": "small debugging utility", 9 | "keywords": [ 10 | "debug", 11 | "log", 12 | "debugger" 13 | ], 14 | "files": [ 15 | "src", 16 | "LICENSE", 17 | "README.md" 18 | ], 19 | "author": "TJ Holowaychuk ", 20 | "contributors": [ 21 | "Nathan Rajlich (http://n8.io)", 22 | "Andrew Rhyne ", 23 | "Josh Junon " 24 | ], 25 | "license": "MIT", 26 | "scripts": { 27 | "lint": "xo", 28 | "test": "npm run test:node && npm run test:browser && npm run lint", 29 | "test:node": "istanbul cover _mocha -- test.js", 30 | "test:browser": "karma start --single-run", 31 | "test:coverage": "cat ./coverage/lcov.info | coveralls" 32 | }, 33 | "dependencies": { 34 | "ms": "2.1.2" 35 | }, 36 | "devDependencies": { 37 | "brfs": "^2.0.1", 38 | "browserify": "^16.2.3", 39 | "coveralls": "^3.0.2", 40 | "istanbul": "^0.4.5", 41 | "karma": "^3.1.4", 42 | "karma-browserify": "^6.0.0", 43 | "karma-chrome-launcher": "^2.2.0", 44 | "karma-mocha": "^1.3.0", 45 | "mocha": "^5.2.0", 46 | "mocha-lcov-reporter": "^1.2.0", 47 | "xo": "^0.23.0" 48 | }, 49 | "peerDependenciesMeta": { 50 | "supports-color": { 51 | "optional": true 52 | } 53 | }, 54 | "main": "./src/index.js", 55 | "browser": "./src/browser.js", 56 | "engines": { 57 | "node": ">=6.0" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /node_modules/debug/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Detect Electron renderer / nwjs process, which is node, but we should 3 | * treat as a browser. 4 | */ 5 | 6 | if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { 7 | module.exports = require('./browser.js'); 8 | } else { 9 | module.exports = require('./node.js'); 10 | } 11 | -------------------------------------------------------------------------------- /node_modules/engine.io-parser/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [4.0.2](https://github.com/socketio/engine.io-parser/compare/4.0.1...4.0.2) (2020-12-07) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * add base64-arraybuffer as prod dependency ([2ccdeb2](https://github.com/socketio/engine.io-parser/commit/2ccdeb277955bed8742a29f2dcbbf57ca95eb12a)) 7 | 8 | 9 | ## [2.2.1](https://github.com/socketio/engine.io-parser/compare/2.2.0...2.2.1) (2020-09-30) 10 | 11 | 12 | ## [4.0.1](https://github.com/socketio/engine.io-parser/compare/4.0.0...4.0.1) (2020-09-10) 13 | 14 | 15 | ### Bug Fixes 16 | 17 | * use a terser-compatible representation of the separator ([886f9ea](https://github.com/socketio/engine.io-parser/commit/886f9ea7c4e717573152c31320f6fb6c6664061b)) 18 | 19 | 20 | # [4.0.0](https://github.com/socketio/engine.io-parser/compare/v4.0.0-alpha.1...4.0.0) (2020-09-08) 21 | 22 | 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). 23 | 24 | Encoding changes between v3 and v4: 25 | 26 | - encodePacket with string 27 | - input: `{ type: "message", data: "hello" }` 28 | - output in v3: `"4hello"` 29 | - output in v4: `"4hello"` 30 | 31 | - encodePacket with binary 32 | - input: `{ type: 'message', data: }` 33 | - output in v3: `` 34 | - output in v4: `` 35 | 36 | - encodePayload with strings 37 | - input: `[ { type: 'message', data: 'hello' }, { type: 'message', data: '€€€' } ]` 38 | - output in v3: `"6:4hello4:4€€€"` 39 | - output in v4: `"4hello\x1e4€€€"` 40 | 41 | - encodePayload with string and binary 42 | - input: `[ { type: 'message', data: 'hello' }, { type: 'message', data: } ]` 43 | - output in v3: `` 44 | - output in v4: `"4hello\x1ebAQID"` 45 | 46 | Please note that the parser is now dependency-free! This should help reduce the size of the browser bundle. 47 | 48 | ### Bug Fixes 49 | 50 | * keep track of the buffer initial length ([8edf2d1](https://github.com/socketio/engine.io-parser/commit/8edf2d1478026da442f519c2d2521af43ba01832)) 51 | 52 | 53 | ### Features 54 | 55 | * restore the upgrade mechanism ([6efedfa](https://github.com/socketio/engine.io-parser/commit/6efedfa0f3048506a4ba99e70674ddf4c0732e0c)) 56 | 57 | 58 | 59 | # [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) 60 | 61 | 62 | ### Features 63 | 64 | * implement the version 4 of the protocol ([cab7db0](https://github.com/socketio/engine.io-parser/commit/cab7db0404e0a69f86a05ececd62c8c31f4d97d5)) 65 | 66 | 67 | 68 | # [4.0.0-alpha.0](https://github.com/socketio/engine.io-parser/compare/2.2.0...v4.0.0-alpha.0) (2020-02-04) 69 | 70 | 71 | ### Bug Fixes 72 | 73 | * properly decode binary packets ([5085373](https://github.com/socketio/engine.io-parser/commit/50853738e0c6c16f9cee0d7887651155f4b78240)) 74 | 75 | 76 | ### Features 77 | 78 | * remove packet type when encoding binary packets ([a947ae5](https://github.com/socketio/engine.io-parser/commit/a947ae59a2844e4041db58ff36b270d1528b3bee)) 79 | 80 | 81 | ### BREAKING CHANGES 82 | 83 | * the packet containing binary data will now be sent without any transformation 84 | 85 | Protocol v3: { type: 'message', data: } => 86 | Protocol v4: { type: 'message', data: } => 87 | 88 | 89 | 90 | # [2.2.0](https://github.com/socketio/engine.io-parser/compare/2.1.3...2.2.0) (2019-09-13) 91 | 92 | 93 | * [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) 94 | 95 | 96 | ### BREAKING CHANGES 97 | 98 | * drop support for Node.js 4 (since Buffer.allocUnsafe was added in v5.10.0) 99 | 100 | Reference: https://nodejs.org/docs/latest/api/buffer.html#buffer_class_method_buffer_allocunsafe_size 101 | -------------------------------------------------------------------------------- /node_modules/engine.io-parser/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2016 Guillermo Rauch (@rauchg) 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. -------------------------------------------------------------------------------- /node_modules/engine.io-parser/lib/commons.js: -------------------------------------------------------------------------------- 1 | const PACKET_TYPES = Object.create(null); // no Map = no polyfill 2 | PACKET_TYPES["open"] = "0"; 3 | PACKET_TYPES["close"] = "1"; 4 | PACKET_TYPES["ping"] = "2"; 5 | PACKET_TYPES["pong"] = "3"; 6 | PACKET_TYPES["message"] = "4"; 7 | PACKET_TYPES["upgrade"] = "5"; 8 | PACKET_TYPES["noop"] = "6"; 9 | 10 | const PACKET_TYPES_REVERSE = Object.create(null); 11 | Object.keys(PACKET_TYPES).forEach(key => { 12 | PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key; 13 | }); 14 | 15 | const ERROR_PACKET = { type: "error", data: "parser error" }; 16 | 17 | module.exports = { 18 | PACKET_TYPES, 19 | PACKET_TYPES_REVERSE, 20 | ERROR_PACKET 21 | }; 22 | -------------------------------------------------------------------------------- /node_modules/engine.io-parser/lib/decodePacket.browser.js: -------------------------------------------------------------------------------- 1 | const { PACKET_TYPES_REVERSE, ERROR_PACKET } = require("./commons"); 2 | 3 | const withNativeArrayBuffer = typeof ArrayBuffer === "function"; 4 | 5 | let base64decoder; 6 | if (withNativeArrayBuffer) { 7 | base64decoder = require("base64-arraybuffer"); 8 | } 9 | 10 | const decodePacket = (encodedPacket, binaryType) => { 11 | if (typeof encodedPacket !== "string") { 12 | return { 13 | type: "message", 14 | data: mapBinary(encodedPacket, binaryType) 15 | }; 16 | } 17 | const type = encodedPacket.charAt(0); 18 | if (type === "b") { 19 | return { 20 | type: "message", 21 | data: decodeBase64Packet(encodedPacket.substring(1), binaryType) 22 | }; 23 | } 24 | const packetType = PACKET_TYPES_REVERSE[type]; 25 | if (!packetType) { 26 | return ERROR_PACKET; 27 | } 28 | return encodedPacket.length > 1 29 | ? { 30 | type: PACKET_TYPES_REVERSE[type], 31 | data: encodedPacket.substring(1) 32 | } 33 | : { 34 | type: PACKET_TYPES_REVERSE[type] 35 | }; 36 | }; 37 | 38 | const decodeBase64Packet = (data, binaryType) => { 39 | if (base64decoder) { 40 | const decoded = base64decoder.decode(data); 41 | return mapBinary(decoded, binaryType); 42 | } else { 43 | return { base64: true, data }; // fallback for old browsers 44 | } 45 | }; 46 | 47 | const mapBinary = (data, binaryType) => { 48 | switch (binaryType) { 49 | case "blob": 50 | return data instanceof ArrayBuffer ? new Blob([data]) : data; 51 | case "arraybuffer": 52 | default: 53 | return data; // assuming the data is already an ArrayBuffer 54 | } 55 | }; 56 | 57 | module.exports = decodePacket; 58 | -------------------------------------------------------------------------------- /node_modules/engine.io-parser/lib/decodePacket.js: -------------------------------------------------------------------------------- 1 | const { PACKET_TYPES_REVERSE, ERROR_PACKET } = require("./commons"); 2 | 3 | const decodePacket = (encodedPacket, binaryType) => { 4 | if (typeof encodedPacket !== "string") { 5 | return { 6 | type: "message", 7 | data: mapBinary(encodedPacket, binaryType) 8 | }; 9 | } 10 | const type = encodedPacket.charAt(0); 11 | if (type === "b") { 12 | const buffer = Buffer.from(encodedPacket.substring(1), "base64"); 13 | return { 14 | type: "message", 15 | data: mapBinary(buffer, binaryType) 16 | }; 17 | } 18 | if (!PACKET_TYPES_REVERSE[type]) { 19 | return ERROR_PACKET; 20 | } 21 | return encodedPacket.length > 1 22 | ? { 23 | type: PACKET_TYPES_REVERSE[type], 24 | data: encodedPacket.substring(1) 25 | } 26 | : { 27 | type: PACKET_TYPES_REVERSE[type] 28 | }; 29 | }; 30 | 31 | const mapBinary = (data, binaryType) => { 32 | const isBuffer = Buffer.isBuffer(data); 33 | switch (binaryType) { 34 | case "arraybuffer": 35 | return isBuffer ? toArrayBuffer(data) : data; 36 | case "nodebuffer": 37 | default: 38 | return data; // assuming the data is already a Buffer 39 | } 40 | }; 41 | 42 | const toArrayBuffer = buffer => { 43 | const arrayBuffer = new ArrayBuffer(buffer.length); 44 | const view = new Uint8Array(arrayBuffer); 45 | for (let i = 0; i < buffer.length; i++) { 46 | view[i] = buffer[i]; 47 | } 48 | return arrayBuffer; 49 | }; 50 | 51 | module.exports = decodePacket; 52 | -------------------------------------------------------------------------------- /node_modules/engine.io-parser/lib/encodePacket.browser.js: -------------------------------------------------------------------------------- 1 | const { PACKET_TYPES } = require("./commons"); 2 | 3 | const withNativeBlob = 4 | typeof Blob === "function" || 5 | (typeof Blob !== "undefined" && 6 | Object.prototype.toString.call(Blob) === "[object BlobConstructor]"); 7 | const withNativeArrayBuffer = typeof ArrayBuffer === "function"; 8 | 9 | // ArrayBuffer.isView method is not defined in IE10 10 | const isView = obj => { 11 | return typeof ArrayBuffer.isView === "function" 12 | ? ArrayBuffer.isView(obj) 13 | : obj && obj.buffer instanceof ArrayBuffer; 14 | }; 15 | 16 | const encodePacket = ({ type, data }, supportsBinary, callback) => { 17 | if (withNativeBlob && data instanceof Blob) { 18 | if (supportsBinary) { 19 | return callback(data); 20 | } else { 21 | return encodeBlobAsBase64(data, callback); 22 | } 23 | } else if ( 24 | withNativeArrayBuffer && 25 | (data instanceof ArrayBuffer || isView(data)) 26 | ) { 27 | if (supportsBinary) { 28 | return callback(data instanceof ArrayBuffer ? data : data.buffer); 29 | } else { 30 | return encodeBlobAsBase64(new Blob([data]), callback); 31 | } 32 | } 33 | // plain string 34 | return callback(PACKET_TYPES[type] + (data || "")); 35 | }; 36 | 37 | const encodeBlobAsBase64 = (data, callback) => { 38 | const fileReader = new FileReader(); 39 | fileReader.onload = function() { 40 | const content = fileReader.result.split(",")[1]; 41 | callback("b" + content); 42 | }; 43 | return fileReader.readAsDataURL(data); 44 | }; 45 | 46 | module.exports = encodePacket; 47 | -------------------------------------------------------------------------------- /node_modules/engine.io-parser/lib/encodePacket.js: -------------------------------------------------------------------------------- 1 | const { PACKET_TYPES } = require("./commons"); 2 | 3 | const encodePacket = ({ type, data }, supportsBinary, callback) => { 4 | if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) { 5 | const buffer = toBuffer(data); 6 | return callback(encodeBuffer(buffer, supportsBinary)); 7 | } 8 | // plain string 9 | return callback(PACKET_TYPES[type] + (data || "")); 10 | }; 11 | 12 | const toBuffer = data => { 13 | if (Buffer.isBuffer(data)) { 14 | return data; 15 | } else if (data instanceof ArrayBuffer) { 16 | return Buffer.from(data); 17 | } else { 18 | return Buffer.from(data.buffer, data.byteOffset, data.byteLength); 19 | } 20 | }; 21 | 22 | // only 'message' packets can contain binary, so the type prefix is not needed 23 | const encodeBuffer = (data, supportsBinary) => { 24 | return supportsBinary ? data : "b" + data.toString("base64"); 25 | }; 26 | 27 | module.exports = encodePacket; 28 | -------------------------------------------------------------------------------- /node_modules/engine.io-parser/lib/index.js: -------------------------------------------------------------------------------- 1 | const encodePacket = require("./encodePacket"); 2 | const decodePacket = require("./decodePacket"); 3 | 4 | const SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text 5 | 6 | const encodePayload = (packets, callback) => { 7 | // some packets may be added to the array while encoding, so the initial length must be saved 8 | const length = packets.length; 9 | const encodedPackets = new Array(length); 10 | let count = 0; 11 | 12 | packets.forEach((packet, i) => { 13 | // force base64 encoding for binary packets 14 | encodePacket(packet, false, encodedPacket => { 15 | encodedPackets[i] = encodedPacket; 16 | if (++count === length) { 17 | callback(encodedPackets.join(SEPARATOR)); 18 | } 19 | }); 20 | }); 21 | }; 22 | 23 | const decodePayload = (encodedPayload, binaryType) => { 24 | const encodedPackets = encodedPayload.split(SEPARATOR); 25 | const packets = []; 26 | for (let i = 0; i < encodedPackets.length; i++) { 27 | const decodedPacket = decodePacket(encodedPackets[i], binaryType); 28 | packets.push(decodedPacket); 29 | if (decodedPacket.type === "error") { 30 | break; 31 | } 32 | } 33 | return packets; 34 | }; 35 | 36 | module.exports = { 37 | protocol: 4, 38 | encodePacket, 39 | encodePayload, 40 | decodePacket, 41 | decodePayload 42 | }; 43 | -------------------------------------------------------------------------------- /node_modules/engine.io-parser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "engine.io-parser", 3 | "description": "Parser for the client for the realtime Engine", 4 | "license": "MIT", 5 | "version": "4.0.2", 6 | "main": "lib/index.js", 7 | "homepage": "https://github.com/socketio/engine.io-parser", 8 | "devDependencies": { 9 | "@babel/core": "~7.9.6", 10 | "@babel/preset-env": "~7.9.6", 11 | "babel-eslint": "^10.0.3", 12 | "babelify": "^10.0.0", 13 | "benchmark": "^2.1.4", 14 | "eslint": "^6.8.0", 15 | "eslint-config-prettier": "^6.9.0", 16 | "expect.js": "0.3.1", 17 | "mocha": "^5.2.0", 18 | "nyc": "~15.0.1", 19 | "prettier": "^1.19.1", 20 | "socket.io-browsers": "^1.0.4", 21 | "zuul": "3.11.1", 22 | "zuul-ngrok": "4.0.0" 23 | }, 24 | "dependencies": { 25 | "base64-arraybuffer": "0.1.4" 26 | }, 27 | "scripts": { 28 | "test": "npm run lint && npm run format:check && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi", 29 | "test:node": "nyc mocha test/index.js", 30 | "test:browser": "zuul test/index.js --no-coverage", 31 | "format:check": "prettier --check 'lib/**/*.js' 'test/**/*.js'", 32 | "format:fix": "prettier --write 'lib/**/*.js' 'test/**/*.js'", 33 | "lint": "eslint 'lib/**/*.js' 'test/**/*.js'" 34 | }, 35 | "repository": { 36 | "type": "git", 37 | "url": "git@github.com:socketio/engine.io-parser.git" 38 | }, 39 | "files": [ 40 | "lib/" 41 | ], 42 | "browser": { 43 | "./lib/encodePacket.js": "./lib/encodePacket.browser.js", 44 | "./lib/decodePacket.js": "./lib/decodePacket.browser.js" 45 | }, 46 | "engines": { 47 | "node": ">=8.0.0" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /node_modules/engine.io/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Guillermo Rauch 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 6 | and associated documentation files (the 'Software'), to deal in the Software without restriction, 7 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 8 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or 12 | substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 15 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 16 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | 20 | -------------------------------------------------------------------------------- /node_modules/engine.io/lib/engine.io.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Module dependencies. 3 | */ 4 | 5 | const http = require("http"); 6 | const Server = require("./server"); 7 | 8 | /** 9 | * Invoking the library as a function delegates to attach if the first argument 10 | * is an `http.Server`. 11 | * 12 | * If there are no arguments or the first argument is an options object, then 13 | * a new Server instance is returned. 14 | * 15 | * @param {http.Server} server (if specified, will be attached to by the new Server instance) 16 | * @param {Object} options 17 | * @return {Server} engine server 18 | * @api public 19 | */ 20 | 21 | exports = module.exports = function() { 22 | // backwards compatible use as `.attach` 23 | // if first argument is an http server 24 | if (arguments.length && arguments[0] instanceof http.Server) { 25 | return attach.apply(this, arguments); 26 | } 27 | 28 | // if first argument is not an http server, then just make a regular eio server 29 | return new Server(...arguments); 30 | }; 31 | 32 | /** 33 | * Protocol revision number. 34 | * 35 | * @api public 36 | */ 37 | 38 | exports.protocol = 1; 39 | 40 | /** 41 | * Expose Server constructor. 42 | * 43 | * @api public 44 | */ 45 | 46 | exports.Server = Server; 47 | 48 | /** 49 | * Expose Socket constructor. 50 | * 51 | * @api public 52 | */ 53 | 54 | exports.Socket = require("./socket"); 55 | 56 | /** 57 | * Expose Transport constructor. 58 | * 59 | * @api public 60 | */ 61 | 62 | exports.Transport = require("./transport"); 63 | 64 | /** 65 | * Expose mutable list of available transports. 66 | * 67 | * @api public 68 | */ 69 | 70 | exports.transports = require("./transports"); 71 | 72 | /** 73 | * Exports parser. 74 | * 75 | * @api public 76 | */ 77 | 78 | exports.parser = require("engine.io-parser"); 79 | 80 | /** 81 | * Creates an http.Server exclusively used for WS upgrades. 82 | * 83 | * @param {Number} port 84 | * @param {Function} callback 85 | * @param {Object} options 86 | * @return {Server} websocket.io server 87 | * @api public 88 | */ 89 | 90 | exports.listen = listen; 91 | 92 | function listen(port, options, fn) { 93 | if ("function" === typeof options) { 94 | fn = options; 95 | options = {}; 96 | } 97 | 98 | const server = http.createServer(function(req, res) { 99 | res.writeHead(501); 100 | res.end("Not Implemented"); 101 | }); 102 | 103 | // create engine server 104 | const engine = exports.attach(server, options); 105 | engine.httpServer = server; 106 | 107 | server.listen(port, fn); 108 | 109 | return engine; 110 | } 111 | 112 | /** 113 | * Captures upgrade requests for a http.Server. 114 | * 115 | * @param {http.Server} server 116 | * @param {Object} options 117 | * @return {Server} engine server 118 | * @api public 119 | */ 120 | 121 | exports.attach = attach; 122 | 123 | function attach(server, options) { 124 | const engine = new Server(options); 125 | engine.attach(server, options); 126 | return engine; 127 | } 128 | -------------------------------------------------------------------------------- /node_modules/engine.io/lib/transport.js: -------------------------------------------------------------------------------- 1 | const EventEmitter = require("events"); 2 | const parser_v4 = require("engine.io-parser"); 3 | const parser_v3 = require("./parser-v3/index"); 4 | const debug = require("debug")("engine:transport"); 5 | 6 | /** 7 | * Noop function. 8 | * 9 | * @api private 10 | */ 11 | 12 | function noop() {} 13 | 14 | class Transport extends EventEmitter { 15 | /** 16 | * Transport constructor. 17 | * 18 | * @param {http.IncomingMessage} request 19 | * @api public 20 | */ 21 | constructor(req) { 22 | super(); 23 | this.readyState = "open"; 24 | this.discarded = false; 25 | this.protocol = req._query.EIO === "4" ? 4 : 3; // 3rd revision by default 26 | this.parser = this.protocol === 4 ? parser_v4 : parser_v3; 27 | } 28 | 29 | /** 30 | * Flags the transport as discarded. 31 | * 32 | * @api private 33 | */ 34 | discard() { 35 | this.discarded = true; 36 | } 37 | 38 | /** 39 | * Called with an incoming HTTP request. 40 | * 41 | * @param {http.IncomingMessage} request 42 | * @api private 43 | */ 44 | onRequest(req) { 45 | debug("setting request"); 46 | this.req = req; 47 | } 48 | 49 | /** 50 | * Closes the transport. 51 | * 52 | * @api private 53 | */ 54 | close(fn) { 55 | if ("closed" === this.readyState || "closing" === this.readyState) return; 56 | 57 | this.readyState = "closing"; 58 | this.doClose(fn || noop); 59 | } 60 | 61 | /** 62 | * Called with a transport error. 63 | * 64 | * @param {String} message error 65 | * @param {Object} error description 66 | * @api private 67 | */ 68 | onError(msg, desc) { 69 | if (this.listeners("error").length) { 70 | const err = new Error(msg); 71 | err.type = "TransportError"; 72 | err.description = desc; 73 | this.emit("error", err); 74 | } else { 75 | debug("ignored transport error %s (%s)", msg, desc); 76 | } 77 | } 78 | 79 | /** 80 | * Called with parsed out a packets from the data stream. 81 | * 82 | * @param {Object} packet 83 | * @api private 84 | */ 85 | onPacket(packet) { 86 | this.emit("packet", packet); 87 | } 88 | 89 | /** 90 | * Called with the encoded packet data. 91 | * 92 | * @param {String} data 93 | * @api private 94 | */ 95 | onData(data) { 96 | this.onPacket(this.parser.decodePacket(data)); 97 | } 98 | 99 | /** 100 | * Called upon transport close. 101 | * 102 | * @api private 103 | */ 104 | onClose() { 105 | this.readyState = "closed"; 106 | this.emit("close"); 107 | } 108 | } 109 | 110 | module.exports = Transport; 111 | -------------------------------------------------------------------------------- /node_modules/engine.io/lib/transports/index.js: -------------------------------------------------------------------------------- 1 | const XHR = require("./polling"); 2 | const JSONP = require("./polling-jsonp"); 3 | 4 | /** 5 | * Export transports. 6 | */ 7 | 8 | module.exports = exports = { 9 | polling: polling, 10 | websocket: require("./websocket") 11 | }; 12 | 13 | /** 14 | * Export upgrades map. 15 | */ 16 | 17 | exports.polling.upgradesTo = ["websocket"]; 18 | 19 | /** 20 | * Polling polymorphic constructor. 21 | * 22 | * @api private 23 | */ 24 | 25 | function polling(req) { 26 | if ("string" === typeof req._query.j) { 27 | return new JSONP(req); 28 | } else { 29 | return new XHR(req); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /node_modules/engine.io/lib/transports/polling-jsonp.js: -------------------------------------------------------------------------------- 1 | const Polling = require("./polling"); 2 | const qs = require("querystring"); 3 | const rDoubleSlashes = /\\\\n/g; 4 | const rSlashes = /(\\)?\\n/g; 5 | 6 | class JSONP extends Polling { 7 | /** 8 | * JSON-P polling transport. 9 | * 10 | * @api public 11 | */ 12 | constructor(req) { 13 | super(req); 14 | 15 | this.head = "___eio[" + (req._query.j || "").replace(/[^0-9]/g, "") + "]("; 16 | this.foot = ");"; 17 | } 18 | 19 | /** 20 | * Handles incoming data. 21 | * Due to a bug in \n handling by browsers, we expect a escaped string. 22 | * 23 | * @api private 24 | */ 25 | onData(data) { 26 | // we leverage the qs module so that we get built-in DoS protection 27 | // and the fast alternative to decodeURIComponent 28 | data = qs.parse(data).d; 29 | if ("string" === typeof data) { 30 | // client will send already escaped newlines as \\\\n and newlines as \\n 31 | // \\n must be replaced with \n and \\\\n with \\n 32 | data = data.replace(rSlashes, function(match, slashes) { 33 | return slashes ? match : "\n"; 34 | }); 35 | super.onData(data.replace(rDoubleSlashes, "\\n")); 36 | } 37 | } 38 | 39 | /** 40 | * Performs the write. 41 | * 42 | * @api private 43 | */ 44 | doWrite(data, options, callback) { 45 | // we must output valid javascript, not valid json 46 | // see: http://timelessrepo.com/json-isnt-a-javascript-subset 47 | const js = JSON.stringify(data) 48 | .replace(/\u2028/g, "\\u2028") 49 | .replace(/\u2029/g, "\\u2029"); 50 | 51 | // prepare response 52 | data = this.head + js + this.foot; 53 | 54 | super.doWrite(data, options, callback); 55 | } 56 | } 57 | 58 | module.exports = JSONP; 59 | -------------------------------------------------------------------------------- /node_modules/engine.io/lib/transports/websocket.js: -------------------------------------------------------------------------------- 1 | const Transport = require("../transport"); 2 | const debug = require("debug")("engine:ws"); 3 | 4 | class WebSocket extends Transport { 5 | /** 6 | * WebSocket transport 7 | * 8 | * @param {http.IncomingMessage} 9 | * @api public 10 | */ 11 | constructor(req) { 12 | super(req); 13 | this.socket = req.websocket; 14 | this.socket.on("message", this.onData.bind(this)); 15 | this.socket.once("close", this.onClose.bind(this)); 16 | this.socket.on("error", this.onError.bind(this)); 17 | this.socket.on("headers", headers => { 18 | this.emit("headers", headers); 19 | }); 20 | this.writable = true; 21 | this.perMessageDeflate = null; 22 | } 23 | 24 | /** 25 | * Transport name 26 | * 27 | * @api public 28 | */ 29 | get name() { 30 | return "websocket"; 31 | } 32 | 33 | /** 34 | * Advertise upgrade support. 35 | * 36 | * @api public 37 | */ 38 | get handlesUpgrades() { 39 | return true; 40 | } 41 | 42 | /** 43 | * Advertise framing support. 44 | * 45 | * @api public 46 | */ 47 | get supportsFraming() { 48 | return true; 49 | } 50 | 51 | /** 52 | * Processes the incoming data. 53 | * 54 | * @param {String} encoded packet 55 | * @api private 56 | */ 57 | onData(data) { 58 | debug('received "%s"', data); 59 | super.onData(data); 60 | } 61 | 62 | /** 63 | * Writes a packet payload. 64 | * 65 | * @param {Array} packets 66 | * @api private 67 | */ 68 | send(packets) { 69 | var self = this; 70 | 71 | for (var i = 0; i < packets.length; i++) { 72 | var packet = packets[i]; 73 | this.parser.encodePacket(packet, self.supportsBinary, send); 74 | } 75 | 76 | function send(data) { 77 | debug('writing "%s"', data); 78 | 79 | // always creates a new object since ws modifies it 80 | var opts = {}; 81 | if (packet.options) { 82 | opts.compress = packet.options.compress; 83 | } 84 | 85 | if (self.perMessageDeflate) { 86 | var len = 87 | "string" === typeof data ? Buffer.byteLength(data) : data.length; 88 | if (len < self.perMessageDeflate.threshold) { 89 | opts.compress = false; 90 | } 91 | } 92 | 93 | self.writable = false; 94 | self.socket.send(data, opts, onEnd); 95 | } 96 | 97 | function onEnd(err) { 98 | if (err) return self.onError("write error", err.stack); 99 | self.writable = true; 100 | self.emit("drain"); 101 | } 102 | } 103 | 104 | /** 105 | * Closes the transport. 106 | * 107 | * @api private 108 | */ 109 | doClose(fn) { 110 | debug("closing"); 111 | this.socket.close(); 112 | fn && fn(); 113 | } 114 | } 115 | 116 | module.exports = WebSocket; 117 | -------------------------------------------------------------------------------- /node_modules/engine.io/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "engine.io", 3 | "version": "5.0.0", 4 | "description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server", 5 | "main": "lib/engine.io.js", 6 | "author": "Guillermo Rauch ", 7 | "homepage": "https://github.com/socketio/engine.io", 8 | "contributors": [ 9 | { 10 | "name": "Eugen Dueck", 11 | "web": "https://github.com/EugenDueck" 12 | }, 13 | { 14 | "name": "Afshin Mehrabani", 15 | "web": "https://github.com/afshinm" 16 | }, 17 | { 18 | "name": "Christoph Dorn", 19 | "web": "https://github.com/cadorn" 20 | }, 21 | { 22 | "name": "Mark Mokryn", 23 | "email": "mokesmokes@gmail.com" 24 | } 25 | ], 26 | "license": "MIT", 27 | "dependencies": { 28 | "accepts": "~1.3.4", 29 | "base64id": "2.0.0", 30 | "cookie": "~0.4.1", 31 | "cors": "~2.8.5", 32 | "debug": "~4.3.1", 33 | "engine.io-parser": "~4.0.0", 34 | "ws": "~7.4.2" 35 | }, 36 | "devDependencies": { 37 | "babel-eslint": "^8.0.2", 38 | "eiows": "^3.3.0", 39 | "engine.io-client": "5.0.0", 40 | "engine.io-client-v3": "npm:engine.io-client@3.5.0", 41 | "eslint": "^4.19.1", 42 | "eslint-config-prettier": "^6.9.0", 43 | "expect.js": "^0.3.1", 44 | "mocha": "^4.0.1", 45 | "prettier": "^1.19.1", 46 | "s": "0.1.1", 47 | "superagent": "^3.8.1" 48 | }, 49 | "scripts": { 50 | "lint": "eslint lib/ test/ *.js", 51 | "test": "npm run lint && npm run format:check && mocha && EIO_CLIENT=3 mocha && EIO_WS_ENGINE=eiows mocha", 52 | "format:check": "prettier --check 'lib/**/*.js' 'test/**/*.js'", 53 | "format:fix": "prettier --write 'lib/**/*.js' 'test/**/*.js'" 54 | }, 55 | "repository": { 56 | "type": "git", 57 | "url": "git@github.com:socketio/engine.io.git" 58 | }, 59 | "files": [ 60 | "lib/" 61 | ], 62 | "engines": { 63 | "node": ">=10.0.0" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /node_modules/mime-db/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Jonathan Ong me@jongleberry.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /node_modules/mime-db/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * mime-db 3 | * Copyright(c) 2014 Jonathan Ong 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module exports. 9 | */ 10 | 11 | module.exports = require('./db.json') 12 | -------------------------------------------------------------------------------- /node_modules/mime-db/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mime-db", 3 | "description": "Media Type Database", 4 | "version": "1.47.0", 5 | "contributors": [ 6 | "Douglas Christopher Wilson ", 7 | "Jonathan Ong (http://jongleberry.com)", 8 | "Robert Kieffer (http://github.com/broofa)" 9 | ], 10 | "license": "MIT", 11 | "keywords": [ 12 | "mime", 13 | "db", 14 | "type", 15 | "types", 16 | "database", 17 | "charset", 18 | "charsets" 19 | ], 20 | "repository": "jshttp/mime-db", 21 | "devDependencies": { 22 | "bluebird": "3.7.2", 23 | "co": "4.6.0", 24 | "cogent": "1.0.1", 25 | "csv-parse": "4.15.3", 26 | "eslint": "7.23.0", 27 | "eslint-config-standard": "15.0.1", 28 | "eslint-plugin-import": "2.22.1", 29 | "eslint-plugin-markdown": "2.0.0", 30 | "eslint-plugin-node": "11.1.0", 31 | "eslint-plugin-promise": "4.3.1", 32 | "eslint-plugin-standard": "4.1.0", 33 | "gnode": "0.1.2", 34 | "mocha": "8.3.2", 35 | "nyc": "15.1.0", 36 | "raw-body": "2.4.1", 37 | "stream-to-array": "2.3.0" 38 | }, 39 | "files": [ 40 | "HISTORY.md", 41 | "LICENSE", 42 | "README.md", 43 | "db.json", 44 | "index.js" 45 | ], 46 | "engines": { 47 | "node": ">= 0.6" 48 | }, 49 | "scripts": { 50 | "build": "node scripts/build", 51 | "fetch": "node scripts/fetch-apache && gnode scripts/fetch-iana && node scripts/fetch-nginx", 52 | "lint": "eslint .", 53 | "test": "mocha --reporter spec --bail --check-leaks test/", 54 | "test-ci": "nyc --reporter=lcov --reporter=text npm test", 55 | "test-cov": "nyc --reporter=html --reporter=text npm test", 56 | "update": "npm run fetch && npm run build", 57 | "version": "node scripts/version-history.js && git add HISTORY.md" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /node_modules/mime-types/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Jonathan Ong 4 | Copyright (c) 2015 Douglas Christopher Wilson 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | 'Software'), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /node_modules/mime-types/README.md: -------------------------------------------------------------------------------- 1 | # mime-types 2 | 3 | [![NPM Version][npm-version-image]][npm-url] 4 | [![NPM Downloads][npm-downloads-image]][npm-url] 5 | [![Node.js Version][node-version-image]][node-version-url] 6 | [![Build Status][ci-image]][ci-url] 7 | [![Test Coverage][coveralls-image]][coveralls-url] 8 | 9 | The ultimate javascript content-type utility. 10 | 11 | Similar to [the `mime@1.x` module](https://www.npmjs.com/package/mime), except: 12 | 13 | - __No fallbacks.__ Instead of naively returning the first available type, 14 | `mime-types` simply returns `false`, so do 15 | `var type = mime.lookup('unrecognized') || 'application/octet-stream'`. 16 | - No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`. 17 | - No `.define()` functionality 18 | - Bug fixes for `.lookup(path)` 19 | 20 | Otherwise, the API is compatible with `mime` 1.x. 21 | 22 | ## Install 23 | 24 | This is a [Node.js](https://nodejs.org/en/) module available through the 25 | [npm registry](https://www.npmjs.com/). Installation is done using the 26 | [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): 27 | 28 | ```sh 29 | $ npm install mime-types 30 | ``` 31 | 32 | ## Adding Types 33 | 34 | All mime types are based on [mime-db](https://www.npmjs.com/package/mime-db), 35 | so open a PR there if you'd like to add mime types. 36 | 37 | ## API 38 | 39 | ```js 40 | var mime = require('mime-types') 41 | ``` 42 | 43 | All functions return `false` if input is invalid or not found. 44 | 45 | ### mime.lookup(path) 46 | 47 | Lookup the content-type associated with a file. 48 | 49 | ```js 50 | mime.lookup('json') // 'application/json' 51 | mime.lookup('.md') // 'text/markdown' 52 | mime.lookup('file.html') // 'text/html' 53 | mime.lookup('folder/file.js') // 'application/javascript' 54 | mime.lookup('folder/.htaccess') // false 55 | 56 | mime.lookup('cats') // false 57 | ``` 58 | 59 | ### mime.contentType(type) 60 | 61 | Create a full content-type header given a content-type or extension. 62 | When given an extension, `mime.lookup` is used to get the matching 63 | content-type, otherwise the given content-type is used. Then if the 64 | content-type does not already have a `charset` parameter, `mime.charset` 65 | is used to get the default charset and add to the returned content-type. 66 | 67 | ```js 68 | mime.contentType('markdown') // 'text/x-markdown; charset=utf-8' 69 | mime.contentType('file.json') // 'application/json; charset=utf-8' 70 | mime.contentType('text/html') // 'text/html; charset=utf-8' 71 | mime.contentType('text/html; charset=iso-8859-1') // 'text/html; charset=iso-8859-1' 72 | 73 | // from a full path 74 | mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8' 75 | ``` 76 | 77 | ### mime.extension(type) 78 | 79 | Get the default extension for a content-type. 80 | 81 | ```js 82 | mime.extension('application/octet-stream') // 'bin' 83 | ``` 84 | 85 | ### mime.charset(type) 86 | 87 | Lookup the implied default charset of a content-type. 88 | 89 | ```js 90 | mime.charset('text/markdown') // 'UTF-8' 91 | ``` 92 | 93 | ### var type = mime.types[extension] 94 | 95 | A map of content-types by extension. 96 | 97 | ### [extensions...] = mime.extensions[type] 98 | 99 | A map of extensions by content-type. 100 | 101 | ## License 102 | 103 | [MIT](LICENSE) 104 | 105 | [ci-image]: https://badgen.net/github/checks/jshttp/mime-types/master?label=ci 106 | [ci-url]: https://github.com/jshttp/mime-types/actions?query=workflow%3Aci 107 | [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-types/master 108 | [coveralls-url]: https://coveralls.io/r/jshttp/mime-types?branch=master 109 | [node-version-image]: https://badgen.net/npm/node/mime-types 110 | [node-version-url]: https://nodejs.org/en/download 111 | [npm-downloads-image]: https://badgen.net/npm/dm/mime-types 112 | [npm-url]: https://npmjs.org/package/mime-types 113 | [npm-version-image]: https://badgen.net/npm/v/mime-types 114 | -------------------------------------------------------------------------------- /node_modules/mime-types/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mime-types", 3 | "description": "The ultimate javascript content-type utility.", 4 | "version": "2.1.30", 5 | "contributors": [ 6 | "Douglas Christopher Wilson ", 7 | "Jeremiah Senkpiel (https://searchbeam.jit.su)", 8 | "Jonathan Ong (http://jongleberry.com)" 9 | ], 10 | "license": "MIT", 11 | "keywords": [ 12 | "mime", 13 | "types" 14 | ], 15 | "repository": "jshttp/mime-types", 16 | "dependencies": { 17 | "mime-db": "1.47.0" 18 | }, 19 | "devDependencies": { 20 | "eslint": "7.23.0", 21 | "eslint-config-standard": "14.1.1", 22 | "eslint-plugin-import": "2.22.1", 23 | "eslint-plugin-markdown": "2.0.0", 24 | "eslint-plugin-node": "11.1.0", 25 | "eslint-plugin-promise": "4.3.1", 26 | "eslint-plugin-standard": "4.1.0", 27 | "mocha": "8.3.2", 28 | "nyc": "15.1.0" 29 | }, 30 | "files": [ 31 | "HISTORY.md", 32 | "LICENSE", 33 | "index.js" 34 | ], 35 | "engines": { 36 | "node": ">= 0.6" 37 | }, 38 | "scripts": { 39 | "lint": "eslint .", 40 | "test": "mocha --reporter spec test/test.js", 41 | "test-ci": "nyc --reporter=lcov --reporter=text npm test", 42 | "test-cov": "nyc --reporter=html --reporter=text npm test" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /node_modules/ms/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Helpers. 3 | */ 4 | 5 | var s = 1000; 6 | var m = s * 60; 7 | var h = m * 60; 8 | var d = h * 24; 9 | var w = d * 7; 10 | var y = d * 365.25; 11 | 12 | /** 13 | * Parse or format the given `val`. 14 | * 15 | * Options: 16 | * 17 | * - `long` verbose formatting [false] 18 | * 19 | * @param {String|Number} val 20 | * @param {Object} [options] 21 | * @throws {Error} throw an error if val is not a non-empty string or a number 22 | * @return {String|Number} 23 | * @api public 24 | */ 25 | 26 | module.exports = function(val, options) { 27 | options = options || {}; 28 | var type = typeof val; 29 | if (type === 'string' && val.length > 0) { 30 | return parse(val); 31 | } else if (type === 'number' && isFinite(val)) { 32 | return options.long ? fmtLong(val) : fmtShort(val); 33 | } 34 | throw new Error( 35 | 'val is not a non-empty string or a valid number. val=' + 36 | JSON.stringify(val) 37 | ); 38 | }; 39 | 40 | /** 41 | * Parse the given `str` and return milliseconds. 42 | * 43 | * @param {String} str 44 | * @return {Number} 45 | * @api private 46 | */ 47 | 48 | function parse(str) { 49 | str = String(str); 50 | if (str.length > 100) { 51 | return; 52 | } 53 | var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( 54 | str 55 | ); 56 | if (!match) { 57 | return; 58 | } 59 | var n = parseFloat(match[1]); 60 | var type = (match[2] || 'ms').toLowerCase(); 61 | switch (type) { 62 | case 'years': 63 | case 'year': 64 | case 'yrs': 65 | case 'yr': 66 | case 'y': 67 | return n * y; 68 | case 'weeks': 69 | case 'week': 70 | case 'w': 71 | return n * w; 72 | case 'days': 73 | case 'day': 74 | case 'd': 75 | return n * d; 76 | case 'hours': 77 | case 'hour': 78 | case 'hrs': 79 | case 'hr': 80 | case 'h': 81 | return n * h; 82 | case 'minutes': 83 | case 'minute': 84 | case 'mins': 85 | case 'min': 86 | case 'm': 87 | return n * m; 88 | case 'seconds': 89 | case 'second': 90 | case 'secs': 91 | case 'sec': 92 | case 's': 93 | return n * s; 94 | case 'milliseconds': 95 | case 'millisecond': 96 | case 'msecs': 97 | case 'msec': 98 | case 'ms': 99 | return n; 100 | default: 101 | return undefined; 102 | } 103 | } 104 | 105 | /** 106 | * Short format for `ms`. 107 | * 108 | * @param {Number} ms 109 | * @return {String} 110 | * @api private 111 | */ 112 | 113 | function fmtShort(ms) { 114 | var msAbs = Math.abs(ms); 115 | if (msAbs >= d) { 116 | return Math.round(ms / d) + 'd'; 117 | } 118 | if (msAbs >= h) { 119 | return Math.round(ms / h) + 'h'; 120 | } 121 | if (msAbs >= m) { 122 | return Math.round(ms / m) + 'm'; 123 | } 124 | if (msAbs >= s) { 125 | return Math.round(ms / s) + 's'; 126 | } 127 | return ms + 'ms'; 128 | } 129 | 130 | /** 131 | * Long format for `ms`. 132 | * 133 | * @param {Number} ms 134 | * @return {String} 135 | * @api private 136 | */ 137 | 138 | function fmtLong(ms) { 139 | var msAbs = Math.abs(ms); 140 | if (msAbs >= d) { 141 | return plural(ms, msAbs, d, 'day'); 142 | } 143 | if (msAbs >= h) { 144 | return plural(ms, msAbs, h, 'hour'); 145 | } 146 | if (msAbs >= m) { 147 | return plural(ms, msAbs, m, 'minute'); 148 | } 149 | if (msAbs >= s) { 150 | return plural(ms, msAbs, s, 'second'); 151 | } 152 | return ms + ' ms'; 153 | } 154 | 155 | /** 156 | * Pluralization helper. 157 | */ 158 | 159 | function plural(ms, msAbs, n, name) { 160 | var isPlural = msAbs >= n * 1.5; 161 | return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); 162 | } 163 | -------------------------------------------------------------------------------- /node_modules/ms/license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Zeit, Inc. 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. 22 | -------------------------------------------------------------------------------- /node_modules/ms/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ms", 3 | "version": "2.1.2", 4 | "description": "Tiny millisecond conversion utility", 5 | "repository": "zeit/ms", 6 | "main": "./index", 7 | "files": [ 8 | "index.js" 9 | ], 10 | "scripts": { 11 | "precommit": "lint-staged", 12 | "lint": "eslint lib/* bin/*", 13 | "test": "mocha tests.js" 14 | }, 15 | "eslintConfig": { 16 | "extends": "eslint:recommended", 17 | "env": { 18 | "node": true, 19 | "es6": true 20 | } 21 | }, 22 | "lint-staged": { 23 | "*.js": [ 24 | "npm run lint", 25 | "prettier --single-quote --write", 26 | "git add" 27 | ] 28 | }, 29 | "license": "MIT", 30 | "devDependencies": { 31 | "eslint": "4.12.1", 32 | "expect.js": "0.3.1", 33 | "husky": "0.14.3", 34 | "lint-staged": "5.0.0", 35 | "mocha": "4.0.1" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /node_modules/ms/readme.md: -------------------------------------------------------------------------------- 1 | # ms 2 | 3 | [![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) 4 | [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) 5 | 6 | Use this package to easily convert various time formats to milliseconds. 7 | 8 | ## Examples 9 | 10 | ```js 11 | ms('2 days') // 172800000 12 | ms('1d') // 86400000 13 | ms('10h') // 36000000 14 | ms('2.5 hrs') // 9000000 15 | ms('2h') // 7200000 16 | ms('1m') // 60000 17 | ms('5s') // 5000 18 | ms('1y') // 31557600000 19 | ms('100') // 100 20 | ms('-3 days') // -259200000 21 | ms('-1h') // -3600000 22 | ms('-200') // -200 23 | ``` 24 | 25 | ### Convert from Milliseconds 26 | 27 | ```js 28 | ms(60000) // "1m" 29 | ms(2 * 60000) // "2m" 30 | ms(-3 * 60000) // "-3m" 31 | ms(ms('10 hours')) // "10h" 32 | ``` 33 | 34 | ### Time Format Written-Out 35 | 36 | ```js 37 | ms(60000, { long: true }) // "1 minute" 38 | ms(2 * 60000, { long: true }) // "2 minutes" 39 | ms(-3 * 60000, { long: true }) // "-3 minutes" 40 | ms(ms('10 hours'), { long: true }) // "10 hours" 41 | ``` 42 | 43 | ## Features 44 | 45 | - Works both in [Node.js](https://nodejs.org) and in the browser 46 | - If a number is supplied to `ms`, a string with a unit is returned 47 | - If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) 48 | - If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned 49 | 50 | ## Related Packages 51 | 52 | - [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. 53 | 54 | ## Caught a Bug? 55 | 56 | 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device 57 | 2. Link the package to the global module directory: `npm link` 58 | 3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! 59 | 60 | As always, you can run the tests using: `npm test` 61 | -------------------------------------------------------------------------------- /node_modules/negotiator/HISTORY.md: -------------------------------------------------------------------------------- 1 | 0.6.2 / 2019-04-29 2 | ================== 3 | 4 | * Fix sorting charset, encoding, and language with extra parameters 5 | 6 | 0.6.1 / 2016-05-02 7 | ================== 8 | 9 | * perf: improve `Accept` parsing speed 10 | * perf: improve `Accept-Charset` parsing speed 11 | * perf: improve `Accept-Encoding` parsing speed 12 | * perf: improve `Accept-Language` parsing speed 13 | 14 | 0.6.0 / 2015-09-29 15 | ================== 16 | 17 | * Fix including type extensions in parameters in `Accept` parsing 18 | * Fix parsing `Accept` parameters with quoted equals 19 | * Fix parsing `Accept` parameters with quoted semicolons 20 | * Lazy-load modules from main entry point 21 | * perf: delay type concatenation until needed 22 | * perf: enable strict mode 23 | * perf: hoist regular expressions 24 | * perf: remove closures getting spec properties 25 | * perf: remove a closure from media type parsing 26 | * perf: remove property delete from media type parsing 27 | 28 | 0.5.3 / 2015-05-10 29 | ================== 30 | 31 | * Fix media type parameter matching to be case-insensitive 32 | 33 | 0.5.2 / 2015-05-06 34 | ================== 35 | 36 | * Fix comparing media types with quoted values 37 | * Fix splitting media types with quoted commas 38 | 39 | 0.5.1 / 2015-02-14 40 | ================== 41 | 42 | * Fix preference sorting to be stable for long acceptable lists 43 | 44 | 0.5.0 / 2014-12-18 45 | ================== 46 | 47 | * Fix list return order when large accepted list 48 | * Fix missing identity encoding when q=0 exists 49 | * Remove dynamic building of Negotiator class 50 | 51 | 0.4.9 / 2014-10-14 52 | ================== 53 | 54 | * Fix error when media type has invalid parameter 55 | 56 | 0.4.8 / 2014-09-28 57 | ================== 58 | 59 | * Fix all negotiations to be case-insensitive 60 | * Stable sort preferences of same quality according to client order 61 | * Support Node.js 0.6 62 | 63 | 0.4.7 / 2014-06-24 64 | ================== 65 | 66 | * Handle invalid provided languages 67 | * Handle invalid provided media types 68 | 69 | 0.4.6 / 2014-06-11 70 | ================== 71 | 72 | * Order by specificity when quality is the same 73 | 74 | 0.4.5 / 2014-05-29 75 | ================== 76 | 77 | * Fix regression in empty header handling 78 | 79 | 0.4.4 / 2014-05-29 80 | ================== 81 | 82 | * Fix behaviors when headers are not present 83 | 84 | 0.4.3 / 2014-04-16 85 | ================== 86 | 87 | * Handle slashes on media params correctly 88 | 89 | 0.4.2 / 2014-02-28 90 | ================== 91 | 92 | * Fix media type sorting 93 | * Handle media types params strictly 94 | 95 | 0.4.1 / 2014-01-16 96 | ================== 97 | 98 | * Use most specific matches 99 | 100 | 0.4.0 / 2014-01-09 101 | ================== 102 | 103 | * Remove preferred prefix from methods 104 | -------------------------------------------------------------------------------- /node_modules/negotiator/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2012-2014 Federico Romero 4 | Copyright (c) 2012-2014 Isaac Z. Schlueter 5 | Copyright (c) 2014-2015 Douglas Christopher Wilson 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | 'Software'), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /node_modules/negotiator/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * negotiator 3 | * Copyright(c) 2012 Federico Romero 4 | * Copyright(c) 2012-2014 Isaac Z. Schlueter 5 | * Copyright(c) 2015 Douglas Christopher Wilson 6 | * MIT Licensed 7 | */ 8 | 9 | 'use strict'; 10 | 11 | /** 12 | * Cached loaded submodules. 13 | * @private 14 | */ 15 | 16 | var modules = Object.create(null); 17 | 18 | /** 19 | * Module exports. 20 | * @public 21 | */ 22 | 23 | module.exports = Negotiator; 24 | module.exports.Negotiator = Negotiator; 25 | 26 | /** 27 | * Create a Negotiator instance from a request. 28 | * @param {object} request 29 | * @public 30 | */ 31 | 32 | function Negotiator(request) { 33 | if (!(this instanceof Negotiator)) { 34 | return new Negotiator(request); 35 | } 36 | 37 | this.request = request; 38 | } 39 | 40 | Negotiator.prototype.charset = function charset(available) { 41 | var set = this.charsets(available); 42 | return set && set[0]; 43 | }; 44 | 45 | Negotiator.prototype.charsets = function charsets(available) { 46 | var preferredCharsets = loadModule('charset').preferredCharsets; 47 | return preferredCharsets(this.request.headers['accept-charset'], available); 48 | }; 49 | 50 | Negotiator.prototype.encoding = function encoding(available) { 51 | var set = this.encodings(available); 52 | return set && set[0]; 53 | }; 54 | 55 | Negotiator.prototype.encodings = function encodings(available) { 56 | var preferredEncodings = loadModule('encoding').preferredEncodings; 57 | return preferredEncodings(this.request.headers['accept-encoding'], available); 58 | }; 59 | 60 | Negotiator.prototype.language = function language(available) { 61 | var set = this.languages(available); 62 | return set && set[0]; 63 | }; 64 | 65 | Negotiator.prototype.languages = function languages(available) { 66 | var preferredLanguages = loadModule('language').preferredLanguages; 67 | return preferredLanguages(this.request.headers['accept-language'], available); 68 | }; 69 | 70 | Negotiator.prototype.mediaType = function mediaType(available) { 71 | var set = this.mediaTypes(available); 72 | return set && set[0]; 73 | }; 74 | 75 | Negotiator.prototype.mediaTypes = function mediaTypes(available) { 76 | var preferredMediaTypes = loadModule('mediaType').preferredMediaTypes; 77 | return preferredMediaTypes(this.request.headers.accept, available); 78 | }; 79 | 80 | // Backwards compatibility 81 | Negotiator.prototype.preferredCharset = Negotiator.prototype.charset; 82 | Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets; 83 | Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding; 84 | Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings; 85 | Negotiator.prototype.preferredLanguage = Negotiator.prototype.language; 86 | Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages; 87 | Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType; 88 | Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes; 89 | 90 | /** 91 | * Load the given module. 92 | * @private 93 | */ 94 | 95 | function loadModule(moduleName) { 96 | var module = modules[moduleName]; 97 | 98 | if (module !== undefined) { 99 | return module; 100 | } 101 | 102 | // This uses a switch for static require analysis 103 | switch (moduleName) { 104 | case 'charset': 105 | module = require('./lib/charset'); 106 | break; 107 | case 'encoding': 108 | module = require('./lib/encoding'); 109 | break; 110 | case 'language': 111 | module = require('./lib/language'); 112 | break; 113 | case 'mediaType': 114 | module = require('./lib/mediaType'); 115 | break; 116 | default: 117 | throw new Error('Cannot find module \'' + moduleName + '\''); 118 | } 119 | 120 | // Store to prevent invoking require() 121 | modules[moduleName] = module; 122 | 123 | return module; 124 | } 125 | -------------------------------------------------------------------------------- /node_modules/negotiator/lib/charset.js: -------------------------------------------------------------------------------- 1 | /** 2 | * negotiator 3 | * Copyright(c) 2012 Isaac Z. Schlueter 4 | * Copyright(c) 2014 Federico Romero 5 | * Copyright(c) 2014-2015 Douglas Christopher Wilson 6 | * MIT Licensed 7 | */ 8 | 9 | 'use strict'; 10 | 11 | /** 12 | * Module exports. 13 | * @public 14 | */ 15 | 16 | module.exports = preferredCharsets; 17 | module.exports.preferredCharsets = preferredCharsets; 18 | 19 | /** 20 | * Module variables. 21 | * @private 22 | */ 23 | 24 | var simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/; 25 | 26 | /** 27 | * Parse the Accept-Charset header. 28 | * @private 29 | */ 30 | 31 | function parseAcceptCharset(accept) { 32 | var accepts = accept.split(','); 33 | 34 | for (var i = 0, j = 0; i < accepts.length; i++) { 35 | var charset = parseCharset(accepts[i].trim(), i); 36 | 37 | if (charset) { 38 | accepts[j++] = charset; 39 | } 40 | } 41 | 42 | // trim accepts 43 | accepts.length = j; 44 | 45 | return accepts; 46 | } 47 | 48 | /** 49 | * Parse a charset from the Accept-Charset header. 50 | * @private 51 | */ 52 | 53 | function parseCharset(str, i) { 54 | var match = simpleCharsetRegExp.exec(str); 55 | if (!match) return null; 56 | 57 | var charset = match[1]; 58 | var q = 1; 59 | if (match[2]) { 60 | var params = match[2].split(';') 61 | for (var j = 0; j < params.length; j++) { 62 | var p = params[j].trim().split('='); 63 | if (p[0] === 'q') { 64 | q = parseFloat(p[1]); 65 | break; 66 | } 67 | } 68 | } 69 | 70 | return { 71 | charset: charset, 72 | q: q, 73 | i: i 74 | }; 75 | } 76 | 77 | /** 78 | * Get the priority of a charset. 79 | * @private 80 | */ 81 | 82 | function getCharsetPriority(charset, accepted, index) { 83 | var priority = {o: -1, q: 0, s: 0}; 84 | 85 | for (var i = 0; i < accepted.length; i++) { 86 | var spec = specify(charset, accepted[i], index); 87 | 88 | if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) { 89 | priority = spec; 90 | } 91 | } 92 | 93 | return priority; 94 | } 95 | 96 | /** 97 | * Get the specificity of the charset. 98 | * @private 99 | */ 100 | 101 | function specify(charset, spec, index) { 102 | var s = 0; 103 | if(spec.charset.toLowerCase() === charset.toLowerCase()){ 104 | s |= 1; 105 | } else if (spec.charset !== '*' ) { 106 | return null 107 | } 108 | 109 | return { 110 | i: index, 111 | o: spec.i, 112 | q: spec.q, 113 | s: s 114 | } 115 | } 116 | 117 | /** 118 | * Get the preferred charsets from an Accept-Charset header. 119 | * @public 120 | */ 121 | 122 | function preferredCharsets(accept, provided) { 123 | // RFC 2616 sec 14.2: no header = * 124 | var accepts = parseAcceptCharset(accept === undefined ? '*' : accept || ''); 125 | 126 | if (!provided) { 127 | // sorted list of all charsets 128 | return accepts 129 | .filter(isQuality) 130 | .sort(compareSpecs) 131 | .map(getFullCharset); 132 | } 133 | 134 | var priorities = provided.map(function getPriority(type, index) { 135 | return getCharsetPriority(type, accepts, index); 136 | }); 137 | 138 | // sorted list of accepted charsets 139 | return priorities.filter(isQuality).sort(compareSpecs).map(function getCharset(priority) { 140 | return provided[priorities.indexOf(priority)]; 141 | }); 142 | } 143 | 144 | /** 145 | * Compare two specs. 146 | * @private 147 | */ 148 | 149 | function compareSpecs(a, b) { 150 | return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0; 151 | } 152 | 153 | /** 154 | * Get full charset string. 155 | * @private 156 | */ 157 | 158 | function getFullCharset(spec) { 159 | return spec.charset; 160 | } 161 | 162 | /** 163 | * Check if a spec has any quality. 164 | * @private 165 | */ 166 | 167 | function isQuality(spec) { 168 | return spec.q > 0; 169 | } 170 | -------------------------------------------------------------------------------- /node_modules/negotiator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "negotiator", 3 | "description": "HTTP content negotiation", 4 | "version": "0.6.2", 5 | "contributors": [ 6 | "Douglas Christopher Wilson ", 7 | "Federico Romero ", 8 | "Isaac Z. Schlueter (http://blog.izs.me/)" 9 | ], 10 | "license": "MIT", 11 | "keywords": [ 12 | "http", 13 | "content negotiation", 14 | "accept", 15 | "accept-language", 16 | "accept-encoding", 17 | "accept-charset" 18 | ], 19 | "repository": "jshttp/negotiator", 20 | "devDependencies": { 21 | "eslint": "5.16.0", 22 | "eslint-plugin-markdown": "1.0.0", 23 | "mocha": "6.1.4", 24 | "nyc": "14.0.0" 25 | }, 26 | "files": [ 27 | "lib/", 28 | "HISTORY.md", 29 | "LICENSE", 30 | "index.js", 31 | "README.md" 32 | ], 33 | "engines": { 34 | "node": ">= 0.6" 35 | }, 36 | "scripts": { 37 | "lint": "eslint --plugin markdown --ext js,md .", 38 | "test": "mocha --reporter spec --check-leaks --bail test/", 39 | "test-cov": "nyc --reporter=html --reporter=text npm test", 40 | "test-travis": "nyc --reporter=text npm test" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /node_modules/object-assign/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | object-assign 3 | (c) Sindre Sorhus 4 | @license MIT 5 | */ 6 | 7 | 'use strict'; 8 | /* eslint-disable no-unused-vars */ 9 | var getOwnPropertySymbols = Object.getOwnPropertySymbols; 10 | var hasOwnProperty = Object.prototype.hasOwnProperty; 11 | var propIsEnumerable = Object.prototype.propertyIsEnumerable; 12 | 13 | function toObject(val) { 14 | if (val === null || val === undefined) { 15 | throw new TypeError('Object.assign cannot be called with null or undefined'); 16 | } 17 | 18 | return Object(val); 19 | } 20 | 21 | function shouldUseNative() { 22 | try { 23 | if (!Object.assign) { 24 | return false; 25 | } 26 | 27 | // Detect buggy property enumeration order in older V8 versions. 28 | 29 | // https://bugs.chromium.org/p/v8/issues/detail?id=4118 30 | var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 31 | test1[5] = 'de'; 32 | if (Object.getOwnPropertyNames(test1)[0] === '5') { 33 | return false; 34 | } 35 | 36 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 37 | var test2 = {}; 38 | for (var i = 0; i < 10; i++) { 39 | test2['_' + String.fromCharCode(i)] = i; 40 | } 41 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 42 | return test2[n]; 43 | }); 44 | if (order2.join('') !== '0123456789') { 45 | return false; 46 | } 47 | 48 | // https://bugs.chromium.org/p/v8/issues/detail?id=3056 49 | var test3 = {}; 50 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 51 | test3[letter] = letter; 52 | }); 53 | if (Object.keys(Object.assign({}, test3)).join('') !== 54 | 'abcdefghijklmnopqrst') { 55 | return false; 56 | } 57 | 58 | return true; 59 | } catch (err) { 60 | // We don't expect any of the above to throw, but better to be safe. 61 | return false; 62 | } 63 | } 64 | 65 | module.exports = shouldUseNative() ? Object.assign : function (target, source) { 66 | var from; 67 | var to = toObject(target); 68 | var symbols; 69 | 70 | for (var s = 1; s < arguments.length; s++) { 71 | from = Object(arguments[s]); 72 | 73 | for (var key in from) { 74 | if (hasOwnProperty.call(from, key)) { 75 | to[key] = from[key]; 76 | } 77 | } 78 | 79 | if (getOwnPropertySymbols) { 80 | symbols = getOwnPropertySymbols(from); 81 | for (var i = 0; i < symbols.length; i++) { 82 | if (propIsEnumerable.call(from, symbols[i])) { 83 | to[symbols[i]] = from[symbols[i]]; 84 | } 85 | } 86 | } 87 | } 88 | 89 | return to; 90 | }; 91 | -------------------------------------------------------------------------------- /node_modules/object-assign/license: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Sindre Sorhus (sindresorhus.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /node_modules/object-assign/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "object-assign", 3 | "version": "4.1.1", 4 | "description": "ES2015 `Object.assign()` ponyfill", 5 | "license": "MIT", 6 | "repository": "sindresorhus/object-assign", 7 | "author": { 8 | "name": "Sindre Sorhus", 9 | "email": "sindresorhus@gmail.com", 10 | "url": "sindresorhus.com" 11 | }, 12 | "engines": { 13 | "node": ">=0.10.0" 14 | }, 15 | "scripts": { 16 | "test": "xo && ava", 17 | "bench": "matcha bench.js" 18 | }, 19 | "files": [ 20 | "index.js" 21 | ], 22 | "keywords": [ 23 | "object", 24 | "assign", 25 | "extend", 26 | "properties", 27 | "es2015", 28 | "ecmascript", 29 | "harmony", 30 | "ponyfill", 31 | "prollyfill", 32 | "polyfill", 33 | "shim", 34 | "browser" 35 | ], 36 | "devDependencies": { 37 | "ava": "^0.16.0", 38 | "lodash": "^4.16.4", 39 | "matcha": "^0.7.0", 40 | "xo": "^0.16.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /node_modules/object-assign/readme.md: -------------------------------------------------------------------------------- 1 | # object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) 2 | 3 | > ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) 4 | 5 | 6 | ## Use the built-in 7 | 8 | Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), 9 | support `Object.assign()` :tada:. If you target only those environments, then by all 10 | means, use `Object.assign()` instead of this package. 11 | 12 | 13 | ## Install 14 | 15 | ``` 16 | $ npm install --save object-assign 17 | ``` 18 | 19 | 20 | ## Usage 21 | 22 | ```js 23 | const objectAssign = require('object-assign'); 24 | 25 | objectAssign({foo: 0}, {bar: 1}); 26 | //=> {foo: 0, bar: 1} 27 | 28 | // multiple sources 29 | objectAssign({foo: 0}, {bar: 1}, {baz: 2}); 30 | //=> {foo: 0, bar: 1, baz: 2} 31 | 32 | // overwrites equal keys 33 | objectAssign({foo: 0}, {foo: 1}, {foo: 2}); 34 | //=> {foo: 2} 35 | 36 | // ignores null and undefined sources 37 | objectAssign({foo: 0}, null, {bar: 1}, undefined); 38 | //=> {foo: 0, bar: 1} 39 | ``` 40 | 41 | 42 | ## API 43 | 44 | ### objectAssign(target, [source, ...]) 45 | 46 | Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. 47 | 48 | 49 | ## Resources 50 | 51 | - [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) 52 | 53 | 54 | ## Related 55 | 56 | - [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` 57 | 58 | 59 | ## License 60 | 61 | MIT © [Sindre Sorhus](https://sindresorhus.com) 62 | -------------------------------------------------------------------------------- /node_modules/socket.io-adapter/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # [2.2.0](https://github.com/socketio/socket.io-adapter/compare/2.1.0...2.2.0) (2021-02-27) 2 | 3 | 4 | ### Features 5 | 6 | * add some utility methods ([1c9827e](https://github.com/socketio/socket.io-adapter/commit/1c9827ec1136e24094295907efaf4d4e6c2fef2f)) 7 | * allow excluding all sockets in a room ([#66](https://github.com/socketio/socket.io-adapter/issues/66)) ([985bb41](https://github.com/socketio/socket.io-adapter/commit/985bb41fa2c04f17f1cf3a17c14ab9acde8947f7)) 8 | 9 | 10 | # [2.1.0](https://github.com/socketio/socket.io-adapter/compare/2.0.3...2.1.0) (2021-01-15) 11 | 12 | 13 | ### Features 14 | 15 | * add room events ([155fa63](https://github.com/socketio/socket.io-adapter/commit/155fa6333a504036e99a33667dc0397f6aede25e)) 16 | * make rooms and sids public ([313c5a9](https://github.com/socketio/socket.io-adapter/commit/313c5a9fb60d913cd3a866001d67516399d8ee2f)) 17 | 18 | 19 | ## [2.0.3](https://github.com/socketio/socket.io-adapter/compare/1.1.2...2.0.3) (2020-11-05) 20 | 21 | ### Features 22 | 23 | * add init() and close() methods ([2e023bf](https://github.com/socketio/socket.io-adapter/commit/2e023bf2b651e543a34147fab19497fbdb8bdb72)) 24 | * use ES6 Sets and Maps ([53ed3f4](https://github.com/socketio/socket.io-adapter/commit/53ed3f4099c073546c66d911a95171adcefc524c)) 25 | 26 | ### Bug Fixes 27 | 28 | * Encoder#encode() is now synchronous ([c043650](https://github.com/socketio/socket.io-adapter/commit/c043650f1c6e58b20364383103314ddc733e4615)) 29 | 30 | 31 | 32 | ## [2.0.3-rc2](https://github.com/socketio/socket.io-adapter/compare/2.0.3-rc1...2.0.3-rc2) (2020-10-20) 33 | 34 | 35 | ### Features 36 | 37 | * add init() and close() methods ([2e023bf](https://github.com/socketio/socket.io-adapter/commit/2e023bf2b651e543a34147fab19497fbdb8bdb72)) 38 | 39 | 40 | 41 | ## [2.0.3-rc1](https://github.com/socketio/socket.io-adapter/compare/2.0.2...2.0.3-rc1) (2020-10-15) 42 | 43 | 44 | 45 | ## [2.0.2](https://github.com/socketio/socket.io-adapter/compare/2.0.1...2.0.2) (2020-09-28) 46 | 47 | The dist/ directory was not up-to-date when publishing the previous version... 48 | 49 | 50 | 51 | ## [2.0.1](https://github.com/socketio/socket.io-adapter/compare/2.0.0...2.0.1) (2020-09-28) 52 | 53 | 54 | ### Bug Fixes 55 | 56 | * Encoder#encode() is now synchronous ([c043650](https://github.com/socketio/socket.io-adapter/commit/c043650f1c6e58b20364383103314ddc733e4615)) 57 | 58 | 59 | 60 | # [2.0.0](https://github.com/socketio/socket.io-adapter/compare/1.1.2...2.0.0) (2020-09-25) 61 | 62 | 63 | ### Features 64 | 65 | * use ES6 Sets and Maps ([53ed3f4](https://github.com/socketio/socket.io-adapter/commit/53ed3f4099c073546c66d911a95171adcefc524c)) 66 | -------------------------------------------------------------------------------- /node_modules/socket.io-adapter/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Guillermo Rauch 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the 'Software'), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /node_modules/socket.io-adapter/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | # socket.io-adapter 3 | 4 | Default socket.io in-memory adapter class. 5 | 6 | Compatibility table: 7 | 8 | | Adapter version | Socket.IO server version | 9 | |-----------------| ------------------------ | 10 | | 1.x.x | 1.x.x / 2.x.x | 11 | | 2.x.x | 3.x.x | 12 | 13 | ## How to use 14 | 15 | This module is not intended for end-user usage, but can be used as an 16 | interface to inherit from other adapters you might want to build. 17 | 18 | As an example of an adapter that builds on top of this, please take a look 19 | at [socket.io-redis](https://github.com/learnboost/socket.io-redis). 20 | 21 | ## License 22 | 23 | MIT 24 | -------------------------------------------------------------------------------- /node_modules/socket.io-adapter/dist/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { EventEmitter } from "events"; 3 | export declare type SocketId = string; 4 | export declare type Room = string; 5 | export interface BroadcastFlags { 6 | volatile?: boolean; 7 | compress?: boolean; 8 | local?: boolean; 9 | broadcast?: boolean; 10 | binary?: boolean; 11 | } 12 | export interface BroadcastOptions { 13 | rooms: Set; 14 | except?: Set; 15 | flags?: BroadcastFlags; 16 | } 17 | export declare class Adapter extends EventEmitter { 18 | readonly nsp: any; 19 | rooms: Map>; 20 | sids: Map>; 21 | private readonly encoder; 22 | /** 23 | * In-memory adapter constructor. 24 | * 25 | * @param {Namespace} nsp 26 | */ 27 | constructor(nsp: any); 28 | /** 29 | * To be overridden 30 | */ 31 | init(): Promise | void; 32 | /** 33 | * To be overridden 34 | */ 35 | close(): Promise | void; 36 | /** 37 | * Adds a socket to a list of room. 38 | * 39 | * @param {SocketId} id the socket id 40 | * @param {Set} rooms a set of rooms 41 | * @public 42 | */ 43 | addAll(id: SocketId, rooms: Set): Promise | void; 44 | /** 45 | * Removes a socket from a room. 46 | * 47 | * @param {SocketId} id the socket id 48 | * @param {Room} room the room name 49 | */ 50 | del(id: SocketId, room: Room): Promise | void; 51 | private _del; 52 | /** 53 | * Removes a socket from all rooms it's joined. 54 | * 55 | * @param {SocketId} id the socket id 56 | */ 57 | delAll(id: SocketId): void; 58 | /** 59 | * Broadcasts a packet. 60 | * 61 | * Options: 62 | * - `flags` {Object} flags for this packet 63 | * - `except` {Array} sids that should be excluded 64 | * - `rooms` {Array} list of rooms to broadcast to 65 | * 66 | * @param {Object} packet the packet object 67 | * @param {Object} opts the options 68 | * @public 69 | */ 70 | broadcast(packet: any, opts: BroadcastOptions): void; 71 | /** 72 | * Gets a list of sockets by sid. 73 | * 74 | * @param {Set} rooms the explicit set of rooms to check. 75 | */ 76 | sockets(rooms: Set): Promise>; 77 | /** 78 | * Gets the list of rooms a given socket has joined. 79 | * 80 | * @param {SocketId} id the socket id 81 | */ 82 | socketRooms(id: SocketId): Set | undefined; 83 | /** 84 | * Returns the matching socket instances 85 | * 86 | * @param opts - the filters to apply 87 | */ 88 | fetchSockets(opts: BroadcastOptions): Promise; 89 | /** 90 | * Makes the matching socket instances join the specified rooms 91 | * 92 | * @param opts - the filters to apply 93 | * @param rooms - the rooms to join 94 | */ 95 | addSockets(opts: BroadcastOptions, rooms: Room[]): void; 96 | /** 97 | * Makes the matching socket instances leave the specified rooms 98 | * 99 | * @param opts - the filters to apply 100 | * @param rooms - the rooms to leave 101 | */ 102 | delSockets(opts: BroadcastOptions, rooms: Room[]): void; 103 | /** 104 | * Makes the matching socket instances disconnect 105 | * 106 | * @param opts - the filters to apply 107 | * @param close - whether to close the underlying connection 108 | */ 109 | disconnectSockets(opts: BroadcastOptions, close: boolean): void; 110 | private apply; 111 | private computeExceptSids; 112 | } 113 | -------------------------------------------------------------------------------- /node_modules/socket.io-adapter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "socket.io-adapter", 3 | "version": "2.2.0", 4 | "license": "MIT", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/socketio/socket.io-adapter.git" 8 | }, 9 | "files": [ 10 | "dist/" 11 | ], 12 | "main": "./dist/index.js", 13 | "types": "./dist/index.d.ts", 14 | "description": "default socket.io in-memory adapter", 15 | "devDependencies": { 16 | "@types/node": "^14.11.2", 17 | "expect.js": "^0.3.1", 18 | "mocha": "^8.1.3", 19 | "nyc": "^15.1.0", 20 | "prettier": "^1.19.1", 21 | "typescript": "^4.0.3" 22 | }, 23 | "scripts": { 24 | "test": "npm run format:check && tsc && nyc mocha test/index.js", 25 | "format:check": "prettier --parser typescript --check 'lib/**/*.ts' 'test/**/*.js'", 26 | "format:fix": "prettier --parser typescript --write 'lib/**/*.ts' 'test/**/*.js'", 27 | "prepack": "tsc" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /node_modules/socket.io-parser/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [4.0.4](https://github.com/socketio/socket.io-parser/compare/4.0.3...4.0.4) (2021-01-15) 2 | 3 | 4 | ### Bug Fixes 5 | 6 | * allow integers as event names ([1c220dd](https://github.com/socketio/socket.io-parser/commit/1c220ddbf45ea4b44bc8dbf6f9ae245f672ba1b9)) 7 | 8 | 9 | ## [4.0.3](https://github.com/socketio/socket.io-parser/compare/4.0.2...4.0.3) (2021-01-05) 10 | 11 | 12 | ## [4.0.2](https://github.com/socketio/socket.io-parser/compare/4.0.1...4.0.2) (2020-11-25) 13 | 14 | 15 | ### Bug Fixes 16 | 17 | * move @types/component-emitter to dependencies ([#99](https://github.com/socketio/socket.io-parser/issues/99)) ([4efa005](https://github.com/socketio/socket.io-parser/commit/4efa005846ae15ecc7fb0a7f27141439113b1179)) 18 | 19 | 20 | ## [4.0.1](https://github.com/socketio/socket.io-parser/compare/3.4.1...4.0.1) (2020-11-05) 21 | 22 | ### Features 23 | 24 | * move binary detection back to the parser ([285e7cd](https://github.com/socketio/socket.io-parser/commit/285e7cd0d837adfc911c999e7294788681226ae1)) 25 | * add support for a payload in a CONNECT packet ([78f9fc2](https://github.com/socketio/socket.io-parser/commit/78f9fc2999b15804b02f2c22a2b4007734a26af9)) 26 | 27 | ### Bug Fixes 28 | 29 | * do not catch encoding errors ([aeae87c](https://github.com/socketio/socket.io-parser/commit/aeae87c220287197cb78370dbd86b950a7dd29eb)) 30 | * throw upon invalid payload format ([c327acb](https://github.com/socketio/socket.io-parser/commit/c327acbc3c3c2d0b2b439136cbcb56c81db173d6)) 31 | 32 | ### BREAKING CHANGES 33 | 34 | * the encode method is now synchronous ([28d4f03](https://github.com/socketio/socket.io-parser/commit/28d4f0309bdd9e306b78d1946d3e1760941d6544)) 35 | 36 | 37 | 38 | ## [4.0.1-rc3](https://github.com/socketio/socket.io-parser/compare/4.0.1-rc2...4.0.1-rc3) (2020-10-25) 39 | 40 | 41 | 42 | ## [4.0.1-rc2](https://github.com/socketio/socket.io-parser/compare/4.0.1-rc1...4.0.1-rc2) (2020-10-15) 43 | 44 | 45 | ### Features 46 | 47 | * move binary detection back to the parser ([285e7cd](https://github.com/socketio/socket.io-parser/commit/285e7cd0d837adfc911c999e7294788681226ae1)) 48 | 49 | 50 | 51 | ## [4.0.1-rc1](https://github.com/socketio/socket.io-parser/compare/4.0.0...4.0.1-rc1) (2020-10-12) 52 | 53 | 54 | ### Features 55 | 56 | * add support for a payload in a CONNECT packet ([78f9fc2](https://github.com/socketio/socket.io-parser/commit/78f9fc2999b15804b02f2c22a2b4007734a26af9)) 57 | 58 | 59 | 60 | ## [3.3.1](https://github.com/socketio/socket.io-parser/compare/3.3.0...3.3.1) (2020-09-30) 61 | 62 | 63 | # [4.0.0](https://github.com/socketio/socket.io-parser/compare/3.4.1...4.0.0) (2020-09-28) 64 | 65 | This release will be included in Socket.IO v3. 66 | 67 | There is a breaking API change (see below), but the exchange [protocol](https://github.com/socketio/socket.io-protocol) is left untouched and thus stays in version 4. 68 | 69 | ### Bug Fixes 70 | 71 | * do not catch encoding errors ([aeae87c](https://github.com/socketio/socket.io-parser/commit/aeae87c220287197cb78370dbd86b950a7dd29eb)) 72 | * throw upon invalid payload format ([c327acb](https://github.com/socketio/socket.io-parser/commit/c327acbc3c3c2d0b2b439136cbcb56c81db173d6)) 73 | 74 | 75 | ### BREAKING CHANGES 76 | 77 | * the encode method is now synchronous ([28d4f03](https://github.com/socketio/socket.io-parser/commit/28d4f0309bdd9e306b78d1946d3e1760941d6544)) 78 | 79 | 80 | 81 | ## [3.4.1](https://github.com/socketio/socket.io-parser/compare/3.4.0...3.4.1) (2020-05-13) 82 | 83 | 84 | ### Bug Fixes 85 | 86 | * prevent DoS (OOM) via massive packets ([#95](https://github.com/socketio/socket.io-parser/issues/95)) ([dcb942d](https://github.com/socketio/socket.io-parser/commit/dcb942d24db97162ad16a67c2a0cf30875342d55)) 87 | -------------------------------------------------------------------------------- /node_modules/socket.io-parser/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014 Guillermo Rauch 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the 'Software'), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /node_modules/socket.io-parser/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | # socket.io-parser 3 | 4 | [![Build Status](https://github.com/socketio/socket.io-parser/workflows/CI/badge.svg)](https://github.com/socketio/socket.io-parser/actions) 5 | [![NPM version](https://badge.fury.io/js/socket.io-parser.svg)](http://badge.fury.io/js/socket.io-parser) 6 | 7 | A socket.io encoder and decoder written in JavaScript complying with version `5` 8 | of [socket.io-protocol](https://github.com/socketio/socket.io-protocol). 9 | Used by [socket.io](https://github.com/automattic/socket.io) and 10 | [socket.io-client](https://github.com/automattic/socket.io-client). 11 | 12 | Compatibility table: 13 | 14 | | Parser version | Socket.IO server version | Protocol revision | 15 | |----------------| ------------------------ | ----------------- | 16 | | 3.x | 1.x / 2.x | 4 | 17 | | 4.x | 3.x | 5 | 18 | 19 | 20 | ## Parser API 21 | 22 | socket.io-parser is the reference implementation of socket.io-protocol. Read 23 | the full API here: 24 | [socket.io-protocol](https://github.com/learnboost/socket.io-protocol). 25 | 26 | ## Example Usage 27 | 28 | ### Encoding and decoding a packet 29 | 30 | ```js 31 | var parser = require('socket.io-parser'); 32 | var encoder = new parser.Encoder(); 33 | var packet = { 34 | type: parser.EVENT, 35 | data: 'test-packet', 36 | id: 13 37 | }; 38 | encoder.encode(packet, function(encodedPackets) { 39 | var decoder = new parser.Decoder(); 40 | decoder.on('decoded', function(decodedPacket) { 41 | // decodedPacket.type == parser.EVENT 42 | // decodedPacket.data == 'test-packet' 43 | // decodedPacket.id == 13 44 | }); 45 | 46 | for (var i = 0; i < encodedPackets.length; i++) { 47 | decoder.add(encodedPackets[i]); 48 | } 49 | }); 50 | ``` 51 | 52 | ### Encoding and decoding a packet with binary data 53 | 54 | ```js 55 | var parser = require('socket.io-parser'); 56 | var encoder = new parser.Encoder(); 57 | var packet = { 58 | type: parser.BINARY_EVENT, 59 | data: {i: new Buffer(1234), j: new Blob([new ArrayBuffer(2)])}, 60 | id: 15 61 | }; 62 | encoder.encode(packet, function(encodedPackets) { 63 | var decoder = new parser.Decoder(); 64 | decoder.on('decoded', function(decodedPacket) { 65 | // decodedPacket.type == parser.BINARY_EVENT 66 | // Buffer.isBuffer(decodedPacket.data.i) == true 67 | // Buffer.isBuffer(decodedPacket.data.j) == true 68 | // decodedPacket.id == 15 69 | }); 70 | 71 | for (var i = 0; i < encodedPackets.length; i++) { 72 | decoder.add(encodedPackets[i]); 73 | } 74 | }); 75 | ``` 76 | See the test suite for more examples of how socket.io-parser is used. 77 | 78 | 79 | ## License 80 | 81 | MIT 82 | -------------------------------------------------------------------------------- /node_modules/socket.io-parser/dist/binary.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder. 3 | * 4 | * @param {Object} packet - socket.io event packet 5 | * @return {Object} with deconstructed packet and list of buffers 6 | * @public 7 | */ 8 | export declare function deconstructPacket(packet: any): { 9 | packet: any; 10 | buffers: any[]; 11 | }; 12 | /** 13 | * Reconstructs a binary packet from its placeholder packet and buffers 14 | * 15 | * @param {Object} packet - event packet with placeholders 16 | * @param {Array} buffers - binary buffers to put in placeholder positions 17 | * @return {Object} reconstructed packet 18 | * @public 19 | */ 20 | export declare function reconstructPacket(packet: any, buffers: any): any; 21 | -------------------------------------------------------------------------------- /node_modules/socket.io-parser/dist/binary.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.reconstructPacket = exports.deconstructPacket = void 0; 4 | const is_binary_1 = require("./is-binary"); 5 | /** 6 | * Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder. 7 | * 8 | * @param {Object} packet - socket.io event packet 9 | * @return {Object} with deconstructed packet and list of buffers 10 | * @public 11 | */ 12 | function deconstructPacket(packet) { 13 | const buffers = []; 14 | const packetData = packet.data; 15 | const pack = packet; 16 | pack.data = _deconstructPacket(packetData, buffers); 17 | pack.attachments = buffers.length; // number of binary 'attachments' 18 | return { packet: pack, buffers: buffers }; 19 | } 20 | exports.deconstructPacket = deconstructPacket; 21 | function _deconstructPacket(data, buffers) { 22 | if (!data) 23 | return data; 24 | if (is_binary_1.isBinary(data)) { 25 | const placeholder = { _placeholder: true, num: buffers.length }; 26 | buffers.push(data); 27 | return placeholder; 28 | } 29 | else if (Array.isArray(data)) { 30 | const newData = new Array(data.length); 31 | for (let i = 0; i < data.length; i++) { 32 | newData[i] = _deconstructPacket(data[i], buffers); 33 | } 34 | return newData; 35 | } 36 | else if (typeof data === "object" && !(data instanceof Date)) { 37 | const newData = {}; 38 | for (const key in data) { 39 | if (data.hasOwnProperty(key)) { 40 | newData[key] = _deconstructPacket(data[key], buffers); 41 | } 42 | } 43 | return newData; 44 | } 45 | return data; 46 | } 47 | /** 48 | * Reconstructs a binary packet from its placeholder packet and buffers 49 | * 50 | * @param {Object} packet - event packet with placeholders 51 | * @param {Array} buffers - binary buffers to put in placeholder positions 52 | * @return {Object} reconstructed packet 53 | * @public 54 | */ 55 | function reconstructPacket(packet, buffers) { 56 | packet.data = _reconstructPacket(packet.data, buffers); 57 | packet.attachments = undefined; // no longer useful 58 | return packet; 59 | } 60 | exports.reconstructPacket = reconstructPacket; 61 | function _reconstructPacket(data, buffers) { 62 | if (!data) 63 | return data; 64 | if (data && data._placeholder) { 65 | return buffers[data.num]; // appropriate buffer (should be natural order anyway) 66 | } 67 | else if (Array.isArray(data)) { 68 | for (let i = 0; i < data.length; i++) { 69 | data[i] = _reconstructPacket(data[i], buffers); 70 | } 71 | } 72 | else if (typeof data === "object") { 73 | for (const key in data) { 74 | if (data.hasOwnProperty(key)) { 75 | data[key] = _reconstructPacket(data[key], buffers); 76 | } 77 | } 78 | } 79 | return data; 80 | } 81 | -------------------------------------------------------------------------------- /node_modules/socket.io-parser/dist/index.d.ts: -------------------------------------------------------------------------------- 1 | import Emitter = require("component-emitter"); 2 | /** 3 | * Protocol version. 4 | * 5 | * @public 6 | */ 7 | export declare const protocol: number; 8 | export declare enum PacketType { 9 | CONNECT = 0, 10 | DISCONNECT = 1, 11 | EVENT = 2, 12 | ACK = 3, 13 | CONNECT_ERROR = 4, 14 | BINARY_EVENT = 5, 15 | BINARY_ACK = 6 16 | } 17 | export interface Packet { 18 | type: PacketType; 19 | nsp: string; 20 | data?: any; 21 | id?: number; 22 | attachments?: number; 23 | } 24 | /** 25 | * A socket.io Encoder instance 26 | */ 27 | export declare class Encoder { 28 | /** 29 | * Encode a packet as a single string if non-binary, or as a 30 | * buffer sequence, depending on packet type. 31 | * 32 | * @param {Object} obj - packet object 33 | */ 34 | encode(obj: Packet): any[]; 35 | /** 36 | * Encode packet as string. 37 | */ 38 | private encodeAsString; 39 | /** 40 | * Encode packet as 'buffer sequence' by removing blobs, and 41 | * deconstructing packet into object with placeholders and 42 | * a list of buffers. 43 | */ 44 | private encodeAsBinary; 45 | } 46 | /** 47 | * A socket.io Decoder instance 48 | * 49 | * @return {Object} decoder 50 | */ 51 | export declare class Decoder extends Emitter { 52 | private reconstructor; 53 | constructor(); 54 | /** 55 | * Decodes an encoded packet string into packet JSON. 56 | * 57 | * @param {String} obj - encoded packet 58 | */ 59 | add(obj: any): void; 60 | /** 61 | * Decode a packet String (JSON data) 62 | * 63 | * @param {String} str 64 | * @return {Object} packet 65 | */ 66 | private decodeString; 67 | private static isPayloadValid; 68 | /** 69 | * Deallocates a parser's resources 70 | */ 71 | destroy(): void; 72 | } 73 | -------------------------------------------------------------------------------- /node_modules/socket.io-parser/dist/is-binary.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns true if obj is a Buffer, an ArrayBuffer, a Blob or a File. 3 | * 4 | * @private 5 | */ 6 | export declare function isBinary(obj: any): boolean; 7 | export declare function hasBinary(obj: any, toJSON?: boolean): any; 8 | -------------------------------------------------------------------------------- /node_modules/socket.io-parser/dist/is-binary.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.hasBinary = exports.isBinary = void 0; 4 | const withNativeArrayBuffer = typeof ArrayBuffer === "function"; 5 | const isView = (obj) => { 6 | return typeof ArrayBuffer.isView === "function" 7 | ? ArrayBuffer.isView(obj) 8 | : obj.buffer instanceof ArrayBuffer; 9 | }; 10 | const toString = Object.prototype.toString; 11 | const withNativeBlob = typeof Blob === "function" || 12 | (typeof Blob !== "undefined" && 13 | toString.call(Blob) === "[object BlobConstructor]"); 14 | const withNativeFile = typeof File === "function" || 15 | (typeof File !== "undefined" && 16 | toString.call(File) === "[object FileConstructor]"); 17 | /** 18 | * Returns true if obj is a Buffer, an ArrayBuffer, a Blob or a File. 19 | * 20 | * @private 21 | */ 22 | function isBinary(obj) { 23 | return ((withNativeArrayBuffer && (obj instanceof ArrayBuffer || isView(obj))) || 24 | (withNativeBlob && obj instanceof Blob) || 25 | (withNativeFile && obj instanceof File)); 26 | } 27 | exports.isBinary = isBinary; 28 | function hasBinary(obj, toJSON) { 29 | if (!obj || typeof obj !== "object") { 30 | return false; 31 | } 32 | if (Array.isArray(obj)) { 33 | for (let i = 0, l = obj.length; i < l; i++) { 34 | if (hasBinary(obj[i])) { 35 | return true; 36 | } 37 | } 38 | return false; 39 | } 40 | if (isBinary(obj)) { 41 | return true; 42 | } 43 | if (obj.toJSON && 44 | typeof obj.toJSON === "function" && 45 | arguments.length === 1) { 46 | return hasBinary(obj.toJSON(), true); 47 | } 48 | for (const key in obj) { 49 | if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) { 50 | return true; 51 | } 52 | } 53 | return false; 54 | } 55 | exports.hasBinary = hasBinary; 56 | -------------------------------------------------------------------------------- /node_modules/socket.io-parser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "socket.io-parser", 3 | "version": "4.0.4", 4 | "description": "socket.io protocol parser", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/socketio/socket.io-parser.git" 8 | }, 9 | "files": [ 10 | "dist/" 11 | ], 12 | "main": "./dist/index.js", 13 | "types": "./dist/index.d.ts", 14 | "dependencies": { 15 | "@types/component-emitter": "^1.2.10", 16 | "component-emitter": "~1.3.0", 17 | "debug": "~4.3.1" 18 | }, 19 | "devDependencies": { 20 | "@babel/core": "~7.9.6", 21 | "@babel/preset-env": "~7.9.6", 22 | "@types/debug": "^4.1.5", 23 | "@types/node": "^14.11.1", 24 | "babelify": "~10.0.0", 25 | "benchmark": "2.1.2", 26 | "expect.js": "0.3.1", 27 | "mocha": "3.2.0", 28 | "prettier": "^2.1.2", 29 | "rimraf": "^3.0.2", 30 | "socket.io-browsers": "^1.0.0", 31 | "typescript": "^4.0.3", 32 | "zuul": "3.11.1", 33 | "zuul-ngrok": "4.0.0" 34 | }, 35 | "scripts": { 36 | "compile": "rimraf ./dist && tsc", 37 | "test": "npm run format:check && npm run compile && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi", 38 | "test:node": "mocha --reporter dot --bail test/index.js", 39 | "test:browser": "zuul test/index.js --no-coverage", 40 | "format:fix": "prettier --write --parser typescript 'lib/**/*.ts' 'test/**/*.js'", 41 | "format:check": "prettier --check --parser typescript 'lib/**/*.ts' 'test/**/*.js'", 42 | "prepack": "npm run compile" 43 | }, 44 | "license": "MIT", 45 | "engines": { 46 | "node": ">=10.0.0" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /node_modules/socket.io/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2018 Automattic 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. 23 | -------------------------------------------------------------------------------- /node_modules/socket.io/dist/client.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { Packet } from "socket.io-parser"; 3 | import type { IncomingMessage } from "http"; 4 | import type { Server } from "./index"; 5 | import type { EventsMap } from "./typed-events"; 6 | import type { Socket } from "./socket"; 7 | export declare class Client { 8 | readonly conn: any; 9 | private readonly id; 10 | private readonly server; 11 | private readonly encoder; 12 | private readonly decoder; 13 | private sockets; 14 | private nsps; 15 | private connectTimeout?; 16 | /** 17 | * Client constructor. 18 | * 19 | * @param server instance 20 | * @param conn 21 | * @package 22 | */ 23 | constructor(server: Server, conn: any); 24 | /** 25 | * @return the reference to the request that originated the Engine.IO connection 26 | * 27 | * @public 28 | */ 29 | get request(): IncomingMessage; 30 | /** 31 | * Sets up event listeners. 32 | * 33 | * @private 34 | */ 35 | private setup; 36 | /** 37 | * Connects a client to a namespace. 38 | * 39 | * @param {String} name - the namespace 40 | * @param {Object} auth - the auth parameters 41 | * @private 42 | */ 43 | private connect; 44 | /** 45 | * Connects a client to a namespace. 46 | * 47 | * @param name - the namespace 48 | * @param {Object} auth - the auth parameters 49 | * 50 | * @private 51 | */ 52 | private doConnect; 53 | /** 54 | * Disconnects from all namespaces and closes transport. 55 | * 56 | * @private 57 | */ 58 | _disconnect(): void; 59 | /** 60 | * Removes a socket. Called by each `Socket`. 61 | * 62 | * @private 63 | */ 64 | _remove(socket: Socket): void; 65 | /** 66 | * Closes the underlying connection. 67 | * 68 | * @private 69 | */ 70 | private close; 71 | /** 72 | * Writes a packet to the transport. 73 | * 74 | * @param {Object} packet object 75 | * @param {Object} opts 76 | * @private 77 | */ 78 | _packet(packet: Packet, opts?: any): void; 79 | /** 80 | * Called with incoming transport data. 81 | * 82 | * @private 83 | */ 84 | private ondata; 85 | /** 86 | * Called when parser fully decodes a packet. 87 | * 88 | * @private 89 | */ 90 | private ondecoded; 91 | /** 92 | * Handles an error. 93 | * 94 | * @param {Object} err object 95 | * @private 96 | */ 97 | private onerror; 98 | /** 99 | * Called upon transport close. 100 | * 101 | * @param reason 102 | * @private 103 | */ 104 | private onclose; 105 | /** 106 | * Cleans up event listeners. 107 | * @private 108 | */ 109 | private destroy; 110 | } 111 | -------------------------------------------------------------------------------- /node_modules/socket.io/dist/parent-namespace.d.ts: -------------------------------------------------------------------------------- 1 | import { Namespace } from "./namespace"; 2 | import type { Server } from "./index"; 3 | import type { EventParams, EventNames, EventsMap, DefaultEventsMap } from "./typed-events"; 4 | export declare class ParentNamespace extends Namespace { 5 | private static count; 6 | private children; 7 | constructor(server: Server); 8 | /** 9 | * @private 10 | */ 11 | _initAdapter(): void; 12 | emit>(ev: Ev, ...args: EventParams): boolean; 13 | createChild(name: string): Namespace; 14 | } 15 | -------------------------------------------------------------------------------- /node_modules/socket.io/dist/parent-namespace.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ParentNamespace = void 0; 4 | const namespace_1 = require("./namespace"); 5 | class ParentNamespace extends namespace_1.Namespace { 6 | constructor(server) { 7 | super(server, "/_" + ParentNamespace.count++); 8 | this.children = new Set(); 9 | } 10 | /** 11 | * @private 12 | */ 13 | _initAdapter() { 14 | const broadcast = (packet, opts) => { 15 | this.children.forEach((nsp) => { 16 | nsp.adapter.broadcast(packet, opts); 17 | }); 18 | }; 19 | // @ts-ignore FIXME is there a way to declare an inner class in TypeScript? 20 | this.adapter = { broadcast }; 21 | } 22 | emit(ev, ...args) { 23 | this.children.forEach((nsp) => { 24 | nsp.emit(ev, ...args); 25 | }); 26 | return true; 27 | } 28 | createChild(name) { 29 | const namespace = new namespace_1.Namespace(this.server, name); 30 | namespace._fns = this._fns.slice(0); 31 | this.listeners("connect").forEach((listener) => namespace.on("connect", listener)); 32 | this.listeners("connection").forEach((listener) => namespace.on("connection", listener)); 33 | this.children.add(namespace); 34 | this.server._nsps.set(name, namespace); 35 | return namespace; 36 | } 37 | } 38 | exports.ParentNamespace = ParentNamespace; 39 | ParentNamespace.count = 0; 40 | -------------------------------------------------------------------------------- /node_modules/socket.io/dist/typed-events.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.StrictEventEmitter = void 0; 4 | const events_1 = require("events"); 5 | /** 6 | * Strictly typed version of an `EventEmitter`. A `TypedEventEmitter` takes type 7 | * parameters for mappings of event names to event data types, and strictly 8 | * types method calls to the `EventEmitter` according to these event maps. 9 | * 10 | * @typeParam ListenEvents - `EventsMap` of user-defined events that can be 11 | * listened to with `on` or `once` 12 | * @typeParam EmitEvents - `EventsMap` of user-defined events that can be 13 | * emitted with `emit` 14 | * @typeParam ReservedEvents - `EventsMap` of reserved events, that can be 15 | * emitted by socket.io with `emitReserved`, and can be listened to with 16 | * `listen`. 17 | */ 18 | class StrictEventEmitter extends events_1.EventEmitter { 19 | /** 20 | * Adds the `listener` function as an event listener for `ev`. 21 | * 22 | * @param ev Name of the event 23 | * @param listener Callback function 24 | */ 25 | on(ev, listener) { 26 | return super.on(ev, listener); 27 | } 28 | /** 29 | * Adds a one-time `listener` function as an event listener for `ev`. 30 | * 31 | * @param ev Name of the event 32 | * @param listener Callback function 33 | */ 34 | once(ev, listener) { 35 | return super.once(ev, listener); 36 | } 37 | /** 38 | * Emits an event. 39 | * 40 | * @param ev Name of the event 41 | * @param args Values to send to listeners of this event 42 | */ 43 | emit(ev, ...args) { 44 | return super.emit(ev, ...args); 45 | } 46 | /** 47 | * Emits a reserved event. 48 | * 49 | * This method is `protected`, so that only a class extending 50 | * `StrictEventEmitter` can emit its own reserved events. 51 | * 52 | * @param ev Reserved event name 53 | * @param args Arguments to emit along with the event 54 | */ 55 | emitReserved(ev, ...args) { 56 | return super.emit(ev, ...args); 57 | } 58 | /** 59 | * Emits an event. 60 | * 61 | * This method is `protected`, so that only a class extending 62 | * `StrictEventEmitter` can get around the strict typing. This is useful for 63 | * calling `emit.apply`, which can be called as `emitUntyped.apply`. 64 | * 65 | * @param ev Event name 66 | * @param args Arguments to emit along with the event 67 | */ 68 | emitUntyped(ev, ...args) { 69 | return super.emit(ev, ...args); 70 | } 71 | /** 72 | * Returns the listeners listening to an event. 73 | * 74 | * @param event Event name 75 | * @returns Array of listeners subscribed to `event` 76 | */ 77 | listeners(event) { 78 | return super.listeners(event); 79 | } 80 | } 81 | exports.StrictEventEmitter = StrictEventEmitter; 82 | -------------------------------------------------------------------------------- /node_modules/socket.io/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "socket.io", 3 | "version": "4.0.1", 4 | "description": "node.js realtime framework server", 5 | "keywords": [ 6 | "realtime", 7 | "framework", 8 | "websocket", 9 | "tcp", 10 | "events", 11 | "socket", 12 | "io" 13 | ], 14 | "files": [ 15 | "dist/", 16 | "client-dist/", 17 | "wrapper.mjs", 18 | "!**/*.tsbuildinfo" 19 | ], 20 | "directories": { 21 | "doc": "docs/", 22 | "example": "example/", 23 | "lib": "lib/", 24 | "test": "test/" 25 | }, 26 | "type": "commonjs", 27 | "main": "./dist/index.js", 28 | "exports": { 29 | "import": "./wrapper.mjs", 30 | "require": "./dist/index.js" 31 | }, 32 | "types": "./dist/index.d.ts", 33 | "license": "MIT", 34 | "repository": { 35 | "type": "git", 36 | "url": "git://github.com/socketio/socket.io" 37 | }, 38 | "scripts": { 39 | "compile": "rimraf ./dist && tsc", 40 | "test": "npm run format:check && npm run compile && npm run test:types && npm run test:unit", 41 | "test:types": "tsd", 42 | "test:unit": "nyc mocha --require ts-node/register --reporter spec --slow 200 --bail --timeout 10000 test/socket.io.ts", 43 | "format:check": "prettier --check \"lib/**/*.ts\" \"test/**/*.ts\"", 44 | "format:fix": "prettier --write \"lib/**/*.ts\" \"test/**/*.ts\"", 45 | "prepack": "npm run compile" 46 | }, 47 | "dependencies": { 48 | "@types/cookie": "^0.4.0", 49 | "@types/cors": "^2.8.8", 50 | "@types/node": ">=10.0.0", 51 | "accepts": "~1.3.4", 52 | "base64id": "~2.0.0", 53 | "debug": "~4.3.1", 54 | "engine.io": "~5.0.0", 55 | "socket.io-adapter": "~2.2.0", 56 | "socket.io-parser": "~4.0.3" 57 | }, 58 | "devDependencies": { 59 | "@types/mocha": "^8.0.4", 60 | "babel-eslint": "^10.1.0", 61 | "eslint": "^7.14.0", 62 | "eslint-config-prettier": "^6.11.0", 63 | "expect.js": "0.3.1", 64 | "mocha": "^3.5.3", 65 | "nyc": "^15.1.0", 66 | "prettier": "^2.2.0", 67 | "rimraf": "^3.0.2", 68 | "socket.io-client": "4.0.1", 69 | "socket.io-client-v2": "npm:socket.io-client@^2.4.0", 70 | "superagent": "^6.1.0", 71 | "supertest": "^6.0.1", 72 | "ts-node": "^9.0.0", 73 | "tsd": "^0.14.0", 74 | "typescript": "^4.1.2" 75 | }, 76 | "contributors": [ 77 | { 78 | "name": "Guillermo Rauch", 79 | "email": "rauchg@gmail.com" 80 | }, 81 | { 82 | "name": "Arnout Kazemier", 83 | "email": "info@3rd-eden.com" 84 | }, 85 | { 86 | "name": "Vladimir Dronnikov", 87 | "email": "dronnikov@gmail.com" 88 | }, 89 | { 90 | "name": "Einar Otto Stangvik", 91 | "email": "einaros@gmail.com" 92 | } 93 | ], 94 | "engines": { 95 | "node": ">=10.0.0" 96 | }, 97 | "tsd": { 98 | "directory": "test" 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /node_modules/socket.io/wrapper.mjs: -------------------------------------------------------------------------------- 1 | import io from "./dist/index.js"; 2 | 3 | export const {Server, Namespace, Socket} = io; 4 | -------------------------------------------------------------------------------- /node_modules/vary/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.1.2 / 2017-09-23 2 | ================== 3 | 4 | * perf: improve header token parsing speed 5 | 6 | 1.1.1 / 2017-03-20 7 | ================== 8 | 9 | * perf: hoist regular expression 10 | 11 | 1.1.0 / 2015-09-29 12 | ================== 13 | 14 | * Only accept valid field names in the `field` argument 15 | - Ensures the resulting string is a valid HTTP header value 16 | 17 | 1.0.1 / 2015-07-08 18 | ================== 19 | 20 | * Fix setting empty header from empty `field` 21 | * perf: enable strict mode 22 | * perf: remove argument reassignments 23 | 24 | 1.0.0 / 2014-08-10 25 | ================== 26 | 27 | * Accept valid `Vary` header string as `field` 28 | * Add `vary.append` for low-level string manipulation 29 | * Move to `jshttp` orgainzation 30 | 31 | 0.1.0 / 2014-06-05 32 | ================== 33 | 34 | * Support array of fields to set 35 | 36 | 0.0.0 / 2014-06-04 37 | ================== 38 | 39 | * Initial release 40 | -------------------------------------------------------------------------------- /node_modules/vary/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2014-2017 Douglas Christopher Wilson 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. 23 | -------------------------------------------------------------------------------- /node_modules/vary/README.md: -------------------------------------------------------------------------------- 1 | # vary 2 | 3 | [![NPM Version][npm-image]][npm-url] 4 | [![NPM Downloads][downloads-image]][downloads-url] 5 | [![Node.js Version][node-version-image]][node-version-url] 6 | [![Build Status][travis-image]][travis-url] 7 | [![Test Coverage][coveralls-image]][coveralls-url] 8 | 9 | Manipulate the HTTP Vary header 10 | 11 | ## Installation 12 | 13 | This is a [Node.js](https://nodejs.org/en/) module available through the 14 | [npm registry](https://www.npmjs.com/). Installation is done using the 15 | [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): 16 | 17 | ```sh 18 | $ npm install vary 19 | ``` 20 | 21 | ## API 22 | 23 | 24 | 25 | ```js 26 | var vary = require('vary') 27 | ``` 28 | 29 | ### vary(res, field) 30 | 31 | Adds the given header `field` to the `Vary` response header of `res`. 32 | This can be a string of a single field, a string of a valid `Vary` 33 | header, or an array of multiple fields. 34 | 35 | This will append the header if not already listed, otherwise leaves 36 | it listed in the current location. 37 | 38 | 39 | 40 | ```js 41 | // Append "Origin" to the Vary header of the response 42 | vary(res, 'Origin') 43 | ``` 44 | 45 | ### vary.append(header, field) 46 | 47 | Adds the given header `field` to the `Vary` response header string `header`. 48 | This can be a string of a single field, a string of a valid `Vary` header, 49 | or an array of multiple fields. 50 | 51 | This will append the header if not already listed, otherwise leaves 52 | it listed in the current location. The new header string is returned. 53 | 54 | 55 | 56 | ```js 57 | // Get header string appending "Origin" to "Accept, User-Agent" 58 | vary.append('Accept, User-Agent', 'Origin') 59 | ``` 60 | 61 | ## Examples 62 | 63 | ### Updating the Vary header when content is based on it 64 | 65 | ```js 66 | var http = require('http') 67 | var vary = require('vary') 68 | 69 | http.createServer(function onRequest (req, res) { 70 | // about to user-agent sniff 71 | vary(res, 'User-Agent') 72 | 73 | var ua = req.headers['user-agent'] || '' 74 | var isMobile = /mobi|android|touch|mini/i.test(ua) 75 | 76 | // serve site, depending on isMobile 77 | res.setHeader('Content-Type', 'text/html') 78 | res.end('You are (probably) ' + (isMobile ? '' : 'not ') + 'a mobile user') 79 | }) 80 | ``` 81 | 82 | ## Testing 83 | 84 | ```sh 85 | $ npm test 86 | ``` 87 | 88 | ## License 89 | 90 | [MIT](LICENSE) 91 | 92 | [npm-image]: https://img.shields.io/npm/v/vary.svg 93 | [npm-url]: https://npmjs.org/package/vary 94 | [node-version-image]: https://img.shields.io/node/v/vary.svg 95 | [node-version-url]: https://nodejs.org/en/download 96 | [travis-image]: https://img.shields.io/travis/jshttp/vary/master.svg 97 | [travis-url]: https://travis-ci.org/jshttp/vary 98 | [coveralls-image]: https://img.shields.io/coveralls/jshttp/vary/master.svg 99 | [coveralls-url]: https://coveralls.io/r/jshttp/vary 100 | [downloads-image]: https://img.shields.io/npm/dm/vary.svg 101 | [downloads-url]: https://npmjs.org/package/vary 102 | -------------------------------------------------------------------------------- /node_modules/vary/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * vary 3 | * Copyright(c) 2014-2017 Douglas Christopher Wilson 4 | * MIT Licensed 5 | */ 6 | 7 | 'use strict' 8 | 9 | /** 10 | * Module exports. 11 | */ 12 | 13 | module.exports = vary 14 | module.exports.append = append 15 | 16 | /** 17 | * RegExp to match field-name in RFC 7230 sec 3.2 18 | * 19 | * field-name = token 20 | * token = 1*tchar 21 | * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" 22 | * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" 23 | * / DIGIT / ALPHA 24 | * ; any VCHAR, except delimiters 25 | */ 26 | 27 | var FIELD_NAME_REGEXP = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/ 28 | 29 | /** 30 | * Append a field to a vary header. 31 | * 32 | * @param {String} header 33 | * @param {String|Array} field 34 | * @return {String} 35 | * @public 36 | */ 37 | 38 | function append (header, field) { 39 | if (typeof header !== 'string') { 40 | throw new TypeError('header argument is required') 41 | } 42 | 43 | if (!field) { 44 | throw new TypeError('field argument is required') 45 | } 46 | 47 | // get fields array 48 | var fields = !Array.isArray(field) 49 | ? parse(String(field)) 50 | : field 51 | 52 | // assert on invalid field names 53 | for (var j = 0; j < fields.length; j++) { 54 | if (!FIELD_NAME_REGEXP.test(fields[j])) { 55 | throw new TypeError('field argument contains an invalid header name') 56 | } 57 | } 58 | 59 | // existing, unspecified vary 60 | if (header === '*') { 61 | return header 62 | } 63 | 64 | // enumerate current values 65 | var val = header 66 | var vals = parse(header.toLowerCase()) 67 | 68 | // unspecified vary 69 | if (fields.indexOf('*') !== -1 || vals.indexOf('*') !== -1) { 70 | return '*' 71 | } 72 | 73 | for (var i = 0; i < fields.length; i++) { 74 | var fld = fields[i].toLowerCase() 75 | 76 | // append value (case-preserving) 77 | if (vals.indexOf(fld) === -1) { 78 | vals.push(fld) 79 | val = val 80 | ? val + ', ' + fields[i] 81 | : fields[i] 82 | } 83 | } 84 | 85 | return val 86 | } 87 | 88 | /** 89 | * Parse a vary header into an array. 90 | * 91 | * @param {String} header 92 | * @return {Array} 93 | * @private 94 | */ 95 | 96 | function parse (header) { 97 | var end = 0 98 | var list = [] 99 | var start = 0 100 | 101 | // gather tokens 102 | for (var i = 0, len = header.length; i < len; i++) { 103 | switch (header.charCodeAt(i)) { 104 | case 0x20: /* */ 105 | if (start === end) { 106 | start = end = i + 1 107 | } 108 | break 109 | case 0x2c: /* , */ 110 | list.push(header.substring(start, end)) 111 | start = end = i + 1 112 | break 113 | default: 114 | end = i + 1 115 | break 116 | } 117 | } 118 | 119 | // final token 120 | list.push(header.substring(start, end)) 121 | 122 | return list 123 | } 124 | 125 | /** 126 | * Mark that a request is varied on a header field. 127 | * 128 | * @param {Object} res 129 | * @param {String|Array} field 130 | * @public 131 | */ 132 | 133 | function vary (res, field) { 134 | if (!res || !res.getHeader || !res.setHeader) { 135 | // quack quack 136 | throw new TypeError('res argument is required') 137 | } 138 | 139 | // get existing header 140 | var val = res.getHeader('Vary') || '' 141 | var header = Array.isArray(val) 142 | ? val.join(', ') 143 | : String(val) 144 | 145 | // set new header 146 | if ((val = append(header, field))) { 147 | res.setHeader('Vary', val) 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /node_modules/vary/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vary", 3 | "description": "Manipulate the HTTP Vary header", 4 | "version": "1.1.2", 5 | "author": "Douglas Christopher Wilson ", 6 | "license": "MIT", 7 | "keywords": [ 8 | "http", 9 | "res", 10 | "vary" 11 | ], 12 | "repository": "jshttp/vary", 13 | "devDependencies": { 14 | "beautify-benchmark": "0.2.4", 15 | "benchmark": "2.1.4", 16 | "eslint": "3.19.0", 17 | "eslint-config-standard": "10.2.1", 18 | "eslint-plugin-import": "2.7.0", 19 | "eslint-plugin-markdown": "1.0.0-beta.6", 20 | "eslint-plugin-node": "5.1.1", 21 | "eslint-plugin-promise": "3.5.0", 22 | "eslint-plugin-standard": "3.0.1", 23 | "istanbul": "0.4.5", 24 | "mocha": "2.5.3", 25 | "supertest": "1.1.0" 26 | }, 27 | "files": [ 28 | "HISTORY.md", 29 | "LICENSE", 30 | "README.md", 31 | "index.js" 32 | ], 33 | "engines": { 34 | "node": ">= 0.8" 35 | }, 36 | "scripts": { 37 | "bench": "node benchmark/index.js", 38 | "lint": "eslint --plugin markdown --ext js,md .", 39 | "test": "mocha --reporter spec --bail --check-leaks test/", 40 | "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", 41 | "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /node_modules/ws/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011 Einar Otto Stangvik 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. 22 | -------------------------------------------------------------------------------- /node_modules/ws/browser.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function () { 4 | throw new Error( 5 | 'ws does not work in the browser. Browser clients must use the native ' + 6 | 'WebSocket object' 7 | ); 8 | }; 9 | -------------------------------------------------------------------------------- /node_modules/ws/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const WebSocket = require('./lib/websocket'); 4 | 5 | WebSocket.createWebSocketStream = require('./lib/stream'); 6 | WebSocket.Server = require('./lib/websocket-server'); 7 | WebSocket.Receiver = require('./lib/receiver'); 8 | WebSocket.Sender = require('./lib/sender'); 9 | 10 | module.exports = WebSocket; 11 | -------------------------------------------------------------------------------- /node_modules/ws/lib/buffer-util.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { EMPTY_BUFFER } = require('./constants'); 4 | 5 | /** 6 | * Merges an array of buffers into a new buffer. 7 | * 8 | * @param {Buffer[]} list The array of buffers to concat 9 | * @param {Number} totalLength The total length of buffers in the list 10 | * @return {Buffer} The resulting buffer 11 | * @public 12 | */ 13 | function concat(list, totalLength) { 14 | if (list.length === 0) return EMPTY_BUFFER; 15 | if (list.length === 1) return list[0]; 16 | 17 | const target = Buffer.allocUnsafe(totalLength); 18 | let offset = 0; 19 | 20 | for (let i = 0; i < list.length; i++) { 21 | const buf = list[i]; 22 | target.set(buf, offset); 23 | offset += buf.length; 24 | } 25 | 26 | if (offset < totalLength) return target.slice(0, offset); 27 | 28 | return target; 29 | } 30 | 31 | /** 32 | * Masks a buffer using the given mask. 33 | * 34 | * @param {Buffer} source The buffer to mask 35 | * @param {Buffer} mask The mask to use 36 | * @param {Buffer} output The buffer where to store the result 37 | * @param {Number} offset The offset at which to start writing 38 | * @param {Number} length The number of bytes to mask. 39 | * @public 40 | */ 41 | function _mask(source, mask, output, offset, length) { 42 | for (let i = 0; i < length; i++) { 43 | output[offset + i] = source[i] ^ mask[i & 3]; 44 | } 45 | } 46 | 47 | /** 48 | * Unmasks a buffer using the given mask. 49 | * 50 | * @param {Buffer} buffer The buffer to unmask 51 | * @param {Buffer} mask The mask to use 52 | * @public 53 | */ 54 | function _unmask(buffer, mask) { 55 | // Required until https://github.com/nodejs/node/issues/9006 is resolved. 56 | const length = buffer.length; 57 | for (let i = 0; i < length; i++) { 58 | buffer[i] ^= mask[i & 3]; 59 | } 60 | } 61 | 62 | /** 63 | * Converts a buffer to an `ArrayBuffer`. 64 | * 65 | * @param {Buffer} buf The buffer to convert 66 | * @return {ArrayBuffer} Converted buffer 67 | * @public 68 | */ 69 | function toArrayBuffer(buf) { 70 | if (buf.byteLength === buf.buffer.byteLength) { 71 | return buf.buffer; 72 | } 73 | 74 | return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); 75 | } 76 | 77 | /** 78 | * Converts `data` to a `Buffer`. 79 | * 80 | * @param {*} data The data to convert 81 | * @return {Buffer} The buffer 82 | * @throws {TypeError} 83 | * @public 84 | */ 85 | function toBuffer(data) { 86 | toBuffer.readOnly = true; 87 | 88 | if (Buffer.isBuffer(data)) return data; 89 | 90 | let buf; 91 | 92 | if (data instanceof ArrayBuffer) { 93 | buf = Buffer.from(data); 94 | } else if (ArrayBuffer.isView(data)) { 95 | buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength); 96 | } else { 97 | buf = Buffer.from(data); 98 | toBuffer.readOnly = false; 99 | } 100 | 101 | return buf; 102 | } 103 | 104 | try { 105 | const bufferUtil = require('bufferutil'); 106 | const bu = bufferUtil.BufferUtil || bufferUtil; 107 | 108 | module.exports = { 109 | concat, 110 | mask(source, mask, output, offset, length) { 111 | if (length < 48) _mask(source, mask, output, offset, length); 112 | else bu.mask(source, mask, output, offset, length); 113 | }, 114 | toArrayBuffer, 115 | toBuffer, 116 | unmask(buffer, mask) { 117 | if (buffer.length < 32) _unmask(buffer, mask); 118 | else bu.unmask(buffer, mask); 119 | } 120 | }; 121 | } catch (e) /* istanbul ignore next */ { 122 | module.exports = { 123 | concat, 124 | mask: _mask, 125 | toArrayBuffer, 126 | toBuffer, 127 | unmask: _unmask 128 | }; 129 | } 130 | -------------------------------------------------------------------------------- /node_modules/ws/lib/constants.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], 5 | GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', 6 | kStatusCode: Symbol('status-code'), 7 | kWebSocket: Symbol('websocket'), 8 | EMPTY_BUFFER: Buffer.alloc(0), 9 | NOOP: () => {} 10 | }; 11 | -------------------------------------------------------------------------------- /node_modules/ws/lib/limiter.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const kDone = Symbol('kDone'); 4 | const kRun = Symbol('kRun'); 5 | 6 | /** 7 | * A very simple job queue with adjustable concurrency. Adapted from 8 | * https://github.com/STRML/async-limiter 9 | */ 10 | class Limiter { 11 | /** 12 | * Creates a new `Limiter`. 13 | * 14 | * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed 15 | * to run concurrently 16 | */ 17 | constructor(concurrency) { 18 | this[kDone] = () => { 19 | this.pending--; 20 | this[kRun](); 21 | }; 22 | this.concurrency = concurrency || Infinity; 23 | this.jobs = []; 24 | this.pending = 0; 25 | } 26 | 27 | /** 28 | * Adds a job to the queue. 29 | * 30 | * @param {Function} job The job to run 31 | * @public 32 | */ 33 | add(job) { 34 | this.jobs.push(job); 35 | this[kRun](); 36 | } 37 | 38 | /** 39 | * Removes a job from the queue and runs it if possible. 40 | * 41 | * @private 42 | */ 43 | [kRun]() { 44 | if (this.pending === this.concurrency) return; 45 | 46 | if (this.jobs.length) { 47 | const job = this.jobs.shift(); 48 | 49 | this.pending++; 50 | job(this[kDone]); 51 | } 52 | } 53 | } 54 | 55 | module.exports = Limiter; 56 | -------------------------------------------------------------------------------- /node_modules/ws/lib/validation.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * Checks if a status code is allowed in a close frame. 5 | * 6 | * @param {Number} code The status code 7 | * @return {Boolean} `true` if the status code is valid, else `false` 8 | * @public 9 | */ 10 | function isValidStatusCode(code) { 11 | return ( 12 | (code >= 1000 && 13 | code <= 1014 && 14 | code !== 1004 && 15 | code !== 1005 && 16 | code !== 1006) || 17 | (code >= 3000 && code <= 4999) 18 | ); 19 | } 20 | 21 | /** 22 | * Checks if a given buffer contains only correct UTF-8. 23 | * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by 24 | * Markus Kuhn. 25 | * 26 | * @param {Buffer} buf The buffer to check 27 | * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false` 28 | * @public 29 | */ 30 | function _isValidUTF8(buf) { 31 | const len = buf.length; 32 | let i = 0; 33 | 34 | while (i < len) { 35 | if (buf[i] < 0x80) { 36 | // 0xxxxxxx 37 | i++; 38 | } else if ((buf[i] & 0xe0) === 0xc0) { 39 | // 110xxxxx 10xxxxxx 40 | if ( 41 | i + 1 === len || 42 | (buf[i + 1] & 0xc0) !== 0x80 || 43 | (buf[i] & 0xfe) === 0xc0 // Overlong 44 | ) { 45 | return false; 46 | } else { 47 | i += 2; 48 | } 49 | } else if ((buf[i] & 0xf0) === 0xe0) { 50 | // 1110xxxx 10xxxxxx 10xxxxxx 51 | if ( 52 | i + 2 >= len || 53 | (buf[i + 1] & 0xc0) !== 0x80 || 54 | (buf[i + 2] & 0xc0) !== 0x80 || 55 | (buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong 56 | (buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF) 57 | ) { 58 | return false; 59 | } else { 60 | i += 3; 61 | } 62 | } else if ((buf[i] & 0xf8) === 0xf0) { 63 | // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 64 | if ( 65 | i + 3 >= len || 66 | (buf[i + 1] & 0xc0) !== 0x80 || 67 | (buf[i + 2] & 0xc0) !== 0x80 || 68 | (buf[i + 3] & 0xc0) !== 0x80 || 69 | (buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong 70 | (buf[i] === 0xf4 && buf[i + 1] > 0x8f) || 71 | buf[i] > 0xf4 // > U+10FFFF 72 | ) { 73 | return false; 74 | } else { 75 | i += 4; 76 | } 77 | } else { 78 | return false; 79 | } 80 | } 81 | 82 | return true; 83 | } 84 | 85 | try { 86 | let isValidUTF8 = require('utf-8-validate'); 87 | 88 | /* istanbul ignore if */ 89 | if (typeof isValidUTF8 === 'object') { 90 | isValidUTF8 = isValidUTF8.Validation.isValidUTF8; // utf-8-validate@<3.0.0 91 | } 92 | 93 | module.exports = { 94 | isValidStatusCode, 95 | isValidUTF8(buf) { 96 | return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf); 97 | } 98 | }; 99 | } catch (e) /* istanbul ignore next */ { 100 | module.exports = { 101 | isValidStatusCode, 102 | isValidUTF8: _isValidUTF8 103 | }; 104 | } 105 | -------------------------------------------------------------------------------- /node_modules/ws/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ws", 3 | "version": "7.4.5", 4 | "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", 5 | "keywords": [ 6 | "HyBi", 7 | "Push", 8 | "RFC-6455", 9 | "WebSocket", 10 | "WebSockets", 11 | "real-time" 12 | ], 13 | "homepage": "https://github.com/websockets/ws", 14 | "bugs": "https://github.com/websockets/ws/issues", 15 | "repository": "websockets/ws", 16 | "author": "Einar Otto Stangvik (http://2x.io)", 17 | "license": "MIT", 18 | "main": "index.js", 19 | "browser": "browser.js", 20 | "engines": { 21 | "node": ">=8.3.0" 22 | }, 23 | "files": [ 24 | "browser.js", 25 | "index.js", 26 | "lib/*.js" 27 | ], 28 | "scripts": { 29 | "test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js", 30 | "integration": "mocha --throw-deprecation test/*.integration.js", 31 | "lint": "eslint --ignore-path .gitignore . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\"" 32 | }, 33 | "peerDependencies": { 34 | "bufferutil": "^4.0.1", 35 | "utf-8-validate": "^5.0.2" 36 | }, 37 | "peerDependenciesMeta": { 38 | "bufferutil": { 39 | "optional": true 40 | }, 41 | "utf-8-validate": { 42 | "optional": true 43 | } 44 | }, 45 | "devDependencies": { 46 | "benchmark": "^2.1.4", 47 | "bufferutil": "^4.0.1", 48 | "eslint": "^7.2.0", 49 | "eslint-config-prettier": "^8.1.0", 50 | "eslint-plugin-prettier": "^3.0.1", 51 | "mocha": "^7.0.0", 52 | "nyc": "^15.0.0", 53 | "prettier": "^2.0.5", 54 | "utf-8-validate": "^5.0.2" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "premid-powercord", 3 | "version": "1.0.0", 4 | "description": "Gives you the abilty to have a custom presence that will start when you launch discord. Works with [show-all-activty](https://github.com/Juby210/show-all-activities)", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/MulverineX/premid-powercord.git" 12 | }, 13 | "author": "MulverineX", 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/MulverineX/premid-powercord/issues" 17 | }, 18 | "homepage": "https://github.com/MulverineX/premid-powercord#readme", 19 | "dependencies": { 20 | "socket.io": "^4.0.1" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/sideload.js: -------------------------------------------------------------------------------- 1 | const { readdirSync, readFileSync, watch, unwatchFile } = require('fs'); 2 | 3 | const info = (s) => console.log(`%c[PreMiD]%c ${s}`, 'color: #7289da; font-weight: bold', 'font-weight: bold'); 4 | 5 | let presenceDevWatchedFiles = [], 6 | currWatchPath = '', 7 | currWatcher = null; 8 | 9 | 10 | // Haha watch doesn't actually work at all and I have no idea why, also, when I remove it, it breaks, hahaha, kill me. no there isn't a reload hotkey, my sanity demands it so, remove it and readd it 11 | async function watchDir(path, socket) { 12 | currWatchPath = path + '/'; 13 | let files = readdirSync(path); 14 | 15 | if (currWatcher) await currWatcher.close(); 16 | 17 | currWatcher = watch(currWatchPath); 18 | 19 | currWatcher.on('all', eventName => { 20 | files = readdirSync(currWatchPath); 21 | 22 | console.log(eventName, currWatchPath, files); 23 | 24 | readFiles(files, currWatchPath, socket); 25 | }); 26 | 27 | readFiles(files, path, socket); 28 | } 29 | 30 | async function readFiles(files, path, socket) { 31 | //* Send files to extension 32 | const files_ = await Promise.all( 33 | files.map(f => { 34 | console.log() 35 | const ext = _.last(f.split('.')); 36 | if (ext === 'json') 37 | return { 38 | file: f, 39 | contents: JSON.parse(readFileSync(`${path}/${f}`).toString()) 40 | }; 41 | else if (ext === 'js') 42 | return { 43 | file: f, 44 | contents: readFileSync(`${path}/${f}`).toString() 45 | }; 46 | else return; 47 | }) 48 | ); 49 | console.log(files_) 50 | socket.emit('localPresence', { 51 | files: files_ 52 | }); 53 | } 54 | 55 | module.exports.openFileDialog = async function openFileDialog(socket) { 56 | //* Open file dialog 57 | //* If user cancels 58 | //* Unwatch all still watched files 59 | //* Watch directory 60 | let path = await DiscordNative.fileManager.showOpenDialog({ 61 | title: 'Select Presence Folder', 62 | message: 63 | 'Please select the folder that contains the presence you want to load.\n(metadata.json, presence.js, iframe.js)', 64 | buttonLabel: 'Load Presence', 65 | properties: ['openDirectory'] 66 | }); 67 | if (path.length === 0) { 68 | //* Show debug 69 | //* return 70 | info('Presence load canceled.'); 71 | return; 72 | } 73 | info(`Watching ${path[0]}`); 74 | if (presenceDevWatchedFiles.length > 0) 75 | await Promise.all( 76 | presenceDevWatchedFiles.map(f => unwatchFile(currWatchPath + f)) 77 | ); 78 | 79 | watchDir(path[0], socket); 80 | } --------------------------------------------------------------------------------