typespeed 2.3.6 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/app/src/config-development.json +3 -2
  2. package/app/src/test-socket.class.ts +56 -0
  3. package/app/src/views/socket.html +23 -0
  4. package/dist/introduction/decorator/example-import.class.js +17 -0
  5. package/dist/introduction/decorator/main-app.js +14 -0
  6. package/dist/introduction/decorator/main-decorator.js +127 -0
  7. package/dist/introduction/decorator/main-import.js +1 -0
  8. package/dist/introduction/decorator/main-reflect.js +38 -0
  9. package/dist/introduction/web-services/db-init.js +33 -0
  10. package/dist/introduction/web-services/db-singleton.js +49 -0
  11. package/dist/introduction/web-services/http-if.js +12 -0
  12. package/dist/introduction/web-services/http-init.js +7 -0
  13. package/dist/introduction/web-services/http-router.js +23 -0
  14. package/dist/{database.decorator.js → src/database.decorator.js} +2 -4
  15. package/dist/{default → src/default}/express-server.class.js +20 -5
  16. package/dist/{default → src/default}/rabbitmq.class.js +3 -3
  17. package/dist/{default → src/default}/redis.class.js +1 -1
  18. package/dist/src/default/socket-io.class.js +64 -0
  19. package/dist/{typespeed.js → src/typespeed.js} +6 -3
  20. package/dist/typespeed.d.ts +19 -1
  21. package/package.json +8 -8
  22. package/src/database.decorator.ts +2 -4
  23. package/src/default/express-server.class.ts +18 -7
  24. package/src/default/rabbitmq.class.ts +3 -3
  25. package/src/default/redis.class.ts +1 -1
  26. package/src/default/socket-io.class.ts +68 -0
  27. package/src/factory/server-factory.class.ts +1 -1
  28. package/src/typespeed.d.ts +19 -1
  29. package/src/typespeed.ts +7 -4
  30. package/test/socket.test.ts +60 -0
  31. package/tsconfig.json +2 -1
  32. package/app/node_modules/.package-lock.json +0 -134
  33. package/app/node_modules/@types/body-parser/LICENSE +0 -21
  34. package/app/node_modules/@types/body-parser/README.md +0 -16
  35. package/app/node_modules/@types/body-parser/index.d.ts +0 -107
  36. package/app/node_modules/@types/body-parser/package.json +0 -58
  37. package/app/node_modules/@types/connect/LICENSE +0 -21
  38. package/app/node_modules/@types/connect/README.md +0 -16
  39. package/app/node_modules/@types/connect/index.d.ts +0 -93
  40. package/app/node_modules/@types/connect/package.json +0 -32
  41. package/app/node_modules/@types/express/LICENSE +0 -21
  42. package/app/node_modules/@types/express/README.md +0 -16
  43. package/app/node_modules/@types/express/index.d.ts +0 -136
  44. package/app/node_modules/@types/express/package.json +0 -45
  45. package/app/node_modules/@types/express-serve-static-core/LICENSE +0 -21
  46. package/app/node_modules/@types/express-serve-static-core/README.md +0 -16
  47. package/app/node_modules/@types/express-serve-static-core/index.d.ts +0 -1281
  48. package/app/node_modules/@types/express-serve-static-core/package.json +0 -55
  49. package/app/node_modules/@types/mime/LICENSE +0 -21
  50. package/app/node_modules/@types/mime/Mime.d.ts +0 -10
  51. package/app/node_modules/@types/mime/README.md +0 -16
  52. package/app/node_modules/@types/mime/index.d.ts +0 -35
  53. package/app/node_modules/@types/mime/lite.d.ts +0 -7
  54. package/app/node_modules/@types/mime/package.json +0 -29
  55. package/app/node_modules/@types/node/LICENSE +0 -21
  56. package/app/node_modules/@types/node/README.md +0 -16
  57. package/app/node_modules/@types/node/assert/strict.d.ts +0 -8
  58. package/app/node_modules/@types/node/assert.d.ts +0 -961
  59. package/app/node_modules/@types/node/async_hooks.d.ts +0 -518
  60. package/app/node_modules/@types/node/buffer.d.ts +0 -2323
  61. package/app/node_modules/@types/node/child_process.d.ts +0 -1399
  62. package/app/node_modules/@types/node/cluster.d.ts +0 -410
  63. package/app/node_modules/@types/node/console.d.ts +0 -412
  64. package/app/node_modules/@types/node/constants.d.ts +0 -18
  65. package/app/node_modules/@types/node/crypto.d.ts +0 -3973
  66. package/app/node_modules/@types/node/dgram.d.ts +0 -545
  67. package/app/node_modules/@types/node/diagnostics_channel.d.ts +0 -192
  68. package/app/node_modules/@types/node/dns/promises.d.ts +0 -370
  69. package/app/node_modules/@types/node/dns.d.ts +0 -660
  70. package/app/node_modules/@types/node/dom-events.d.ts +0 -126
  71. package/app/node_modules/@types/node/domain.d.ts +0 -170
  72. package/app/node_modules/@types/node/events.d.ts +0 -682
  73. package/app/node_modules/@types/node/fs/promises.d.ts +0 -1159
  74. package/app/node_modules/@types/node/fs.d.ts +0 -3976
  75. package/app/node_modules/@types/node/globals.d.ts +0 -303
  76. package/app/node_modules/@types/node/globals.global.d.ts +0 -1
  77. package/app/node_modules/@types/node/http.d.ts +0 -1714
  78. package/app/node_modules/@types/node/http2.d.ts +0 -2133
  79. package/app/node_modules/@types/node/https.d.ts +0 -542
  80. package/app/node_modules/@types/node/index.d.ts +0 -134
  81. package/app/node_modules/@types/node/inspector.d.ts +0 -2741
  82. package/app/node_modules/@types/node/module.d.ts +0 -115
  83. package/app/node_modules/@types/node/net.d.ts +0 -883
  84. package/app/node_modules/@types/node/os.d.ts +0 -473
  85. package/app/node_modules/@types/node/package.json +0 -237
  86. package/app/node_modules/@types/node/path.d.ts +0 -191
  87. package/app/node_modules/@types/node/perf_hooks.d.ts +0 -625
  88. package/app/node_modules/@types/node/process.d.ts +0 -1488
  89. package/app/node_modules/@types/node/punycode.d.ts +0 -117
  90. package/app/node_modules/@types/node/querystring.d.ts +0 -131
  91. package/app/node_modules/@types/node/readline/promises.d.ts +0 -143
  92. package/app/node_modules/@types/node/readline.d.ts +0 -653
  93. package/app/node_modules/@types/node/repl.d.ts +0 -424
  94. package/app/node_modules/@types/node/stream/consumers.d.ts +0 -12
  95. package/app/node_modules/@types/node/stream/promises.d.ts +0 -42
  96. package/app/node_modules/@types/node/stream/web.d.ts +0 -330
  97. package/app/node_modules/@types/node/stream.d.ts +0 -1440
  98. package/app/node_modules/@types/node/string_decoder.d.ts +0 -67
  99. package/app/node_modules/@types/node/test.d.ts +0 -783
  100. package/app/node_modules/@types/node/timers/promises.d.ts +0 -93
  101. package/app/node_modules/@types/node/timers.d.ts +0 -101
  102. package/app/node_modules/@types/node/tls.d.ts +0 -1111
  103. package/app/node_modules/@types/node/trace_events.d.ts +0 -171
  104. package/app/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  105. package/app/node_modules/@types/node/ts4.8/assert.d.ts +0 -961
  106. package/app/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -518
  107. package/app/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2323
  108. package/app/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1399
  109. package/app/node_modules/@types/node/ts4.8/cluster.d.ts +0 -410
  110. package/app/node_modules/@types/node/ts4.8/console.d.ts +0 -412
  111. package/app/node_modules/@types/node/ts4.8/constants.d.ts +0 -18
  112. package/app/node_modules/@types/node/ts4.8/crypto.d.ts +0 -3972
  113. package/app/node_modules/@types/node/ts4.8/dgram.d.ts +0 -545
  114. package/app/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -192
  115. package/app/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -370
  116. package/app/node_modules/@types/node/ts4.8/dns.d.ts +0 -660
  117. package/app/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -126
  118. package/app/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  119. package/app/node_modules/@types/node/ts4.8/events.d.ts +0 -682
  120. package/app/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1138
  121. package/app/node_modules/@types/node/ts4.8/fs.d.ts +0 -3875
  122. package/app/node_modules/@types/node/ts4.8/globals.d.ts +0 -302
  123. package/app/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  124. package/app/node_modules/@types/node/ts4.8/http.d.ts +0 -1651
  125. package/app/node_modules/@types/node/ts4.8/http2.d.ts +0 -2133
  126. package/app/node_modules/@types/node/ts4.8/https.d.ts +0 -542
  127. package/app/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  128. package/app/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2741
  129. package/app/node_modules/@types/node/ts4.8/module.d.ts +0 -115
  130. package/app/node_modules/@types/node/ts4.8/net.d.ts +0 -883
  131. package/app/node_modules/@types/node/ts4.8/os.d.ts +0 -473
  132. package/app/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  133. package/app/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -625
  134. package/app/node_modules/@types/node/ts4.8/process.d.ts +0 -1488
  135. package/app/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  136. package/app/node_modules/@types/node/ts4.8/querystring.d.ts +0 -131
  137. package/app/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -143
  138. package/app/node_modules/@types/node/ts4.8/readline.d.ts +0 -653
  139. package/app/node_modules/@types/node/ts4.8/repl.d.ts +0 -424
  140. package/app/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  141. package/app/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -42
  142. package/app/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -330
  143. package/app/node_modules/@types/node/ts4.8/stream.d.ts +0 -1440
  144. package/app/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  145. package/app/node_modules/@types/node/ts4.8/test.d.ts +0 -784
  146. package/app/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  147. package/app/node_modules/@types/node/ts4.8/timers.d.ts +0 -94
  148. package/app/node_modules/@types/node/ts4.8/tls.d.ts +0 -1111
  149. package/app/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -171
  150. package/app/node_modules/@types/node/ts4.8/tty.d.ts +0 -206
  151. package/app/node_modules/@types/node/ts4.8/url.d.ts +0 -902
  152. package/app/node_modules/@types/node/ts4.8/util.d.ts +0 -2017
  153. package/app/node_modules/@types/node/ts4.8/v8.d.ts +0 -541
  154. package/app/node_modules/@types/node/ts4.8/vm.d.ts +0 -644
  155. package/app/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  156. package/app/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -695
  157. package/app/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  158. package/app/node_modules/@types/node/tty.d.ts +0 -206
  159. package/app/node_modules/@types/node/url.d.ts +0 -902
  160. package/app/node_modules/@types/node/util.d.ts +0 -2017
  161. package/app/node_modules/@types/node/v8.d.ts +0 -541
  162. package/app/node_modules/@types/node/vm.d.ts +0 -644
  163. package/app/node_modules/@types/node/wasi.d.ts +0 -158
  164. package/app/node_modules/@types/node/worker_threads.d.ts +0 -695
  165. package/app/node_modules/@types/node/zlib.d.ts +0 -517
  166. package/app/node_modules/@types/qs/LICENSE +0 -21
  167. package/app/node_modules/@types/qs/README.md +0 -16
  168. package/app/node_modules/@types/qs/index.d.ts +0 -62
  169. package/app/node_modules/@types/qs/package.json +0 -65
  170. package/app/node_modules/@types/range-parser/LICENSE +0 -21
  171. package/app/node_modules/@types/range-parser/README.md +0 -55
  172. package/app/node_modules/@types/range-parser/index.d.ts +0 -35
  173. package/app/node_modules/@types/range-parser/package.json +0 -25
  174. package/app/node_modules/@types/send/LICENSE +0 -21
  175. package/app/node_modules/@types/send/README.md +0 -16
  176. package/app/node_modules/@types/send/index.d.ts +0 -231
  177. package/app/node_modules/@types/send/package.json +0 -33
  178. package/app/node_modules/@types/serve-static/LICENSE +0 -21
  179. package/app/node_modules/@types/serve-static/README.md +0 -16
  180. package/app/node_modules/@types/serve-static/index.d.ts +0 -113
  181. package/app/node_modules/@types/serve-static/package.json +0 -38
  182. package/app/node_modules/colors/LICENSE +0 -25
  183. package/app/node_modules/colors/README.md +0 -221
  184. package/app/node_modules/colors/examples/normal-usage.js +0 -82
  185. package/app/node_modules/colors/examples/safe-string.js +0 -79
  186. package/app/node_modules/colors/index.d.ts +0 -136
  187. package/app/node_modules/colors/lib/colors.js +0 -211
  188. package/app/node_modules/colors/lib/custom/trap.js +0 -46
  189. package/app/node_modules/colors/lib/custom/zalgo.js +0 -110
  190. package/app/node_modules/colors/lib/extendStringPrototype.js +0 -110
  191. package/app/node_modules/colors/lib/index.js +0 -13
  192. package/app/node_modules/colors/lib/maps/america.js +0 -10
  193. package/app/node_modules/colors/lib/maps/rainbow.js +0 -12
  194. package/app/node_modules/colors/lib/maps/random.js +0 -11
  195. package/app/node_modules/colors/lib/maps/zebra.js +0 -5
  196. package/app/node_modules/colors/lib/styles.js +0 -95
  197. package/app/node_modules/colors/lib/system/has-flag.js +0 -35
  198. package/app/node_modules/colors/lib/system/supports-colors.js +0 -151
  199. package/app/node_modules/colors/package.json +0 -45
  200. package/app/node_modules/colors/safe.d.ts +0 -48
  201. package/app/node_modules/colors/safe.js +0 -10
  202. package/app/node_modules/colors/themes/generic-logging.js +0 -12
  203. package/app/node_modules/dateformat/LICENSE +0 -20
  204. package/app/node_modules/dateformat/Readme.md +0 -204
  205. package/app/node_modules/dateformat/lib/dateformat.js +0 -1
  206. package/app/node_modules/dateformat/package.json +0 -38
  207. package/app/node_modules/mkdirp/CHANGELOG.md +0 -15
  208. package/app/node_modules/mkdirp/LICENSE +0 -21
  209. package/app/node_modules/mkdirp/bin/cmd.js +0 -68
  210. package/app/node_modules/mkdirp/index.js +0 -31
  211. package/app/node_modules/mkdirp/lib/find-made.js +0 -29
  212. package/app/node_modules/mkdirp/lib/mkdirp-manual.js +0 -64
  213. package/app/node_modules/mkdirp/lib/mkdirp-native.js +0 -39
  214. package/app/node_modules/mkdirp/lib/opts-arg.js +0 -23
  215. package/app/node_modules/mkdirp/lib/path-arg.js +0 -29
  216. package/app/node_modules/mkdirp/lib/use-native.js +0 -10
  217. package/app/node_modules/mkdirp/package.json +0 -44
  218. package/app/node_modules/mkdirp/readme.markdown +0 -266
  219. package/app/node_modules/tinytim/.travis.yml +0 -5
  220. package/app/node_modules/tinytim/README.md +0 -212
  221. package/app/node_modules/tinytim/index.js +0 -1
  222. package/app/node_modules/tinytim/lib/index.js +0 -55
  223. package/app/node_modules/tinytim/lib/tinytim.js +0 -50
  224. package/app/node_modules/tinytim/package.json +0 -24
  225. package/app/node_modules/tinytim/test/files/html.tim +0 -1
  226. package/app/node_modules/tinytim/test/files/string.tim +0 -1
  227. package/app/node_modules/tinytim/test/files/string2.tim +0 -1
  228. package/app/node_modules/tinytim/test/render-file-replace.js +0 -39
  229. package/app/node_modules/tinytim/test/render-replace.js +0 -94
  230. package/app/node_modules/tinytim/test/tim-replace.js +0 -95
  231. package/app/node_modules/tracer/README.md +0 -747
  232. package/app/node_modules/tracer/lib/color_console.js +0 -15
  233. package/app/node_modules/tracer/lib/console.js +0 -165
  234. package/app/node_modules/tracer/lib/dailyfile.js +0 -92
  235. package/app/node_modules/tracer/lib/index.js +0 -10
  236. package/app/node_modules/tracer/lib/settings.js +0 -25
  237. package/app/node_modules/tracer/lib/utils.js +0 -58
  238. package/app/node_modules/tracer/package.json +0 -53
  239. package/app/node_modules/tracer/types/index.d.ts +0 -189
  240. package/dist/scaffold/templates/front-page.class.ts.tpl +0 -12
  241. package/dist/scaffold/templates/main.ts.tpl +0 -13
  242. package/dist/scaffold/templates/nodemon.json.tpl +0 -7
  243. package/dist/scaffold/templates/package.json.tpl +0 -16
  244. package/dist/scaffold/templates/tsconfig.json.tpl +0 -20
  245. /package/dist/{core.decorator.js → src/core.decorator.js} +0 -0
  246. /package/dist/{default → src/default}/default-authentication.class.js +0 -0
  247. /package/dist/{default → src/default}/log-default.class.js +0 -0
  248. /package/dist/{default → src/default}/node-cache.class.js +0 -0
  249. /package/dist/{default → src/default}/pages/404.html +0 -0
  250. /package/dist/{default → src/default}/pages/500.html +0 -0
  251. /package/dist/{default → src/default}/read-write-db.class.js +0 -0
  252. /package/dist/{factory → src/factory}/authentication-factory.class.js +0 -0
  253. /package/dist/{factory → src/factory}/cache-factory.class.js +0 -0
  254. /package/dist/{factory → src/factory}/data-source-factory.class.js +0 -0
  255. /package/dist/{factory → src/factory}/log-factory.class.js +0 -0
  256. /package/dist/{factory → src/factory}/server-factory.class.js +0 -0
  257. /package/dist/{route.decorator.js → src/route.decorator.js} +0 -0
  258. /package/dist/{scaffold → src/scaffold}/command.js +0 -0
@@ -1,211 +0,0 @@
1
- /*
2
-
3
- The MIT License (MIT)
4
-
5
- Original Library
6
- - Copyright (c) Marak Squires
7
-
8
- Additional functionality
9
- - Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in
19
- all copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
- THE SOFTWARE.
28
-
29
- */
30
-
31
- var colors = {};
32
- module['exports'] = colors;
33
-
34
- colors.themes = {};
35
-
36
- var util = require('util');
37
- var ansiStyles = colors.styles = require('./styles');
38
- var defineProps = Object.defineProperties;
39
- var newLineRegex = new RegExp(/[\r\n]+/g);
40
-
41
- colors.supportsColor = require('./system/supports-colors').supportsColor;
42
-
43
- if (typeof colors.enabled === 'undefined') {
44
- colors.enabled = colors.supportsColor() !== false;
45
- }
46
-
47
- colors.enable = function() {
48
- colors.enabled = true;
49
- };
50
-
51
- colors.disable = function() {
52
- colors.enabled = false;
53
- };
54
-
55
- colors.stripColors = colors.strip = function(str) {
56
- return ('' + str).replace(/\x1B\[\d+m/g, '');
57
- };
58
-
59
- // eslint-disable-next-line no-unused-vars
60
- var stylize = colors.stylize = function stylize(str, style) {
61
- if (!colors.enabled) {
62
- return str+'';
63
- }
64
-
65
- var styleMap = ansiStyles[style];
66
-
67
- // Stylize should work for non-ANSI styles, too
68
- if(!styleMap && style in colors){
69
- // Style maps like trap operate as functions on strings;
70
- // they don't have properties like open or close.
71
- return colors[style](str);
72
- }
73
-
74
- return styleMap.open + str + styleMap.close;
75
- };
76
-
77
- var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
78
- var escapeStringRegexp = function(str) {
79
- if (typeof str !== 'string') {
80
- throw new TypeError('Expected a string');
81
- }
82
- return str.replace(matchOperatorsRe, '\\$&');
83
- };
84
-
85
- function build(_styles) {
86
- var builder = function builder() {
87
- return applyStyle.apply(builder, arguments);
88
- };
89
- builder._styles = _styles;
90
- // __proto__ is used because we must return a function, but there is
91
- // no way to create a function with a different prototype.
92
- builder.__proto__ = proto;
93
- return builder;
94
- }
95
-
96
- var styles = (function() {
97
- var ret = {};
98
- ansiStyles.grey = ansiStyles.gray;
99
- Object.keys(ansiStyles).forEach(function(key) {
100
- ansiStyles[key].closeRe =
101
- new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
102
- ret[key] = {
103
- get: function() {
104
- return build(this._styles.concat(key));
105
- },
106
- };
107
- });
108
- return ret;
109
- })();
110
-
111
- var proto = defineProps(function colors() {}, styles);
112
-
113
- function applyStyle() {
114
- var args = Array.prototype.slice.call(arguments);
115
-
116
- var str = args.map(function(arg) {
117
- // Use weak equality check so we can colorize null/undefined in safe mode
118
- if (arg != null && arg.constructor === String) {
119
- return arg;
120
- } else {
121
- return util.inspect(arg);
122
- }
123
- }).join(' ');
124
-
125
- if (!colors.enabled || !str) {
126
- return str;
127
- }
128
-
129
- var newLinesPresent = str.indexOf('\n') != -1;
130
-
131
- var nestedStyles = this._styles;
132
-
133
- var i = nestedStyles.length;
134
- while (i--) {
135
- var code = ansiStyles[nestedStyles[i]];
136
- str = code.open + str.replace(code.closeRe, code.open) + code.close;
137
- if (newLinesPresent) {
138
- str = str.replace(newLineRegex, function(match) {
139
- return code.close + match + code.open;
140
- });
141
- }
142
- }
143
-
144
- return str;
145
- }
146
-
147
- colors.setTheme = function(theme) {
148
- if (typeof theme === 'string') {
149
- console.log('colors.setTheme now only accepts an object, not a string. ' +
150
- 'If you are trying to set a theme from a file, it is now your (the ' +
151
- 'caller\'s) responsibility to require the file. The old syntax ' +
152
- 'looked like colors.setTheme(__dirname + ' +
153
- '\'/../themes/generic-logging.js\'); The new syntax looks like '+
154
- 'colors.setTheme(require(__dirname + ' +
155
- '\'/../themes/generic-logging.js\'));');
156
- return;
157
- }
158
- for (var style in theme) {
159
- (function(style) {
160
- colors[style] = function(str) {
161
- if (typeof theme[style] === 'object') {
162
- var out = str;
163
- for (var i in theme[style]) {
164
- out = colors[theme[style][i]](out);
165
- }
166
- return out;
167
- }
168
- return colors[theme[style]](str);
169
- };
170
- })(style);
171
- }
172
- };
173
-
174
- function init() {
175
- var ret = {};
176
- Object.keys(styles).forEach(function(name) {
177
- ret[name] = {
178
- get: function() {
179
- return build([name]);
180
- },
181
- };
182
- });
183
- return ret;
184
- }
185
-
186
- var sequencer = function sequencer(map, str) {
187
- var exploded = str.split('');
188
- exploded = exploded.map(map);
189
- return exploded.join('');
190
- };
191
-
192
- // custom formatter methods
193
- colors.trap = require('./custom/trap');
194
- colors.zalgo = require('./custom/zalgo');
195
-
196
- // maps
197
- colors.maps = {};
198
- colors.maps.america = require('./maps/america')(colors);
199
- colors.maps.zebra = require('./maps/zebra')(colors);
200
- colors.maps.rainbow = require('./maps/rainbow')(colors);
201
- colors.maps.random = require('./maps/random')(colors);
202
-
203
- for (var map in colors.maps) {
204
- (function(map) {
205
- colors[map] = function(str) {
206
- return sequencer(colors.maps[map], str);
207
- };
208
- })(map);
209
- }
210
-
211
- defineProps(colors, init());
@@ -1,46 +0,0 @@
1
- module['exports'] = function runTheTrap(text, options) {
2
- var result = '';
3
- text = text || 'Run the trap, drop the bass';
4
- text = text.split('');
5
- var trap = {
6
- a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'],
7
- b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'],
8
- c: ['\u00a9', '\u023b', '\u03fe'],
9
- d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'],
10
- e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc',
11
- '\u0a6c'],
12
- f: ['\u04fa'],
13
- g: ['\u0262'],
14
- h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'],
15
- i: ['\u0f0f'],
16
- j: ['\u0134'],
17
- k: ['\u0138', '\u04a0', '\u04c3', '\u051e'],
18
- l: ['\u0139'],
19
- m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'],
20
- n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'],
21
- o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd',
22
- '\u06dd', '\u0e4f'],
23
- p: ['\u01f7', '\u048e'],
24
- q: ['\u09cd'],
25
- r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'],
26
- s: ['\u00a7', '\u03de', '\u03df', '\u03e8'],
27
- t: ['\u0141', '\u0166', '\u0373'],
28
- u: ['\u01b1', '\u054d'],
29
- v: ['\u05d8'],
30
- w: ['\u0428', '\u0460', '\u047c', '\u0d70'],
31
- x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'],
32
- y: ['\u00a5', '\u04b0', '\u04cb'],
33
- z: ['\u01b5', '\u0240'],
34
- };
35
- text.forEach(function(c) {
36
- c = c.toLowerCase();
37
- var chars = trap[c] || [' '];
38
- var rand = Math.floor(Math.random() * chars.length);
39
- if (typeof trap[c] !== 'undefined') {
40
- result += trap[c][rand];
41
- } else {
42
- result += c;
43
- }
44
- });
45
- return result;
46
- };
@@ -1,110 +0,0 @@
1
- // please no
2
- module['exports'] = function zalgo(text, options) {
3
- text = text || ' he is here ';
4
- var soul = {
5
- 'up': [
6
- '̍', '̎', '̄', '̅',
7
- '̿', '̑', '̆', '̐',
8
- '͒', '͗', '͑', '̇',
9
- '̈', '̊', '͂', '̓',
10
- '̈', '͊', '͋', '͌',
11
- '̃', '̂', '̌', '͐',
12
- '̀', '́', '̋', '̏',
13
- '̒', '̓', '̔', '̽',
14
- '̉', 'ͣ', 'ͤ', 'ͥ',
15
- 'ͦ', 'ͧ', 'ͨ', 'ͩ',
16
- 'ͪ', 'ͫ', 'ͬ', 'ͭ',
17
- 'ͮ', 'ͯ', '̾', '͛',
18
- '͆', '̚',
19
- ],
20
- 'down': [
21
- '̖', '̗', '̘', '̙',
22
- '̜', '̝', '̞', '̟',
23
- '̠', '̤', '̥', '̦',
24
- '̩', '̪', '̫', '̬',
25
- '̭', '̮', '̯', '̰',
26
- '̱', '̲', '̳', '̹',
27
- '̺', '̻', '̼', 'ͅ',
28
- '͇', '͈', '͉', '͍',
29
- '͎', '͓', '͔', '͕',
30
- '͖', '͙', '͚', '̣',
31
- ],
32
- 'mid': [
33
- '̕', '̛', '̀', '́',
34
- '͘', '̡', '̢', '̧',
35
- '̨', '̴', '̵', '̶',
36
- '͜', '͝', '͞',
37
- '͟', '͠', '͢', '̸',
38
- '̷', '͡', ' ҉',
39
- ],
40
- };
41
- var all = [].concat(soul.up, soul.down, soul.mid);
42
-
43
- function randomNumber(range) {
44
- var r = Math.floor(Math.random() * range);
45
- return r;
46
- }
47
-
48
- function isChar(character) {
49
- var bool = false;
50
- all.filter(function(i) {
51
- bool = (i === character);
52
- });
53
- return bool;
54
- }
55
-
56
-
57
- function heComes(text, options) {
58
- var result = '';
59
- var counts;
60
- var l;
61
- options = options || {};
62
- options['up'] =
63
- typeof options['up'] !== 'undefined' ? options['up'] : true;
64
- options['mid'] =
65
- typeof options['mid'] !== 'undefined' ? options['mid'] : true;
66
- options['down'] =
67
- typeof options['down'] !== 'undefined' ? options['down'] : true;
68
- options['size'] =
69
- typeof options['size'] !== 'undefined' ? options['size'] : 'maxi';
70
- text = text.split('');
71
- for (l in text) {
72
- if (isChar(l)) {
73
- continue;
74
- }
75
- result = result + text[l];
76
- counts = {'up': 0, 'down': 0, 'mid': 0};
77
- switch (options.size) {
78
- case 'mini':
79
- counts.up = randomNumber(8);
80
- counts.mid = randomNumber(2);
81
- counts.down = randomNumber(8);
82
- break;
83
- case 'maxi':
84
- counts.up = randomNumber(16) + 3;
85
- counts.mid = randomNumber(4) + 1;
86
- counts.down = randomNumber(64) + 3;
87
- break;
88
- default:
89
- counts.up = randomNumber(8) + 1;
90
- counts.mid = randomNumber(6) / 2;
91
- counts.down = randomNumber(8) + 1;
92
- break;
93
- }
94
-
95
- var arr = ['up', 'mid', 'down'];
96
- for (var d in arr) {
97
- var index = arr[d];
98
- for (var i = 0; i <= counts[index]; i++) {
99
- if (options[index]) {
100
- result = result + soul[index][randomNumber(soul[index].length)];
101
- }
102
- }
103
- }
104
- }
105
- return result;
106
- }
107
- // don't summon him
108
- return heComes(text, options);
109
- };
110
-
@@ -1,110 +0,0 @@
1
- var colors = require('./colors');
2
-
3
- module['exports'] = function() {
4
- //
5
- // Extends prototype of native string object to allow for "foo".red syntax
6
- //
7
- var addProperty = function(color, func) {
8
- String.prototype.__defineGetter__(color, func);
9
- };
10
-
11
- addProperty('strip', function() {
12
- return colors.strip(this);
13
- });
14
-
15
- addProperty('stripColors', function() {
16
- return colors.strip(this);
17
- });
18
-
19
- addProperty('trap', function() {
20
- return colors.trap(this);
21
- });
22
-
23
- addProperty('zalgo', function() {
24
- return colors.zalgo(this);
25
- });
26
-
27
- addProperty('zebra', function() {
28
- return colors.zebra(this);
29
- });
30
-
31
- addProperty('rainbow', function() {
32
- return colors.rainbow(this);
33
- });
34
-
35
- addProperty('random', function() {
36
- return colors.random(this);
37
- });
38
-
39
- addProperty('america', function() {
40
- return colors.america(this);
41
- });
42
-
43
- //
44
- // Iterate through all default styles and colors
45
- //
46
- var x = Object.keys(colors.styles);
47
- x.forEach(function(style) {
48
- addProperty(style, function() {
49
- return colors.stylize(this, style);
50
- });
51
- });
52
-
53
- function applyTheme(theme) {
54
- //
55
- // Remark: This is a list of methods that exist
56
- // on String that you should not overwrite.
57
- //
58
- var stringPrototypeBlacklist = [
59
- '__defineGetter__', '__defineSetter__', '__lookupGetter__',
60
- '__lookupSetter__', 'charAt', 'constructor', 'hasOwnProperty',
61
- 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString',
62
- 'valueOf', 'charCodeAt', 'indexOf', 'lastIndexOf', 'length',
63
- 'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice',
64
- 'split', 'substring', 'toLocaleLowerCase', 'toLocaleUpperCase',
65
- 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight',
66
- ];
67
-
68
- Object.keys(theme).forEach(function(prop) {
69
- if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
70
- console.log('warn: '.red + ('String.prototype' + prop).magenta +
71
- ' is probably something you don\'t want to override. ' +
72
- 'Ignoring style name');
73
- } else {
74
- if (typeof(theme[prop]) === 'string') {
75
- colors[prop] = colors[theme[prop]];
76
- addProperty(prop, function() {
77
- return colors[prop](this);
78
- });
79
- } else {
80
- var themePropApplicator = function(str) {
81
- var ret = str || this;
82
- for (var t = 0; t < theme[prop].length; t++) {
83
- ret = colors[theme[prop][t]](ret);
84
- }
85
- return ret;
86
- };
87
- addProperty(prop, themePropApplicator);
88
- colors[prop] = function(str) {
89
- return themePropApplicator(str);
90
- };
91
- }
92
- }
93
- });
94
- }
95
-
96
- colors.setTheme = function(theme) {
97
- if (typeof theme === 'string') {
98
- console.log('colors.setTheme now only accepts an object, not a string. ' +
99
- 'If you are trying to set a theme from a file, it is now your (the ' +
100
- 'caller\'s) responsibility to require the file. The old syntax ' +
101
- 'looked like colors.setTheme(__dirname + ' +
102
- '\'/../themes/generic-logging.js\'); The new syntax looks like '+
103
- 'colors.setTheme(require(__dirname + ' +
104
- '\'/../themes/generic-logging.js\'));');
105
- return;
106
- } else {
107
- applyTheme(theme);
108
- }
109
- };
110
- };
@@ -1,13 +0,0 @@
1
- var colors = require('./colors');
2
- module['exports'] = colors;
3
-
4
- // Remark: By default, colors will add style properties to String.prototype.
5
- //
6
- // If you don't wish to extend String.prototype, you can do this instead and
7
- // native String will not be touched:
8
- //
9
- // var colors = require('colors/safe);
10
- // colors.red("foo")
11
- //
12
- //
13
- require('./extendStringPrototype')();
@@ -1,10 +0,0 @@
1
- module['exports'] = function(colors) {
2
- return function(letter, i, exploded) {
3
- if (letter === ' ') return letter;
4
- switch (i%3) {
5
- case 0: return colors.red(letter);
6
- case 1: return colors.white(letter);
7
- case 2: return colors.blue(letter);
8
- }
9
- };
10
- };
@@ -1,12 +0,0 @@
1
- module['exports'] = function(colors) {
2
- // RoY G BiV
3
- var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
4
- return function(letter, i, exploded) {
5
- if (letter === ' ') {
6
- return letter;
7
- } else {
8
- return colors[rainbowColors[i++ % rainbowColors.length]](letter);
9
- }
10
- };
11
- };
12
-
@@ -1,11 +0,0 @@
1
- module['exports'] = function(colors) {
2
- var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
3
- 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed',
4
- 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta'];
5
- return function(letter, i, exploded) {
6
- return letter === ' ' ? letter :
7
- colors[
8
- available[Math.round(Math.random() * (available.length - 2))]
9
- ](letter);
10
- };
11
- };
@@ -1,5 +0,0 @@
1
- module['exports'] = function(colors) {
2
- return function(letter, i, exploded) {
3
- return i % 2 === 0 ? letter : colors.inverse(letter);
4
- };
5
- };
@@ -1,95 +0,0 @@
1
- /*
2
- The MIT License (MIT)
3
-
4
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
23
-
24
- */
25
-
26
- var styles = {};
27
- module['exports'] = styles;
28
-
29
- var codes = {
30
- reset: [0, 0],
31
-
32
- bold: [1, 22],
33
- dim: [2, 22],
34
- italic: [3, 23],
35
- underline: [4, 24],
36
- inverse: [7, 27],
37
- hidden: [8, 28],
38
- strikethrough: [9, 29],
39
-
40
- black: [30, 39],
41
- red: [31, 39],
42
- green: [32, 39],
43
- yellow: [33, 39],
44
- blue: [34, 39],
45
- magenta: [35, 39],
46
- cyan: [36, 39],
47
- white: [37, 39],
48
- gray: [90, 39],
49
- grey: [90, 39],
50
-
51
- brightRed: [91, 39],
52
- brightGreen: [92, 39],
53
- brightYellow: [93, 39],
54
- brightBlue: [94, 39],
55
- brightMagenta: [95, 39],
56
- brightCyan: [96, 39],
57
- brightWhite: [97, 39],
58
-
59
- bgBlack: [40, 49],
60
- bgRed: [41, 49],
61
- bgGreen: [42, 49],
62
- bgYellow: [43, 49],
63
- bgBlue: [44, 49],
64
- bgMagenta: [45, 49],
65
- bgCyan: [46, 49],
66
- bgWhite: [47, 49],
67
- bgGray: [100, 49],
68
- bgGrey: [100, 49],
69
-
70
- bgBrightRed: [101, 49],
71
- bgBrightGreen: [102, 49],
72
- bgBrightYellow: [103, 49],
73
- bgBrightBlue: [104, 49],
74
- bgBrightMagenta: [105, 49],
75
- bgBrightCyan: [106, 49],
76
- bgBrightWhite: [107, 49],
77
-
78
- // legacy styles for colors pre v1.0.0
79
- blackBG: [40, 49],
80
- redBG: [41, 49],
81
- greenBG: [42, 49],
82
- yellowBG: [43, 49],
83
- blueBG: [44, 49],
84
- magentaBG: [45, 49],
85
- cyanBG: [46, 49],
86
- whiteBG: [47, 49],
87
-
88
- };
89
-
90
- Object.keys(codes).forEach(function(key) {
91
- var val = codes[key];
92
- var style = styles[key] = [];
93
- style.open = '\u001b[' + val[0] + 'm';
94
- style.close = '\u001b[' + val[1] + 'm';
95
- });
@@ -1,35 +0,0 @@
1
- /*
2
- MIT License
3
-
4
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy of
7
- this software and associated documentation files (the "Software"), to deal in
8
- the Software without restriction, including without limitation the rights to
9
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10
- of the Software, and to permit persons to whom the Software is furnished to do
11
- so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
- */
24
-
25
- 'use strict';
26
-
27
- module.exports = function(flag, argv) {
28
- argv = argv || process.argv;
29
-
30
- var terminatorPos = argv.indexOf('--');
31
- var prefix = /^-{1,2}/.test(flag) ? '' : '--';
32
- var pos = argv.indexOf(prefix + flag);
33
-
34
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
35
- };