Showing
141 changed files
with
4721 additions
and
9 deletions
.env
0 → 100644
1 | var express = require('express'); | 1 | var express = require('express'); |
2 | +const path = require('path'); | ||
2 | const request = require('request'); | 3 | const request = require('request'); |
4 | +require("dotenv").config({ path: path.resolve(__dirname, "../.env") }); | ||
5 | +//console.log(path) | ||
3 | const TARGET_URL = 'https://api.line.me/v2/bot/message/reply' | 6 | const TARGET_URL = 'https://api.line.me/v2/bot/message/reply' |
4 | const PUSH_TARGET_URL = 'https://api.line.me/v2/bot/message/push' | 7 | const PUSH_TARGET_URL = 'https://api.line.me/v2/bot/message/push' |
5 | -const TOKEN = "OVIxKODBqM8Pn2dpFtFeSLsDbBvApfTu88rh8wFGOzfvgvPjmBH0A4XKii97VxIDO9shYyTix4qGq32vwvL895Rbss5VSVEiU/XG5lOdyTLgECkSQKOdObSetZwcVHbGmzZJ+0Cz5vZrB5KuImOwrwdB04t89/1O/w1cDnyilFU=" | 8 | +const TOKEN = process.env.TOKEN |
6 | const fs = require('fs'); | 9 | const fs = require('fs'); |
7 | -const path = require('path'); | ||
8 | const HTTPS = require('https'); | 10 | const HTTPS = require('https'); |
9 | -const domain = "2017103989.oss2021.tk" | 11 | +const domain = process.env.domain |
10 | const sslport = 23023; | 12 | const sslport = 23023; |
11 | const bodyParser = require('body-parser'); | 13 | const bodyParser = require('body-parser'); |
12 | var app = express(); | 14 | var app = express(); |
... | @@ -240,7 +242,7 @@ function printhelp(replyToken, message){ | ... | @@ -240,7 +242,7 @@ function printhelp(replyToken, message){ |
240 | "messages":[ | 242 | "messages":[ |
241 | { | 243 | { |
242 | "type":"text", | 244 | "type":"text", |
243 | - "text":"사용자 : 주가 도움말\n챗봇: 종목명을 알려주세요.\n사용자: 종목명 입력 (ex 삼성전자)\n챗봇 : 현재가 거래량 전일대비 수익률" | 245 | + "text":"'주가' 라고 입력하고 종목명을 입력해주세요. \n 현재가, 거래량, 전일대비 상승/하락률을 알려드릴게요!" |
244 | } | 246 | } |
245 | ] | 247 | ] |
246 | } | 248 | } |
... | @@ -261,7 +263,7 @@ function printhelp(replyToken, message){ | ... | @@ -261,7 +263,7 @@ function printhelp(replyToken, message){ |
261 | "messages":[ | 263 | "messages":[ |
262 | { | 264 | { |
263 | "type":"text", | 265 | "type":"text", |
264 | - "text":"사용자 : 비중 추천\n챗봇 : 포트폴리오에 넣을 종목을 선택해주세요(2 종목 이상)\n사용자: 종목명 입력\n챗봇: 시작할 날짜를 입력해주세요\n사용자 : 종목명 입력 (ex 삼성전자, LG전자 ...)\n챗봇: 전략을 선택해주세요. (gmv, ms , rp)\n사용자: gmv, ms, rp 중 입력\n챗봇 : 케이스에 맞게 함수 실행 후 비중 출력" | 266 | + "text":"'비중 추천'이라고 입력해주세요. \n 포트폴리오에 넣을 종목과 전략, 시작 날짜를 선택하면 비중을 추천해줄게요!" |
265 | } | 267 | } |
266 | ] | 268 | ] |
267 | } | 269 | } |
... | @@ -282,7 +284,7 @@ function printhelp(replyToken, message){ | ... | @@ -282,7 +284,7 @@ function printhelp(replyToken, message){ |
282 | "messages":[ | 284 | "messages":[ |
283 | { | 285 | { |
284 | "type":"text", | 286 | "type":"text", |
285 | - "text":"사용자 : 백테스트\n챗봇: 포트폴리오에 넣을 종목을 선택해주세요(2 종목 이상)\n사용자: 종목명 입력\n챗봇: 시작할 날짜를 입력해주세요\n사용자: 입력\n챗봇: 전략을 선택해주세요 (gmv, ms , rp)\n사용자: gmv,ms,rp 중 입력\n챗봇: 함수 실행 후 그래프 출력" | 287 | + "text":" '백테스트' 라고 입력해주세요. \n 포트폴리오에 넣을 종목과 전략, 시작 날짜를 선택하면 포트폴리오 수익률을 보여줄게요!" |
286 | } | 288 | } |
287 | ] | 289 | ] |
288 | } | 290 | } |
... | @@ -427,8 +429,8 @@ function optimizer(userid, sdate) { | ... | @@ -427,8 +429,8 @@ function optimizer(userid, sdate) { |
427 | }, | 429 | }, |
428 | { | 430 | { |
429 | "type":"image", | 431 | "type":"image", |
430 | - "originalContentUrl": "https://2017103989.oss2021.tk:23023/simages/test.png", | 432 | + "originalContentUrl": "https://" + domain+ ":23023/simages/test.png", |
431 | - "previewImageUrl": "https://2017103989.oss2021.tk:23023/simages/test.png" | 433 | + "previewImageUrl": "https://" + domain+ ":23023/simages/test.png" |
432 | } | 434 | } |
433 | ] | 435 | ] |
434 | } | 436 | } | ... | ... |
... | @@ -37,7 +37,7 @@ def basicinform(input): | ... | @@ -37,7 +37,7 @@ def basicinform(input): |
37 | ror = round(ror, 4) | 37 | ror = round(ror, 4) |
38 | ror = ror * 100 | 38 | ror = ror * 100 |
39 | value = '' | 39 | value = '' |
40 | - value = "1현재가: " + str(price) + "원\n거래랑: " + str(volume) + "건\n전일대비: " + str(ror) + "%" | 40 | + value = "1현재가: " + str(price) + "원\n거래량: " + str(volume) + "건\n전일대비: " + str(ror) + "%" |
41 | # value = { | 41 | # value = { |
42 | # "현재가": price, | 42 | # "현재가": price, |
43 | # "거래랑": volume, | 43 | # "거래랑": volume, | ... | ... |
server/node_modules/dotenv/CHANGELOG.md
0 → 100644
1 | +# Changelog | ||
2 | + | ||
3 | +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
4 | + | ||
5 | +## [10.0.0](https://github.com/motdotla/dotenv/compare/v9.0.2...v10.0.0) (2021-05-20) | ||
6 | + | ||
7 | +### Added | ||
8 | + | ||
9 | +- Add generic support to parse function | ||
10 | +- Allow for import "dotenv/config.js" | ||
11 | +- Add support to resolve home directory in path via ~ | ||
12 | + | ||
13 | +## [9.0.2](https://github.com/motdotla/dotenv/compare/v9.0.1...v9.0.2) (2021-05-10) | ||
14 | + | ||
15 | +### Changed | ||
16 | + | ||
17 | +- Support windows newlines with debug mode | ||
18 | + | ||
19 | +## [9.0.1](https://github.com/motdotla/dotenv/compare/v9.0.0...v9.0.1) (2021-05-08) | ||
20 | + | ||
21 | +### Changed | ||
22 | + | ||
23 | +- Updates to README | ||
24 | + | ||
25 | +## [9.0.0](https://github.com/motdotla/dotenv/compare/v8.6.0...v9.0.0) (2021-05-05) | ||
26 | + | ||
27 | +### Changed | ||
28 | + | ||
29 | +- _Breaking:_ drop support for Node v8 | ||
30 | + | ||
31 | +## [8.6.0](https://github.com/motdotla/dotenv/compare/v8.5.1...v8.6.0) (2021-05-05) | ||
32 | + | ||
33 | +### Added | ||
34 | + | ||
35 | +- define package.json in exports | ||
36 | + | ||
37 | +## [8.5.1](https://github.com/motdotla/dotenv/compare/v8.5.0...v8.5.1) (2021-05-05) | ||
38 | + | ||
39 | +### Changed | ||
40 | + | ||
41 | +- updated dev dependencies via npm audit | ||
42 | + | ||
43 | +## [8.5.0](https://github.com/motdotla/dotenv/compare/v8.4.0...v8.5.0) (2021-05-05) | ||
44 | + | ||
45 | +### Added | ||
46 | + | ||
47 | +- allow for `import "dotenv/config"` | ||
48 | + | ||
49 | +## [8.4.0](https://github.com/motdotla/dotenv/compare/v8.3.0...v8.4.0) (2021-05-05) | ||
50 | + | ||
51 | +### Changed | ||
52 | + | ||
53 | +- point to exact types file to work with VS Code | ||
54 | + | ||
55 | +## [8.3.0](https://github.com/motdotla/dotenv/compare/v8.2.0...v8.3.0) (2021-05-05) | ||
56 | + | ||
57 | +### Changed | ||
58 | + | ||
59 | +- _Breaking:_ drop support for Node v8 (mistake to be released as minor bump. later bumped to 9.0.0. see above.) | ||
60 | + | ||
61 | +## [8.2.0](https://github.com/motdotla/dotenv/compare/v8.1.0...v8.2.0) (2019-10-16) | ||
62 | + | ||
63 | +### Added | ||
64 | + | ||
65 | +- TypeScript types | ||
66 | + | ||
67 | +## [8.1.0](https://github.com/motdotla/dotenv/compare/v8.0.0...v8.1.0) (2019-08-18) | ||
68 | + | ||
69 | +### Changed | ||
70 | + | ||
71 | +- _Breaking:_ drop support for Node v6 ([#392](https://github.com/motdotla/dotenv/issues/392)) | ||
72 | + | ||
73 | +# [8.0.0](https://github.com/motdotla/dotenv/compare/v7.0.0...v8.0.0) (2019-05-02) | ||
74 | + | ||
75 | +### Changed | ||
76 | + | ||
77 | +- _Breaking:_ drop support for Node v6 ([#302](https://github.com/motdotla/dotenv/issues/392)) | ||
78 | + | ||
79 | +## [7.0.0] - 2019-03-12 | ||
80 | + | ||
81 | +### Fixed | ||
82 | + | ||
83 | +- Fix removing unbalanced quotes ([#376](https://github.com/motdotla/dotenv/pull/376)) | ||
84 | + | ||
85 | +### Removed | ||
86 | + | ||
87 | +- Removed `load` alias for `config` for consistency throughout code and documentation. | ||
88 | + | ||
89 | +## [6.2.0] - 2018-12-03 | ||
90 | + | ||
91 | +### Added | ||
92 | + | ||
93 | +- Support preload configuration via environment variables ([#351](https://github.com/motdotla/dotenv/issues/351)) | ||
94 | + | ||
95 | +## [6.1.0] - 2018-10-08 | ||
96 | + | ||
97 | +### Added | ||
98 | + | ||
99 | +- `debug` option for `config` and `parse` methods will turn on logging | ||
100 | + | ||
101 | +## [6.0.0] - 2018-06-02 | ||
102 | + | ||
103 | +### Changed | ||
104 | + | ||
105 | +- _Breaking:_ drop support for Node v4 ([#304](https://github.com/motdotla/dotenv/pull/304)) | ||
106 | + | ||
107 | +## [5.0.0] - 2018-01-29 | ||
108 | + | ||
109 | +### Added | ||
110 | + | ||
111 | +- Testing against Node v8 and v9 | ||
112 | +- Documentation on trim behavior of values | ||
113 | +- Documentation on how to use with `import` | ||
114 | + | ||
115 | +### Changed | ||
116 | + | ||
117 | +- _Breaking_: default `path` is now `path.resolve(process.cwd(), '.env')` | ||
118 | +- _Breaking_: does not write over keys already in `process.env` if the key has a falsy value | ||
119 | +- using `const` and `let` instead of `var` | ||
120 | + | ||
121 | +### Removed | ||
122 | + | ||
123 | +- Testing against Node v7 | ||
124 | + | ||
125 | +## [4.0.0] - 2016-12-23 | ||
126 | + | ||
127 | +### Changed | ||
128 | + | ||
129 | +- Return Object with parsed content or error instead of false ([#165](https://github.com/motdotla/dotenv/pull/165)). | ||
130 | + | ||
131 | +### Removed | ||
132 | + | ||
133 | +- `verbose` option removed in favor of returning result. | ||
134 | + | ||
135 | +## [3.0.0] - 2016-12-20 | ||
136 | + | ||
137 | +### Added | ||
138 | + | ||
139 | +- `verbose` option will log any error messages. Off by default. | ||
140 | +- parses email addresses correctly | ||
141 | +- allow importing config method directly in ES6 | ||
142 | + | ||
143 | +### Changed | ||
144 | + | ||
145 | +- Suppress error messages by default ([#154](https://github.com/motdotla/dotenv/pull/154)) | ||
146 | +- Ignoring more files for NPM to make package download smaller | ||
147 | + | ||
148 | +### Fixed | ||
149 | + | ||
150 | +- False positive test due to case-sensitive variable ([#124](https://github.com/motdotla/dotenv/pull/124)) | ||
151 | + | ||
152 | +### Removed | ||
153 | + | ||
154 | +- `silent` option removed in favor of `verbose` | ||
155 | + | ||
156 | +## [2.0.0] - 2016-01-20 | ||
157 | + | ||
158 | +### Added | ||
159 | + | ||
160 | +- CHANGELOG to ["make it easier for users and contributors to see precisely what notable changes have been made between each release"](http://keepachangelog.com/). Linked to from README | ||
161 | +- LICENSE to be more explicit about what was defined in `package.json`. Linked to from README | ||
162 | +- Testing nodejs v4 on travis-ci | ||
163 | +- added examples of how to use dotenv in different ways | ||
164 | +- return parsed object on success rather than boolean true | ||
165 | + | ||
166 | +### Changed | ||
167 | + | ||
168 | +- README has shorter description not referencing ruby gem since we don't have or want feature parity | ||
169 | + | ||
170 | +### Removed | ||
171 | + | ||
172 | +- Variable expansion and escaping so environment variables are encouraged to be fully orthogonal | ||
173 | + | ||
174 | +## [1.2.0] - 2015-06-20 | ||
175 | + | ||
176 | +### Added | ||
177 | + | ||
178 | +- Preload hook to require dotenv without including it in your code | ||
179 | + | ||
180 | +### Changed | ||
181 | + | ||
182 | +- clarified license to be "BSD-2-Clause" in `package.json` | ||
183 | + | ||
184 | +### Fixed | ||
185 | + | ||
186 | +- retain spaces in string vars | ||
187 | + | ||
188 | +## [1.1.0] - 2015-03-31 | ||
189 | + | ||
190 | +### Added | ||
191 | + | ||
192 | +- Silent option to silence `console.log` when `.env` missing | ||
193 | + | ||
194 | +## [1.0.0] - 2015-03-13 | ||
195 | + | ||
196 | +### Removed | ||
197 | + | ||
198 | +- support for multiple `.env` files. should always use one `.env` file for the current environment | ||
199 | + | ||
200 | +[7.0.0]: https://github.com/motdotla/dotenv/compare/v6.2.0...v7.0.0 | ||
201 | +[6.2.0]: https://github.com/motdotla/dotenv/compare/v6.1.0...v6.2.0 | ||
202 | +[6.1.0]: https://github.com/motdotla/dotenv/compare/v6.0.0...v6.1.0 | ||
203 | +[6.0.0]: https://github.com/motdotla/dotenv/compare/v5.0.0...v6.0.0 | ||
204 | +[5.0.0]: https://github.com/motdotla/dotenv/compare/v4.0.0...v5.0.0 | ||
205 | +[4.0.0]: https://github.com/motdotla/dotenv/compare/v3.0.0...v4.0.0 | ||
206 | +[3.0.0]: https://github.com/motdotla/dotenv/compare/v2.0.0...v3.0.0 | ||
207 | +[2.0.0]: https://github.com/motdotla/dotenv/compare/v1.2.0...v2.0.0 | ||
208 | +[1.2.0]: https://github.com/motdotla/dotenv/compare/v1.1.0...v1.2.0 | ||
209 | +[1.1.0]: https://github.com/motdotla/dotenv/compare/v1.0.0...v1.1.0 | ||
210 | +[1.0.0]: https://github.com/motdotla/dotenv/compare/v0.4.0...v1.0.0 |
server/node_modules/dotenv/LICENSE
0 → 100644
1 | +Copyright (c) 2015, Scott Motte | ||
2 | +All rights reserved. | ||
3 | + | ||
4 | +Redistribution and use in source and binary forms, with or without | ||
5 | +modification, are permitted provided that the following conditions are met: | ||
6 | + | ||
7 | +* Redistributions of source code must retain the above copyright notice, this | ||
8 | + list of conditions and the following disclaimer. | ||
9 | + | ||
10 | +* Redistributions in binary form must reproduce the above copyright notice, | ||
11 | + this list of conditions and the following disclaimer in the documentation | ||
12 | + and/or other materials provided with the distribution. | ||
13 | + | ||
14 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
15 | +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
16 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
17 | +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
18 | +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
19 | +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
20 | +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
21 | +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
22 | +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
23 | +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
server/node_modules/dotenv/README.md
0 → 100644
1 | +<p align="center"> | ||
2 | +<strong>Announcement 📣</strong><br/>From the makers that brought you Dotenv, introducing <a href="https://sync.dotenv.org">Dotenv Sync</a>.<br/>Sync your .env files between machines, environments, and team members.<br/><a href="https://sync.dotenv.org">Join the early access list. 🕶</a> | ||
3 | +</p> | ||
4 | + | ||
5 | +# dotenv | ||
6 | + | ||
7 | +<img src="https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.png" alt="dotenv" align="right" /> | ||
8 | + | ||
9 | +Dotenv is a zero-dependency module that loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). Storing configuration in the environment separate from code is based on [The Twelve-Factor App](http://12factor.net/config) methodology. | ||
10 | + | ||
11 | +[![BuildStatus](https://img.shields.io/travis/motdotla/dotenv/master.svg?style=flat-square)](https://travis-ci.org/motdotla/dotenv) | ||
12 | +[![Build status](https://ci.appveyor.com/api/projects/status/github/motdotla/dotenv?svg=true)](https://ci.appveyor.com/project/motdotla/dotenv/branch/master) | ||
13 | +[![NPM version](https://img.shields.io/npm/v/dotenv.svg?style=flat-square)](https://www.npmjs.com/package/dotenv) | ||
14 | +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) | ||
15 | +[![Coverage Status](https://img.shields.io/coveralls/motdotla/dotenv/master.svg?style=flat-square)](https://coveralls.io/github/motdotla/dotenv?branch=coverall-intergration) | ||
16 | +[![LICENSE](https://img.shields.io/github/license/motdotla/dotenv.svg)](LICENSE) | ||
17 | +[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) | ||
18 | + | ||
19 | +## Install | ||
20 | + | ||
21 | +```bash | ||
22 | +# with npm | ||
23 | +npm install dotenv | ||
24 | + | ||
25 | +# or with Yarn | ||
26 | +yarn add dotenv | ||
27 | +``` | ||
28 | + | ||
29 | +## Usage | ||
30 | + | ||
31 | +As early as possible in your application, require and configure dotenv. | ||
32 | + | ||
33 | +```javascript | ||
34 | +require('dotenv').config() | ||
35 | +``` | ||
36 | + | ||
37 | +Create a `.env` file in the root directory of your project. Add | ||
38 | +environment-specific variables on new lines in the form of `NAME=VALUE`. | ||
39 | +For example: | ||
40 | + | ||
41 | +```dosini | ||
42 | +DB_HOST=localhost | ||
43 | +DB_USER=root | ||
44 | +DB_PASS=s1mpl3 | ||
45 | +``` | ||
46 | + | ||
47 | +`process.env` now has the keys and values you defined in your `.env` file. | ||
48 | + | ||
49 | +```javascript | ||
50 | +const db = require('db') | ||
51 | +db.connect({ | ||
52 | + host: process.env.DB_HOST, | ||
53 | + username: process.env.DB_USER, | ||
54 | + password: process.env.DB_PASS | ||
55 | +}) | ||
56 | +``` | ||
57 | + | ||
58 | +### Preload | ||
59 | + | ||
60 | +You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#cli_r_require_module) to preload dotenv. By doing this, you do not need to require and load dotenv in your application code. This is the preferred approach when using `import` instead of `require`. | ||
61 | + | ||
62 | +```bash | ||
63 | +$ node -r dotenv/config your_script.js | ||
64 | +``` | ||
65 | + | ||
66 | +The configuration options below are supported as command line arguments in the format `dotenv_config_<option>=value` | ||
67 | + | ||
68 | +```bash | ||
69 | +$ node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/.env | ||
70 | +``` | ||
71 | + | ||
72 | +Additionally, you can use environment variables to set configuration options. Command line arguments will precede these. | ||
73 | + | ||
74 | +```bash | ||
75 | +$ DOTENV_CONFIG_<OPTION>=value node -r dotenv/config your_script.js | ||
76 | +``` | ||
77 | + | ||
78 | +```bash | ||
79 | +$ DOTENV_CONFIG_ENCODING=latin1 node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/.env | ||
80 | +``` | ||
81 | + | ||
82 | +## Config | ||
83 | + | ||
84 | +`config` will read your `.env` file, parse the contents, assign it to | ||
85 | +[`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env), | ||
86 | +and return an Object with a `parsed` key containing the loaded content or an `error` key if it failed. | ||
87 | + | ||
88 | +```js | ||
89 | +const result = dotenv.config() | ||
90 | + | ||
91 | +if (result.error) { | ||
92 | + throw result.error | ||
93 | +} | ||
94 | + | ||
95 | +console.log(result.parsed) | ||
96 | +``` | ||
97 | + | ||
98 | +You can additionally, pass options to `config`. | ||
99 | + | ||
100 | +### Options | ||
101 | + | ||
102 | +#### Path | ||
103 | + | ||
104 | +Default: `path.resolve(process.cwd(), '.env')` | ||
105 | + | ||
106 | +You may specify a custom path if your file containing environment variables is located elsewhere. | ||
107 | + | ||
108 | +```js | ||
109 | +require('dotenv').config({ path: '/custom/path/to/.env' }) | ||
110 | +``` | ||
111 | + | ||
112 | +#### Encoding | ||
113 | + | ||
114 | +Default: `utf8` | ||
115 | + | ||
116 | +You may specify the encoding of your file containing environment variables. | ||
117 | + | ||
118 | +```js | ||
119 | +require('dotenv').config({ encoding: 'latin1' }) | ||
120 | +``` | ||
121 | + | ||
122 | +#### Debug | ||
123 | + | ||
124 | +Default: `false` | ||
125 | + | ||
126 | +You may turn on logging to help debug why certain keys or values are not being set as you expect. | ||
127 | + | ||
128 | +```js | ||
129 | +require('dotenv').config({ debug: process.env.DEBUG }) | ||
130 | +``` | ||
131 | + | ||
132 | +## Parse | ||
133 | + | ||
134 | +The engine which parses the contents of your file containing environment | ||
135 | +variables is available to use. It accepts a String or Buffer and will return | ||
136 | +an Object with the parsed keys and values. | ||
137 | + | ||
138 | +```js | ||
139 | +const dotenv = require('dotenv') | ||
140 | +const buf = Buffer.from('BASIC=basic') | ||
141 | +const config = dotenv.parse(buf) // will return an object | ||
142 | +console.log(typeof config, config) // object { BASIC : 'basic' } | ||
143 | +``` | ||
144 | + | ||
145 | +### Options | ||
146 | + | ||
147 | +#### Debug | ||
148 | + | ||
149 | +Default: `false` | ||
150 | + | ||
151 | +You may turn on logging to help debug why certain keys or values are not being set as you expect. | ||
152 | + | ||
153 | +```js | ||
154 | +const dotenv = require('dotenv') | ||
155 | +const buf = Buffer.from('hello world') | ||
156 | +const opt = { debug: true } | ||
157 | +const config = dotenv.parse(buf, opt) | ||
158 | +// expect a debug message because the buffer is not in KEY=VAL form | ||
159 | +``` | ||
160 | + | ||
161 | +### Rules | ||
162 | + | ||
163 | +The parsing engine currently supports the following rules: | ||
164 | + | ||
165 | +- `BASIC=basic` becomes `{BASIC: 'basic'}` | ||
166 | +- empty lines are skipped | ||
167 | +- lines beginning with `#` are treated as comments | ||
168 | +- empty values become empty strings (`EMPTY=` becomes `{EMPTY: ''}`) | ||
169 | +- inner quotes are maintained (think JSON) (`JSON={"foo": "bar"}` becomes `{JSON:"{\"foo\": \"bar\"}"`) | ||
170 | +- whitespace is removed from both ends of unquoted values (see more on [`trim`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)) (`FOO= some value ` becomes `{FOO: 'some value'}`) | ||
171 | +- single and double quoted values are escaped (`SINGLE_QUOTE='quoted'` becomes `{SINGLE_QUOTE: "quoted"}`) | ||
172 | +- single and double quoted values maintain whitespace from both ends (`FOO=" some value "` becomes `{FOO: ' some value '}`) | ||
173 | +- double quoted values expand new lines (`MULTILINE="new\nline"` becomes | ||
174 | + | ||
175 | +``` | ||
176 | +{MULTILINE: 'new | ||
177 | +line'} | ||
178 | +``` | ||
179 | + | ||
180 | +## FAQ | ||
181 | + | ||
182 | +### Should I commit my `.env` file? | ||
183 | + | ||
184 | +No. We **strongly** recommend against committing your `.env` file to version | ||
185 | +control. It should only include environment-specific values such as database | ||
186 | +passwords or API keys. Your production database should have a different | ||
187 | +password than your development database. | ||
188 | + | ||
189 | +### Should I have multiple `.env` files? | ||
190 | + | ||
191 | +No. We **strongly** recommend against having a "main" `.env` file and an "environment" `.env` file like `.env.test`. Your config should vary between deploys, and you should not be sharing values between environments. | ||
192 | + | ||
193 | +> In a twelve-factor app, env vars are granular controls, each fully orthogonal to other env vars. They are never grouped together as “environments”, but instead are independently managed for each deploy. This is a model that scales up smoothly as the app naturally expands into more deploys over its lifetime. | ||
194 | +> | ||
195 | +> – [The Twelve-Factor App](http://12factor.net/config) | ||
196 | + | ||
197 | +### What happens to environment variables that were already set? | ||
198 | + | ||
199 | +We will never modify any environment variables that have already been set. In particular, if there is a variable in your `.env` file which collides with one that already exists in your environment, then that variable will be skipped. This behavior allows you to override all `.env` configurations with a machine-specific environment, although it is not recommended. | ||
200 | + | ||
201 | +If you want to override `process.env` you can do something like this: | ||
202 | + | ||
203 | +```javascript | ||
204 | +const fs = require('fs') | ||
205 | +const dotenv = require('dotenv') | ||
206 | +const envConfig = dotenv.parse(fs.readFileSync('.env.override')) | ||
207 | +for (const k in envConfig) { | ||
208 | + process.env[k] = envConfig[k] | ||
209 | +} | ||
210 | +``` | ||
211 | + | ||
212 | +### Can I customize/write plugins for dotenv? | ||
213 | + | ||
214 | +For `dotenv@2.x.x`: Yes. `dotenv.config()` now returns an object representing | ||
215 | +the parsed `.env` file. This gives you everything you need to continue | ||
216 | +setting values on `process.env`. For example: | ||
217 | + | ||
218 | +```js | ||
219 | +const dotenv = require('dotenv') | ||
220 | +const variableExpansion = require('dotenv-expand') | ||
221 | +const myEnv = dotenv.config() | ||
222 | +variableExpansion(myEnv) | ||
223 | +``` | ||
224 | + | ||
225 | +### What about variable expansion? | ||
226 | + | ||
227 | +Try [dotenv-expand](https://github.com/motdotla/dotenv-expand) | ||
228 | + | ||
229 | +### How do I use dotenv with `import`? | ||
230 | + | ||
231 | +ES2015 and beyond offers modules that allow you to `export` any top-level `function`, `class`, `var`, `let`, or `const`. | ||
232 | + | ||
233 | +> When you run a module containing an `import` declaration, the modules it imports are loaded first, then each module body is executed in a depth-first traversal of the dependency graph, avoiding cycles by skipping anything already executed. | ||
234 | +> | ||
235 | +> – [ES6 In Depth: Modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/) | ||
236 | + | ||
237 | +You must run `dotenv.config()` before referencing any environment variables. Here's an example of problematic code: | ||
238 | + | ||
239 | +`errorReporter.js`: | ||
240 | + | ||
241 | +```js | ||
242 | +import { Client } from 'best-error-reporting-service' | ||
243 | + | ||
244 | +export const client = new Client(process.env.BEST_API_KEY) | ||
245 | +``` | ||
246 | + | ||
247 | +`index.js`: | ||
248 | + | ||
249 | +```js | ||
250 | +import dotenv from 'dotenv' | ||
251 | +import errorReporter from './errorReporter' | ||
252 | + | ||
253 | +dotenv.config() | ||
254 | +errorReporter.client.report(new Error('faq example')) | ||
255 | +``` | ||
256 | + | ||
257 | +`client` will not be configured correctly because it was constructed before `dotenv.config()` was executed. There are (at least) 3 ways to make this work. | ||
258 | + | ||
259 | +1. Preload dotenv: `node --require dotenv/config index.js` (_Note: you do not need to `import` dotenv with this approach_) | ||
260 | +2. Import `dotenv/config` instead of `dotenv` (_Note: you do not need to call `dotenv.config()` and must pass options via the command line or environment variables with this approach_) | ||
261 | +3. Create a separate file that will execute `config` first as outlined in [this comment on #133](https://github.com/motdotla/dotenv/issues/133#issuecomment-255298822) | ||
262 | + | ||
263 | +## Contributing Guide | ||
264 | + | ||
265 | +See [CONTRIBUTING.md](CONTRIBUTING.md) | ||
266 | + | ||
267 | +## Change Log | ||
268 | + | ||
269 | +See [CHANGELOG.md](CHANGELOG.md) | ||
270 | + | ||
271 | +## Who's using dotenv? | ||
272 | + | ||
273 | +[These npm modules depend on it.](https://www.npmjs.com/browse/depended/dotenv) | ||
274 | + | ||
275 | +Projects that expand it often use the [keyword "dotenv" on npm](https://www.npmjs.com/search?q=keywords:dotenv). |
server/node_modules/dotenv/config.js
0 → 100644
1 | +/* @flow */ | ||
2 | + | ||
3 | +const re = /^dotenv_config_(encoding|path|debug)=(.+)$/ | ||
4 | + | ||
5 | +module.exports = function optionMatcher (args /*: Array<string> */) { | ||
6 | + return args.reduce(function (acc, cur) { | ||
7 | + const matches = cur.match(re) | ||
8 | + if (matches) { | ||
9 | + acc[matches[1]] = matches[2] | ||
10 | + } | ||
11 | + return acc | ||
12 | + }, {}) | ||
13 | +} |
1 | +/* @flow */ | ||
2 | + | ||
3 | +// ../config.js accepts options via environment variables | ||
4 | +const options = {} | ||
5 | + | ||
6 | +if (process.env.DOTENV_CONFIG_ENCODING != null) { | ||
7 | + options.encoding = process.env.DOTENV_CONFIG_ENCODING | ||
8 | +} | ||
9 | + | ||
10 | +if (process.env.DOTENV_CONFIG_PATH != null) { | ||
11 | + options.path = process.env.DOTENV_CONFIG_PATH | ||
12 | +} | ||
13 | + | ||
14 | +if (process.env.DOTENV_CONFIG_DEBUG != null) { | ||
15 | + options.debug = process.env.DOTENV_CONFIG_DEBUG | ||
16 | +} | ||
17 | + | ||
18 | +module.exports = options |
server/node_modules/dotenv/lib/main.js
0 → 100644
1 | +/* @flow */ | ||
2 | +/*:: | ||
3 | + | ||
4 | +type DotenvParseOptions = { | ||
5 | + debug?: boolean | ||
6 | +} | ||
7 | + | ||
8 | +// keys and values from src | ||
9 | +type DotenvParseOutput = { [string]: string } | ||
10 | + | ||
11 | +type DotenvConfigOptions = { | ||
12 | + path?: string, // path to .env file | ||
13 | + encoding?: string, // encoding of .env file | ||
14 | + debug?: string // turn on logging for debugging purposes | ||
15 | +} | ||
16 | + | ||
17 | +type DotenvConfigOutput = { | ||
18 | + parsed?: DotenvParseOutput, | ||
19 | + error?: Error | ||
20 | +} | ||
21 | + | ||
22 | +*/ | ||
23 | + | ||
24 | +const fs = require('fs') | ||
25 | +const path = require('path') | ||
26 | +const os = require('os') | ||
27 | + | ||
28 | +function log (message /*: string */) { | ||
29 | + console.log(`[dotenv][DEBUG] ${message}`) | ||
30 | +} | ||
31 | + | ||
32 | +const NEWLINE = '\n' | ||
33 | +const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/ | ||
34 | +const RE_NEWLINES = /\\n/g | ||
35 | +const NEWLINES_MATCH = /\r\n|\n|\r/ | ||
36 | + | ||
37 | +// Parses src into an Object | ||
38 | +function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ { | ||
39 | + const debug = Boolean(options && options.debug) | ||
40 | + const obj = {} | ||
41 | + | ||
42 | + // convert Buffers before splitting into lines and processing | ||
43 | + src.toString().split(NEWLINES_MATCH).forEach(function (line, idx) { | ||
44 | + // matching "KEY' and 'VAL' in 'KEY=VAL' | ||
45 | + const keyValueArr = line.match(RE_INI_KEY_VAL) | ||
46 | + // matched? | ||
47 | + if (keyValueArr != null) { | ||
48 | + const key = keyValueArr[1] | ||
49 | + // default undefined or missing values to empty string | ||
50 | + let val = (keyValueArr[2] || '') | ||
51 | + const end = val.length - 1 | ||
52 | + const isDoubleQuoted = val[0] === '"' && val[end] === '"' | ||
53 | + const isSingleQuoted = val[0] === "'" && val[end] === "'" | ||
54 | + | ||
55 | + // if single or double quoted, remove quotes | ||
56 | + if (isSingleQuoted || isDoubleQuoted) { | ||
57 | + val = val.substring(1, end) | ||
58 | + | ||
59 | + // if double quoted, expand newlines | ||
60 | + if (isDoubleQuoted) { | ||
61 | + val = val.replace(RE_NEWLINES, NEWLINE) | ||
62 | + } | ||
63 | + } else { | ||
64 | + // remove surrounding whitespace | ||
65 | + val = val.trim() | ||
66 | + } | ||
67 | + | ||
68 | + obj[key] = val | ||
69 | + } else if (debug) { | ||
70 | + log(`did not match key and value when parsing line ${idx + 1}: ${line}`) | ||
71 | + } | ||
72 | + }) | ||
73 | + | ||
74 | + return obj | ||
75 | +} | ||
76 | + | ||
77 | +function resolveHome (envPath) { | ||
78 | + return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath | ||
79 | +} | ||
80 | + | ||
81 | +// Populates process.env from .env file | ||
82 | +function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ { | ||
83 | + let dotenvPath = path.resolve(process.cwd(), '.env') | ||
84 | + let encoding /*: string */ = 'utf8' | ||
85 | + let debug = false | ||
86 | + | ||
87 | + if (options) { | ||
88 | + if (options.path != null) { | ||
89 | + dotenvPath = resolveHome(options.path) | ||
90 | + } | ||
91 | + if (options.encoding != null) { | ||
92 | + encoding = options.encoding | ||
93 | + } | ||
94 | + if (options.debug != null) { | ||
95 | + debug = true | ||
96 | + } | ||
97 | + } | ||
98 | + | ||
99 | + try { | ||
100 | + // specifying an encoding returns a string instead of a buffer | ||
101 | + const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug }) | ||
102 | + | ||
103 | + Object.keys(parsed).forEach(function (key) { | ||
104 | + if (!Object.prototype.hasOwnProperty.call(process.env, key)) { | ||
105 | + process.env[key] = parsed[key] | ||
106 | + } else if (debug) { | ||
107 | + log(`"${key}" is already defined in \`process.env\` and will not be overwritten`) | ||
108 | + } | ||
109 | + }) | ||
110 | + | ||
111 | + return { parsed } | ||
112 | + } catch (e) { | ||
113 | + return { error: e } | ||
114 | + } | ||
115 | +} | ||
116 | + | ||
117 | +module.exports.config = config | ||
118 | +module.exports.parse = parse |
server/node_modules/dotenv/package.json
0 → 100644
1 | +{ | ||
2 | + "_from": "dotenv", | ||
3 | + "_id": "dotenv@10.0.0", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", | ||
6 | + "_location": "/dotenv", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "tag", | ||
10 | + "registry": true, | ||
11 | + "raw": "dotenv", | ||
12 | + "name": "dotenv", | ||
13 | + "escapedName": "dotenv", | ||
14 | + "rawSpec": "", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "latest" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "#USER", | ||
20 | + "/" | ||
21 | + ], | ||
22 | + "_resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", | ||
23 | + "_shasum": "3d4227b8fb95f81096cdd2b66653fb2c7085ba81", | ||
24 | + "_spec": "dotenv", | ||
25 | + "_where": "/home/ubuntu/stock_chatbot/server", | ||
26 | + "bugs": { | ||
27 | + "url": "https://github.com/motdotla/dotenv/issues" | ||
28 | + }, | ||
29 | + "bundleDependencies": false, | ||
30 | + "dependencies": {}, | ||
31 | + "deprecated": false, | ||
32 | + "description": "Loads environment variables from .env file", | ||
33 | + "devDependencies": { | ||
34 | + "decache": "^4.5.1", | ||
35 | + "dtslint": "^0.9.8", | ||
36 | + "flow-bin": "^0.109.0", | ||
37 | + "sinon": "^7.5.0", | ||
38 | + "standard": "^13.1.0", | ||
39 | + "standard-markdown": "^5.1.0", | ||
40 | + "standard-version": "^7.0.0", | ||
41 | + "tap": "^14.7.0" | ||
42 | + }, | ||
43 | + "engines": { | ||
44 | + "node": ">=10" | ||
45 | + }, | ||
46 | + "exports": { | ||
47 | + ".": "./lib/main.js", | ||
48 | + "./config": "./config.js", | ||
49 | + "./config.js": "./config.js", | ||
50 | + "./package.json": "./package.json" | ||
51 | + }, | ||
52 | + "homepage": "https://github.com/motdotla/dotenv#readme", | ||
53 | + "keywords": [ | ||
54 | + "dotenv", | ||
55 | + "env", | ||
56 | + ".env", | ||
57 | + "environment", | ||
58 | + "variables", | ||
59 | + "config", | ||
60 | + "settings" | ||
61 | + ], | ||
62 | + "license": "BSD-2-Clause", | ||
63 | + "main": "lib/main.js", | ||
64 | + "name": "dotenv", | ||
65 | + "repository": { | ||
66 | + "type": "git", | ||
67 | + "url": "git://github.com/motdotla/dotenv.git" | ||
68 | + }, | ||
69 | + "scripts": { | ||
70 | + "dtslint": "dtslint types", | ||
71 | + "flow": "flow", | ||
72 | + "lint": "standard", | ||
73 | + "postlint": "standard-markdown", | ||
74 | + "prerelease": "npm test", | ||
75 | + "pretest": "npm run lint && npm run dtslint", | ||
76 | + "release": "standard-version", | ||
77 | + "test": "tap tests/*.js --100" | ||
78 | + }, | ||
79 | + "standard": { | ||
80 | + "ignore": [ | ||
81 | + "flow-typed/" | ||
82 | + ] | ||
83 | + }, | ||
84 | + "types": "types/index.d.ts", | ||
85 | + "version": "10.0.0" | ||
86 | +} |
server/node_modules/dotenv/types/index.d.ts
0 → 100644
1 | +// TypeScript Version: 3.0 | ||
2 | +/// <reference types="node" /> | ||
3 | + | ||
4 | +export interface DotenvParseOptions { | ||
5 | + /** | ||
6 | + * You may turn on logging to help debug why certain keys or values are not being set as you expect. | ||
7 | + */ | ||
8 | + debug?: boolean; | ||
9 | +} | ||
10 | + | ||
11 | +export interface DotenvParseOutput { | ||
12 | + [name: string]: string; | ||
13 | +} | ||
14 | + | ||
15 | +/** | ||
16 | + * Parses a string or buffer in the .env file format into an object. | ||
17 | + * | ||
18 | + * @param src - contents to be parsed | ||
19 | + * @param options - additional options | ||
20 | + * @returns an object with keys and values based on `src` | ||
21 | + */ | ||
22 | +export function parse<T extends DotenvParseOutput = DotenvParseOutput>( | ||
23 | + src: string | Buffer, | ||
24 | + options?: DotenvParseOptions | ||
25 | +): T; | ||
26 | + | ||
27 | +export interface DotenvConfigOptions { | ||
28 | + /** | ||
29 | + * You may specify a custom path if your file containing environment variables is located elsewhere. | ||
30 | + */ | ||
31 | + path?: string; | ||
32 | + | ||
33 | + /** | ||
34 | + * You may specify the encoding of your file containing environment variables. | ||
35 | + */ | ||
36 | + encoding?: string; | ||
37 | + | ||
38 | + /** | ||
39 | + * You may turn on logging to help debug why certain keys or values are not being set as you expect. | ||
40 | + */ | ||
41 | + debug?: boolean; | ||
42 | +} | ||
43 | + | ||
44 | +export interface DotenvConfigOutput { | ||
45 | + error?: Error; | ||
46 | + parsed?: DotenvParseOutput; | ||
47 | +} | ||
48 | + | ||
49 | +/** | ||
50 | + * Loads `.env` file contents into {@link https://nodejs.org/api/process.html#process_process_env `process.env`}. | ||
51 | + * Example: 'KEY=value' becomes { parsed: { KEY: 'value' } } | ||
52 | + * | ||
53 | + * @param options - controls behavior | ||
54 | + * @returns an object with a `parsed` key if successful or `error` key if an error occurred | ||
55 | + * | ||
56 | + */ | ||
57 | +export function config(options?: DotenvConfigOptions): DotenvConfigOutput; | ||
58 | +/** @deprecated since v7.0.0 Use config instead. */ | ||
59 | +export const load: typeof config; |
server/node_modules/dotenv/types/test.ts
0 → 100644
1 | +import { config, parse } from "dotenv"; | ||
2 | + | ||
3 | +const env = config(); | ||
4 | +const dbUrl: string | null = | ||
5 | + env.error || !env.parsed ? null : env.parsed["BASIC"]; | ||
6 | + | ||
7 | +config({ | ||
8 | + path: ".env-example", | ||
9 | + encoding: "utf8", | ||
10 | + debug: true | ||
11 | +}); | ||
12 | + | ||
13 | +const parsed = parse("NODE_ENV=production\nDB_HOST=a.b.c"); | ||
14 | +const dbHost: string = parsed["DB_HOST"]; | ||
15 | + | ||
16 | +const parsedFromBuffer = parse(new Buffer("JUSTICE=league\n"), { | ||
17 | + debug: true | ||
18 | +}); | ||
19 | +const justice: string = parsedFromBuffer["JUSTICE"]; |
server/node_modules/dotenv/types/tslint.json
0 → 100644
1 | +root = true | ||
2 | + | ||
3 | +[*] | ||
4 | +indent_style = tab | ||
5 | +indent_size = 4 | ||
6 | +end_of_line = lf | ||
7 | +charset = utf-8 | ||
8 | +trim_trailing_whitespace = true | ||
9 | +insert_final_newline = true | ||
10 | +max_line_length = 120 | ||
11 | + | ||
12 | +[CHANGELOG.md] | ||
13 | +indent_style = space | ||
14 | +indent_size = 2 | ||
15 | + | ||
16 | +[*.json] | ||
17 | +max_line_length = off | ||
18 | + | ||
19 | +[Makefile] | ||
20 | +max_line_length = off |
server/node_modules/function-bind/.eslintrc
0 → 100644
server/node_modules/function-bind/.jscs.json
0 → 100644
1 | +{ | ||
2 | + "es3": true, | ||
3 | + | ||
4 | + "additionalRules": [], | ||
5 | + | ||
6 | + "requireSemicolons": true, | ||
7 | + | ||
8 | + "disallowMultipleSpaces": true, | ||
9 | + | ||
10 | + "disallowIdentifierNames": [], | ||
11 | + | ||
12 | + "requireCurlyBraces": { | ||
13 | + "allExcept": [], | ||
14 | + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] | ||
15 | + }, | ||
16 | + | ||
17 | + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], | ||
18 | + | ||
19 | + "disallowSpaceAfterKeywords": [], | ||
20 | + | ||
21 | + "disallowSpaceBeforeComma": true, | ||
22 | + "disallowSpaceAfterComma": false, | ||
23 | + "disallowSpaceBeforeSemicolon": true, | ||
24 | + | ||
25 | + "disallowNodeTypes": [ | ||
26 | + "DebuggerStatement", | ||
27 | + "ForInStatement", | ||
28 | + "LabeledStatement", | ||
29 | + "SwitchCase", | ||
30 | + "SwitchStatement", | ||
31 | + "WithStatement" | ||
32 | + ], | ||
33 | + | ||
34 | + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, | ||
35 | + | ||
36 | + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, | ||
37 | + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, | ||
38 | + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, | ||
39 | + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, | ||
40 | + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, | ||
41 | + | ||
42 | + "requireSpaceBetweenArguments": true, | ||
43 | + | ||
44 | + "disallowSpacesInsideParentheses": true, | ||
45 | + | ||
46 | + "disallowSpacesInsideArrayBrackets": true, | ||
47 | + | ||
48 | + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, | ||
49 | + | ||
50 | + "disallowSpaceAfterObjectKeys": true, | ||
51 | + | ||
52 | + "requireCommaBeforeLineBreak": true, | ||
53 | + | ||
54 | + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], | ||
55 | + "requireSpaceAfterPrefixUnaryOperators": [], | ||
56 | + | ||
57 | + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], | ||
58 | + "requireSpaceBeforePostfixUnaryOperators": [], | ||
59 | + | ||
60 | + "disallowSpaceBeforeBinaryOperators": [], | ||
61 | + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], | ||
62 | + | ||
63 | + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], | ||
64 | + "disallowSpaceAfterBinaryOperators": [], | ||
65 | + | ||
66 | + "disallowImplicitTypeConversion": ["binary", "string"], | ||
67 | + | ||
68 | + "disallowKeywords": ["with", "eval"], | ||
69 | + | ||
70 | + "requireKeywordsOnNewLine": [], | ||
71 | + "disallowKeywordsOnNewLine": ["else"], | ||
72 | + | ||
73 | + "requireLineFeedAtFileEnd": true, | ||
74 | + | ||
75 | + "disallowTrailingWhitespace": true, | ||
76 | + | ||
77 | + "disallowTrailingComma": true, | ||
78 | + | ||
79 | + "excludeFiles": ["node_modules/**", "vendor/**"], | ||
80 | + | ||
81 | + "disallowMultipleLineStrings": true, | ||
82 | + | ||
83 | + "requireDotNotation": { "allExcept": ["keywords"] }, | ||
84 | + | ||
85 | + "requireParenthesesAroundIIFE": true, | ||
86 | + | ||
87 | + "validateLineBreaks": "LF", | ||
88 | + | ||
89 | + "validateQuoteMarks": { | ||
90 | + "escape": true, | ||
91 | + "mark": "'" | ||
92 | + }, | ||
93 | + | ||
94 | + "disallowOperatorBeforeLineBreak": [], | ||
95 | + | ||
96 | + "requireSpaceBeforeKeywords": [ | ||
97 | + "do", | ||
98 | + "for", | ||
99 | + "if", | ||
100 | + "else", | ||
101 | + "switch", | ||
102 | + "case", | ||
103 | + "try", | ||
104 | + "catch", | ||
105 | + "finally", | ||
106 | + "while", | ||
107 | + "with", | ||
108 | + "return" | ||
109 | + ], | ||
110 | + | ||
111 | + "validateAlignedFunctionParameters": { | ||
112 | + "lineBreakAfterOpeningBraces": true, | ||
113 | + "lineBreakBeforeClosingBraces": true | ||
114 | + }, | ||
115 | + | ||
116 | + "requirePaddingNewLinesBeforeExport": true, | ||
117 | + | ||
118 | + "validateNewlineAfterArrayElements": { | ||
119 | + "maximum": 8 | ||
120 | + }, | ||
121 | + | ||
122 | + "requirePaddingNewLinesAfterUseStrict": true, | ||
123 | + | ||
124 | + "disallowArrowFunctions": true, | ||
125 | + | ||
126 | + "disallowMultiLineTernary": true, | ||
127 | + | ||
128 | + "validateOrderInObjectKeys": "asc-insensitive", | ||
129 | + | ||
130 | + "disallowIdenticalDestructuringNames": true, | ||
131 | + | ||
132 | + "disallowNestedTernaries": { "maxLevel": 1 }, | ||
133 | + | ||
134 | + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, | ||
135 | + "requireAlignedMultilineParams": false, | ||
136 | + | ||
137 | + "requireSpacesInGenerator": { | ||
138 | + "afterStar": true | ||
139 | + }, | ||
140 | + | ||
141 | + "disallowSpacesInGenerator": { | ||
142 | + "beforeStar": true | ||
143 | + }, | ||
144 | + | ||
145 | + "disallowVar": false, | ||
146 | + | ||
147 | + "requireArrayDestructuring": false, | ||
148 | + | ||
149 | + "requireEnhancedObjectLiterals": false, | ||
150 | + | ||
151 | + "requireObjectDestructuring": false, | ||
152 | + | ||
153 | + "requireEarlyReturn": false, | ||
154 | + | ||
155 | + "requireCapitalizedConstructorsNew": { | ||
156 | + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] | ||
157 | + }, | ||
158 | + | ||
159 | + "requireImportAlphabetized": false, | ||
160 | + | ||
161 | + "requireSpaceBeforeObjectValues": true, | ||
162 | + "requireSpaceBeforeDestructuredValues": true, | ||
163 | + | ||
164 | + "disallowSpacesInsideTemplateStringPlaceholders": true, | ||
165 | + | ||
166 | + "disallowArrayDestructuringReturn": false, | ||
167 | + | ||
168 | + "requireNewlineBeforeSingleStatementsInIf": false, | ||
169 | + | ||
170 | + "disallowUnusedVariables": true, | ||
171 | + | ||
172 | + "requireSpacesInsideImportedObjectBraces": true, | ||
173 | + | ||
174 | + "requireUseStrict": true | ||
175 | +} | ||
176 | + |
server/node_modules/function-bind/.npmignore
0 → 100644
1 | +# gitignore | ||
2 | +.DS_Store | ||
3 | +.monitor | ||
4 | +.*.swp | ||
5 | +.nodemonignore | ||
6 | +releases | ||
7 | +*.log | ||
8 | +*.err | ||
9 | +fleet.json | ||
10 | +public/browserify | ||
11 | +bin/*.json | ||
12 | +.bin | ||
13 | +build | ||
14 | +compile | ||
15 | +.lock-wscript | ||
16 | +coverage | ||
17 | +node_modules | ||
18 | + | ||
19 | +# Only apps should have lockfiles | ||
20 | +npm-shrinkwrap.json | ||
21 | +package-lock.json | ||
22 | +yarn.lock |
1 | +language: node_js | ||
2 | +os: | ||
3 | + - linux | ||
4 | +node_js: | ||
5 | + - "8.4" | ||
6 | + - "7.10" | ||
7 | + - "6.11" | ||
8 | + - "5.12" | ||
9 | + - "4.8" | ||
10 | + - "iojs-v3.3" | ||
11 | + - "iojs-v2.5" | ||
12 | + - "iojs-v1.8" | ||
13 | + - "0.12" | ||
14 | + - "0.10" | ||
15 | + - "0.8" | ||
16 | +before_install: | ||
17 | + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' | ||
18 | + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ] || [ "${TRAVIS_NODE_VERSION:0:4}" = "iojs" ]; then npm install -g npm@4.5 ; else npm install -g npm; fi; fi' | ||
19 | +install: | ||
20 | + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' | ||
21 | +script: | ||
22 | + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' | ||
23 | + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' | ||
24 | + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' | ||
25 | + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' | ||
26 | +sudo: false | ||
27 | +env: | ||
28 | + - TEST=true | ||
29 | +matrix: | ||
30 | + fast_finish: true | ||
31 | + include: | ||
32 | + - node_js: "node" | ||
33 | + env: PRETEST=true | ||
34 | + - node_js: "4" | ||
35 | + env: COVERAGE=true | ||
36 | + - node_js: "8.3" | ||
37 | + env: TEST=true ALLOW_FAILURE=true | ||
38 | + - node_js: "8.2" | ||
39 | + env: TEST=true ALLOW_FAILURE=true | ||
40 | + - node_js: "8.1" | ||
41 | + env: TEST=true ALLOW_FAILURE=true | ||
42 | + - node_js: "8.0" | ||
43 | + env: TEST=true ALLOW_FAILURE=true | ||
44 | + - node_js: "7.9" | ||
45 | + env: TEST=true ALLOW_FAILURE=true | ||
46 | + - node_js: "7.8" | ||
47 | + env: TEST=true ALLOW_FAILURE=true | ||
48 | + - node_js: "7.7" | ||
49 | + env: TEST=true ALLOW_FAILURE=true | ||
50 | + - node_js: "7.6" | ||
51 | + env: TEST=true ALLOW_FAILURE=true | ||
52 | + - node_js: "7.5" | ||
53 | + env: TEST=true ALLOW_FAILURE=true | ||
54 | + - node_js: "7.4" | ||
55 | + env: TEST=true ALLOW_FAILURE=true | ||
56 | + - node_js: "7.3" | ||
57 | + env: TEST=true ALLOW_FAILURE=true | ||
58 | + - node_js: "7.2" | ||
59 | + env: TEST=true ALLOW_FAILURE=true | ||
60 | + - node_js: "7.1" | ||
61 | + env: TEST=true ALLOW_FAILURE=true | ||
62 | + - node_js: "7.0" | ||
63 | + env: TEST=true ALLOW_FAILURE=true | ||
64 | + - node_js: "6.10" | ||
65 | + env: TEST=true ALLOW_FAILURE=true | ||
66 | + - node_js: "6.9" | ||
67 | + env: TEST=true ALLOW_FAILURE=true | ||
68 | + - node_js: "6.8" | ||
69 | + env: TEST=true ALLOW_FAILURE=true | ||
70 | + - node_js: "6.7" | ||
71 | + env: TEST=true ALLOW_FAILURE=true | ||
72 | + - node_js: "6.6" | ||
73 | + env: TEST=true ALLOW_FAILURE=true | ||
74 | + - node_js: "6.5" | ||
75 | + env: TEST=true ALLOW_FAILURE=true | ||
76 | + - node_js: "6.4" | ||
77 | + env: TEST=true ALLOW_FAILURE=true | ||
78 | + - node_js: "6.3" | ||
79 | + env: TEST=true ALLOW_FAILURE=true | ||
80 | + - node_js: "6.2" | ||
81 | + env: TEST=true ALLOW_FAILURE=true | ||
82 | + - node_js: "6.1" | ||
83 | + env: TEST=true ALLOW_FAILURE=true | ||
84 | + - node_js: "6.0" | ||
85 | + env: TEST=true ALLOW_FAILURE=true | ||
86 | + - node_js: "5.11" | ||
87 | + env: TEST=true ALLOW_FAILURE=true | ||
88 | + - node_js: "5.10" | ||
89 | + env: TEST=true ALLOW_FAILURE=true | ||
90 | + - node_js: "5.9" | ||
91 | + env: TEST=true ALLOW_FAILURE=true | ||
92 | + - node_js: "5.8" | ||
93 | + env: TEST=true ALLOW_FAILURE=true | ||
94 | + - node_js: "5.7" | ||
95 | + env: TEST=true ALLOW_FAILURE=true | ||
96 | + - node_js: "5.6" | ||
97 | + env: TEST=true ALLOW_FAILURE=true | ||
98 | + - node_js: "5.5" | ||
99 | + env: TEST=true ALLOW_FAILURE=true | ||
100 | + - node_js: "5.4" | ||
101 | + env: TEST=true ALLOW_FAILURE=true | ||
102 | + - node_js: "5.3" | ||
103 | + env: TEST=true ALLOW_FAILURE=true | ||
104 | + - node_js: "5.2" | ||
105 | + env: TEST=true ALLOW_FAILURE=true | ||
106 | + - node_js: "5.1" | ||
107 | + env: TEST=true ALLOW_FAILURE=true | ||
108 | + - node_js: "5.0" | ||
109 | + env: TEST=true ALLOW_FAILURE=true | ||
110 | + - node_js: "4.7" | ||
111 | + env: TEST=true ALLOW_FAILURE=true | ||
112 | + - node_js: "4.6" | ||
113 | + env: TEST=true ALLOW_FAILURE=true | ||
114 | + - node_js: "4.5" | ||
115 | + env: TEST=true ALLOW_FAILURE=true | ||
116 | + - node_js: "4.4" | ||
117 | + env: TEST=true ALLOW_FAILURE=true | ||
118 | + - node_js: "4.3" | ||
119 | + env: TEST=true ALLOW_FAILURE=true | ||
120 | + - node_js: "4.2" | ||
121 | + env: TEST=true ALLOW_FAILURE=true | ||
122 | + - node_js: "4.1" | ||
123 | + env: TEST=true ALLOW_FAILURE=true | ||
124 | + - node_js: "4.0" | ||
125 | + env: TEST=true ALLOW_FAILURE=true | ||
126 | + - node_js: "iojs-v3.2" | ||
127 | + env: TEST=true ALLOW_FAILURE=true | ||
128 | + - node_js: "iojs-v3.1" | ||
129 | + env: TEST=true ALLOW_FAILURE=true | ||
130 | + - node_js: "iojs-v3.0" | ||
131 | + env: TEST=true ALLOW_FAILURE=true | ||
132 | + - node_js: "iojs-v2.4" | ||
133 | + env: TEST=true ALLOW_FAILURE=true | ||
134 | + - node_js: "iojs-v2.3" | ||
135 | + env: TEST=true ALLOW_FAILURE=true | ||
136 | + - node_js: "iojs-v2.2" | ||
137 | + env: TEST=true ALLOW_FAILURE=true | ||
138 | + - node_js: "iojs-v2.1" | ||
139 | + env: TEST=true ALLOW_FAILURE=true | ||
140 | + - node_js: "iojs-v2.0" | ||
141 | + env: TEST=true ALLOW_FAILURE=true | ||
142 | + - node_js: "iojs-v1.7" | ||
143 | + env: TEST=true ALLOW_FAILURE=true | ||
144 | + - node_js: "iojs-v1.6" | ||
145 | + env: TEST=true ALLOW_FAILURE=true | ||
146 | + - node_js: "iojs-v1.5" | ||
147 | + env: TEST=true ALLOW_FAILURE=true | ||
148 | + - node_js: "iojs-v1.4" | ||
149 | + env: TEST=true ALLOW_FAILURE=true | ||
150 | + - node_js: "iojs-v1.3" | ||
151 | + env: TEST=true ALLOW_FAILURE=true | ||
152 | + - node_js: "iojs-v1.2" | ||
153 | + env: TEST=true ALLOW_FAILURE=true | ||
154 | + - node_js: "iojs-v1.1" | ||
155 | + env: TEST=true ALLOW_FAILURE=true | ||
156 | + - node_js: "iojs-v1.0" | ||
157 | + env: TEST=true ALLOW_FAILURE=true | ||
158 | + - node_js: "0.11" | ||
159 | + env: TEST=true ALLOW_FAILURE=true | ||
160 | + - node_js: "0.9" | ||
161 | + env: TEST=true ALLOW_FAILURE=true | ||
162 | + - node_js: "0.6" | ||
163 | + env: TEST=true ALLOW_FAILURE=true | ||
164 | + - node_js: "0.4" | ||
165 | + env: TEST=true ALLOW_FAILURE=true | ||
166 | + allow_failures: | ||
167 | + - os: osx | ||
168 | + - env: TEST=true ALLOW_FAILURE=true |
server/node_modules/function-bind/LICENSE
0 → 100644
1 | +Copyright (c) 2013 Raynos. | ||
2 | + | ||
3 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | +of this software and associated documentation files (the "Software"), to deal | ||
5 | +in the Software without restriction, including without limitation the rights | ||
6 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
7 | +copies of the Software, and to permit persons to whom the Software is | ||
8 | +furnished to do so, subject to the following conditions: | ||
9 | + | ||
10 | +The above copyright notice and this permission notice shall be included in | ||
11 | +all copies or substantial portions of the Software. | ||
12 | + | ||
13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
18 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
19 | +THE SOFTWARE. | ||
20 | + |
server/node_modules/function-bind/README.md
0 → 100644
1 | +# function-bind | ||
2 | + | ||
3 | +<!-- | ||
4 | + [![build status][travis-svg]][travis-url] | ||
5 | + [![NPM version][npm-badge-svg]][npm-url] | ||
6 | + [![Coverage Status][5]][6] | ||
7 | + [![gemnasium Dependency Status][7]][8] | ||
8 | + [![Dependency status][deps-svg]][deps-url] | ||
9 | + [![Dev Dependency status][dev-deps-svg]][dev-deps-url] | ||
10 | +--> | ||
11 | + | ||
12 | +<!-- [![browser support][11]][12] --> | ||
13 | + | ||
14 | +Implementation of function.prototype.bind | ||
15 | + | ||
16 | +## Example | ||
17 | + | ||
18 | +I mainly do this for unit tests I run on phantomjs. | ||
19 | +PhantomJS does not have Function.prototype.bind :( | ||
20 | + | ||
21 | +```js | ||
22 | +Function.prototype.bind = require("function-bind") | ||
23 | +``` | ||
24 | + | ||
25 | +## Installation | ||
26 | + | ||
27 | +`npm install function-bind` | ||
28 | + | ||
29 | +## Contributors | ||
30 | + | ||
31 | + - Raynos | ||
32 | + | ||
33 | +## MIT Licenced | ||
34 | + | ||
35 | + [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg | ||
36 | + [travis-url]: https://travis-ci.org/Raynos/function-bind | ||
37 | + [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg | ||
38 | + [npm-url]: https://npmjs.org/package/function-bind | ||
39 | + [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png | ||
40 | + [6]: https://coveralls.io/r/Raynos/function-bind | ||
41 | + [7]: https://gemnasium.com/Raynos/function-bind.png | ||
42 | + [8]: https://gemnasium.com/Raynos/function-bind | ||
43 | + [deps-svg]: https://david-dm.org/Raynos/function-bind.svg | ||
44 | + [deps-url]: https://david-dm.org/Raynos/function-bind | ||
45 | + [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg | ||
46 | + [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies | ||
47 | + [11]: https://ci.testling.com/Raynos/function-bind.png | ||
48 | + [12]: https://ci.testling.com/Raynos/function-bind |
1 | +'use strict'; | ||
2 | + | ||
3 | +/* eslint no-invalid-this: 1 */ | ||
4 | + | ||
5 | +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; | ||
6 | +var slice = Array.prototype.slice; | ||
7 | +var toStr = Object.prototype.toString; | ||
8 | +var funcType = '[object Function]'; | ||
9 | + | ||
10 | +module.exports = function bind(that) { | ||
11 | + var target = this; | ||
12 | + if (typeof target !== 'function' || toStr.call(target) !== funcType) { | ||
13 | + throw new TypeError(ERROR_MESSAGE + target); | ||
14 | + } | ||
15 | + var args = slice.call(arguments, 1); | ||
16 | + | ||
17 | + var bound; | ||
18 | + var binder = function () { | ||
19 | + if (this instanceof bound) { | ||
20 | + var result = target.apply( | ||
21 | + this, | ||
22 | + args.concat(slice.call(arguments)) | ||
23 | + ); | ||
24 | + if (Object(result) === result) { | ||
25 | + return result; | ||
26 | + } | ||
27 | + return this; | ||
28 | + } else { | ||
29 | + return target.apply( | ||
30 | + that, | ||
31 | + args.concat(slice.call(arguments)) | ||
32 | + ); | ||
33 | + } | ||
34 | + }; | ||
35 | + | ||
36 | + var boundLength = Math.max(0, target.length - args.length); | ||
37 | + var boundArgs = []; | ||
38 | + for (var i = 0; i < boundLength; i++) { | ||
39 | + boundArgs.push('$' + i); | ||
40 | + } | ||
41 | + | ||
42 | + bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); | ||
43 | + | ||
44 | + if (target.prototype) { | ||
45 | + var Empty = function Empty() {}; | ||
46 | + Empty.prototype = target.prototype; | ||
47 | + bound.prototype = new Empty(); | ||
48 | + Empty.prototype = null; | ||
49 | + } | ||
50 | + | ||
51 | + return bound; | ||
52 | +}; |
server/node_modules/function-bind/index.js
0 → 100644
1 | +{ | ||
2 | + "_from": "function-bind@^1.1.1", | ||
3 | + "_id": "function-bind@1.1.1", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", | ||
6 | + "_location": "/function-bind", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "range", | ||
10 | + "registry": true, | ||
11 | + "raw": "function-bind@^1.1.1", | ||
12 | + "name": "function-bind", | ||
13 | + "escapedName": "function-bind", | ||
14 | + "rawSpec": "^1.1.1", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "^1.1.1" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "/has" | ||
20 | + ], | ||
21 | + "_resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", | ||
22 | + "_shasum": "a56899d3ea3c9bab874bb9773b7c5ede92f4895d", | ||
23 | + "_spec": "function-bind@^1.1.1", | ||
24 | + "_where": "/home/ubuntu/stock_chatbot/server/node_modules/has", | ||
25 | + "author": { | ||
26 | + "name": "Raynos", | ||
27 | + "email": "raynos2@gmail.com" | ||
28 | + }, | ||
29 | + "bugs": { | ||
30 | + "url": "https://github.com/Raynos/function-bind/issues", | ||
31 | + "email": "raynos2@gmail.com" | ||
32 | + }, | ||
33 | + "bundleDependencies": false, | ||
34 | + "contributors": [ | ||
35 | + { | ||
36 | + "name": "Raynos" | ||
37 | + }, | ||
38 | + { | ||
39 | + "name": "Jordan Harband", | ||
40 | + "url": "https://github.com/ljharb" | ||
41 | + } | ||
42 | + ], | ||
43 | + "dependencies": {}, | ||
44 | + "deprecated": false, | ||
45 | + "description": "Implementation of Function.prototype.bind", | ||
46 | + "devDependencies": { | ||
47 | + "@ljharb/eslint-config": "^12.2.1", | ||
48 | + "covert": "^1.1.0", | ||
49 | + "eslint": "^4.5.0", | ||
50 | + "jscs": "^3.0.7", | ||
51 | + "tape": "^4.8.0" | ||
52 | + }, | ||
53 | + "homepage": "https://github.com/Raynos/function-bind", | ||
54 | + "keywords": [ | ||
55 | + "function", | ||
56 | + "bind", | ||
57 | + "shim", | ||
58 | + "es5" | ||
59 | + ], | ||
60 | + "license": "MIT", | ||
61 | + "main": "index", | ||
62 | + "name": "function-bind", | ||
63 | + "repository": { | ||
64 | + "type": "git", | ||
65 | + "url": "git://github.com/Raynos/function-bind.git" | ||
66 | + }, | ||
67 | + "scripts": { | ||
68 | + "coverage": "covert test/*.js", | ||
69 | + "eslint": "eslint *.js */*.js", | ||
70 | + "jscs": "jscs *.js */*.js", | ||
71 | + "lint": "npm run jscs && npm run eslint", | ||
72 | + "posttest": "npm run coverage -- --quiet", | ||
73 | + "pretest": "npm run lint", | ||
74 | + "test": "npm run tests-only", | ||
75 | + "tests-only": "node test" | ||
76 | + }, | ||
77 | + "testling": { | ||
78 | + "files": "test/index.js", | ||
79 | + "browsers": [ | ||
80 | + "ie/8..latest", | ||
81 | + "firefox/16..latest", | ||
82 | + "firefox/nightly", | ||
83 | + "chrome/22..latest", | ||
84 | + "chrome/canary", | ||
85 | + "opera/12..latest", | ||
86 | + "opera/next", | ||
87 | + "safari/5.1..latest", | ||
88 | + "ipad/6.0..latest", | ||
89 | + "iphone/6.0..latest", | ||
90 | + "android-browser/4.2..latest" | ||
91 | + ] | ||
92 | + }, | ||
93 | + "version": "1.1.1" | ||
94 | +} |
1 | +// jscs:disable requireUseStrict | ||
2 | + | ||
3 | +var test = require('tape'); | ||
4 | + | ||
5 | +var functionBind = require('../implementation'); | ||
6 | +var getCurrentContext = function () { return this; }; | ||
7 | + | ||
8 | +test('functionBind is a function', function (t) { | ||
9 | + t.equal(typeof functionBind, 'function'); | ||
10 | + t.end(); | ||
11 | +}); | ||
12 | + | ||
13 | +test('non-functions', function (t) { | ||
14 | + var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g]; | ||
15 | + t.plan(nonFunctions.length); | ||
16 | + for (var i = 0; i < nonFunctions.length; ++i) { | ||
17 | + try { functionBind.call(nonFunctions[i]); } catch (ex) { | ||
18 | + t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i])); | ||
19 | + } | ||
20 | + } | ||
21 | + t.end(); | ||
22 | +}); | ||
23 | + | ||
24 | +test('without a context', function (t) { | ||
25 | + t.test('binds properly', function (st) { | ||
26 | + var args, context; | ||
27 | + var namespace = { | ||
28 | + func: functionBind.call(function () { | ||
29 | + args = Array.prototype.slice.call(arguments); | ||
30 | + context = this; | ||
31 | + }) | ||
32 | + }; | ||
33 | + namespace.func(1, 2, 3); | ||
34 | + st.deepEqual(args, [1, 2, 3]); | ||
35 | + st.equal(context, getCurrentContext.call()); | ||
36 | + st.end(); | ||
37 | + }); | ||
38 | + | ||
39 | + t.test('binds properly, and still supplies bound arguments', function (st) { | ||
40 | + var args, context; | ||
41 | + var namespace = { | ||
42 | + func: functionBind.call(function () { | ||
43 | + args = Array.prototype.slice.call(arguments); | ||
44 | + context = this; | ||
45 | + }, undefined, 1, 2, 3) | ||
46 | + }; | ||
47 | + namespace.func(4, 5, 6); | ||
48 | + st.deepEqual(args, [1, 2, 3, 4, 5, 6]); | ||
49 | + st.equal(context, getCurrentContext.call()); | ||
50 | + st.end(); | ||
51 | + }); | ||
52 | + | ||
53 | + t.test('returns properly', function (st) { | ||
54 | + var args; | ||
55 | + var namespace = { | ||
56 | + func: functionBind.call(function () { | ||
57 | + args = Array.prototype.slice.call(arguments); | ||
58 | + return this; | ||
59 | + }, null) | ||
60 | + }; | ||
61 | + var context = namespace.func(1, 2, 3); | ||
62 | + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); | ||
63 | + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); | ||
64 | + st.end(); | ||
65 | + }); | ||
66 | + | ||
67 | + t.test('returns properly with bound arguments', function (st) { | ||
68 | + var args; | ||
69 | + var namespace = { | ||
70 | + func: functionBind.call(function () { | ||
71 | + args = Array.prototype.slice.call(arguments); | ||
72 | + return this; | ||
73 | + }, null, 1, 2, 3) | ||
74 | + }; | ||
75 | + var context = namespace.func(4, 5, 6); | ||
76 | + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); | ||
77 | + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); | ||
78 | + st.end(); | ||
79 | + }); | ||
80 | + | ||
81 | + t.test('called as a constructor', function (st) { | ||
82 | + var thunkify = function (value) { | ||
83 | + return function () { return value; }; | ||
84 | + }; | ||
85 | + st.test('returns object value', function (sst) { | ||
86 | + var expectedReturnValue = [1, 2, 3]; | ||
87 | + var Constructor = functionBind.call(thunkify(expectedReturnValue), null); | ||
88 | + var result = new Constructor(); | ||
89 | + sst.equal(result, expectedReturnValue); | ||
90 | + sst.end(); | ||
91 | + }); | ||
92 | + | ||
93 | + st.test('does not return primitive value', function (sst) { | ||
94 | + var Constructor = functionBind.call(thunkify(42), null); | ||
95 | + var result = new Constructor(); | ||
96 | + sst.notEqual(result, 42); | ||
97 | + sst.end(); | ||
98 | + }); | ||
99 | + | ||
100 | + st.test('object from bound constructor is instance of original and bound constructor', function (sst) { | ||
101 | + var A = function (x) { | ||
102 | + this.name = x || 'A'; | ||
103 | + }; | ||
104 | + var B = functionBind.call(A, null, 'B'); | ||
105 | + | ||
106 | + var result = new B(); | ||
107 | + sst.ok(result instanceof B, 'result is instance of bound constructor'); | ||
108 | + sst.ok(result instanceof A, 'result is instance of original constructor'); | ||
109 | + sst.end(); | ||
110 | + }); | ||
111 | + | ||
112 | + st.end(); | ||
113 | + }); | ||
114 | + | ||
115 | + t.end(); | ||
116 | +}); | ||
117 | + | ||
118 | +test('with a context', function (t) { | ||
119 | + t.test('with no bound arguments', function (st) { | ||
120 | + var args, context; | ||
121 | + var boundContext = {}; | ||
122 | + var namespace = { | ||
123 | + func: functionBind.call(function () { | ||
124 | + args = Array.prototype.slice.call(arguments); | ||
125 | + context = this; | ||
126 | + }, boundContext) | ||
127 | + }; | ||
128 | + namespace.func(1, 2, 3); | ||
129 | + st.equal(context, boundContext, 'binds a context properly'); | ||
130 | + st.deepEqual(args, [1, 2, 3], 'supplies passed arguments'); | ||
131 | + st.end(); | ||
132 | + }); | ||
133 | + | ||
134 | + t.test('with bound arguments', function (st) { | ||
135 | + var args, context; | ||
136 | + var boundContext = {}; | ||
137 | + var namespace = { | ||
138 | + func: functionBind.call(function () { | ||
139 | + args = Array.prototype.slice.call(arguments); | ||
140 | + context = this; | ||
141 | + }, boundContext, 1, 2, 3) | ||
142 | + }; | ||
143 | + namespace.func(4, 5, 6); | ||
144 | + st.equal(context, boundContext, 'binds a context properly'); | ||
145 | + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments'); | ||
146 | + st.end(); | ||
147 | + }); | ||
148 | + | ||
149 | + t.test('returns properly', function (st) { | ||
150 | + var boundContext = {}; | ||
151 | + var args; | ||
152 | + var namespace = { | ||
153 | + func: functionBind.call(function () { | ||
154 | + args = Array.prototype.slice.call(arguments); | ||
155 | + return this; | ||
156 | + }, boundContext) | ||
157 | + }; | ||
158 | + var context = namespace.func(1, 2, 3); | ||
159 | + st.equal(context, boundContext, 'returned context is bound context'); | ||
160 | + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); | ||
161 | + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); | ||
162 | + st.end(); | ||
163 | + }); | ||
164 | + | ||
165 | + t.test('returns properly with bound arguments', function (st) { | ||
166 | + var boundContext = {}; | ||
167 | + var args; | ||
168 | + var namespace = { | ||
169 | + func: functionBind.call(function () { | ||
170 | + args = Array.prototype.slice.call(arguments); | ||
171 | + return this; | ||
172 | + }, boundContext, 1, 2, 3) | ||
173 | + }; | ||
174 | + var context = namespace.func(4, 5, 6); | ||
175 | + st.equal(context, boundContext, 'returned context is bound context'); | ||
176 | + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); | ||
177 | + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); | ||
178 | + st.end(); | ||
179 | + }); | ||
180 | + | ||
181 | + t.test('passes the correct arguments when called as a constructor', function (st) { | ||
182 | + var expected = { name: 'Correct' }; | ||
183 | + var namespace = { | ||
184 | + Func: functionBind.call(function (arg) { | ||
185 | + return arg; | ||
186 | + }, { name: 'Incorrect' }) | ||
187 | + }; | ||
188 | + var returned = new namespace.Func(expected); | ||
189 | + st.equal(returned, expected, 'returns the right arg when called as a constructor'); | ||
190 | + st.end(); | ||
191 | + }); | ||
192 | + | ||
193 | + t.test('has the new instance\'s context when called as a constructor', function (st) { | ||
194 | + var actualContext; | ||
195 | + var expectedContext = { foo: 'bar' }; | ||
196 | + var namespace = { | ||
197 | + Func: functionBind.call(function () { | ||
198 | + actualContext = this; | ||
199 | + }, expectedContext) | ||
200 | + }; | ||
201 | + var result = new namespace.Func(); | ||
202 | + st.equal(result instanceof namespace.Func, true); | ||
203 | + st.notEqual(actualContext, expectedContext); | ||
204 | + st.end(); | ||
205 | + }); | ||
206 | + | ||
207 | + t.end(); | ||
208 | +}); | ||
209 | + | ||
210 | +test('bound function length', function (t) { | ||
211 | + t.test('sets a correct length without thisArg', function (st) { | ||
212 | + var subject = functionBind.call(function (a, b, c) { return a + b + c; }); | ||
213 | + st.equal(subject.length, 3); | ||
214 | + st.equal(subject(1, 2, 3), 6); | ||
215 | + st.end(); | ||
216 | + }); | ||
217 | + | ||
218 | + t.test('sets a correct length with thisArg', function (st) { | ||
219 | + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}); | ||
220 | + st.equal(subject.length, 3); | ||
221 | + st.equal(subject(1, 2, 3), 6); | ||
222 | + st.end(); | ||
223 | + }); | ||
224 | + | ||
225 | + t.test('sets a correct length without thisArg and first argument', function (st) { | ||
226 | + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1); | ||
227 | + st.equal(subject.length, 2); | ||
228 | + st.equal(subject(2, 3), 6); | ||
229 | + st.end(); | ||
230 | + }); | ||
231 | + | ||
232 | + t.test('sets a correct length with thisArg and first argument', function (st) { | ||
233 | + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1); | ||
234 | + st.equal(subject.length, 2); | ||
235 | + st.equal(subject(2, 3), 6); | ||
236 | + st.end(); | ||
237 | + }); | ||
238 | + | ||
239 | + t.test('sets a correct length without thisArg and too many arguments', function (st) { | ||
240 | + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4); | ||
241 | + st.equal(subject.length, 0); | ||
242 | + st.equal(subject(), 6); | ||
243 | + st.end(); | ||
244 | + }); | ||
245 | + | ||
246 | + t.test('sets a correct length with thisArg and too many arguments', function (st) { | ||
247 | + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4); | ||
248 | + st.equal(subject.length, 0); | ||
249 | + st.equal(subject(), 6); | ||
250 | + st.end(); | ||
251 | + }); | ||
252 | +}); |
server/node_modules/has/LICENSE-MIT
0 → 100644
1 | +Copyright (c) 2013 Thiago de Arruda | ||
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. |
server/node_modules/has/README.md
0 → 100644
1 | +# has | ||
2 | + | ||
3 | +> Object.prototype.hasOwnProperty.call shortcut | ||
4 | + | ||
5 | +## Installation | ||
6 | + | ||
7 | +```sh | ||
8 | +npm install --save has | ||
9 | +``` | ||
10 | + | ||
11 | +## Usage | ||
12 | + | ||
13 | +```js | ||
14 | +var has = require('has'); | ||
15 | + | ||
16 | +has({}, 'hasOwnProperty'); // false | ||
17 | +has(Object.prototype, 'hasOwnProperty'); // true | ||
18 | +``` |
server/node_modules/has/package.json
0 → 100644
1 | +{ | ||
2 | + "_from": "has@^1.0.3", | ||
3 | + "_id": "has@1.0.3", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", | ||
6 | + "_location": "/has", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "range", | ||
10 | + "registry": true, | ||
11 | + "raw": "has@^1.0.3", | ||
12 | + "name": "has", | ||
13 | + "escapedName": "has", | ||
14 | + "rawSpec": "^1.0.3", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "^1.0.3" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "/is-core-module" | ||
20 | + ], | ||
21 | + "_resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", | ||
22 | + "_shasum": "722d7cbfc1f6aa8241f16dd814e011e1f41e8796", | ||
23 | + "_spec": "has@^1.0.3", | ||
24 | + "_where": "/home/ubuntu/stock_chatbot/server/node_modules/is-core-module", | ||
25 | + "author": { | ||
26 | + "name": "Thiago de Arruda", | ||
27 | + "email": "tpadilha84@gmail.com" | ||
28 | + }, | ||
29 | + "bugs": { | ||
30 | + "url": "https://github.com/tarruda/has/issues" | ||
31 | + }, | ||
32 | + "bundleDependencies": false, | ||
33 | + "contributors": [ | ||
34 | + { | ||
35 | + "name": "Jordan Harband", | ||
36 | + "email": "ljharb@gmail.com", | ||
37 | + "url": "http://ljharb.codes" | ||
38 | + } | ||
39 | + ], | ||
40 | + "dependencies": { | ||
41 | + "function-bind": "^1.1.1" | ||
42 | + }, | ||
43 | + "deprecated": false, | ||
44 | + "description": "Object.prototype.hasOwnProperty.call shortcut", | ||
45 | + "devDependencies": { | ||
46 | + "@ljharb/eslint-config": "^12.2.1", | ||
47 | + "eslint": "^4.19.1", | ||
48 | + "tape": "^4.9.0" | ||
49 | + }, | ||
50 | + "engines": { | ||
51 | + "node": ">= 0.4.0" | ||
52 | + }, | ||
53 | + "homepage": "https://github.com/tarruda/has", | ||
54 | + "license": "MIT", | ||
55 | + "licenses": [ | ||
56 | + { | ||
57 | + "type": "MIT", | ||
58 | + "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" | ||
59 | + } | ||
60 | + ], | ||
61 | + "main": "./src", | ||
62 | + "name": "has", | ||
63 | + "repository": { | ||
64 | + "type": "git", | ||
65 | + "url": "git://github.com/tarruda/has.git" | ||
66 | + }, | ||
67 | + "scripts": { | ||
68 | + "lint": "eslint .", | ||
69 | + "pretest": "npm run lint", | ||
70 | + "test": "tape test" | ||
71 | + }, | ||
72 | + "version": "1.0.3" | ||
73 | +} |
server/node_modules/has/src/index.js
0 → 100644
server/node_modules/has/test/index.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var test = require('tape'); | ||
4 | +var has = require('../'); | ||
5 | + | ||
6 | +test('has', function (t) { | ||
7 | + t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"'); | ||
8 | + t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"'); | ||
9 | + t.end(); | ||
10 | +}); |
1 | +coverage/ |
server/node_modules/is-core-module/.eslintrc
0 → 100644
1 | +{ | ||
2 | + "extends": "@ljharb", | ||
3 | + "root": true, | ||
4 | + "rules": { | ||
5 | + "func-style": 1, | ||
6 | + "operator-linebreak": [2, "before"], | ||
7 | + }, | ||
8 | + "overrides": [ | ||
9 | + { | ||
10 | + "files": "test/**", | ||
11 | + "rules": { | ||
12 | + "global-require": 0, | ||
13 | + "max-lines-per-function": 0, | ||
14 | + "no-negated-condition": 0, | ||
15 | + }, | ||
16 | + }, | ||
17 | + ], | ||
18 | +} |
server/node_modules/is-core-module/.nycrc
0 → 100644
1 | +# Changelog | ||
2 | + | ||
3 | +All notable changes to this project will be documented in this file. | ||
4 | + | ||
5 | +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | ||
6 | +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
7 | + | ||
8 | +## [v2.4.0](https://github.com/inspect-js/is-core-module/compare/v2.3.0...v2.4.0) - 2021-05-09 | ||
9 | + | ||
10 | +### Commits | ||
11 | + | ||
12 | +- [readme] add actions and codecov badges [`82b7faa`](https://github.com/inspect-js/is-core-module/commit/82b7faa12b56dbe47fbea67e1a5b9e447027ba40) | ||
13 | +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`8096868`](https://github.com/inspect-js/is-core-module/commit/8096868c024a161ccd4d44110b136763e92eace8) | ||
14 | +- [Dev Deps] update `eslint` [`6726824`](https://github.com/inspect-js/is-core-module/commit/67268249b88230018c510f6532a8046d7326346f) | ||
15 | +- [New] add `diagnostics_channel` to node `^14.17` [`86c6563`](https://github.com/inspect-js/is-core-module/commit/86c65634201b8ff9b3e48a9a782594579c7f5c3c) | ||
16 | +- [meta] fix prepublish script [`697a01e`](https://github.com/inspect-js/is-core-module/commit/697a01e3c9c0be074066520954f30fb28532ec57) | ||
17 | + | ||
18 | +## [v2.3.0](https://github.com/inspect-js/is-core-module/compare/v2.2.0...v2.3.0) - 2021-04-24 | ||
19 | + | ||
20 | +### Commits | ||
21 | + | ||
22 | +- [meta] do not publish github action workflow files [`060d4bb`](https://github.com/inspect-js/is-core-module/commit/060d4bb971a29451c19ff336eb56bee27f9fa95a) | ||
23 | +- [New] add support for `node:` prefix, in node 16+ [`7341223`](https://github.com/inspect-js/is-core-module/commit/73412230a769f6e81c05eea50b6520cebf54ed2f) | ||
24 | +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`016269a`](https://github.com/inspect-js/is-core-module/commit/016269abae9f6657a5254adfbb813f09a05067f9) | ||
25 | +- [patch] remove unneeded `.0` in version ranges [`cb466a6`](https://github.com/inspect-js/is-core-module/commit/cb466a6d89e52b8389e5c12715efcd550c41cea3) | ||
26 | +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`c9f9c39`](https://github.com/inspect-js/is-core-module/commit/c9f9c396ace60ef81906f98059c064e6452473ed) | ||
27 | +- [actions] update workflows [`3ee4a89`](https://github.com/inspect-js/is-core-module/commit/3ee4a89fd5a02fccd43882d905448ea6a98e9a3c) | ||
28 | +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`dee4fed`](https://github.com/inspect-js/is-core-module/commit/dee4fed79690c1d43a22f7fa9426abebdc6d727f) | ||
29 | +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`7d046ba`](https://github.com/inspect-js/is-core-module/commit/7d046ba07ae8c9292e43652694ca808d7b309de8) | ||
30 | +- [meta] use `prepublishOnly` script for npm 7+ [`149e677`](https://github.com/inspect-js/is-core-module/commit/149e6771a5ede6d097e71785b467a9c4b4977cc7) | ||
31 | +- [readme] remove travis badge [`903b51d`](https://github.com/inspect-js/is-core-module/commit/903b51d6b69b98abeabfbc3695c345b02646f19c) | ||
32 | + | ||
33 | +## [v2.2.0](https://github.com/inspect-js/is-core-module/compare/v2.1.0...v2.2.0) - 2020-11-26 | ||
34 | + | ||
35 | +### Commits | ||
36 | + | ||
37 | +- [Tests] migrate tests to Github Actions [`c919f57`](https://github.com/inspect-js/is-core-module/commit/c919f573c0a92d10a0acad0b650b5aecb033d426) | ||
38 | +- [patch] `core.json`: %s/ /\t/g [`db3f685`](https://github.com/inspect-js/is-core-module/commit/db3f68581f53e73cc09cd675955eb1bdd6a5a39b) | ||
39 | +- [Tests] run `nyc` on all tests [`b2f925f`](https://github.com/inspect-js/is-core-module/commit/b2f925f8866f210ef441f39fcc8cc42692ab89b1) | ||
40 | +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`; add `safe-publish-latest` [`89f02a2`](https://github.com/inspect-js/is-core-module/commit/89f02a2b4162246dea303a6ee31bb9a550b05c72) | ||
41 | +- [New] add `path/posix`, `path/win32`, `util/types` [`77f94f1`](https://github.com/inspect-js/is-core-module/commit/77f94f1e90ffd7c0be2a3f1aa8574ebf7fd981b3) | ||
42 | + | ||
43 | +## [v2.1.0](https://github.com/inspect-js/is-core-module/compare/v2.0.0...v2.1.0) - 2020-11-04 | ||
44 | + | ||
45 | +### Commits | ||
46 | + | ||
47 | +- [Dev Deps] update `eslint` [`5e0034e`](https://github.com/inspect-js/is-core-module/commit/5e0034eae57c09c8f1bd769f502486a00f56c6e4) | ||
48 | +- [New] Add `diagnostics_channel` [`c2d83d0`](https://github.com/inspect-js/is-core-module/commit/c2d83d0a0225a1a658945d9bab7036ea347d29ec) | ||
49 | + | ||
50 | +## [v2.0.0](https://github.com/inspect-js/is-core-module/compare/v1.0.2...v2.0.0) - 2020-09-29 | ||
51 | + | ||
52 | +### Commits | ||
53 | + | ||
54 | +- v2 implementation [`865aeb5`](https://github.com/inspect-js/is-core-module/commit/865aeb5ca0e90248a3dfff5d7622e4751fdeb9cd) | ||
55 | +- Only apps should have lockfiles [`5a5e660`](https://github.com/inspect-js/is-core-module/commit/5a5e660d568e37eb44e17fb1ebb12a105205fc2b) | ||
56 | +- Initial commit for v2 [`5a51524`](https://github.com/inspect-js/is-core-module/commit/5a51524e06f92adece5fbb138c69b7b9748a2348) | ||
57 | +- Tests [`116eae4`](https://github.com/inspect-js/is-core-module/commit/116eae4fccd01bc72c1fd3cc4b7561c387afc496) | ||
58 | +- [meta] add `auto-changelog` [`c24388b`](https://github.com/inspect-js/is-core-module/commit/c24388bee828d223040519d1f5b226ca35beee63) | ||
59 | +- [actions] add "Automatic Rebase" and "require allow edits" actions [`34292db`](https://github.com/inspect-js/is-core-module/commit/34292dbcbadae0868aff03c22dbd8b7b8a11558a) | ||
60 | +- [Tests] add `npm run lint` [`4f9eeee`](https://github.com/inspect-js/is-core-module/commit/4f9eeee7ddff10698bbf528620f4dc8d4fa3e697) | ||
61 | +- [readme] fix travis badges, https all URLs [`e516a73`](https://github.com/inspect-js/is-core-module/commit/e516a73b0dccce20938c432b1ba512eae8eff9e9) | ||
62 | +- [meta] create FUNDING.yml [`1aabebc`](https://github.com/inspect-js/is-core-module/commit/1aabebca98d01f8a04e46bc2e2520fa93cf21ac6) | ||
63 | +- [Fix] `domain`: domain landed sometime > v0.7.7 and <= v0.7.12 [`2df7d37`](https://github.com/inspect-js/is-core-module/commit/2df7d37595d41b15eeada732b706b926c2771655) | ||
64 | +- [Fix] `sys`: worked in 0.6, not 0.7, and 0.8+ [`a75c134`](https://github.com/inspect-js/is-core-module/commit/a75c134229e1e9441801f6b73f6a52489346eb65) | ||
65 | + | ||
66 | +## [v1.0.2](https://github.com/inspect-js/is-core-module/compare/v1.0.1...v1.0.2) - 2014-09-28 | ||
67 | + | ||
68 | +### Commits | ||
69 | + | ||
70 | +- simpler [`66fe90f`](https://github.com/inspect-js/is-core-module/commit/66fe90f9771581b9adc0c3900baa52c21b5baea2) | ||
71 | + | ||
72 | +## [v1.0.1](https://github.com/inspect-js/is-core-module/compare/v1.0.0...v1.0.1) - 2014-09-28 | ||
73 | + | ||
74 | +### Commits | ||
75 | + | ||
76 | +- remove stupid [`f21f906`](https://github.com/inspect-js/is-core-module/commit/f21f906f882c2bd656a5fc5ed6fbe48ddaffb2ac) | ||
77 | +- update readme [`1eff0ec`](https://github.com/inspect-js/is-core-module/commit/1eff0ec69798d1ec65771552d1562911e90a8027) | ||
78 | + | ||
79 | +## v1.0.0 - 2014-09-28 | ||
80 | + | ||
81 | +### Commits | ||
82 | + | ||
83 | +- init [`48e5e76`](https://github.com/inspect-js/is-core-module/commit/48e5e76cac378fddb8c1f7d4055b8dfc943d6b96) |
server/node_modules/is-core-module/LICENSE
0 → 100644
1 | +The MIT License (MIT) | ||
2 | + | ||
3 | +Copyright (c) 2014 Dave Justice | ||
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. | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
server/node_modules/is-core-module/README.md
0 → 100644
1 | +# is-core-module <sup>[![Version Badge][2]][1]</sup> | ||
2 | + | ||
3 | +[![github actions][actions-image]][actions-url] | ||
4 | +[![coverage][codecov-image]][codecov-url] | ||
5 | +[![dependency status][5]][6] | ||
6 | +[![dev dependency status][7]][8] | ||
7 | +[![License][license-image]][license-url] | ||
8 | +[![Downloads][downloads-image]][downloads-url] | ||
9 | + | ||
10 | +[![npm badge][11]][1] | ||
11 | + | ||
12 | +Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version. | ||
13 | + | ||
14 | +## Example | ||
15 | + | ||
16 | +```js | ||
17 | +var isCore = require('is-core-module'); | ||
18 | +var assert = require('assert'); | ||
19 | +assert(isCore('fs')); | ||
20 | +assert(!isCore('butts')); | ||
21 | +``` | ||
22 | + | ||
23 | +## Tests | ||
24 | +Clone the repo, `npm install`, and run `npm test` | ||
25 | + | ||
26 | +[1]: https://npmjs.org/package/is-core-module | ||
27 | +[2]: https://versionbadg.es/inspect-js/is-core-module.svg | ||
28 | +[5]: https://david-dm.org/inspect-js/is-core-module.svg | ||
29 | +[6]: https://david-dm.org/inspect-js/is-core-module | ||
30 | +[7]: https://david-dm.org/inspect-js/is-core-module/dev-status.svg | ||
31 | +[8]: https://david-dm.org/inspect-js/is-core-module#info=devDependencies | ||
32 | +[11]: https://nodei.co/npm/is-core-module.png?downloads=true&stars=true | ||
33 | +[license-image]: https://img.shields.io/npm/l/is-core-module.svg | ||
34 | +[license-url]: LICENSE | ||
35 | +[downloads-image]: https://img.shields.io/npm/dm/is-core-module.svg | ||
36 | +[downloads-url]: https://npm-stat.com/charts.html?package=is-core-module | ||
37 | +[codecov-image]: https://codecov.io/gh/inspect-js/is-core-module/branch/main/graphs/badge.svg | ||
38 | +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-core-module/ | ||
39 | +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-core-module | ||
40 | +[actions-url]: https://github.com/inspect-js/is-core-module/actions |
server/node_modules/is-core-module/core.json
0 → 100644
1 | +{ | ||
2 | + "assert": true, | ||
3 | + "node:assert": ">= 16", | ||
4 | + "assert/strict": ">= 15", | ||
5 | + "node:assert/strict": ">= 16", | ||
6 | + "async_hooks": ">= 8", | ||
7 | + "node:async_hooks": ">= 16", | ||
8 | + "buffer_ieee754": "< 0.9.7", | ||
9 | + "buffer": true, | ||
10 | + "node:buffer": ">= 16", | ||
11 | + "child_process": true, | ||
12 | + "node:child_process": ">= 16", | ||
13 | + "cluster": true, | ||
14 | + "node:cluster": ">= 16", | ||
15 | + "console": true, | ||
16 | + "node:console": ">= 16", | ||
17 | + "constants": true, | ||
18 | + "node:constants": ">= 16", | ||
19 | + "crypto": true, | ||
20 | + "node:crypto": ">= 16", | ||
21 | + "_debug_agent": ">= 1 && < 8", | ||
22 | + "_debugger": "< 8", | ||
23 | + "dgram": true, | ||
24 | + "node:dgram": ">= 16", | ||
25 | + "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], | ||
26 | + "node:diagnostics_channel": ">= 16", | ||
27 | + "dns": true, | ||
28 | + "node:dns": ">= 16", | ||
29 | + "dns/promises": ">= 15", | ||
30 | + "node:dns/promises": ">= 16", | ||
31 | + "domain": ">= 0.7.12", | ||
32 | + "node:domain": ">= 16", | ||
33 | + "events": true, | ||
34 | + "node:events": ">= 16", | ||
35 | + "freelist": "< 6", | ||
36 | + "fs": true, | ||
37 | + "node:fs": ">= 16", | ||
38 | + "fs/promises": [">= 10 && < 10.1", ">= 14"], | ||
39 | + "node:fs/promises": ">= 16", | ||
40 | + "_http_agent": ">= 0.11.1", | ||
41 | + "node:_http_agent": ">= 16", | ||
42 | + "_http_client": ">= 0.11.1", | ||
43 | + "node:_http_client": ">= 16", | ||
44 | + "_http_common": ">= 0.11.1", | ||
45 | + "node:_http_common": ">= 16", | ||
46 | + "_http_incoming": ">= 0.11.1", | ||
47 | + "node:_http_incoming": ">= 16", | ||
48 | + "_http_outgoing": ">= 0.11.1", | ||
49 | + "node:_http_outgoing": ">= 16", | ||
50 | + "_http_server": ">= 0.11.1", | ||
51 | + "node:_http_server": ">= 16", | ||
52 | + "http": true, | ||
53 | + "node:http": ">= 16", | ||
54 | + "http2": ">= 8.8", | ||
55 | + "node:http2": ">= 16", | ||
56 | + "https": true, | ||
57 | + "node:https": ">= 16", | ||
58 | + "inspector": ">= 8", | ||
59 | + "node:inspector": ">= 16", | ||
60 | + "_linklist": "< 8", | ||
61 | + "module": true, | ||
62 | + "node:module": ">= 16", | ||
63 | + "net": true, | ||
64 | + "node:net": ">= 16", | ||
65 | + "node-inspect/lib/_inspect": ">= 7.6 && < 12", | ||
66 | + "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", | ||
67 | + "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", | ||
68 | + "os": true, | ||
69 | + "node:os": ">= 16", | ||
70 | + "path": true, | ||
71 | + "node:path": ">= 16", | ||
72 | + "path/posix": ">= 15.3", | ||
73 | + "node:path/posix": ">= 16", | ||
74 | + "path/win32": ">= 15.3", | ||
75 | + "node:path/win32": ">= 16", | ||
76 | + "perf_hooks": ">= 8.5", | ||
77 | + "node:perf_hooks": ">= 16", | ||
78 | + "process": ">= 1", | ||
79 | + "node:process": ">= 16", | ||
80 | + "punycode": true, | ||
81 | + "node:punycode": ">= 16", | ||
82 | + "querystring": true, | ||
83 | + "node:querystring": ">= 16", | ||
84 | + "readline": true, | ||
85 | + "node:readline": ">= 16", | ||
86 | + "repl": true, | ||
87 | + "node:repl": ">= 16", | ||
88 | + "smalloc": ">= 0.11.5 && < 3", | ||
89 | + "_stream_duplex": ">= 0.9.4", | ||
90 | + "node:_stream_duplex": ">= 16", | ||
91 | + "_stream_transform": ">= 0.9.4", | ||
92 | + "node:_stream_transform": ">= 16", | ||
93 | + "_stream_wrap": ">= 1.4.1", | ||
94 | + "node:_stream_wrap": ">= 16", | ||
95 | + "_stream_passthrough": ">= 0.9.4", | ||
96 | + "node:_stream_passthrough": ">= 16", | ||
97 | + "_stream_readable": ">= 0.9.4", | ||
98 | + "node:_stream_readable": ">= 16", | ||
99 | + "_stream_writable": ">= 0.9.4", | ||
100 | + "node:_stream_writable": ">= 16", | ||
101 | + "stream": true, | ||
102 | + "node:stream": ">= 16", | ||
103 | + "stream/promises": ">= 15", | ||
104 | + "node:stream/promises": ">= 16", | ||
105 | + "string_decoder": true, | ||
106 | + "node:string_decoder": ">= 16", | ||
107 | + "sys": [">= 0.6 && < 0.7", ">= 0.8"], | ||
108 | + "node:sys": ">= 16", | ||
109 | + "timers": true, | ||
110 | + "node:timers": ">= 16", | ||
111 | + "timers/promises": ">= 15", | ||
112 | + "node:timers/promises": ">= 16", | ||
113 | + "_tls_common": ">= 0.11.13", | ||
114 | + "node:_tls_common": ">= 16", | ||
115 | + "_tls_legacy": ">= 0.11.3 && < 10", | ||
116 | + "_tls_wrap": ">= 0.11.3", | ||
117 | + "node:_tls_wrap": ">= 16", | ||
118 | + "tls": true, | ||
119 | + "node:tls": ">= 16", | ||
120 | + "trace_events": ">= 10", | ||
121 | + "node:trace_events": ">= 16", | ||
122 | + "tty": true, | ||
123 | + "node:tty": ">= 16", | ||
124 | + "url": true, | ||
125 | + "node:url": ">= 16", | ||
126 | + "util": true, | ||
127 | + "node:util": ">= 16", | ||
128 | + "util/types": ">= 15.3", | ||
129 | + "node:util/types": ">= 16", | ||
130 | + "v8/tools/arguments": ">= 10 && < 12", | ||
131 | + "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], | ||
132 | + "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], | ||
133 | + "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], | ||
134 | + "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], | ||
135 | + "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], | ||
136 | + "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], | ||
137 | + "v8": ">= 1", | ||
138 | + "node:v8": ">= 16", | ||
139 | + "vm": true, | ||
140 | + "node:vm": ">= 16", | ||
141 | + "wasi": ">= 13.4 && < 13.5", | ||
142 | + "worker_threads": ">= 11.7", | ||
143 | + "node:worker_threads": ">= 16", | ||
144 | + "zlib": true, | ||
145 | + "node:zlib": ">= 16" | ||
146 | +} |
server/node_modules/is-core-module/index.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var has = require('has'); | ||
4 | + | ||
5 | +function specifierIncluded(current, specifier) { | ||
6 | + var nodeParts = current.split('.'); | ||
7 | + var parts = specifier.split(' '); | ||
8 | + var op = parts.length > 1 ? parts[0] : '='; | ||
9 | + var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); | ||
10 | + | ||
11 | + for (var i = 0; i < 3; ++i) { | ||
12 | + var cur = parseInt(nodeParts[i] || 0, 10); | ||
13 | + var ver = parseInt(versionParts[i] || 0, 10); | ||
14 | + if (cur === ver) { | ||
15 | + continue; // eslint-disable-line no-restricted-syntax, no-continue | ||
16 | + } | ||
17 | + if (op === '<') { | ||
18 | + return cur < ver; | ||
19 | + } | ||
20 | + if (op === '>=') { | ||
21 | + return cur >= ver; | ||
22 | + } | ||
23 | + return false; | ||
24 | + } | ||
25 | + return op === '>='; | ||
26 | +} | ||
27 | + | ||
28 | +function matchesRange(current, range) { | ||
29 | + var specifiers = range.split(/ ?&& ?/); | ||
30 | + if (specifiers.length === 0) { | ||
31 | + return false; | ||
32 | + } | ||
33 | + for (var i = 0; i < specifiers.length; ++i) { | ||
34 | + if (!specifierIncluded(current, specifiers[i])) { | ||
35 | + return false; | ||
36 | + } | ||
37 | + } | ||
38 | + return true; | ||
39 | +} | ||
40 | + | ||
41 | +function versionIncluded(nodeVersion, specifierValue) { | ||
42 | + if (typeof specifierValue === 'boolean') { | ||
43 | + return specifierValue; | ||
44 | + } | ||
45 | + | ||
46 | + var current = typeof nodeVersion === 'undefined' | ||
47 | + ? process.versions && process.versions.node && process.versions.node | ||
48 | + : nodeVersion; | ||
49 | + | ||
50 | + if (typeof current !== 'string') { | ||
51 | + throw new TypeError(typeof nodeVersion === 'undefined' ? 'Unable to determine current node version' : 'If provided, a valid node version is required'); | ||
52 | + } | ||
53 | + | ||
54 | + if (specifierValue && typeof specifierValue === 'object') { | ||
55 | + for (var i = 0; i < specifierValue.length; ++i) { | ||
56 | + if (matchesRange(current, specifierValue[i])) { | ||
57 | + return true; | ||
58 | + } | ||
59 | + } | ||
60 | + return false; | ||
61 | + } | ||
62 | + return matchesRange(current, specifierValue); | ||
63 | +} | ||
64 | + | ||
65 | +var data = require('./core.json'); | ||
66 | + | ||
67 | +module.exports = function isCore(x, nodeVersion) { | ||
68 | + return has(data, x) && versionIncluded(nodeVersion, data[x]); | ||
69 | +}; |
1 | +{ | ||
2 | + "_from": "is-core-module@^2.2.0", | ||
3 | + "_id": "is-core-module@2.4.0", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", | ||
6 | + "_location": "/is-core-module", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "range", | ||
10 | + "registry": true, | ||
11 | + "raw": "is-core-module@^2.2.0", | ||
12 | + "name": "is-core-module", | ||
13 | + "escapedName": "is-core-module", | ||
14 | + "rawSpec": "^2.2.0", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "^2.2.0" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "/resolve" | ||
20 | + ], | ||
21 | + "_resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", | ||
22 | + "_shasum": "8e9fc8e15027b011418026e98f0e6f4d86305cc1", | ||
23 | + "_spec": "is-core-module@^2.2.0", | ||
24 | + "_where": "/home/ubuntu/stock_chatbot/server/node_modules/resolve", | ||
25 | + "author": { | ||
26 | + "name": "Jordan Harband", | ||
27 | + "email": "ljharb@gmail.com" | ||
28 | + }, | ||
29 | + "auto-changelog": { | ||
30 | + "output": "CHANGELOG.md", | ||
31 | + "template": "keepachangelog", | ||
32 | + "unreleased": false, | ||
33 | + "commitLimit": false, | ||
34 | + "backfillLimit": false, | ||
35 | + "hideCredit": true | ||
36 | + }, | ||
37 | + "bugs": { | ||
38 | + "url": "https://github.com/inspect-js/is-core-module/issues" | ||
39 | + }, | ||
40 | + "bundleDependencies": false, | ||
41 | + "dependencies": { | ||
42 | + "has": "^1.0.3" | ||
43 | + }, | ||
44 | + "deprecated": false, | ||
45 | + "description": "Is this specifier a node.js core module?", | ||
46 | + "devDependencies": { | ||
47 | + "@ljharb/eslint-config": "^17.6.0", | ||
48 | + "aud": "^1.1.5", | ||
49 | + "auto-changelog": "^2.2.1", | ||
50 | + "eslint": "^7.26.0", | ||
51 | + "nyc": "^10.3.2", | ||
52 | + "safe-publish-latest": "^1.1.4", | ||
53 | + "semver": "^6.3.0", | ||
54 | + "tape": "^5.2.2" | ||
55 | + }, | ||
56 | + "exports": { | ||
57 | + ".": [ | ||
58 | + { | ||
59 | + "default": "./index.js" | ||
60 | + }, | ||
61 | + "./index.js" | ||
62 | + ], | ||
63 | + "./package.json": "./package.json" | ||
64 | + }, | ||
65 | + "funding": { | ||
66 | + "url": "https://github.com/sponsors/ljharb" | ||
67 | + }, | ||
68 | + "homepage": "https://github.com/inspect-js/is-core-module", | ||
69 | + "keywords": [ | ||
70 | + "core", | ||
71 | + "modules", | ||
72 | + "module", | ||
73 | + "npm", | ||
74 | + "node", | ||
75 | + "dependencies" | ||
76 | + ], | ||
77 | + "license": "MIT", | ||
78 | + "main": "index.js", | ||
79 | + "name": "is-core-module", | ||
80 | + "repository": { | ||
81 | + "type": "git", | ||
82 | + "url": "git+https://github.com/inspect-js/is-core-module.git" | ||
83 | + }, | ||
84 | + "scripts": { | ||
85 | + "lint": "eslint .", | ||
86 | + "posttest": "aud --production", | ||
87 | + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", | ||
88 | + "prepublish": "not-in-publish || npm run prepublishOnly", | ||
89 | + "prepublishOnly": "safe-publish-latest", | ||
90 | + "pretest": "npm run lint", | ||
91 | + "test": "nyc npm run tests-only", | ||
92 | + "tests-only": "tape 'test/**/*.js'", | ||
93 | + "version": "auto-changelog && git add CHANGELOG.md" | ||
94 | + }, | ||
95 | + "version": "2.4.0" | ||
96 | +} |
1 | +'use strict'; | ||
2 | + | ||
3 | +var test = require('tape'); | ||
4 | +var keys = require('object-keys'); | ||
5 | +var semver = require('semver'); | ||
6 | +var isCore = require('../'); | ||
7 | +var data = require('../core.json'); | ||
8 | + | ||
9 | +var supportsNodePrefix = semver.satisfies(process.versions.node, '>= 16'); | ||
10 | + | ||
11 | +test('core modules', function (t) { | ||
12 | + t.test('isCore()', function (st) { | ||
13 | + st.ok(isCore('fs')); | ||
14 | + st.ok(isCore('net')); | ||
15 | + st.ok(isCore('http')); | ||
16 | + | ||
17 | + st.ok(!isCore('seq')); | ||
18 | + st.ok(!isCore('../')); | ||
19 | + | ||
20 | + st.ok(!isCore('toString')); | ||
21 | + | ||
22 | + st.end(); | ||
23 | + }); | ||
24 | + | ||
25 | + t.test('core list', function (st) { | ||
26 | + var cores = keys(data); | ||
27 | + st.plan(cores.length); | ||
28 | + | ||
29 | + for (var i = 0; i < cores.length; ++i) { | ||
30 | + var mod = cores[i]; | ||
31 | + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func | ||
32 | + if (isCore(mod)) { | ||
33 | + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); | ||
34 | + } else { | ||
35 | + st['throws'](requireFunc, mod + ' not supported; requiring throws'); | ||
36 | + } | ||
37 | + } | ||
38 | + | ||
39 | + st.end(); | ||
40 | + }); | ||
41 | + | ||
42 | + t.test('core via repl module', { skip: !data.repl }, function (st) { | ||
43 | + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle | ||
44 | + if (!libs) { | ||
45 | + st.skip('module.builtinModules does not exist'); | ||
46 | + } else { | ||
47 | + for (var i = 0; i < libs.length; ++i) { | ||
48 | + var mod = libs[i]; | ||
49 | + st.ok(data[mod], mod + ' is a core module'); | ||
50 | + st.doesNotThrow( | ||
51 | + function () { require(mod); }, // eslint-disable-line no-loop-func | ||
52 | + 'requiring ' + mod + ' does not throw' | ||
53 | + ); | ||
54 | + if (supportsNodePrefix) { | ||
55 | + st.doesNotThrow( | ||
56 | + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func | ||
57 | + 'requiring node:' + mod + ' does not throw' | ||
58 | + ); | ||
59 | + } else { | ||
60 | + st['throws']( | ||
61 | + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func | ||
62 | + 'requiring node:' + mod + ' throws' | ||
63 | + ); | ||
64 | + } | ||
65 | + } | ||
66 | + } | ||
67 | + st.end(); | ||
68 | + }); | ||
69 | + | ||
70 | + t.test('core via builtinModules list', { skip: !data.module }, function (st) { | ||
71 | + var libs = require('module').builtinModules; | ||
72 | + if (!libs) { | ||
73 | + st.skip('module.builtinModules does not exist'); | ||
74 | + } else { | ||
75 | + var excludeList = [ | ||
76 | + '_debug_agent', | ||
77 | + 'v8/tools/tickprocessor-driver', | ||
78 | + 'v8/tools/SourceMap', | ||
79 | + 'v8/tools/tickprocessor', | ||
80 | + 'v8/tools/profile' | ||
81 | + ]; | ||
82 | + for (var i = 0; i < libs.length; ++i) { | ||
83 | + var mod = libs[i]; | ||
84 | + if (excludeList.indexOf(mod) === -1) { | ||
85 | + st.ok(data[mod], mod + ' is a core module'); | ||
86 | + st.doesNotThrow( | ||
87 | + function () { require(mod); }, // eslint-disable-line no-loop-func | ||
88 | + 'requiring ' + mod + ' does not throw' | ||
89 | + ); | ||
90 | + if (supportsNodePrefix) { | ||
91 | + st.doesNotThrow( | ||
92 | + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func | ||
93 | + 'requiring node:' + mod + ' does not throw' | ||
94 | + ); | ||
95 | + } else { | ||
96 | + st['throws']( | ||
97 | + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func | ||
98 | + 'requiring node:' + mod + ' throws' | ||
99 | + ); | ||
100 | + } | ||
101 | + } | ||
102 | + } | ||
103 | + } | ||
104 | + st.end(); | ||
105 | + }); | ||
106 | + | ||
107 | + t.end(); | ||
108 | +}); |
server/node_modules/path-parse/LICENSE
0 → 100644
1 | +The MIT License (MIT) | ||
2 | + | ||
3 | +Copyright (c) 2015 Javier Blanco | ||
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. |
server/node_modules/path-parse/README.md
0 → 100644
1 | +# path-parse [![Build Status](https://travis-ci.org/jbgutierrez/path-parse.svg?branch=master)](https://travis-ci.org/jbgutierrez/path-parse) | ||
2 | + | ||
3 | +> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) [ponyfill](https://ponyfill.com). | ||
4 | + | ||
5 | +## Install | ||
6 | + | ||
7 | +``` | ||
8 | +$ npm install --save path-parse | ||
9 | +``` | ||
10 | + | ||
11 | +## Usage | ||
12 | + | ||
13 | +```js | ||
14 | +var pathParse = require('path-parse'); | ||
15 | + | ||
16 | +pathParse('/home/user/dir/file.txt'); | ||
17 | +//=> { | ||
18 | +// root : "/", | ||
19 | +// dir : "/home/user/dir", | ||
20 | +// base : "file.txt", | ||
21 | +// ext : ".txt", | ||
22 | +// name : "file" | ||
23 | +// } | ||
24 | +``` | ||
25 | + | ||
26 | +## API | ||
27 | + | ||
28 | +See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs. | ||
29 | + | ||
30 | +### pathParse(path) | ||
31 | + | ||
32 | +### pathParse.posix(path) | ||
33 | + | ||
34 | +The Posix specific version. | ||
35 | + | ||
36 | +### pathParse.win32(path) | ||
37 | + | ||
38 | +The Windows specific version. | ||
39 | + | ||
40 | +## License | ||
41 | + | ||
42 | +MIT © [Javier Blanco](http://jbgutierrez.info) |
server/node_modules/path-parse/index.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +var isWindows = process.platform === 'win32'; | ||
4 | + | ||
5 | +// Regex to split a windows path into into [dir, root, basename, name, ext] | ||
6 | +var splitWindowsRe = | ||
7 | + /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/; | ||
8 | + | ||
9 | +var win32 = {}; | ||
10 | + | ||
11 | +function win32SplitPath(filename) { | ||
12 | + return splitWindowsRe.exec(filename).slice(1); | ||
13 | +} | ||
14 | + | ||
15 | +win32.parse = function(pathString) { | ||
16 | + if (typeof pathString !== 'string') { | ||
17 | + throw new TypeError( | ||
18 | + "Parameter 'pathString' must be a string, not " + typeof pathString | ||
19 | + ); | ||
20 | + } | ||
21 | + var allParts = win32SplitPath(pathString); | ||
22 | + if (!allParts || allParts.length !== 5) { | ||
23 | + throw new TypeError("Invalid path '" + pathString + "'"); | ||
24 | + } | ||
25 | + return { | ||
26 | + root: allParts[1], | ||
27 | + dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1), | ||
28 | + base: allParts[2], | ||
29 | + ext: allParts[4], | ||
30 | + name: allParts[3] | ||
31 | + }; | ||
32 | +}; | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | +// Split a filename into [dir, root, basename, name, ext], unix version | ||
37 | +// 'root' is just a slash, or nothing. | ||
38 | +var splitPathRe = | ||
39 | + /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/; | ||
40 | +var posix = {}; | ||
41 | + | ||
42 | + | ||
43 | +function posixSplitPath(filename) { | ||
44 | + return splitPathRe.exec(filename).slice(1); | ||
45 | +} | ||
46 | + | ||
47 | + | ||
48 | +posix.parse = function(pathString) { | ||
49 | + if (typeof pathString !== 'string') { | ||
50 | + throw new TypeError( | ||
51 | + "Parameter 'pathString' must be a string, not " + typeof pathString | ||
52 | + ); | ||
53 | + } | ||
54 | + var allParts = posixSplitPath(pathString); | ||
55 | + if (!allParts || allParts.length !== 5) { | ||
56 | + throw new TypeError("Invalid path '" + pathString + "'"); | ||
57 | + } | ||
58 | + | ||
59 | + return { | ||
60 | + root: allParts[1], | ||
61 | + dir: allParts[0].slice(0, -1), | ||
62 | + base: allParts[2], | ||
63 | + ext: allParts[4], | ||
64 | + name: allParts[3], | ||
65 | + }; | ||
66 | +}; | ||
67 | + | ||
68 | + | ||
69 | +if (isWindows) | ||
70 | + module.exports = win32.parse; | ||
71 | +else /* posix */ | ||
72 | + module.exports = posix.parse; | ||
73 | + | ||
74 | +module.exports.posix = posix.parse; | ||
75 | +module.exports.win32 = win32.parse; |
server/node_modules/path-parse/package.json
0 → 100644
1 | +{ | ||
2 | + "_from": "path-parse@^1.0.6", | ||
3 | + "_id": "path-parse@1.0.7", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", | ||
6 | + "_location": "/path-parse", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "range", | ||
10 | + "registry": true, | ||
11 | + "raw": "path-parse@^1.0.6", | ||
12 | + "name": "path-parse", | ||
13 | + "escapedName": "path-parse", | ||
14 | + "rawSpec": "^1.0.6", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "^1.0.6" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "/resolve" | ||
20 | + ], | ||
21 | + "_resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", | ||
22 | + "_shasum": "fbc114b60ca42b30d9daf5858e4bd68bbedb6735", | ||
23 | + "_spec": "path-parse@^1.0.6", | ||
24 | + "_where": "/home/ubuntu/stock_chatbot/server/node_modules/resolve", | ||
25 | + "author": { | ||
26 | + "name": "Javier Blanco", | ||
27 | + "email": "http://jbgutierrez.info" | ||
28 | + }, | ||
29 | + "bugs": { | ||
30 | + "url": "https://github.com/jbgutierrez/path-parse/issues" | ||
31 | + }, | ||
32 | + "bundleDependencies": false, | ||
33 | + "deprecated": false, | ||
34 | + "description": "Node.js path.parse() ponyfill", | ||
35 | + "homepage": "https://github.com/jbgutierrez/path-parse#readme", | ||
36 | + "keywords": [ | ||
37 | + "path", | ||
38 | + "paths", | ||
39 | + "file", | ||
40 | + "dir", | ||
41 | + "parse", | ||
42 | + "built-in", | ||
43 | + "util", | ||
44 | + "utils", | ||
45 | + "core", | ||
46 | + "ponyfill", | ||
47 | + "polyfill", | ||
48 | + "shim" | ||
49 | + ], | ||
50 | + "license": "MIT", | ||
51 | + "main": "index.js", | ||
52 | + "name": "path-parse", | ||
53 | + "repository": { | ||
54 | + "type": "git", | ||
55 | + "url": "git+https://github.com/jbgutierrez/path-parse.git" | ||
56 | + }, | ||
57 | + "scripts": { | ||
58 | + "test": "node test.js" | ||
59 | + }, | ||
60 | + "version": "1.0.7" | ||
61 | +} |
server/node_modules/resolve/.editorconfig
0 → 100644
1 | +root = true | ||
2 | + | ||
3 | +[*] | ||
4 | +indent_style = space | ||
5 | +indent_size = 2 | ||
6 | +end_of_line = lf | ||
7 | +charset = utf-8 | ||
8 | +trim_trailing_whitespace = true | ||
9 | +insert_final_newline = true | ||
10 | +max_line_length = 200 | ||
11 | + | ||
12 | +[*.js] | ||
13 | +block_comment_start = /* | ||
14 | +block_comment = * | ||
15 | +block_comment_end = */ | ||
16 | + | ||
17 | +[*.yml] | ||
18 | +indent_size = 1 | ||
19 | + | ||
20 | +[package.json] | ||
21 | +indent_style = tab | ||
22 | + | ||
23 | +[lib/core.json] | ||
24 | +indent_style = tab | ||
25 | + | ||
26 | +[CHANGELOG.md] | ||
27 | +indent_style = space | ||
28 | +indent_size = 2 | ||
29 | + | ||
30 | +[{*.json,Makefile}] | ||
31 | +max_line_length = off | ||
32 | + | ||
33 | +[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*] | ||
34 | +indent_style = off | ||
35 | +indent_size = off | ||
36 | +max_line_length = off | ||
37 | +insert_final_newline = off |
server/node_modules/resolve/.eslintignore
0 → 100644
1 | +node_modules |
server/node_modules/resolve/.eslintrc
0 → 100644
1 | +{ | ||
2 | + "extends": "@ljharb", | ||
3 | + "root": true, | ||
4 | + "rules": { | ||
5 | + "array-bracket-newline": 0, | ||
6 | + "array-element-newline": 0, | ||
7 | + "indent": [2, 4], | ||
8 | + "strict": 0, | ||
9 | + "complexity": 0, | ||
10 | + "consistent-return": 0, | ||
11 | + "curly": 0, | ||
12 | + "dot-notation": [2, { "allowKeywords": true }], | ||
13 | + "func-name-matching": 0, | ||
14 | + "func-style": 0, | ||
15 | + "global-require": 0, | ||
16 | + "id-length": [2, { "min": 1, "max": 30 }], | ||
17 | + "max-lines-per-function": 0, | ||
18 | + "max-nested-callbacks": 0, | ||
19 | + "max-params": 0, | ||
20 | + "max-statements-per-line": [2, { "max": 2 }], | ||
21 | + "max-statements": 0, | ||
22 | + "no-magic-numbers": 0, | ||
23 | + "no-console": 0, | ||
24 | + "no-shadow": 0, | ||
25 | + "no-unused-vars": [2, { "vars": "all", "args": "none" }], | ||
26 | + "no-use-before-define": 0, | ||
27 | + "object-curly-newline": 0, | ||
28 | + "operator-linebreak": [2, "before"], | ||
29 | + "sort-keys": 0, | ||
30 | + }, | ||
31 | + "overrides": [ | ||
32 | + { | ||
33 | + "files": "test/resolver/nested_symlinks/mylib/*.js", | ||
34 | + "rules": { | ||
35 | + "no-throw-literal": 0, | ||
36 | + }, | ||
37 | + }, | ||
38 | + ], | ||
39 | +} |
server/node_modules/resolve/LICENSE
0 → 100644
1 | +MIT License | ||
2 | + | ||
3 | +Copyright (c) 2012 James Halliday | ||
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. |
server/node_modules/resolve/SECURITY.md
0 → 100644
server/node_modules/resolve/appveyor.yml
0 → 100644
1 | +version: 1.0.{build} | ||
2 | +skip_branch_with_pr: true | ||
3 | +build: off | ||
4 | + | ||
5 | +environment: | ||
6 | + matrix: | ||
7 | + #- nodejs_version: "15" | ||
8 | + - nodejs_version: "14" | ||
9 | + - nodejs_version: "13" | ||
10 | + - nodejs_version: "12" | ||
11 | + - nodejs_version: "11" | ||
12 | + - nodejs_version: "10" | ||
13 | + - nodejs_version: "9" | ||
14 | + - nodejs_version: "8" | ||
15 | + - nodejs_version: "7" | ||
16 | + - nodejs_version: "6" | ||
17 | + - nodejs_version: "5" | ||
18 | + - nodejs_version: "4" | ||
19 | + - nodejs_version: "3" | ||
20 | + - nodejs_version: "2" | ||
21 | + - nodejs_version: "1" | ||
22 | + - nodejs_version: "0.12" | ||
23 | + - nodejs_version: "0.10" | ||
24 | + - nodejs_version: "0.8" | ||
25 | + - nodejs_version: "0.6" | ||
26 | +matrix: | ||
27 | + # fast_finish: true | ||
28 | + allow_failures: | ||
29 | + - nodejs_version: "5" # due to windows npm bug, registry-side | ||
30 | + - nodejs_version: "0.8" | ||
31 | + # platform: x86 # x64 has started failing on the registry side, around early November 2020 | ||
32 | + - nodejs_version: "0.6" | ||
33 | + | ||
34 | +platform: | ||
35 | + - x86 | ||
36 | + - x64 | ||
37 | + | ||
38 | +# Install scripts. (runs after repo cloning) | ||
39 | +install: | ||
40 | + # Fix symlinks in working copy (see https://github.com/appveyor/ci/issues/650#issuecomment-186592582) / https://github.com/charleskorn/batect/commit/d08986802ec43086902958c4ee7e57ff3e71dbef | ||
41 | + - git config core.symlinks true | ||
42 | + - git reset --hard | ||
43 | + # Get the latest stable version of Node.js or io.js | ||
44 | + - ps: if ($env:nodejs_version -ne '0.6') { Install-Product node $env:nodejs_version $env:platform } | ||
45 | + - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:platform | ||
46 | + - IF %nodejs_version% EQU 0.6 npm config set strict-ssl false && npm -g install npm@1.3 | ||
47 | + - IF %nodejs_version% EQU 0.8 npm config set strict-ssl false && npm -g install npm@1.4.28 && npm install -g npm@4.5 | ||
48 | + - IF %nodejs_version% EQU 1 npm -g install npm@2.9 | ||
49 | + - IF %nodejs_version% EQU 2 npm -g install npm@4 | ||
50 | + - IF %nodejs_version% EQU 3 npm -g install npm@4 | ||
51 | + - IF %nodejs_version% EQU 4 npm -g install npm@5.3 | ||
52 | + - IF %nodejs_version% EQU 5 npm -g install npm@5.3 | ||
53 | + - IF %nodejs_version% EQU 6 npm -g install npm@6.9 | ||
54 | + - IF %nodejs_version% EQU 7 npm -g install npm@6 | ||
55 | + - IF %nodejs_version% EQU 8 npm -g install npm@6 | ||
56 | + - IF %nodejs_version% EQU 9 npm -g install npm@6.9 | ||
57 | + - IF %nodejs_version% EQU 10 npm -g install npm@7 | ||
58 | + - IF %nodejs_version% EQU 11 npm -g install npm@7 | ||
59 | + - IF %nodejs_version% EQU 12 npm -g install npm@7 | ||
60 | + - IF %nodejs_version% EQU 13 npm -g install npm@7 | ||
61 | + - IF %nodejs_version% EQU 14 npm -g install npm@7 | ||
62 | + - IF %nodejs_version% EQU 15 npm -g install npm@7 | ||
63 | + - set PATH=%APPDATA%\npm;%PATH% | ||
64 | + #- IF %nodejs_version% NEQ 0.6 AND %nodejs_version% NEQ 0.8 npm -g install npm | ||
65 | + # install modules | ||
66 | + - npm install | ||
67 | + | ||
68 | +# Post-install test scripts. | ||
69 | +test_script: | ||
70 | + # Output useful info for debugging. | ||
71 | + - node --version | ||
72 | + - npm --version | ||
73 | + # run tests | ||
74 | + - npm run tests-only |
server/node_modules/resolve/example/async.js
0 → 100644
server/node_modules/resolve/example/sync.js
0 → 100644
server/node_modules/resolve/index.js
0 → 100644
server/node_modules/resolve/lib/async.js
0 → 100644
This diff is collapsed. Click to expand it.
server/node_modules/resolve/lib/caller.js
0 → 100644
1 | +module.exports = function () { | ||
2 | + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi | ||
3 | + var origPrepareStackTrace = Error.prepareStackTrace; | ||
4 | + Error.prepareStackTrace = function (_, stack) { return stack; }; | ||
5 | + var stack = (new Error()).stack; | ||
6 | + Error.prepareStackTrace = origPrepareStackTrace; | ||
7 | + return stack[2].getFileName(); | ||
8 | +}; |
server/node_modules/resolve/lib/core.js
0 → 100644
1 | +var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; | ||
2 | + | ||
3 | +function specifierIncluded(specifier) { | ||
4 | + var parts = specifier.split(' '); | ||
5 | + var op = parts.length > 1 ? parts[0] : '='; | ||
6 | + var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); | ||
7 | + | ||
8 | + for (var i = 0; i < 3; ++i) { | ||
9 | + var cur = parseInt(current[i] || 0, 10); | ||
10 | + var ver = parseInt(versionParts[i] || 0, 10); | ||
11 | + if (cur === ver) { | ||
12 | + continue; // eslint-disable-line no-restricted-syntax, no-continue | ||
13 | + } | ||
14 | + if (op === '<') { | ||
15 | + return cur < ver; | ||
16 | + } else if (op === '>=') { | ||
17 | + return cur >= ver; | ||
18 | + } else { | ||
19 | + return false; | ||
20 | + } | ||
21 | + } | ||
22 | + return op === '>='; | ||
23 | +} | ||
24 | + | ||
25 | +function matchesRange(range) { | ||
26 | + var specifiers = range.split(/ ?&& ?/); | ||
27 | + if (specifiers.length === 0) { return false; } | ||
28 | + for (var i = 0; i < specifiers.length; ++i) { | ||
29 | + if (!specifierIncluded(specifiers[i])) { return false; } | ||
30 | + } | ||
31 | + return true; | ||
32 | +} | ||
33 | + | ||
34 | +function versionIncluded(specifierValue) { | ||
35 | + if (typeof specifierValue === 'boolean') { return specifierValue; } | ||
36 | + if (specifierValue && typeof specifierValue === 'object') { | ||
37 | + for (var i = 0; i < specifierValue.length; ++i) { | ||
38 | + if (matchesRange(specifierValue[i])) { return true; } | ||
39 | + } | ||
40 | + return false; | ||
41 | + } | ||
42 | + return matchesRange(specifierValue); | ||
43 | +} | ||
44 | + | ||
45 | +var data = require('./core.json'); | ||
46 | + | ||
47 | +var core = {}; | ||
48 | +for (var mod in data) { // eslint-disable-line no-restricted-syntax | ||
49 | + if (Object.prototype.hasOwnProperty.call(data, mod)) { | ||
50 | + core[mod] = versionIncluded(data[mod]); | ||
51 | + } | ||
52 | +} | ||
53 | +module.exports = core; |
server/node_modules/resolve/lib/core.json
0 → 100644
1 | +{ | ||
2 | + "assert": true, | ||
3 | + "assert/strict": ">= 15", | ||
4 | + "async_hooks": ">= 8", | ||
5 | + "buffer_ieee754": "< 0.9.7", | ||
6 | + "buffer": true, | ||
7 | + "child_process": true, | ||
8 | + "cluster": true, | ||
9 | + "console": true, | ||
10 | + "constants": true, | ||
11 | + "crypto": true, | ||
12 | + "_debug_agent": ">= 1 && < 8", | ||
13 | + "_debugger": "< 8", | ||
14 | + "dgram": true, | ||
15 | + "diagnostics_channel": ">= 15.1", | ||
16 | + "dns": true, | ||
17 | + "dns/promises": ">= 15", | ||
18 | + "domain": ">= 0.7.12", | ||
19 | + "events": true, | ||
20 | + "freelist": "< 6", | ||
21 | + "fs": true, | ||
22 | + "fs/promises": [">= 10 && < 10.1", ">= 14"], | ||
23 | + "_http_agent": ">= 0.11.1", | ||
24 | + "_http_client": ">= 0.11.1", | ||
25 | + "_http_common": ">= 0.11.1", | ||
26 | + "_http_incoming": ">= 0.11.1", | ||
27 | + "_http_outgoing": ">= 0.11.1", | ||
28 | + "_http_server": ">= 0.11.1", | ||
29 | + "http": true, | ||
30 | + "http2": ">= 8.8", | ||
31 | + "https": true, | ||
32 | + "inspector": ">= 8.0.0", | ||
33 | + "_linklist": "< 8", | ||
34 | + "module": true, | ||
35 | + "net": true, | ||
36 | + "node-inspect/lib/_inspect": ">= 7.6.0 && < 12", | ||
37 | + "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12", | ||
38 | + "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12", | ||
39 | + "os": true, | ||
40 | + "path": true, | ||
41 | + "path/posix": ">= 15.3", | ||
42 | + "path/win32": ">= 15.3", | ||
43 | + "perf_hooks": ">= 8.5", | ||
44 | + "process": ">= 1", | ||
45 | + "punycode": true, | ||
46 | + "querystring": true, | ||
47 | + "readline": true, | ||
48 | + "repl": true, | ||
49 | + "smalloc": ">= 0.11.5 && < 3", | ||
50 | + "_stream_duplex": ">= 0.9.4", | ||
51 | + "_stream_transform": ">= 0.9.4", | ||
52 | + "_stream_wrap": ">= 1.4.1", | ||
53 | + "_stream_passthrough": ">= 0.9.4", | ||
54 | + "_stream_readable": ">= 0.9.4", | ||
55 | + "_stream_writable": ">= 0.9.4", | ||
56 | + "stream": true, | ||
57 | + "stream/promises": ">= 15", | ||
58 | + "string_decoder": true, | ||
59 | + "sys": [">= 0.6 && < 0.7", ">= 0.8"], | ||
60 | + "timers": true, | ||
61 | + "timers/promises": ">= 15", | ||
62 | + "_tls_common": ">= 0.11.13", | ||
63 | + "_tls_legacy": ">= 0.11.3 && < 10", | ||
64 | + "_tls_wrap": ">= 0.11.3", | ||
65 | + "tls": true, | ||
66 | + "trace_events": ">= 10", | ||
67 | + "tty": true, | ||
68 | + "url": true, | ||
69 | + "util": true, | ||
70 | + "util/types": ">= 15.3", | ||
71 | + "v8/tools/arguments": ">= 10 && < 12", | ||
72 | + "v8/tools/codemap": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], | ||
73 | + "v8/tools/consarray": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], | ||
74 | + "v8/tools/csvparser": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], | ||
75 | + "v8/tools/logreader": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], | ||
76 | + "v8/tools/profile_view": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], | ||
77 | + "v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"], | ||
78 | + "v8": ">= 1", | ||
79 | + "vm": true, | ||
80 | + "wasi": ">= 13.4 && < 13.5", | ||
81 | + "worker_threads": ">= 11.7", | ||
82 | + "zlib": true | ||
83 | +} |
server/node_modules/resolve/lib/is-core.js
0 → 100644
1 | +var path = require('path'); | ||
2 | +var parse = path.parse || require('path-parse'); | ||
3 | + | ||
4 | +var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { | ||
5 | + var prefix = '/'; | ||
6 | + if ((/^([A-Za-z]:)/).test(absoluteStart)) { | ||
7 | + prefix = ''; | ||
8 | + } else if ((/^\\\\/).test(absoluteStart)) { | ||
9 | + prefix = '\\\\'; | ||
10 | + } | ||
11 | + | ||
12 | + var paths = [absoluteStart]; | ||
13 | + var parsed = parse(absoluteStart); | ||
14 | + while (parsed.dir !== paths[paths.length - 1]) { | ||
15 | + paths.push(parsed.dir); | ||
16 | + parsed = parse(parsed.dir); | ||
17 | + } | ||
18 | + | ||
19 | + return paths.reduce(function (dirs, aPath) { | ||
20 | + return dirs.concat(modules.map(function (moduleDir) { | ||
21 | + return path.resolve(prefix, aPath, moduleDir); | ||
22 | + })); | ||
23 | + }, []); | ||
24 | +}; | ||
25 | + | ||
26 | +module.exports = function nodeModulesPaths(start, opts, request) { | ||
27 | + var modules = opts && opts.moduleDirectory | ||
28 | + ? [].concat(opts.moduleDirectory) | ||
29 | + : ['node_modules']; | ||
30 | + | ||
31 | + if (opts && typeof opts.paths === 'function') { | ||
32 | + return opts.paths( | ||
33 | + request, | ||
34 | + start, | ||
35 | + function () { return getNodeModulesDirs(start, modules); }, | ||
36 | + opts | ||
37 | + ); | ||
38 | + } | ||
39 | + | ||
40 | + var dirs = getNodeModulesDirs(start, modules); | ||
41 | + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; | ||
42 | +}; |
1 | +module.exports = function (x, opts) { | ||
2 | + /** | ||
3 | + * This file is purposefully a passthrough. It's expected that third-party | ||
4 | + * environments will override it at runtime in order to inject special logic | ||
5 | + * into `resolve` (by manipulating the options). One such example is the PnP | ||
6 | + * code path in Yarn. | ||
7 | + */ | ||
8 | + | ||
9 | + return opts || {}; | ||
10 | +}; |
server/node_modules/resolve/lib/sync.js
0 → 100644
1 | +var isCore = require('is-core-module'); | ||
2 | +var fs = require('fs'); | ||
3 | +var path = require('path'); | ||
4 | +var caller = require('./caller'); | ||
5 | +var nodeModulesPaths = require('./node-modules-paths'); | ||
6 | +var normalizeOptions = require('./normalize-options'); | ||
7 | + | ||
8 | +var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; | ||
9 | + | ||
10 | +var defaultIsFile = function isFile(file) { | ||
11 | + try { | ||
12 | + var stat = fs.statSync(file); | ||
13 | + } catch (e) { | ||
14 | + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; | ||
15 | + throw e; | ||
16 | + } | ||
17 | + return stat.isFile() || stat.isFIFO(); | ||
18 | +}; | ||
19 | + | ||
20 | +var defaultIsDir = function isDirectory(dir) { | ||
21 | + try { | ||
22 | + var stat = fs.statSync(dir); | ||
23 | + } catch (e) { | ||
24 | + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; | ||
25 | + throw e; | ||
26 | + } | ||
27 | + return stat.isDirectory(); | ||
28 | +}; | ||
29 | + | ||
30 | +var defaultRealpathSync = function realpathSync(x) { | ||
31 | + try { | ||
32 | + return realpathFS(x); | ||
33 | + } catch (realpathErr) { | ||
34 | + if (realpathErr.code !== 'ENOENT') { | ||
35 | + throw realpathErr; | ||
36 | + } | ||
37 | + } | ||
38 | + return x; | ||
39 | +}; | ||
40 | + | ||
41 | +var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { | ||
42 | + if (opts && opts.preserveSymlinks === false) { | ||
43 | + return realpathSync(x); | ||
44 | + } | ||
45 | + return x; | ||
46 | +}; | ||
47 | + | ||
48 | +var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) { | ||
49 | + var body = readFileSync(pkgfile); | ||
50 | + try { | ||
51 | + var pkg = JSON.parse(body); | ||
52 | + return pkg; | ||
53 | + } catch (jsonErr) {} | ||
54 | +}; | ||
55 | + | ||
56 | +var getPackageCandidates = function getPackageCandidates(x, start, opts) { | ||
57 | + var dirs = nodeModulesPaths(start, opts, x); | ||
58 | + for (var i = 0; i < dirs.length; i++) { | ||
59 | + dirs[i] = path.join(dirs[i], x); | ||
60 | + } | ||
61 | + return dirs; | ||
62 | +}; | ||
63 | + | ||
64 | +module.exports = function resolveSync(x, options) { | ||
65 | + if (typeof x !== 'string') { | ||
66 | + throw new TypeError('Path must be a string.'); | ||
67 | + } | ||
68 | + var opts = normalizeOptions(x, options); | ||
69 | + | ||
70 | + var isFile = opts.isFile || defaultIsFile; | ||
71 | + var readFileSync = opts.readFileSync || fs.readFileSync; | ||
72 | + var isDirectory = opts.isDirectory || defaultIsDir; | ||
73 | + var realpathSync = opts.realpathSync || defaultRealpathSync; | ||
74 | + var readPackageSync = opts.readPackageSync || defaultReadPackageSync; | ||
75 | + if (opts.readFileSync && opts.readPackageSync) { | ||
76 | + throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.'); | ||
77 | + } | ||
78 | + var packageIterator = opts.packageIterator; | ||
79 | + | ||
80 | + var extensions = opts.extensions || ['.js']; | ||
81 | + var includeCoreModules = opts.includeCoreModules !== false; | ||
82 | + var basedir = opts.basedir || path.dirname(caller()); | ||
83 | + var parent = opts.filename || basedir; | ||
84 | + | ||
85 | + opts.paths = opts.paths || []; | ||
86 | + | ||
87 | + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory | ||
88 | + var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); | ||
89 | + | ||
90 | + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { | ||
91 | + var res = path.resolve(absoluteStart, x); | ||
92 | + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; | ||
93 | + var m = loadAsFileSync(res) || loadAsDirectorySync(res); | ||
94 | + if (m) return maybeRealpathSync(realpathSync, m, opts); | ||
95 | + } else if (includeCoreModules && isCore(x)) { | ||
96 | + return x; | ||
97 | + } else { | ||
98 | + var n = loadNodeModulesSync(x, absoluteStart); | ||
99 | + if (n) return maybeRealpathSync(realpathSync, n, opts); | ||
100 | + } | ||
101 | + | ||
102 | + var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); | ||
103 | + err.code = 'MODULE_NOT_FOUND'; | ||
104 | + throw err; | ||
105 | + | ||
106 | + function loadAsFileSync(x) { | ||
107 | + var pkg = loadpkg(path.dirname(x)); | ||
108 | + | ||
109 | + if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { | ||
110 | + var rfile = path.relative(pkg.dir, x); | ||
111 | + var r = opts.pathFilter(pkg.pkg, x, rfile); | ||
112 | + if (r) { | ||
113 | + x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign | ||
114 | + } | ||
115 | + } | ||
116 | + | ||
117 | + if (isFile(x)) { | ||
118 | + return x; | ||
119 | + } | ||
120 | + | ||
121 | + for (var i = 0; i < extensions.length; i++) { | ||
122 | + var file = x + extensions[i]; | ||
123 | + if (isFile(file)) { | ||
124 | + return file; | ||
125 | + } | ||
126 | + } | ||
127 | + } | ||
128 | + | ||
129 | + function loadpkg(dir) { | ||
130 | + if (dir === '' || dir === '/') return; | ||
131 | + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { | ||
132 | + return; | ||
133 | + } | ||
134 | + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; | ||
135 | + | ||
136 | + var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); | ||
137 | + | ||
138 | + if (!isFile(pkgfile)) { | ||
139 | + return loadpkg(path.dirname(dir)); | ||
140 | + } | ||
141 | + | ||
142 | + var pkg = readPackageSync(readFileSync, pkgfile); | ||
143 | + | ||
144 | + if (pkg && opts.packageFilter) { | ||
145 | + // v2 will pass pkgfile | ||
146 | + pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment | ||
147 | + } | ||
148 | + | ||
149 | + return { pkg: pkg, dir: dir }; | ||
150 | + } | ||
151 | + | ||
152 | + function loadAsDirectorySync(x) { | ||
153 | + var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); | ||
154 | + if (isFile(pkgfile)) { | ||
155 | + try { | ||
156 | + var pkg = readPackageSync(readFileSync, pkgfile); | ||
157 | + } catch (e) {} | ||
158 | + | ||
159 | + if (pkg && opts.packageFilter) { | ||
160 | + // v2 will pass pkgfile | ||
161 | + pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment | ||
162 | + } | ||
163 | + | ||
164 | + if (pkg && pkg.main) { | ||
165 | + if (typeof pkg.main !== 'string') { | ||
166 | + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); | ||
167 | + mainError.code = 'INVALID_PACKAGE_MAIN'; | ||
168 | + throw mainError; | ||
169 | + } | ||
170 | + if (pkg.main === '.' || pkg.main === './') { | ||
171 | + pkg.main = 'index'; | ||
172 | + } | ||
173 | + try { | ||
174 | + var m = loadAsFileSync(path.resolve(x, pkg.main)); | ||
175 | + if (m) return m; | ||
176 | + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); | ||
177 | + if (n) return n; | ||
178 | + } catch (e) {} | ||
179 | + } | ||
180 | + } | ||
181 | + | ||
182 | + return loadAsFileSync(path.join(x, '/index')); | ||
183 | + } | ||
184 | + | ||
185 | + function loadNodeModulesSync(x, start) { | ||
186 | + var thunk = function () { return getPackageCandidates(x, start, opts); }; | ||
187 | + var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); | ||
188 | + | ||
189 | + for (var i = 0; i < dirs.length; i++) { | ||
190 | + var dir = dirs[i]; | ||
191 | + if (isDirectory(path.dirname(dir))) { | ||
192 | + var m = loadAsFileSync(dir); | ||
193 | + if (m) return m; | ||
194 | + var n = loadAsDirectorySync(dir); | ||
195 | + if (n) return n; | ||
196 | + } | ||
197 | + } | ||
198 | + } | ||
199 | +}; |
server/node_modules/resolve/package.json
0 → 100644
1 | +{ | ||
2 | + "_from": "resolve@^1.20.0", | ||
3 | + "_id": "resolve@1.20.0", | ||
4 | + "_inBundle": false, | ||
5 | + "_integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", | ||
6 | + "_location": "/resolve", | ||
7 | + "_phantomChildren": {}, | ||
8 | + "_requested": { | ||
9 | + "type": "range", | ||
10 | + "registry": true, | ||
11 | + "raw": "resolve@^1.20.0", | ||
12 | + "name": "resolve", | ||
13 | + "escapedName": "resolve", | ||
14 | + "rawSpec": "^1.20.0", | ||
15 | + "saveSpec": null, | ||
16 | + "fetchSpec": "^1.20.0" | ||
17 | + }, | ||
18 | + "_requiredBy": [ | ||
19 | + "#USER", | ||
20 | + "/" | ||
21 | + ], | ||
22 | + "_resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", | ||
23 | + "_shasum": "629a013fb3f70755d6f0b7935cc1c2c5378b1975", | ||
24 | + "_spec": "resolve@^1.20.0", | ||
25 | + "_where": "/home/ubuntu/stock_chatbot/server", | ||
26 | + "author": { | ||
27 | + "name": "James Halliday", | ||
28 | + "email": "mail@substack.net", | ||
29 | + "url": "http://substack.net" | ||
30 | + }, | ||
31 | + "bugs": { | ||
32 | + "url": "https://github.com/browserify/resolve/issues" | ||
33 | + }, | ||
34 | + "bundleDependencies": false, | ||
35 | + "dependencies": { | ||
36 | + "is-core-module": "^2.2.0", | ||
37 | + "path-parse": "^1.0.6" | ||
38 | + }, | ||
39 | + "deprecated": false, | ||
40 | + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", | ||
41 | + "devDependencies": { | ||
42 | + "@ljharb/eslint-config": "^17.5.1", | ||
43 | + "array.prototype.map": "^1.0.3", | ||
44 | + "aud": "^1.1.4", | ||
45 | + "eclint": "^2.8.1", | ||
46 | + "eslint": "^7.19.0", | ||
47 | + "object-keys": "^1.1.1", | ||
48 | + "safe-publish-latest": "^1.1.4", | ||
49 | + "tap": "0.4.13", | ||
50 | + "tape": "^5.1.1" | ||
51 | + }, | ||
52 | + "funding": { | ||
53 | + "url": "https://github.com/sponsors/ljharb" | ||
54 | + }, | ||
55 | + "homepage": "https://github.com/browserify/resolve#readme", | ||
56 | + "keywords": [ | ||
57 | + "resolve", | ||
58 | + "require", | ||
59 | + "node", | ||
60 | + "module" | ||
61 | + ], | ||
62 | + "license": "MIT", | ||
63 | + "main": "index.js", | ||
64 | + "name": "resolve", | ||
65 | + "repository": { | ||
66 | + "type": "git", | ||
67 | + "url": "git://github.com/browserify/resolve.git" | ||
68 | + }, | ||
69 | + "scripts": { | ||
70 | + "lint": "eslint --ext=js,mjs .", | ||
71 | + "posttest": "npm run test:multirepo && aud --production", | ||
72 | + "prelint": "eclint check '**/*'", | ||
73 | + "prepublish": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/ ||:", | ||
74 | + "pretest": "npm run lint", | ||
75 | + "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", | ||
76 | + "test": "npm run --silent tests-only", | ||
77 | + "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test", | ||
78 | + "tests-only": "tape test/*.js" | ||
79 | + }, | ||
80 | + "version": "1.20.0" | ||
81 | +} |
server/node_modules/resolve/readme.markdown
0 → 100644
1 | +# resolve | ||
2 | + | ||
3 | +implements the [node `require.resolve()` | ||
4 | +algorithm](https://nodejs.org/api/modules.html#modules_all_together) | ||
5 | +such that you can `require.resolve()` on behalf of a file asynchronously and | ||
6 | +synchronously | ||
7 | + | ||
8 | +[![build status](https://secure.travis-ci.org/browserify/resolve.png)](http://travis-ci.org/browserify/resolve) | ||
9 | + | ||
10 | +# example | ||
11 | + | ||
12 | +asynchronously resolve: | ||
13 | + | ||
14 | +```js | ||
15 | +var resolve = require('resolve'); | ||
16 | +resolve('tap', { basedir: __dirname }, function (err, res) { | ||
17 | + if (err) console.error(err); | ||
18 | + else console.log(res); | ||
19 | +}); | ||
20 | +``` | ||
21 | + | ||
22 | +``` | ||
23 | +$ node example/async.js | ||
24 | +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js | ||
25 | +``` | ||
26 | + | ||
27 | +synchronously resolve: | ||
28 | + | ||
29 | +```js | ||
30 | +var resolve = require('resolve'); | ||
31 | +var res = resolve.sync('tap', { basedir: __dirname }); | ||
32 | +console.log(res); | ||
33 | +``` | ||
34 | + | ||
35 | +``` | ||
36 | +$ node example/sync.js | ||
37 | +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js | ||
38 | +``` | ||
39 | + | ||
40 | +# methods | ||
41 | + | ||
42 | +```js | ||
43 | +var resolve = require('resolve'); | ||
44 | +``` | ||
45 | + | ||
46 | +For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: | ||
47 | + | ||
48 | +- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module | ||
49 | +- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory | ||
50 | +- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) | ||
51 | + | ||
52 | +## resolve(id, opts={}, cb) | ||
53 | + | ||
54 | +Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. | ||
55 | + | ||
56 | +options are: | ||
57 | + | ||
58 | +* opts.basedir - directory to begin resolving from | ||
59 | + | ||
60 | +* opts.package - `package.json` data applicable to the module being loaded | ||
61 | + | ||
62 | +* opts.extensions - array of file extensions to search in order | ||
63 | + | ||
64 | +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search | ||
65 | + | ||
66 | +* opts.readFile - how to read files asynchronously | ||
67 | + | ||
68 | +* opts.isFile - function to asynchronously test whether a file exists | ||
69 | + | ||
70 | +* opts.isDirectory - function to asynchronously test whether a directory exists | ||
71 | + | ||
72 | +* opts.realpath - function to asynchronously resolve a potential symlink to its real path | ||
73 | + | ||
74 | +* `opts.readPackage(readFile, pkgfile, cb)` - function to asynchronously read and parse a package.json file | ||
75 | + * readFile - the passed `opts.readFile` or `fs.readFile` if not specified | ||
76 | + * pkgfile - path to package.json | ||
77 | + * cb - callback | ||
78 | + | ||
79 | +* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field | ||
80 | + * pkg - package data | ||
81 | + * pkgfile - path to package.json | ||
82 | + * dir - directory for package.json | ||
83 | + | ||
84 | +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package | ||
85 | + * pkg - package data | ||
86 | + * path - the path being resolved | ||
87 | + * relativePath - the path relative from the package.json location | ||
88 | + * returns - a relative path that will be joined from the package.json location | ||
89 | + | ||
90 | +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) | ||
91 | + | ||
92 | + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function | ||
93 | + * request - the import specifier being resolved | ||
94 | + * start - lookup path | ||
95 | + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution | ||
96 | + * opts - the resolution options | ||
97 | + | ||
98 | +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) | ||
99 | + * request - the import specifier being resolved | ||
100 | + * start - lookup path | ||
101 | + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution | ||
102 | + * opts - the resolution options | ||
103 | + | ||
104 | +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` | ||
105 | + | ||
106 | +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. | ||
107 | +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. | ||
108 | +**Note:** this property is currently `true` by default but it will be changed to | ||
109 | +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. | ||
110 | + | ||
111 | +default `opts` values: | ||
112 | + | ||
113 | +```js | ||
114 | +{ | ||
115 | + paths: [], | ||
116 | + basedir: __dirname, | ||
117 | + extensions: ['.js'], | ||
118 | + includeCoreModules: true, | ||
119 | + readFile: fs.readFile, | ||
120 | + isFile: function isFile(file, cb) { | ||
121 | + fs.stat(file, function (err, stat) { | ||
122 | + if (!err) { | ||
123 | + return cb(null, stat.isFile() || stat.isFIFO()); | ||
124 | + } | ||
125 | + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); | ||
126 | + return cb(err); | ||
127 | + }); | ||
128 | + }, | ||
129 | + isDirectory: function isDirectory(dir, cb) { | ||
130 | + fs.stat(dir, function (err, stat) { | ||
131 | + if (!err) { | ||
132 | + return cb(null, stat.isDirectory()); | ||
133 | + } | ||
134 | + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); | ||
135 | + return cb(err); | ||
136 | + }); | ||
137 | + }, | ||
138 | + realpath: function realpath(file, cb) { | ||
139 | + var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; | ||
140 | + realpath(file, function (realPathErr, realPath) { | ||
141 | + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); | ||
142 | + else cb(null, realPathErr ? file : realPath); | ||
143 | + }); | ||
144 | + }, | ||
145 | + readPackage: function defaultReadPackage(readFile, pkgfile, cb) { | ||
146 | + readFile(pkgfile, function (readFileErr, body) { | ||
147 | + if (readFileErr) cb(readFileErr); | ||
148 | + else { | ||
149 | + try { | ||
150 | + var pkg = JSON.parse(body); | ||
151 | + cb(null, pkg); | ||
152 | + } catch (jsonErr) { | ||
153 | + cb(null); | ||
154 | + } | ||
155 | + } | ||
156 | + }); | ||
157 | + }, | ||
158 | + moduleDirectory: 'node_modules', | ||
159 | + preserveSymlinks: true | ||
160 | +} | ||
161 | +``` | ||
162 | + | ||
163 | +## resolve.sync(id, opts) | ||
164 | + | ||
165 | +Synchronously resolve the module path string `id`, returning the result and | ||
166 | +throwing an error when `id` can't be resolved. | ||
167 | + | ||
168 | +options are: | ||
169 | + | ||
170 | +* opts.basedir - directory to begin resolving from | ||
171 | + | ||
172 | +* opts.extensions - array of file extensions to search in order | ||
173 | + | ||
174 | +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search | ||
175 | + | ||
176 | +* opts.readFileSync - how to read files synchronously | ||
177 | + | ||
178 | +* opts.isFile - function to synchronously test whether a file exists | ||
179 | + | ||
180 | +* opts.isDirectory - function to synchronously test whether a directory exists | ||
181 | + | ||
182 | +* opts.realpathSync - function to synchronously resolve a potential symlink to its real path | ||
183 | + | ||
184 | +* `opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file | ||
185 | + * readFileSync - the passed `opts.readFileSync` or `fs.readFileSync` if not specified | ||
186 | + * pkgfile - path to package.json | ||
187 | + | ||
188 | +* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field | ||
189 | + * pkg - package data | ||
190 | + * dir - directory for package.json (Note: the second argument will change to "pkgfile" in v2) | ||
191 | + | ||
192 | +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package | ||
193 | + * pkg - package data | ||
194 | + * path - the path being resolved | ||
195 | + * relativePath - the path relative from the package.json location | ||
196 | + * returns - a relative path that will be joined from the package.json location | ||
197 | + | ||
198 | +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) | ||
199 | + | ||
200 | + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function | ||
201 | + * request - the import specifier being resolved | ||
202 | + * start - lookup path | ||
203 | + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution | ||
204 | + * opts - the resolution options | ||
205 | + | ||
206 | +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) | ||
207 | + * request - the import specifier being resolved | ||
208 | + * start - lookup path | ||
209 | + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution | ||
210 | + * opts - the resolution options | ||
211 | + | ||
212 | +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` | ||
213 | + | ||
214 | +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. | ||
215 | +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. | ||
216 | +**Note:** this property is currently `true` by default but it will be changed to | ||
217 | +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. | ||
218 | + | ||
219 | +default `opts` values: | ||
220 | + | ||
221 | +```js | ||
222 | +{ | ||
223 | + paths: [], | ||
224 | + basedir: __dirname, | ||
225 | + extensions: ['.js'], | ||
226 | + includeCoreModules: true, | ||
227 | + readFileSync: fs.readFileSync, | ||
228 | + isFile: function isFile(file) { | ||
229 | + try { | ||
230 | + var stat = fs.statSync(file); | ||
231 | + } catch (e) { | ||
232 | + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; | ||
233 | + throw e; | ||
234 | + } | ||
235 | + return stat.isFile() || stat.isFIFO(); | ||
236 | + }, | ||
237 | + isDirectory: function isDirectory(dir) { | ||
238 | + try { | ||
239 | + var stat = fs.statSync(dir); | ||
240 | + } catch (e) { | ||
241 | + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; | ||
242 | + throw e; | ||
243 | + } | ||
244 | + return stat.isDirectory(); | ||
245 | + }, | ||
246 | + realpathSync: function realpathSync(file) { | ||
247 | + try { | ||
248 | + var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; | ||
249 | + return realpath(file); | ||
250 | + } catch (realPathErr) { | ||
251 | + if (realPathErr.code !== 'ENOENT') { | ||
252 | + throw realPathErr; | ||
253 | + } | ||
254 | + } | ||
255 | + return file; | ||
256 | + }, | ||
257 | + readPackageSync: function defaultReadPackageSync(readFileSync, pkgfile) { | ||
258 | + var body = readFileSync(pkgfile); | ||
259 | + try { | ||
260 | + var pkg = JSON.parse(body); | ||
261 | + return pkg; | ||
262 | + } catch (jsonErr) {} | ||
263 | + }, | ||
264 | + moduleDirectory: 'node_modules', | ||
265 | + preserveSymlinks: true | ||
266 | +} | ||
267 | +``` | ||
268 | + | ||
269 | +# install | ||
270 | + | ||
271 | +With [npm](https://npmjs.org) do: | ||
272 | + | ||
273 | +```sh | ||
274 | +npm install resolve | ||
275 | +``` | ||
276 | + | ||
277 | +# license | ||
278 | + | ||
279 | +MIT |
server/node_modules/resolve/test/.eslintrc
0 → 100644
server/node_modules/resolve/test/core.js
0 → 100644
1 | +var test = require('tape'); | ||
2 | +var keys = require('object-keys'); | ||
3 | +var resolve = require('../'); | ||
4 | + | ||
5 | +test('core modules', function (t) { | ||
6 | + t.test('isCore()', function (st) { | ||
7 | + st.ok(resolve.isCore('fs')); | ||
8 | + st.ok(resolve.isCore('net')); | ||
9 | + st.ok(resolve.isCore('http')); | ||
10 | + | ||
11 | + st.ok(!resolve.isCore('seq')); | ||
12 | + st.ok(!resolve.isCore('../')); | ||
13 | + | ||
14 | + st.ok(!resolve.isCore('toString')); | ||
15 | + | ||
16 | + st.end(); | ||
17 | + }); | ||
18 | + | ||
19 | + t.test('core list', function (st) { | ||
20 | + var cores = keys(resolve.core); | ||
21 | + st.plan(cores.length); | ||
22 | + | ||
23 | + for (var i = 0; i < cores.length; ++i) { | ||
24 | + var mod = cores[i]; | ||
25 | + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func | ||
26 | + console.log(mod, resolve.core, resolve.core[mod]); | ||
27 | + if (resolve.core[mod]) { | ||
28 | + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); | ||
29 | + } else { | ||
30 | + st.throws(requireFunc, mod + ' not supported; requiring throws'); | ||
31 | + } | ||
32 | + } | ||
33 | + | ||
34 | + st.end(); | ||
35 | + }); | ||
36 | + | ||
37 | + t.test('core via repl module', { skip: !resolve.core.repl }, function (st) { | ||
38 | + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle | ||
39 | + if (!libs) { | ||
40 | + st.skip('module.builtinModules does not exist'); | ||
41 | + return st.end(); | ||
42 | + } | ||
43 | + for (var i = 0; i < libs.length; ++i) { | ||
44 | + var mod = libs[i]; | ||
45 | + st.ok(resolve.core[mod], mod + ' is a core module'); | ||
46 | + st.doesNotThrow( | ||
47 | + function () { require(mod); }, // eslint-disable-line no-loop-func | ||
48 | + 'requiring ' + mod + ' does not throw' | ||
49 | + ); | ||
50 | + } | ||
51 | + st.end(); | ||
52 | + }); | ||
53 | + | ||
54 | + t.test('core via builtinModules list', { skip: !resolve.core.module }, function (st) { | ||
55 | + var libs = require('module').builtinModules; | ||
56 | + if (!libs) { | ||
57 | + st.skip('module.builtinModules does not exist'); | ||
58 | + return st.end(); | ||
59 | + } | ||
60 | + var blacklist = [ | ||
61 | + '_debug_agent', | ||
62 | + 'v8/tools/tickprocessor-driver', | ||
63 | + 'v8/tools/SourceMap', | ||
64 | + 'v8/tools/tickprocessor', | ||
65 | + 'v8/tools/profile' | ||
66 | + ]; | ||
67 | + for (var i = 0; i < libs.length; ++i) { | ||
68 | + var mod = libs[i]; | ||
69 | + if (blacklist.indexOf(mod) === -1) { | ||
70 | + st.ok(resolve.core[mod], mod + ' is a core module'); | ||
71 | + st.doesNotThrow( | ||
72 | + function () { require(mod); }, // eslint-disable-line no-loop-func | ||
73 | + 'requiring ' + mod + ' does not throw' | ||
74 | + ); | ||
75 | + } | ||
76 | + } | ||
77 | + st.end(); | ||
78 | + }); | ||
79 | + | ||
80 | + t.end(); | ||
81 | +}); |
server/node_modules/resolve/test/dotdot.js
0 → 100644
1 | +var path = require('path'); | ||
2 | +var test = require('tape'); | ||
3 | +var resolve = require('../'); | ||
4 | + | ||
5 | +test('dotdot', function (t) { | ||
6 | + t.plan(4); | ||
7 | + var dir = path.join(__dirname, '/dotdot/abc'); | ||
8 | + | ||
9 | + resolve('..', { basedir: dir }, function (err, res, pkg) { | ||
10 | + t.ifError(err); | ||
11 | + t.equal(res, path.join(__dirname, 'dotdot/index.js')); | ||
12 | + }); | ||
13 | + | ||
14 | + resolve('.', { basedir: dir }, function (err, res, pkg) { | ||
15 | + t.ifError(err); | ||
16 | + t.equal(res, path.join(dir, 'index.js')); | ||
17 | + }); | ||
18 | +}); | ||
19 | + | ||
20 | +test('dotdot sync', function (t) { | ||
21 | + t.plan(2); | ||
22 | + var dir = path.join(__dirname, '/dotdot/abc'); | ||
23 | + | ||
24 | + var a = resolve.sync('..', { basedir: dir }); | ||
25 | + t.equal(a, path.join(__dirname, 'dotdot/index.js')); | ||
26 | + | ||
27 | + var b = resolve.sync('.', { basedir: dir }); | ||
28 | + t.equal(b, path.join(dir, 'index.js')); | ||
29 | +}); |
1 | +module.exports = 'whatever'; |
1 | +var test = require('tape'); | ||
2 | +var path = require('path'); | ||
3 | +var resolve = require('../'); | ||
4 | + | ||
5 | +test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) { | ||
6 | + t.plan(1); | ||
7 | + | ||
8 | + var resolverDir = 'C:\\a\\b\\c\\d'; | ||
9 | + | ||
10 | + resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) { | ||
11 | + t.equal(!!err, true); | ||
12 | + }); | ||
13 | +}); | ||
14 | + | ||
15 | +test('non-existent basedir should not throw when preserveSymlinks is false', function (t) { | ||
16 | + t.plan(2); | ||
17 | + | ||
18 | + var opts = { | ||
19 | + basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'), | ||
20 | + preserveSymlinks: false | ||
21 | + }; | ||
22 | + | ||
23 | + var module = './dotdot/abc'; | ||
24 | + | ||
25 | + resolve(module, opts, function (err, res) { | ||
26 | + t.equal(err.code, 'MODULE_NOT_FOUND'); | ||
27 | + t.equal(res, undefined); | ||
28 | + }); | ||
29 | +}); |
server/node_modules/resolve/test/filter.js
0 → 100644
1 | +var path = require('path'); | ||
2 | +var test = require('tape'); | ||
3 | +var resolve = require('../'); | ||
4 | + | ||
5 | +test('filter', function (t) { | ||
6 | + t.plan(4); | ||
7 | + var dir = path.join(__dirname, 'resolver'); | ||
8 | + var packageFilterArgs; | ||
9 | + resolve('./baz', { | ||
10 | + basedir: dir, | ||
11 | + packageFilter: function (pkg, pkgfile) { | ||
12 | + pkg.main = 'doom'; // eslint-disable-line no-param-reassign | ||
13 | + packageFilterArgs = [pkg, pkgfile]; | ||
14 | + return pkg; | ||
15 | + } | ||
16 | + }, function (err, res, pkg) { | ||
17 | + if (err) t.fail(err); | ||
18 | + | ||
19 | + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); | ||
20 | + | ||
21 | + var packageData = packageFilterArgs[0]; | ||
22 | + t.equal(pkg, packageData, 'first packageFilter argument is "pkg"'); | ||
23 | + t.equal(packageData.main, 'doom', 'package "main" was altered'); | ||
24 | + | ||
25 | + var packageFile = packageFilterArgs[1]; | ||
26 | + t.equal( | ||
27 | + packageFile, | ||
28 | + path.join(dir, 'baz/package.json'), | ||
29 | + 'second packageFilter argument is "pkgfile"' | ||
30 | + ); | ||
31 | + | ||
32 | + t.end(); | ||
33 | + }); | ||
34 | +}); |
1 | +var path = require('path'); | ||
2 | +var test = require('tape'); | ||
3 | +var resolve = require('../'); | ||
4 | + | ||
5 | +test('filter', function (t) { | ||
6 | + var dir = path.join(__dirname, 'resolver'); | ||
7 | + var packageFilterArgs; | ||
8 | + var res = resolve.sync('./baz', { | ||
9 | + basedir: dir, | ||
10 | + // NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility | ||
11 | + packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment | ||
12 | + pkg.main = 'doom'; // eslint-disable-line no-param-reassign | ||
13 | + packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef | ||
14 | + return pkg; | ||
15 | + } | ||
16 | + }); | ||
17 | + | ||
18 | + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); | ||
19 | + | ||
20 | + var packageData = packageFilterArgs[0]; | ||
21 | + t.equal(packageData.main, 'doom', 'package "main" was altered'); | ||
22 | + | ||
23 | + if (!'is 1.x') { // eslint-disable-line no-constant-condition | ||
24 | + var packageFile = packageFilterArgs[1]; | ||
25 | + t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct'); | ||
26 | + } | ||
27 | + | ||
28 | + var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition | ||
29 | + // eslint-disable-next-line no-constant-condition | ||
30 | + t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"'); | ||
31 | + | ||
32 | + t.end(); | ||
33 | +}); |
server/node_modules/resolve/test/mock.js
0 → 100644
1 | +var path = require('path'); | ||
2 | +var test = require('tape'); | ||
3 | +var resolve = require('../'); | ||
4 | + | ||
5 | +test('mock', function (t) { | ||
6 | + t.plan(8); | ||
7 | + | ||
8 | + var files = {}; | ||
9 | + files[path.resolve('/foo/bar/baz.js')] = 'beep'; | ||
10 | + | ||
11 | + var dirs = {}; | ||
12 | + dirs[path.resolve('/foo/bar')] = true; | ||
13 | + | ||
14 | + function opts(basedir) { | ||
15 | + return { | ||
16 | + basedir: path.resolve(basedir), | ||
17 | + isFile: function (file, cb) { | ||
18 | + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); | ||
19 | + }, | ||
20 | + isDirectory: function (dir, cb) { | ||
21 | + cb(null, !!dirs[path.resolve(dir)]); | ||
22 | + }, | ||
23 | + readFile: function (file, cb) { | ||
24 | + cb(null, files[path.resolve(file)]); | ||
25 | + }, | ||
26 | + realpath: function (file, cb) { | ||
27 | + cb(null, file); | ||
28 | + } | ||
29 | + }; | ||
30 | + } | ||
31 | + | ||
32 | + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { | ||
33 | + if (err) return t.fail(err); | ||
34 | + t.equal(res, path.resolve('/foo/bar/baz.js')); | ||
35 | + t.equal(pkg, undefined); | ||
36 | + }); | ||
37 | + | ||
38 | + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { | ||
39 | + if (err) return t.fail(err); | ||
40 | + t.equal(res, path.resolve('/foo/bar/baz.js')); | ||
41 | + t.equal(pkg, undefined); | ||
42 | + }); | ||
43 | + | ||
44 | + resolve('baz', opts('/foo/bar'), function (err, res) { | ||
45 | + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); | ||
46 | + t.equal(err.code, 'MODULE_NOT_FOUND'); | ||
47 | + }); | ||
48 | + | ||
49 | + resolve('../baz', opts('/foo/bar'), function (err, res) { | ||
50 | + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); | ||
51 | + t.equal(err.code, 'MODULE_NOT_FOUND'); | ||
52 | + }); | ||
53 | +}); | ||
54 | + | ||
55 | +test('mock from package', function (t) { | ||
56 | + t.plan(8); | ||
57 | + | ||
58 | + var files = {}; | ||
59 | + files[path.resolve('/foo/bar/baz.js')] = 'beep'; | ||
60 | + | ||
61 | + var dirs = {}; | ||
62 | + dirs[path.resolve('/foo/bar')] = true; | ||
63 | + | ||
64 | + function opts(basedir) { | ||
65 | + return { | ||
66 | + basedir: path.resolve(basedir), | ||
67 | + isFile: function (file, cb) { | ||
68 | + cb(null, Object.prototype.hasOwnProperty.call(files, file)); | ||
69 | + }, | ||
70 | + isDirectory: function (dir, cb) { | ||
71 | + cb(null, !!dirs[path.resolve(dir)]); | ||
72 | + }, | ||
73 | + 'package': { main: 'bar' }, | ||
74 | + readFile: function (file, cb) { | ||
75 | + cb(null, files[file]); | ||
76 | + }, | ||
77 | + realpath: function (file, cb) { | ||
78 | + cb(null, file); | ||
79 | + } | ||
80 | + }; | ||
81 | + } | ||
82 | + | ||
83 | + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { | ||
84 | + if (err) return t.fail(err); | ||
85 | + t.equal(res, path.resolve('/foo/bar/baz.js')); | ||
86 | + t.equal(pkg && pkg.main, 'bar'); | ||
87 | + }); | ||
88 | + | ||
89 | + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { | ||
90 | + if (err) return t.fail(err); | ||
91 | + t.equal(res, path.resolve('/foo/bar/baz.js')); | ||
92 | + t.equal(pkg && pkg.main, 'bar'); | ||
93 | + }); | ||
94 | + | ||
95 | + resolve('baz', opts('/foo/bar'), function (err, res) { | ||
96 | + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); | ||
97 | + t.equal(err.code, 'MODULE_NOT_FOUND'); | ||
98 | + }); | ||
99 | + | ||
100 | + resolve('../baz', opts('/foo/bar'), function (err, res) { | ||
101 | + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); | ||
102 | + t.equal(err.code, 'MODULE_NOT_FOUND'); | ||
103 | + }); | ||
104 | +}); | ||
105 | + | ||
106 | +test('mock package', function (t) { | ||
107 | + t.plan(2); | ||
108 | + | ||
109 | + var files = {}; | ||
110 | + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; | ||
111 | + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ | ||
112 | + main: './baz.js' | ||
113 | + }); | ||
114 | + | ||
115 | + var dirs = {}; | ||
116 | + dirs[path.resolve('/foo')] = true; | ||
117 | + dirs[path.resolve('/foo/node_modules')] = true; | ||
118 | + | ||
119 | + function opts(basedir) { | ||
120 | + return { | ||
121 | + basedir: path.resolve(basedir), | ||
122 | + isFile: function (file, cb) { | ||
123 | + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); | ||
124 | + }, | ||
125 | + isDirectory: function (dir, cb) { | ||
126 | + cb(null, !!dirs[path.resolve(dir)]); | ||
127 | + }, | ||
128 | + readFile: function (file, cb) { | ||
129 | + cb(null, files[path.resolve(file)]); | ||
130 | + }, | ||
131 | + realpath: function (file, cb) { | ||
132 | + cb(null, file); | ||
133 | + } | ||
134 | + }; | ||
135 | + } | ||
136 | + | ||
137 | + resolve('bar', opts('/foo'), function (err, res, pkg) { | ||
138 | + if (err) return t.fail(err); | ||
139 | + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); | ||
140 | + t.equal(pkg && pkg.main, './baz.js'); | ||
141 | + }); | ||
142 | +}); | ||
143 | + | ||
144 | +test('mock package from package', function (t) { | ||
145 | + t.plan(2); | ||
146 | + | ||
147 | + var files = {}; | ||
148 | + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; | ||
149 | + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ | ||
150 | + main: './baz.js' | ||
151 | + }); | ||
152 | + | ||
153 | + var dirs = {}; | ||
154 | + dirs[path.resolve('/foo')] = true; | ||
155 | + dirs[path.resolve('/foo/node_modules')] = true; | ||
156 | + | ||
157 | + function opts(basedir) { | ||
158 | + return { | ||
159 | + basedir: path.resolve(basedir), | ||
160 | + isFile: function (file, cb) { | ||
161 | + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); | ||
162 | + }, | ||
163 | + isDirectory: function (dir, cb) { | ||
164 | + cb(null, !!dirs[path.resolve(dir)]); | ||
165 | + }, | ||
166 | + 'package': { main: 'bar' }, | ||
167 | + readFile: function (file, cb) { | ||
168 | + cb(null, files[path.resolve(file)]); | ||
169 | + }, | ||
170 | + realpath: function (file, cb) { | ||
171 | + cb(null, file); | ||
172 | + } | ||
173 | + }; | ||
174 | + } | ||
175 | + | ||
176 | + resolve('bar', opts('/foo'), function (err, res, pkg) { | ||
177 | + if (err) return t.fail(err); | ||
178 | + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); | ||
179 | + t.equal(pkg && pkg.main, './baz.js'); | ||
180 | + }); | ||
181 | +}); | ||
182 | + | ||
183 | +test('symlinked', function (t) { | ||
184 | + t.plan(4); | ||
185 | + | ||
186 | + var files = {}; | ||
187 | + files[path.resolve('/foo/bar/baz.js')] = 'beep'; | ||
188 | + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; | ||
189 | + | ||
190 | + var dirs = {}; | ||
191 | + dirs[path.resolve('/foo/bar')] = true; | ||
192 | + dirs[path.resolve('/foo/bar/symlinked')] = true; | ||
193 | + | ||
194 | + function opts(basedir) { | ||
195 | + return { | ||
196 | + preserveSymlinks: false, | ||
197 | + basedir: path.resolve(basedir), | ||
198 | + isFile: function (file, cb) { | ||
199 | + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); | ||
200 | + }, | ||
201 | + isDirectory: function (dir, cb) { | ||
202 | + cb(null, !!dirs[path.resolve(dir)]); | ||
203 | + }, | ||
204 | + readFile: function (file, cb) { | ||
205 | + cb(null, files[path.resolve(file)]); | ||
206 | + }, | ||
207 | + realpath: function (file, cb) { | ||
208 | + var resolved = path.resolve(file); | ||
209 | + | ||
210 | + if (resolved.indexOf('symlinked') >= 0) { | ||
211 | + cb(null, resolved); | ||
212 | + return; | ||
213 | + } | ||
214 | + | ||
215 | + var ext = path.extname(resolved); | ||
216 | + | ||
217 | + if (ext) { | ||
218 | + var dir = path.dirname(resolved); | ||
219 | + var base = path.basename(resolved); | ||
220 | + cb(null, path.join(dir, 'symlinked', base)); | ||
221 | + } else { | ||
222 | + cb(null, path.join(resolved, 'symlinked')); | ||
223 | + } | ||
224 | + } | ||
225 | + }; | ||
226 | + } | ||
227 | + | ||
228 | + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { | ||
229 | + if (err) return t.fail(err); | ||
230 | + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); | ||
231 | + t.equal(pkg, undefined); | ||
232 | + }); | ||
233 | + | ||
234 | + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { | ||
235 | + if (err) return t.fail(err); | ||
236 | + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); | ||
237 | + t.equal(pkg, undefined); | ||
238 | + }); | ||
239 | +}); | ||
240 | + | ||
241 | +test('readPackage', function (t) { | ||
242 | + t.plan(3); | ||
243 | + | ||
244 | + var files = {}; | ||
245 | + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; | ||
246 | + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ | ||
247 | + main: './baz.js' | ||
248 | + }); | ||
249 | + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; | ||
250 | + | ||
251 | + var dirs = {}; | ||
252 | + dirs[path.resolve('/foo')] = true; | ||
253 | + dirs[path.resolve('/foo/node_modules')] = true; | ||
254 | + | ||
255 | + function opts(basedir) { | ||
256 | + return { | ||
257 | + basedir: path.resolve(basedir), | ||
258 | + isFile: function (file, cb) { | ||
259 | + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); | ||
260 | + }, | ||
261 | + isDirectory: function (dir, cb) { | ||
262 | + cb(null, !!dirs[path.resolve(dir)]); | ||
263 | + }, | ||
264 | + 'package': { main: 'bar' }, | ||
265 | + readFile: function (file, cb) { | ||
266 | + cb(null, files[path.resolve(file)]); | ||
267 | + }, | ||
268 | + realpath: function (file, cb) { | ||
269 | + cb(null, file); | ||
270 | + } | ||
271 | + }; | ||
272 | + } | ||
273 | + | ||
274 | + t.test('with readFile', function (st) { | ||
275 | + st.plan(3); | ||
276 | + | ||
277 | + resolve('bar', opts('/foo'), function (err, res, pkg) { | ||
278 | + st.error(err); | ||
279 | + st.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); | ||
280 | + st.equal(pkg && pkg.main, './baz.js'); | ||
281 | + }); | ||
282 | + }); | ||
283 | + | ||
284 | + var readPackage = function (readFile, file, cb) { | ||
285 | + var barPackage = path.join('bar', 'package.json'); | ||
286 | + if (file.slice(-barPackage.length) === barPackage) { | ||
287 | + cb(null, { main: './something-else.js' }); | ||
288 | + } else { | ||
289 | + cb(null, JSON.parse(files[path.resolve(file)])); | ||
290 | + } | ||
291 | + }; | ||
292 | + | ||
293 | + t.test('with readPackage', function (st) { | ||
294 | + st.plan(3); | ||
295 | + | ||
296 | + var options = opts('/foo'); | ||
297 | + delete options.readFile; | ||
298 | + options.readPackage = readPackage; | ||
299 | + resolve('bar', options, function (err, res, pkg) { | ||
300 | + st.error(err); | ||
301 | + st.equal(res, path.resolve('/foo/node_modules/bar/something-else.js')); | ||
302 | + st.equal(pkg && pkg.main, './something-else.js'); | ||
303 | + }); | ||
304 | + }); | ||
305 | + | ||
306 | + t.test('with readFile and readPackage', function (st) { | ||
307 | + st.plan(1); | ||
308 | + | ||
309 | + var options = opts('/foo'); | ||
310 | + options.readPackage = readPackage; | ||
311 | + resolve('bar', options, function (err) { | ||
312 | + st.throws(function () { throw err; }, TypeError, 'errors when both readFile and readPackage are provided'); | ||
313 | + }); | ||
314 | + }); | ||
315 | +}); |
1 | +var path = require('path'); | ||
2 | +var test = require('tape'); | ||
3 | +var resolve = require('../'); | ||
4 | + | ||
5 | +test('mock', function (t) { | ||
6 | + t.plan(4); | ||
7 | + | ||
8 | + var files = {}; | ||
9 | + files[path.resolve('/foo/bar/baz.js')] = 'beep'; | ||
10 | + | ||
11 | + var dirs = {}; | ||
12 | + dirs[path.resolve('/foo/bar')] = true; | ||
13 | + | ||
14 | + function opts(basedir) { | ||
15 | + return { | ||
16 | + basedir: path.resolve(basedir), | ||
17 | + isFile: function (file) { | ||
18 | + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); | ||
19 | + }, | ||
20 | + isDirectory: function (dir) { | ||
21 | + return !!dirs[path.resolve(dir)]; | ||
22 | + }, | ||
23 | + readFileSync: function (file) { | ||
24 | + return files[path.resolve(file)]; | ||
25 | + }, | ||
26 | + realpathSync: function (file) { | ||
27 | + return file; | ||
28 | + } | ||
29 | + }; | ||
30 | + } | ||
31 | + | ||
32 | + t.equal( | ||
33 | + resolve.sync('./baz', opts('/foo/bar')), | ||
34 | + path.resolve('/foo/bar/baz.js') | ||
35 | + ); | ||
36 | + | ||
37 | + t.equal( | ||
38 | + resolve.sync('./baz.js', opts('/foo/bar')), | ||
39 | + path.resolve('/foo/bar/baz.js') | ||
40 | + ); | ||
41 | + | ||
42 | + t.throws(function () { | ||
43 | + resolve.sync('baz', opts('/foo/bar')); | ||
44 | + }); | ||
45 | + | ||
46 | + t.throws(function () { | ||
47 | + resolve.sync('../baz', opts('/foo/bar')); | ||
48 | + }); | ||
49 | +}); | ||
50 | + | ||
51 | +test('mock package', function (t) { | ||
52 | + t.plan(1); | ||
53 | + | ||
54 | + var files = {}; | ||
55 | + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; | ||
56 | + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ | ||
57 | + main: './baz.js' | ||
58 | + }); | ||
59 | + | ||
60 | + var dirs = {}; | ||
61 | + dirs[path.resolve('/foo')] = true; | ||
62 | + dirs[path.resolve('/foo/node_modules')] = true; | ||
63 | + | ||
64 | + function opts(basedir) { | ||
65 | + return { | ||
66 | + basedir: path.resolve(basedir), | ||
67 | + isFile: function (file) { | ||
68 | + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); | ||
69 | + }, | ||
70 | + isDirectory: function (dir) { | ||
71 | + return !!dirs[path.resolve(dir)]; | ||
72 | + }, | ||
73 | + readFileSync: function (file) { | ||
74 | + return files[path.resolve(file)]; | ||
75 | + }, | ||
76 | + realpathSync: function (file) { | ||
77 | + return file; | ||
78 | + } | ||
79 | + }; | ||
80 | + } | ||
81 | + | ||
82 | + t.equal( | ||
83 | + resolve.sync('bar', opts('/foo')), | ||
84 | + path.resolve('/foo/node_modules/bar/baz.js') | ||
85 | + ); | ||
86 | +}); | ||
87 | + | ||
88 | +test('symlinked', function (t) { | ||
89 | + t.plan(2); | ||
90 | + | ||
91 | + var files = {}; | ||
92 | + files[path.resolve('/foo/bar/baz.js')] = 'beep'; | ||
93 | + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; | ||
94 | + | ||
95 | + var dirs = {}; | ||
96 | + dirs[path.resolve('/foo/bar')] = true; | ||
97 | + dirs[path.resolve('/foo/bar/symlinked')] = true; | ||
98 | + | ||
99 | + function opts(basedir) { | ||
100 | + return { | ||
101 | + preserveSymlinks: false, | ||
102 | + basedir: path.resolve(basedir), | ||
103 | + isFile: function (file) { | ||
104 | + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); | ||
105 | + }, | ||
106 | + isDirectory: function (dir) { | ||
107 | + return !!dirs[path.resolve(dir)]; | ||
108 | + }, | ||
109 | + readFileSync: function (file) { | ||
110 | + return files[path.resolve(file)]; | ||
111 | + }, | ||
112 | + realpathSync: function (file) { | ||
113 | + var resolved = path.resolve(file); | ||
114 | + | ||
115 | + if (resolved.indexOf('symlinked') >= 0) { | ||
116 | + return resolved; | ||
117 | + } | ||
118 | + | ||
119 | + var ext = path.extname(resolved); | ||
120 | + | ||
121 | + if (ext) { | ||
122 | + var dir = path.dirname(resolved); | ||
123 | + var base = path.basename(resolved); | ||
124 | + return path.join(dir, 'symlinked', base); | ||
125 | + } else { | ||
126 | + return path.join(resolved, 'symlinked'); | ||
127 | + } | ||
128 | + } | ||
129 | + }; | ||
130 | + } | ||
131 | + | ||
132 | + t.equal( | ||
133 | + resolve.sync('./baz', opts('/foo/bar')), | ||
134 | + path.resolve('/foo/bar/symlinked/baz.js') | ||
135 | + ); | ||
136 | + | ||
137 | + t.equal( | ||
138 | + resolve.sync('./baz.js', opts('/foo/bar')), | ||
139 | + path.resolve('/foo/bar/symlinked/baz.js') | ||
140 | + ); | ||
141 | +}); | ||
142 | + | ||
143 | +test('readPackageSync', function (t) { | ||
144 | + t.plan(3); | ||
145 | + | ||
146 | + var files = {}; | ||
147 | + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; | ||
148 | + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ | ||
149 | + main: './baz.js' | ||
150 | + }); | ||
151 | + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; | ||
152 | + | ||
153 | + var dirs = {}; | ||
154 | + dirs[path.resolve('/foo')] = true; | ||
155 | + dirs[path.resolve('/foo/node_modules')] = true; | ||
156 | + | ||
157 | + function opts(basedir, useReadPackage) { | ||
158 | + return { | ||
159 | + basedir: path.resolve(basedir), | ||
160 | + isFile: function (file) { | ||
161 | + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); | ||
162 | + }, | ||
163 | + isDirectory: function (dir) { | ||
164 | + return !!dirs[path.resolve(dir)]; | ||
165 | + }, | ||
166 | + readFileSync: useReadPackage ? null : function (file) { | ||
167 | + return files[path.resolve(file)]; | ||
168 | + }, | ||
169 | + realpathSync: function (file) { | ||
170 | + return file; | ||
171 | + } | ||
172 | + }; | ||
173 | + } | ||
174 | + t.test('with readFile', function (st) { | ||
175 | + st.plan(1); | ||
176 | + | ||
177 | + st.equal( | ||
178 | + resolve.sync('bar', opts('/foo')), | ||
179 | + path.resolve('/foo/node_modules/bar/baz.js') | ||
180 | + ); | ||
181 | + }); | ||
182 | + | ||
183 | + var readPackageSync = function (readFileSync, file) { | ||
184 | + if (file.indexOf(path.join('bar', 'package.json')) >= 0) { | ||
185 | + return { main: './something-else.js' }; | ||
186 | + } else { | ||
187 | + return JSON.parse(files[path.resolve(file)]); | ||
188 | + } | ||
189 | + }; | ||
190 | + | ||
191 | + t.test('with readPackage', function (st) { | ||
192 | + st.plan(1); | ||
193 | + | ||
194 | + var options = opts('/foo'); | ||
195 | + delete options.readFileSync; | ||
196 | + options.readPackageSync = readPackageSync; | ||
197 | + | ||
198 | + st.equal( | ||
199 | + resolve.sync('bar', options), | ||
200 | + path.resolve('/foo/node_modules/bar/something-else.js') | ||
201 | + ); | ||
202 | + }); | ||
203 | + | ||
204 | + t.test('with readFile and readPackage', function (st) { | ||
205 | + st.plan(1); | ||
206 | + | ||
207 | + var options = opts('/foo'); | ||
208 | + options.readPackageSync = readPackageSync; | ||
209 | + st.throws( | ||
210 | + function () { resolve.sync('bar', options); }, | ||
211 | + TypeError, | ||
212 | + 'errors when both readFile and readPackage are provided' | ||
213 | + ); | ||
214 | + }); | ||
215 | +}); | ||
216 | + |
1 | +var path = require('path'); | ||
2 | +var test = require('tape'); | ||
3 | +var resolve = require('../'); | ||
4 | + | ||
5 | +test('moduleDirectory strings', function (t) { | ||
6 | + t.plan(4); | ||
7 | + var dir = path.join(__dirname, 'module_dir'); | ||
8 | + var xopts = { | ||
9 | + basedir: dir, | ||
10 | + moduleDirectory: 'xmodules' | ||
11 | + }; | ||
12 | + resolve('aaa', xopts, function (err, res, pkg) { | ||
13 | + t.ifError(err); | ||
14 | + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); | ||
15 | + }); | ||
16 | + | ||
17 | + var yopts = { | ||
18 | + basedir: dir, | ||
19 | + moduleDirectory: 'ymodules' | ||
20 | + }; | ||
21 | + resolve('aaa', yopts, function (err, res, pkg) { | ||
22 | + t.ifError(err); | ||
23 | + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); | ||
24 | + }); | ||
25 | +}); | ||
26 | + | ||
27 | +test('moduleDirectory array', function (t) { | ||
28 | + t.plan(6); | ||
29 | + var dir = path.join(__dirname, 'module_dir'); | ||
30 | + var aopts = { | ||
31 | + basedir: dir, | ||
32 | + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] | ||
33 | + }; | ||
34 | + resolve('aaa', aopts, function (err, res, pkg) { | ||
35 | + t.ifError(err); | ||
36 | + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); | ||
37 | + }); | ||
38 | + | ||
39 | + var bopts = { | ||
40 | + basedir: dir, | ||
41 | + moduleDirectory: ['zmodules', 'ymodules', 'xmodules'] | ||
42 | + }; | ||
43 | + resolve('aaa', bopts, function (err, res, pkg) { | ||
44 | + t.ifError(err); | ||
45 | + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); | ||
46 | + }); | ||
47 | + | ||
48 | + var copts = { | ||
49 | + basedir: dir, | ||
50 | + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] | ||
51 | + }; | ||
52 | + resolve('bbb', copts, function (err, res, pkg) { | ||
53 | + t.ifError(err); | ||
54 | + t.equal(res, path.join(dir, '/zmodules/bbb/main.js')); | ||
55 | + }); | ||
56 | +}); |
1 | +module.exports = function (x) { return x * 100; }; |
1 | +module.exports = function (x) { return x + 100; }; |
1 | +module.exports = function (n) { return n * 111; }; |
1 | +var test = require('tape'); | ||
2 | +var path = require('path'); | ||
3 | +var parse = path.parse || require('path-parse'); | ||
4 | +var keys = require('object-keys'); | ||
5 | + | ||
6 | +var nodeModulesPaths = require('../lib/node-modules-paths'); | ||
7 | + | ||
8 | +var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) { | ||
9 | + var moduleDirs = [].concat(moduleDirectories || 'node_modules'); | ||
10 | + if (paths) { | ||
11 | + for (var k = 0; k < paths.length; ++k) { | ||
12 | + moduleDirs.push(path.basename(paths[k])); | ||
13 | + } | ||
14 | + } | ||
15 | + | ||
16 | + var foundModuleDirs = {}; | ||
17 | + var uniqueDirs = {}; | ||
18 | + var parsedDirs = {}; | ||
19 | + for (var i = 0; i < dirs.length; ++i) { | ||
20 | + var parsed = parse(dirs[i]); | ||
21 | + if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; } | ||
22 | + foundModuleDirs[parsed.base] += 1; | ||
23 | + parsedDirs[parsed.dir] = true; | ||
24 | + uniqueDirs[dirs[i]] = true; | ||
25 | + } | ||
26 | + t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has'); | ||
27 | + var foundModuleDirNames = keys(foundModuleDirs); | ||
28 | + t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found'); | ||
29 | + t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique'); | ||
30 | + | ||
31 | + var counts = {}; | ||
32 | + for (var j = 0; j < foundModuleDirNames.length; ++j) { | ||
33 | + counts[foundModuleDirs[j]] = true; | ||
34 | + } | ||
35 | + t.equal(keys(counts).length, 1, 'all found module directories had the same count'); | ||
36 | +}; | ||
37 | + | ||
38 | +test('node-modules-paths', function (t) { | ||
39 | + t.test('no options', function (t) { | ||
40 | + var start = path.join(__dirname, 'resolver'); | ||
41 | + var dirs = nodeModulesPaths(start); | ||
42 | + | ||
43 | + verifyDirs(t, start, dirs); | ||
44 | + | ||
45 | + t.end(); | ||
46 | + }); | ||
47 | + | ||
48 | + t.test('empty options', function (t) { | ||
49 | + var start = path.join(__dirname, 'resolver'); | ||
50 | + var dirs = nodeModulesPaths(start, {}); | ||
51 | + | ||
52 | + verifyDirs(t, start, dirs); | ||
53 | + | ||
54 | + t.end(); | ||
55 | + }); | ||
56 | + | ||
57 | + t.test('with paths=array option', function (t) { | ||
58 | + var start = path.join(__dirname, 'resolver'); | ||
59 | + var paths = ['a', 'b']; | ||
60 | + var dirs = nodeModulesPaths(start, { paths: paths }); | ||
61 | + | ||
62 | + verifyDirs(t, start, dirs, null, paths); | ||
63 | + | ||
64 | + t.end(); | ||
65 | + }); | ||
66 | + | ||
67 | + t.test('with paths=function option', function (t) { | ||
68 | + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { | ||
69 | + return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request)); | ||
70 | + }; | ||
71 | + | ||
72 | + var start = path.join(__dirname, 'resolver'); | ||
73 | + var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg'); | ||
74 | + | ||
75 | + verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]); | ||
76 | + | ||
77 | + t.end(); | ||
78 | + }); | ||
79 | + | ||
80 | + t.test('with paths=function skipping node modules resolution', function (t) { | ||
81 | + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { | ||
82 | + return []; | ||
83 | + }; | ||
84 | + var start = path.join(__dirname, 'resolver'); | ||
85 | + var dirs = nodeModulesPaths(start, { paths: paths }); | ||
86 | + t.deepEqual(dirs, [], 'no node_modules was computed'); | ||
87 | + t.end(); | ||
88 | + }); | ||
89 | + | ||
90 | + t.test('with moduleDirectory option', function (t) { | ||
91 | + var start = path.join(__dirname, 'resolver'); | ||
92 | + var moduleDirectory = 'not node modules'; | ||
93 | + var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory }); | ||
94 | + | ||
95 | + verifyDirs(t, start, dirs, moduleDirectory); | ||
96 | + | ||
97 | + t.end(); | ||
98 | + }); | ||
99 | + | ||
100 | + t.test('with 1 moduleDirectory and paths options', function (t) { | ||
101 | + var start = path.join(__dirname, 'resolver'); | ||
102 | + var paths = ['a', 'b']; | ||
103 | + var moduleDirectory = 'not node modules'; | ||
104 | + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory }); | ||
105 | + | ||
106 | + verifyDirs(t, start, dirs, moduleDirectory, paths); | ||
107 | + | ||
108 | + t.end(); | ||
109 | + }); | ||
110 | + | ||
111 | + t.test('with 1+ moduleDirectory and paths options', function (t) { | ||
112 | + var start = path.join(__dirname, 'resolver'); | ||
113 | + var paths = ['a', 'b']; | ||
114 | + var moduleDirectories = ['not node modules', 'other modules']; | ||
115 | + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); | ||
116 | + | ||
117 | + verifyDirs(t, start, dirs, moduleDirectories, paths); | ||
118 | + | ||
119 | + t.end(); | ||
120 | + }); | ||
121 | + | ||
122 | + t.test('combine paths correctly on Windows', function (t) { | ||
123 | + var start = 'C:\\Users\\username\\myProject\\src'; | ||
124 | + var paths = []; | ||
125 | + var moduleDirectories = ['node_modules', start]; | ||
126 | + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); | ||
127 | + | ||
128 | + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); | ||
129 | + | ||
130 | + t.end(); | ||
131 | + }); | ||
132 | + | ||
133 | + t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) { | ||
134 | + var start = '/Users/username/git/myProject/src'; | ||
135 | + var paths = []; | ||
136 | + var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src']; | ||
137 | + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); | ||
138 | + | ||
139 | + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); | ||
140 | + | ||
141 | + t.end(); | ||
142 | + }); | ||
143 | +}); |
1 | +var fs = require('fs'); | ||
2 | +var path = require('path'); | ||
3 | +var test = require('tape'); | ||
4 | +var resolve = require('../'); | ||
5 | + | ||
6 | +test('$NODE_PATH', function (t) { | ||
7 | + t.plan(8); | ||
8 | + | ||
9 | + var isDir = function (dir, cb) { | ||
10 | + if (dir === '/node_path' || dir === 'node_path/x') { | ||
11 | + return cb(null, true); | ||
12 | + } | ||
13 | + fs.stat(dir, function (err, stat) { | ||
14 | + if (!err) { | ||
15 | + return cb(null, stat.isDirectory()); | ||
16 | + } | ||
17 | + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); | ||
18 | + return cb(err); | ||
19 | + }); | ||
20 | + }; | ||
21 | + | ||
22 | + resolve('aaa', { | ||
23 | + paths: [ | ||
24 | + path.join(__dirname, '/node_path/x'), | ||
25 | + path.join(__dirname, '/node_path/y') | ||
26 | + ], | ||
27 | + basedir: __dirname, | ||
28 | + isDirectory: isDir | ||
29 | + }, function (err, res) { | ||
30 | + t.error(err); | ||
31 | + t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves'); | ||
32 | + }); | ||
33 | + | ||
34 | + resolve('bbb', { | ||
35 | + paths: [ | ||
36 | + path.join(__dirname, '/node_path/x'), | ||
37 | + path.join(__dirname, '/node_path/y') | ||
38 | + ], | ||
39 | + basedir: __dirname, | ||
40 | + isDirectory: isDir | ||
41 | + }, function (err, res) { | ||
42 | + t.error(err); | ||
43 | + t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves'); | ||
44 | + }); | ||
45 | + | ||
46 | + resolve('ccc', { | ||
47 | + paths: [ | ||
48 | + path.join(__dirname, '/node_path/x'), | ||
49 | + path.join(__dirname, '/node_path/y') | ||
50 | + ], | ||
51 | + basedir: __dirname, | ||
52 | + isDirectory: isDir | ||
53 | + }, function (err, res) { | ||
54 | + t.error(err); | ||
55 | + t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves'); | ||
56 | + }); | ||
57 | + | ||
58 | + // ensure that relative paths still resolve against the regular `node_modules` correctly | ||
59 | + resolve('tap', { | ||
60 | + paths: [ | ||
61 | + 'node_path' | ||
62 | + ], | ||
63 | + basedir: path.join(__dirname, 'node_path/x'), | ||
64 | + isDirectory: isDir | ||
65 | + }, function (err, res) { | ||
66 | + var root = require('tap/package.json').main; | ||
67 | + t.error(err); | ||
68 | + t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves'); | ||
69 | + }); | ||
70 | +}); |
1 | +module.exports = 'A'; |
1 | +module.exports = 'C'; |
1 | +module.exports = 'B'; |
1 | +module.exports = 'CY'; |
1 | +var path = require('path'); | ||
2 | +var test = require('tape'); | ||
3 | +var resolve = require('../'); | ||
4 | + | ||
5 | +var resolverDir = path.join(__dirname, '/pathfilter/deep_ref'); | ||
6 | + | ||
7 | +var pathFilterFactory = function (t) { | ||
8 | + return function (pkg, x, remainder) { | ||
9 | + t.equal(pkg.version, '1.2.3'); | ||
10 | + t.equal(x, path.join(resolverDir, 'node_modules/deep/ref')); | ||
11 | + t.equal(remainder, 'ref'); | ||
12 | + return 'alt'; | ||
13 | + }; | ||
14 | +}; | ||
15 | + | ||
16 | +test('#62: deep module references and the pathFilter', function (t) { | ||
17 | + t.test('deep/ref.js', function (st) { | ||
18 | + st.plan(3); | ||
19 | + | ||
20 | + resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) { | ||
21 | + if (err) st.fail(err); | ||
22 | + | ||
23 | + st.equal(pkg.version, '1.2.3'); | ||
24 | + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); | ||
25 | + }); | ||
26 | + | ||
27 | + var res = resolve.sync('deep/ref', { basedir: resolverDir }); | ||
28 | + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); | ||
29 | + }); | ||
30 | + | ||
31 | + t.test('deep/deeper/ref', function (st) { | ||
32 | + st.plan(4); | ||
33 | + | ||
34 | + resolve( | ||
35 | + 'deep/deeper/ref', | ||
36 | + { basedir: resolverDir }, | ||
37 | + function (err, res, pkg) { | ||
38 | + if (err) t.fail(err); | ||
39 | + st.notEqual(pkg, undefined); | ||
40 | + st.equal(pkg.version, '1.2.3'); | ||
41 | + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); | ||
42 | + } | ||
43 | + ); | ||
44 | + | ||
45 | + var res = resolve.sync( | ||
46 | + 'deep/deeper/ref', | ||
47 | + { basedir: resolverDir } | ||
48 | + ); | ||
49 | + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); | ||
50 | + }); | ||
51 | + | ||
52 | + t.test('deep/ref alt', function (st) { | ||
53 | + st.plan(8); | ||
54 | + | ||
55 | + var pathFilter = pathFilterFactory(st); | ||
56 | + | ||
57 | + var res = resolve.sync( | ||
58 | + 'deep/ref', | ||
59 | + { basedir: resolverDir, pathFilter: pathFilter } | ||
60 | + ); | ||
61 | + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); | ||
62 | + | ||
63 | + resolve( | ||
64 | + 'deep/ref', | ||
65 | + { basedir: resolverDir, pathFilter: pathFilter }, | ||
66 | + function (err, res, pkg) { | ||
67 | + if (err) st.fail(err); | ||
68 | + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); | ||
69 | + st.end(); | ||
70 | + } | ||
71 | + ); | ||
72 | + }); | ||
73 | + | ||
74 | + t.end(); | ||
75 | +}); |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
server/node_modules/resolve/test/resolver.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
server/node_modules/resolve/test/subdirs.js
0 → 100644
This diff is collapsed. Click to expand it.
server/node_modules/resolve/test/symlinks.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment