jass 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (503) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +47 -0
  3. data/README.md +45 -0
  4. data/lib/jass.rb +55 -0
  5. data/lib/jass/base.rb +141 -0
  6. data/lib/jass/bundle_processor.rb +28 -0
  7. data/lib/jass/compiler.rb +112 -0
  8. data/lib/jass/dependency.rb +14 -0
  9. data/lib/jass/errors.rb +29 -0
  10. data/lib/jass/es6_processor.rb +17 -0
  11. data/lib/jass/function.rb +13 -0
  12. data/lib/jass/global_directive_processor.rb +12 -0
  13. data/lib/jass/plugin.rb +13 -0
  14. data/lib/jass/railtie.rb +12 -0
  15. data/lib/jass/version.rb +3 -0
  16. data/vendor/node_modules/@types/acorn/index.d.ts +256 -0
  17. data/vendor/node_modules/@types/acorn/package.json +29 -0
  18. data/vendor/node_modules/@types/estree/index.d.ts +546 -0
  19. data/vendor/node_modules/@types/estree/package.json +22 -0
  20. data/vendor/node_modules/acorn-dynamic-import/lib/index.js +17 -0
  21. data/vendor/node_modules/acorn-dynamic-import/lib/inject.js +72 -0
  22. data/vendor/node_modules/acorn-dynamic-import/lib/walk.js +22 -0
  23. data/vendor/node_modules/acorn-dynamic-import/package.json +45 -0
  24. data/vendor/node_modules/acorn-dynamic-import/src/index.js +4 -0
  25. data/vendor/node_modules/acorn-dynamic-import/src/inject.js +52 -0
  26. data/vendor/node_modules/acorn-dynamic-import/src/walk.js +12 -0
  27. data/vendor/node_modules/acorn-es7-plugin/acorn-es7-plugin.js +17 -0
  28. data/vendor/node_modules/acorn-es7-plugin/acorn-v3.js +333 -0
  29. data/vendor/node_modules/acorn-es7-plugin/acorn-v4.js +194 -0
  30. data/vendor/node_modules/acorn-es7-plugin/package.json +29 -0
  31. data/vendor/node_modules/acorn-jsx/index.js +3 -0
  32. data/vendor/node_modules/acorn-jsx/inject.js +449 -0
  33. data/vendor/node_modules/acorn-jsx/package.json +28 -0
  34. data/vendor/node_modules/acorn-jsx/xhtml.js +255 -0
  35. data/vendor/node_modules/acorn/bin/_acorn.js +69 -0
  36. data/vendor/node_modules/acorn/bin/acorn +4 -0
  37. data/vendor/node_modules/acorn/bin/run_test262.js +22 -0
  38. data/vendor/node_modules/acorn/bin/test262.whitelist +409 -0
  39. data/vendor/node_modules/acorn/dist/acorn.es.js +5305 -0
  40. data/vendor/node_modules/acorn/dist/acorn.js +5336 -0
  41. data/vendor/node_modules/acorn/dist/acorn_loose.es.js +1412 -0
  42. data/vendor/node_modules/acorn/dist/acorn_loose.js +1422 -0
  43. data/vendor/node_modules/acorn/dist/walk.es.js +419 -0
  44. data/vendor/node_modules/acorn/dist/walk.js +439 -0
  45. data/vendor/node_modules/acorn/package.json +56 -0
  46. data/vendor/node_modules/ansi-styles/index.js +165 -0
  47. data/vendor/node_modules/ansi-styles/package.json +56 -0
  48. data/vendor/node_modules/arr-diff/index.js +58 -0
  49. data/vendor/node_modules/arr-diff/package.json +49 -0
  50. data/vendor/node_modules/arr-flatten/index.js +22 -0
  51. data/vendor/node_modules/arr-flatten/package.json +76 -0
  52. data/vendor/node_modules/array-unique/index.js +28 -0
  53. data/vendor/node_modules/array-unique/package.json +37 -0
  54. data/vendor/node_modules/braces/index.js +399 -0
  55. data/vendor/node_modules/braces/package.json +83 -0
  56. data/vendor/node_modules/buble/bin/buble +24 -0
  57. data/vendor/node_modules/buble/bin/handleError.js +58 -0
  58. data/vendor/node_modules/buble/bin/runBuble.js +150 -0
  59. data/vendor/node_modules/buble/bin/showHelp.js +16 -0
  60. data/vendor/node_modules/buble/dist/buble-browser-deps.umd.js +14857 -0
  61. data/vendor/node_modules/buble/dist/buble-browser.cjs.js +9941 -0
  62. data/vendor/node_modules/buble/dist/buble-browser.es.js +9933 -0
  63. data/vendor/node_modules/buble/dist/buble.cjs.js +9433 -0
  64. data/vendor/node_modules/buble/dist/buble.es.js +9425 -0
  65. data/vendor/node_modules/buble/package.json +74 -0
  66. data/vendor/node_modules/buble/register.js +90 -0
  67. data/vendor/node_modules/buble/src/index.js +98 -0
  68. data/vendor/node_modules/buble/src/program/BlockStatement.js +373 -0
  69. data/vendor/node_modules/buble/src/program/Node.js +112 -0
  70. data/vendor/node_modules/buble/src/program/Program.js +74 -0
  71. data/vendor/node_modules/buble/src/program/Scope.js +116 -0
  72. data/vendor/node_modules/buble/src/program/extractNames.js +35 -0
  73. data/vendor/node_modules/buble/src/program/keys.js +4 -0
  74. data/vendor/node_modules/buble/src/program/types/ArrayExpression.js +70 -0
  75. data/vendor/node_modules/buble/src/program/types/ArrowFunctionExpression.js +52 -0
  76. data/vendor/node_modules/buble/src/program/types/AssignmentExpression.js +185 -0
  77. data/vendor/node_modules/buble/src/program/types/BinaryExpression.js +12 -0
  78. data/vendor/node_modules/buble/src/program/types/BreakStatement.js +26 -0
  79. data/vendor/node_modules/buble/src/program/types/CallExpression.js +104 -0
  80. data/vendor/node_modules/buble/src/program/types/ClassBody.js +237 -0
  81. data/vendor/node_modules/buble/src/program/types/ClassDeclaration.js +79 -0
  82. data/vendor/node_modules/buble/src/program/types/ClassExpression.js +51 -0
  83. data/vendor/node_modules/buble/src/program/types/ContinueStatement.js +17 -0
  84. data/vendor/node_modules/buble/src/program/types/ExportDefaultDeclaration.js +10 -0
  85. data/vendor/node_modules/buble/src/program/types/ExportNamedDeclaration.js +10 -0
  86. data/vendor/node_modules/buble/src/program/types/ForInStatement.js +76 -0
  87. data/vendor/node_modules/buble/src/program/types/ForOfStatement.js +89 -0
  88. data/vendor/node_modules/buble/src/program/types/ForStatement.js +54 -0
  89. data/vendor/node_modules/buble/src/program/types/FunctionDeclaration.js +25 -0
  90. data/vendor/node_modules/buble/src/program/types/FunctionExpression.js +74 -0
  91. data/vendor/node_modules/buble/src/program/types/Identifier.js +54 -0
  92. data/vendor/node_modules/buble/src/program/types/IfStatement.js +29 -0
  93. data/vendor/node_modules/buble/src/program/types/ImportDeclaration.js +10 -0
  94. data/vendor/node_modules/buble/src/program/types/ImportDefaultSpecifier.js +8 -0
  95. data/vendor/node_modules/buble/src/program/types/ImportSpecifier.js +8 -0
  96. data/vendor/node_modules/buble/src/program/types/JSXAttribute.js +20 -0
  97. data/vendor/node_modules/buble/src/program/types/JSXClosingElement.js +27 -0
  98. data/vendor/node_modules/buble/src/program/types/JSXClosingFragment.js +22 -0
  99. data/vendor/node_modules/buble/src/program/types/JSXElement.js +57 -0
  100. data/vendor/node_modules/buble/src/program/types/JSXExpressionContainer.js +10 -0
  101. data/vendor/node_modules/buble/src/program/types/JSXFragment.js +4 -0
  102. data/vendor/node_modules/buble/src/program/types/JSXOpeningElement.js +93 -0
  103. data/vendor/node_modules/buble/src/program/types/JSXOpeningFragment.js +7 -0
  104. data/vendor/node_modules/buble/src/program/types/JSXSpreadAttribute.js +10 -0
  105. data/vendor/node_modules/buble/src/program/types/Literal.js +43 -0
  106. data/vendor/node_modules/buble/src/program/types/MemberExpression.js +13 -0
  107. data/vendor/node_modules/buble/src/program/types/NewExpression.js +55 -0
  108. data/vendor/node_modules/buble/src/program/types/ObjectExpression.js +250 -0
  109. data/vendor/node_modules/buble/src/program/types/Property.js +52 -0
  110. data/vendor/node_modules/buble/src/program/types/ReturnStatement.js +32 -0
  111. data/vendor/node_modules/buble/src/program/types/SpreadElement.js +12 -0
  112. data/vendor/node_modules/buble/src/program/types/Super.js +88 -0
  113. data/vendor/node_modules/buble/src/program/types/TaggedTemplateExpression.js +63 -0
  114. data/vendor/node_modules/buble/src/program/types/TemplateElement.js +7 -0
  115. data/vendor/node_modules/buble/src/program/types/TemplateLiteral.js +80 -0
  116. data/vendor/node_modules/buble/src/program/types/ThisExpression.js +31 -0
  117. data/vendor/node_modules/buble/src/program/types/UpdateExpression.js +32 -0
  118. data/vendor/node_modules/buble/src/program/types/VariableDeclaration.js +101 -0
  119. data/vendor/node_modules/buble/src/program/types/VariableDeclarator.js +43 -0
  120. data/vendor/node_modules/buble/src/program/types/index.js +98 -0
  121. data/vendor/node_modules/buble/src/program/types/shared/LoopStatement.js +105 -0
  122. data/vendor/node_modules/buble/src/program/types/shared/ModuleDeclaration.js +10 -0
  123. data/vendor/node_modules/buble/src/program/wrap.js +68 -0
  124. data/vendor/node_modules/buble/src/support.js +97 -0
  125. data/vendor/node_modules/buble/src/utils/CompileError.js +30 -0
  126. data/vendor/node_modules/buble/src/utils/array.js +11 -0
  127. data/vendor/node_modules/buble/src/utils/checkConst.js +8 -0
  128. data/vendor/node_modules/buble/src/utils/deindent.js +30 -0
  129. data/vendor/node_modules/buble/src/utils/destructure.js +377 -0
  130. data/vendor/node_modules/buble/src/utils/getSnippet.js +30 -0
  131. data/vendor/node_modules/buble/src/utils/isReference.js +41 -0
  132. data/vendor/node_modules/buble/src/utils/locate.js +20 -0
  133. data/vendor/node_modules/buble/src/utils/patterns.js +1 -0
  134. data/vendor/node_modules/buble/src/utils/removeTrailingComma.js +13 -0
  135. data/vendor/node_modules/buble/src/utils/reserved.js +6 -0
  136. data/vendor/node_modules/buble/src/utils/spread.js +70 -0
  137. data/vendor/node_modules/builtin-modules/builtin-modules.json +39 -0
  138. data/vendor/node_modules/builtin-modules/index.js +10 -0
  139. data/vendor/node_modules/builtin-modules/package.json +40 -0
  140. data/vendor/node_modules/builtin-modules/static.js +2 -0
  141. data/vendor/node_modules/chalk/index.js +228 -0
  142. data/vendor/node_modules/chalk/package.json +66 -0
  143. data/vendor/node_modules/chalk/templates.js +128 -0
  144. data/vendor/node_modules/chalk/types/index.d.ts +97 -0
  145. data/vendor/node_modules/color-convert/conversions.js +861 -0
  146. data/vendor/node_modules/color-convert/index.js +78 -0
  147. data/vendor/node_modules/color-convert/package.json +46 -0
  148. data/vendor/node_modules/color-convert/route.js +97 -0
  149. data/vendor/node_modules/color-name/index.js +152 -0
  150. data/vendor/node_modules/color-name/package.json +25 -0
  151. data/vendor/node_modules/color-name/test.js +7 -0
  152. data/vendor/node_modules/date-time/index.js +33 -0
  153. data/vendor/node_modules/date-time/package.json +39 -0
  154. data/vendor/node_modules/escape-string-regexp/index.js +11 -0
  155. data/vendor/node_modules/escape-string-regexp/package.json +41 -0
  156. data/vendor/node_modules/estree-walker/dist/estree-walker.es.js +57 -0
  157. data/vendor/node_modules/estree-walker/dist/estree-walker.umd.js +68 -0
  158. data/vendor/node_modules/estree-walker/package.json +34 -0
  159. data/vendor/node_modules/estree-walker/src/estree-walker.js +51 -0
  160. data/vendor/node_modules/expand-brackets/index.js +163 -0
  161. data/vendor/node_modules/expand-brackets/package.json +62 -0
  162. data/vendor/node_modules/expand-range/index.js +43 -0
  163. data/vendor/node_modules/expand-range/package.json +73 -0
  164. data/vendor/node_modules/extglob/index.js +178 -0
  165. data/vendor/node_modules/extglob/package.json +60 -0
  166. data/vendor/node_modules/filename-regex/index.js +10 -0
  167. data/vendor/node_modules/filename-regex/package.json +50 -0
  168. data/vendor/node_modules/fill-range/index.js +408 -0
  169. data/vendor/node_modules/fill-range/package.json +61 -0
  170. data/vendor/node_modules/for-in/index.js +16 -0
  171. data/vendor/node_modules/for-in/package.json +68 -0
  172. data/vendor/node_modules/for-own/index.js +19 -0
  173. data/vendor/node_modules/for-own/package.json +70 -0
  174. data/vendor/node_modules/glob-base/index.js +51 -0
  175. data/vendor/node_modules/glob-base/package.json +52 -0
  176. data/vendor/node_modules/glob-parent/index.js +10 -0
  177. data/vendor/node_modules/glob-parent/package.json +35 -0
  178. data/vendor/node_modules/glob-parent/test.js +28 -0
  179. data/vendor/node_modules/has-flag/index.js +8 -0
  180. data/vendor/node_modules/has-flag/package.json +44 -0
  181. data/vendor/node_modules/irregular-plurals/irregular-plurals.json +146 -0
  182. data/vendor/node_modules/irregular-plurals/package.json +39 -0
  183. data/vendor/node_modules/is-buffer/index.js +21 -0
  184. data/vendor/node_modules/is-buffer/package.json +51 -0
  185. data/vendor/node_modules/is-dotfile/index.js +14 -0
  186. data/vendor/node_modules/is-dotfile/package.json +69 -0
  187. data/vendor/node_modules/is-equal-shallow/index.js +27 -0
  188. data/vendor/node_modules/is-equal-shallow/package.json +54 -0
  189. data/vendor/node_modules/is-extendable/index.js +13 -0
  190. data/vendor/node_modules/is-extendable/package.json +51 -0
  191. data/vendor/node_modules/is-extglob/index.js +11 -0
  192. data/vendor/node_modules/is-extglob/package.json +48 -0
  193. data/vendor/node_modules/is-glob/index.js +14 -0
  194. data/vendor/node_modules/is-glob/package.json +60 -0
  195. data/vendor/node_modules/is-module/index.js +11 -0
  196. data/vendor/node_modules/is-module/package.json +20 -0
  197. data/vendor/node_modules/is-number/index.js +19 -0
  198. data/vendor/node_modules/is-number/package.json +59 -0
  199. data/vendor/node_modules/is-posix-bracket/index.js +10 -0
  200. data/vendor/node_modules/is-posix-bracket/package.json +64 -0
  201. data/vendor/node_modules/is-primitive/index.js +13 -0
  202. data/vendor/node_modules/is-primitive/package.json +46 -0
  203. data/vendor/node_modules/is-reference/dist/is-reference.es.js +26 -0
  204. data/vendor/node_modules/is-reference/dist/is-reference.js +34 -0
  205. data/vendor/node_modules/is-reference/dist/types/index.d.ts +2 -0
  206. data/vendor/node_modules/is-reference/package.json +47 -0
  207. data/vendor/node_modules/isarray/index.js +5 -0
  208. data/vendor/node_modules/isarray/package.json +45 -0
  209. data/vendor/node_modules/isarray/test.js +20 -0
  210. data/vendor/node_modules/isobject/index.js +14 -0
  211. data/vendor/node_modules/isobject/package.json +67 -0
  212. data/vendor/node_modules/kind-of/index.js +116 -0
  213. data/vendor/node_modules/kind-of/package.json +90 -0
  214. data/vendor/node_modules/locate-character/dist/locate-character.es.js +43 -0
  215. data/vendor/node_modules/locate-character/dist/locate-character.umd.js +54 -0
  216. data/vendor/node_modules/locate-character/dist/types/index.d.ts +17 -0
  217. data/vendor/node_modules/locate-character/package.json +41 -0
  218. data/vendor/node_modules/magic-string/dist/magic-string.cjs.js +1300 -0
  219. data/vendor/node_modules/magic-string/dist/magic-string.es.js +1296 -0
  220. data/vendor/node_modules/magic-string/dist/magic-string.umd.js +1352 -0
  221. data/vendor/node_modules/magic-string/index.d.ts +83 -0
  222. data/vendor/node_modules/magic-string/node_modules/vlq/dist/vlq.js +91 -0
  223. data/vendor/node_modules/magic-string/node_modules/vlq/package.json +27 -0
  224. data/vendor/node_modules/magic-string/node_modules/vlq/src/vlq.js +78 -0
  225. data/vendor/node_modules/magic-string/package.json +55 -0
  226. data/vendor/node_modules/micromatch/index.js +431 -0
  227. data/vendor/node_modules/micromatch/lib/chars.js +67 -0
  228. data/vendor/node_modules/micromatch/lib/expand.js +304 -0
  229. data/vendor/node_modules/micromatch/lib/glob.js +193 -0
  230. data/vendor/node_modules/micromatch/lib/utils.js +149 -0
  231. data/vendor/node_modules/micromatch/package.json +114 -0
  232. data/vendor/node_modules/minimist/index.js +236 -0
  233. data/vendor/node_modules/minimist/package.json +45 -0
  234. data/vendor/node_modules/nodent-compiler/compiler.js +171 -0
  235. data/vendor/node_modules/nodent-compiler/lib/arboriculture.js +2694 -0
  236. data/vendor/node_modules/nodent-compiler/lib/output.js +934 -0
  237. data/vendor/node_modules/nodent-compiler/lib/parser.js +291 -0
  238. data/vendor/node_modules/nodent-compiler/package.json +37 -0
  239. data/vendor/node_modules/normalize-path/index.js +19 -0
  240. data/vendor/node_modules/normalize-path/package.json +78 -0
  241. data/vendor/node_modules/object.omit/index.js +40 -0
  242. data/vendor/node_modules/object.omit/package.json +67 -0
  243. data/vendor/node_modules/os-homedir/index.js +24 -0
  244. data/vendor/node_modules/os-homedir/package.json +41 -0
  245. data/vendor/node_modules/parse-glob/index.js +156 -0
  246. data/vendor/node_modules/parse-glob/package.json +62 -0
  247. data/vendor/node_modules/parse-ms/index.js +16 -0
  248. data/vendor/node_modules/parse-ms/package.json +34 -0
  249. data/vendor/node_modules/path-parse/index.js +93 -0
  250. data/vendor/node_modules/path-parse/index.min.js +1 -0
  251. data/vendor/node_modules/path-parse/package.json +33 -0
  252. data/vendor/node_modules/path-parse/test.js +77 -0
  253. data/vendor/node_modules/path-parse/test.min.js +1 -0
  254. data/vendor/node_modules/plur/index.js +20 -0
  255. data/vendor/node_modules/plur/package.json +42 -0
  256. data/vendor/node_modules/preserve/index.js +54 -0
  257. data/vendor/node_modules/preserve/package.json +48 -0
  258. data/vendor/node_modules/preserve/test.js +48 -0
  259. data/vendor/node_modules/pretty-ms/index.js +48 -0
  260. data/vendor/node_modules/pretty-ms/package.json +48 -0
  261. data/vendor/node_modules/randomatic/index.js +82 -0
  262. data/vendor/node_modules/randomatic/node_modules/is-number/index.js +22 -0
  263. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +116 -0
  264. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +90 -0
  265. data/vendor/node_modules/randomatic/node_modules/is-number/package.json +83 -0
  266. data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +119 -0
  267. data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +90 -0
  268. data/vendor/node_modules/randomatic/package.json +78 -0
  269. data/vendor/node_modules/regex-cache/index.js +68 -0
  270. data/vendor/node_modules/regex-cache/package.json +64 -0
  271. data/vendor/node_modules/remove-trailing-separator/index.js +17 -0
  272. data/vendor/node_modules/remove-trailing-separator/package.json +37 -0
  273. data/vendor/node_modules/repeat-element/index.js +18 -0
  274. data/vendor/node_modules/repeat-element/package.json +44 -0
  275. data/vendor/node_modules/repeat-string/index.js +70 -0
  276. data/vendor/node_modules/repeat-string/package.json +77 -0
  277. data/vendor/node_modules/require-relative/index.js +33 -0
  278. data/vendor/node_modules/require-relative/package.json +22 -0
  279. data/vendor/node_modules/resolve/index.js +8 -0
  280. data/vendor/node_modules/resolve/lib/async.js +203 -0
  281. data/vendor/node_modules/resolve/lib/caller.js +8 -0
  282. data/vendor/node_modules/resolve/lib/core.js +53 -0
  283. data/vendor/node_modules/resolve/lib/core.json +69 -0
  284. data/vendor/node_modules/resolve/lib/node-modules-paths.js +45 -0
  285. data/vendor/node_modules/resolve/lib/sync.js +93 -0
  286. data/vendor/node_modules/resolve/package.json +40 -0
  287. data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +804 -0
  288. data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +800 -0
  289. data/vendor/node_modules/rollup-plugin-commonjs/package.json +52 -0
  290. data/vendor/node_modules/rollup-plugin-commonjs/src/ast-utils.js +104 -0
  291. data/vendor/node_modules/rollup-plugin-commonjs/src/defaultResolver.js +39 -0
  292. data/vendor/node_modules/rollup-plugin-commonjs/src/helpers.js +19 -0
  293. data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +198 -0
  294. data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +431 -0
  295. data/vendor/node_modules/rollup-plugin-commonjs/src/utils.js +13 -0
  296. data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +218 -0
  297. data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +214 -0
  298. data/vendor/node_modules/rollup-plugin-node-resolve/package.json +51 -0
  299. data/vendor/node_modules/rollup-plugin-node-resolve/src/empty.js +1 -0
  300. data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +205 -0
  301. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +223 -0
  302. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +214 -0
  303. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +217 -0
  304. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +55 -0
  305. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +59 -0
  306. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +65 -0
  307. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +33 -0
  308. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +49 -0
  309. data/vendor/node_modules/rollup-pluginutils/package.json +40 -0
  310. data/vendor/node_modules/rollup-pluginutils/src/addExtension.js +6 -0
  311. data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +147 -0
  312. data/vendor/node_modules/rollup-pluginutils/src/createFilter.js +33 -0
  313. data/vendor/node_modules/rollup-pluginutils/src/index.js +4 -0
  314. data/vendor/node_modules/rollup-pluginutils/src/makeLegalIdentifier.js +15 -0
  315. data/vendor/node_modules/rollup-pluginutils/src/utils/ensureArray.js +5 -0
  316. data/vendor/node_modules/rollup/bin/rollup +4085 -0
  317. data/vendor/node_modules/rollup/dist/rollup.browser.js +19829 -0
  318. data/vendor/node_modules/rollup/dist/rollup.es.js +23586 -0
  319. data/vendor/node_modules/rollup/dist/rollup.js +23597 -0
  320. data/vendor/node_modules/rollup/dist/typings/Chunk.d.ts +85 -0
  321. data/vendor/node_modules/rollup/dist/typings/ExternalModule.d.ts +30 -0
  322. data/vendor/node_modules/rollup/dist/typings/Graph.d.ts +47 -0
  323. data/vendor/node_modules/rollup/dist/typings/Module.d.ts +130 -0
  324. data/vendor/node_modules/rollup/dist/typings/ast/CallOptions.d.ts +20 -0
  325. data/vendor/node_modules/rollup/dist/typings/ast/Entity.d.ts +16 -0
  326. data/vendor/node_modules/rollup/dist/typings/ast/ExecutionPathOptions.d.ts +57 -0
  327. data/vendor/node_modules/rollup/dist/typings/ast/clone.d.ts +1 -0
  328. data/vendor/node_modules/rollup/dist/typings/ast/enhance.d.ts +3 -0
  329. data/vendor/node_modules/rollup/dist/typings/ast/keys.d.ts +4 -0
  330. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayExpression.d.ts +14 -0
  331. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayPattern.d.ts +14 -0
  332. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrowFunctionExpression.d.ts +25 -0
  333. data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentExpression.d.ts +13 -0
  334. data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentPattern.d.ts +16 -0
  335. data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentProperty.d.ts +10 -0
  336. data/vendor/node_modules/rollup/dist/typings/ast/nodes/AwaitExpression.d.ts +8 -0
  337. data/vendor/node_modules/rollup/dist/typings/ast/nodes/BinaryExpression.d.ts +13 -0
  338. data/vendor/node_modules/rollup/dist/typings/ast/nodes/BlockStatement.d.ts +19 -0
  339. data/vendor/node_modules/rollup/dist/typings/ast/nodes/BreakStatement.d.ts +9 -0
  340. data/vendor/node_modules/rollup/dist/typings/ast/nodes/CallExpression.d.ts +22 -0
  341. data/vendor/node_modules/rollup/dist/typings/ast/nodes/CatchClause.d.ts +14 -0
  342. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassBody.d.ts +13 -0
  343. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassDeclaration.d.ts +14 -0
  344. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassExpression.d.ts +10 -0
  345. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ConditionalExpression.d.ts +28 -0
  346. data/vendor/node_modules/rollup/dist/typings/ast/nodes/DoWhileStatement.d.ts +9 -0
  347. data/vendor/node_modules/rollup/dist/typings/ast/nodes/EmptyStatement.d.ts +8 -0
  348. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportAllDeclaration.d.ts +12 -0
  349. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportDefaultDeclaration.d.ts +21 -0
  350. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportNamedDeclaration.d.ts +21 -0
  351. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportSpecifier.d.ts +8 -0
  352. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExpressionStatement.d.ts +10 -0
  353. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForInStatement.d.ts +20 -0
  354. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForOfStatement.d.ts +21 -0
  355. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForStatement.d.ts +19 -0
  356. data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionDeclaration.d.ts +9 -0
  357. data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionExpression.d.ts +6 -0
  358. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Identifier.d.ts +29 -0
  359. data/vendor/node_modules/rollup/dist/typings/ast/nodes/IfStatement.d.ts +17 -0
  360. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Import.d.ts +14 -0
  361. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDeclaration.d.ts +17 -0
  362. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDefaultSpecifier.d.ts +7 -0
  363. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportNamespaceSpecifier.d.ts +7 -0
  364. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportSpecifier.d.ts +8 -0
  365. data/vendor/node_modules/rollup/dist/typings/ast/nodes/LabeledStatement.d.ts +10 -0
  366. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Literal.d.ts +22 -0
  367. data/vendor/node_modules/rollup/dist/typings/ast/nodes/LogicalExpression.d.ts +23 -0
  368. data/vendor/node_modules/rollup/dist/typings/ast/nodes/MemberExpression.d.ts +34 -0
  369. data/vendor/node_modules/rollup/dist/typings/ast/nodes/MethodDefinition.d.ts +16 -0
  370. data/vendor/node_modules/rollup/dist/typings/ast/nodes/NewExpression.d.ts +14 -0
  371. data/vendor/node_modules/rollup/dist/typings/ast/nodes/NodeType.d.ts +64 -0
  372. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectExpression.d.ts +22 -0
  373. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectPattern.d.ts +15 -0
  374. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Program.d.ts +9 -0
  375. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Property.d.ts +30 -0
  376. data/vendor/node_modules/rollup/dist/typings/ast/nodes/RestElement.d.ts +14 -0
  377. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ReturnStatement.d.ts +9 -0
  378. data/vendor/node_modules/rollup/dist/typings/ast/nodes/SequenceExpression.d.ts +13 -0
  379. data/vendor/node_modules/rollup/dist/typings/ast/nodes/SpreadElement.d.ts +6 -0
  380. data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchCase.d.ts +11 -0
  381. data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchStatement.d.ts +12 -0
  382. data/vendor/node_modules/rollup/dist/typings/ast/nodes/TaggedTemplateExpression.d.ts +13 -0
  383. data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateElement.d.ts +12 -0
  384. data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateLiteral.d.ts +12 -0
  385. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThisExpression.d.ts +17 -0
  386. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThrowStatement.d.ts +8 -0
  387. data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnaryExpression.d.ts +16 -0
  388. data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnknownNode.d.ts +5 -0
  389. data/vendor/node_modules/rollup/dist/typings/ast/nodes/UpdateExpression.d.ts +13 -0
  390. data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclaration.d.ts +21 -0
  391. data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclarator.d.ts +13 -0
  392. data/vendor/node_modules/rollup/dist/typings/ast/nodes/WhileStatement.d.ts +9 -0
  393. data/vendor/node_modules/rollup/dist/typings/ast/nodes/YieldExpression.d.ts +9 -0
  394. data/vendor/node_modules/rollup/dist/typings/ast/nodes/index.d.ts +6 -0
  395. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/ClassNode.d.ts +17 -0
  396. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Expression.d.ts +21 -0
  397. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/FunctionNode.d.ts +25 -0
  398. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Node.d.ts +133 -0
  399. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Pattern.d.ts +4 -0
  400. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/pureFunctions.d.ts +4 -0
  401. data/vendor/node_modules/rollup/dist/typings/ast/scopes/BlockScope.d.ts +9 -0
  402. data/vendor/node_modules/rollup/dist/typings/ast/scopes/CatchScope.d.ts +10 -0
  403. data/vendor/node_modules/rollup/dist/typings/ast/scopes/FunctionScope.d.ts +20 -0
  404. data/vendor/node_modules/rollup/dist/typings/ast/scopes/GlobalScope.d.ts +7 -0
  405. data/vendor/node_modules/rollup/dist/typings/ast/scopes/ModuleScope.d.ts +11 -0
  406. data/vendor/node_modules/rollup/dist/typings/ast/scopes/ParameterScope.d.ts +16 -0
  407. data/vendor/node_modules/rollup/dist/typings/ast/scopes/ReturnValueScope.d.ts +11 -0
  408. data/vendor/node_modules/rollup/dist/typings/ast/scopes/Scope.d.ts +42 -0
  409. data/vendor/node_modules/rollup/dist/typings/ast/utils/extractNames.d.ts +2 -0
  410. data/vendor/node_modules/rollup/dist/typings/ast/values.d.ts +31 -0
  411. data/vendor/node_modules/rollup/dist/typings/ast/variables/ArgumentsVariable.d.ts +15 -0
  412. data/vendor/node_modules/rollup/dist/typings/ast/variables/ExportDefaultVariable.d.ts +16 -0
  413. data/vendor/node_modules/rollup/dist/typings/ast/variables/ExternalVariable.d.ts +12 -0
  414. data/vendor/node_modules/rollup/dist/typings/ast/variables/GlobalVariable.d.ts +11 -0
  415. data/vendor/node_modules/rollup/dist/typings/ast/variables/LocalVariable.d.ts +21 -0
  416. data/vendor/node_modules/rollup/dist/typings/ast/variables/NamespaceVariable.d.ts +20 -0
  417. data/vendor/node_modules/rollup/dist/typings/ast/variables/ParameterVariable.d.ts +5 -0
  418. data/vendor/node_modules/rollup/dist/typings/ast/variables/ReplaceableInitializationVariable.d.ts +14 -0
  419. data/vendor/node_modules/rollup/dist/typings/ast/variables/ThisVariable.d.ts +4 -0
  420. data/vendor/node_modules/rollup/dist/typings/ast/variables/Variable.d.ts +43 -0
  421. data/vendor/node_modules/rollup/dist/typings/ast/variables/VariableReassignmentTracker.d.ts +11 -0
  422. data/vendor/node_modules/rollup/dist/typings/finalisers/amd.d.ts +11 -0
  423. data/vendor/node_modules/rollup/dist/typings/finalisers/cjs.d.ts +10 -0
  424. data/vendor/node_modules/rollup/dist/typings/finalisers/es.d.ts +9 -0
  425. data/vendor/node_modules/rollup/dist/typings/finalisers/iife.d.ts +10 -0
  426. data/vendor/node_modules/rollup/dist/typings/finalisers/index.d.ts +15 -0
  427. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/esModuleExport.d.ts +2 -0
  428. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getExportBlock.d.ts +2 -0
  429. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getGlobalNameMaker.d.ts +4 -0
  430. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getInteropBlock.d.ts +3 -0
  431. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/sanitize.d.ts +2 -0
  432. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/setupNamespace.d.ts +2 -0
  433. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/trimEmptyImports.d.ts +2 -0
  434. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/warnOnBuiltins.d.ts +2 -0
  435. data/vendor/node_modules/rollup/dist/typings/finalisers/system.d.ts +8 -0
  436. data/vendor/node_modules/rollup/dist/typings/finalisers/umd.d.ts +10 -0
  437. data/vendor/node_modules/rollup/dist/typings/node-entry.d.ts +6 -0
  438. data/vendor/node_modules/rollup/dist/typings/rollup/index.d.ts +167 -0
  439. data/vendor/node_modules/rollup/dist/typings/utils/callIfFunction.d.ts +1 -0
  440. data/vendor/node_modules/rollup/dist/typings/utils/collapseSourcemaps.d.ts +5 -0
  441. data/vendor/node_modules/rollup/dist/typings/utils/commondir.d.ts +1 -0
  442. data/vendor/node_modules/rollup/dist/typings/utils/defaults.d.ts +6 -0
  443. data/vendor/node_modules/rollup/dist/typings/utils/deprecateOptions.d.ts +6 -0
  444. data/vendor/node_modules/rollup/dist/typings/utils/ensureArray.d.ts +2 -0
  445. data/vendor/node_modules/rollup/dist/typings/utils/entryHashing.d.ts +3 -0
  446. data/vendor/node_modules/rollup/dist/typings/utils/error.d.ts +18 -0
  447. data/vendor/node_modules/rollup/dist/typings/utils/first-sync.d.ts +1 -0
  448. data/vendor/node_modules/rollup/dist/typings/utils/first.d.ts +1 -0
  449. data/vendor/node_modules/rollup/dist/typings/utils/flushTime.d.ts +5 -0
  450. data/vendor/node_modules/rollup/dist/typings/utils/fs.d.ts +3 -0
  451. data/vendor/node_modules/rollup/dist/typings/utils/getCodeFrame.d.ts +1 -0
  452. data/vendor/node_modules/rollup/dist/typings/utils/getExportMode.d.ts +3 -0
  453. data/vendor/node_modules/rollup/dist/typings/utils/getIndentString.d.ts +4 -0
  454. data/vendor/node_modules/rollup/dist/typings/utils/identifierHelpers.d.ts +3 -0
  455. data/vendor/node_modules/rollup/dist/typings/utils/mergeOptions.d.ts +19 -0
  456. data/vendor/node_modules/rollup/dist/typings/utils/object.d.ts +7 -0
  457. data/vendor/node_modules/rollup/dist/typings/utils/path.d.ts +6 -0
  458. data/vendor/node_modules/rollup/dist/typings/utils/promise.d.ts +2 -0
  459. data/vendor/node_modules/rollup/dist/typings/utils/relativeId.d.ts +1 -0
  460. data/vendor/node_modules/rollup/dist/typings/utils/renderHelpers.d.ts +26 -0
  461. data/vendor/node_modules/rollup/dist/typings/utils/sourceMappingURL.d.ts +3 -0
  462. data/vendor/node_modules/rollup/dist/typings/utils/timers.d.ts +7 -0
  463. data/vendor/node_modules/rollup/dist/typings/utils/transform.d.ts +25 -0
  464. data/vendor/node_modules/rollup/dist/typings/utils/transformBundle.d.ts +3 -0
  465. data/vendor/node_modules/rollup/dist/typings/watch/chokidar.d.ts +3 -0
  466. data/vendor/node_modules/rollup/dist/typings/watch/fileWatchers.d.ts +14 -0
  467. data/vendor/node_modules/rollup/dist/typings/watch/index.d.ts +47 -0
  468. data/vendor/node_modules/rollup/package.json +122 -0
  469. data/vendor/node_modules/rollup/typings/package.json.d.ts +3 -0
  470. data/vendor/node_modules/signal-exit/index.js +157 -0
  471. data/vendor/node_modules/signal-exit/package.json +38 -0
  472. data/vendor/node_modules/signal-exit/signals.js +53 -0
  473. data/vendor/node_modules/source-map/dist/source-map.debug.js +3091 -0
  474. data/vendor/node_modules/source-map/dist/source-map.js +3090 -0
  475. data/vendor/node_modules/source-map/dist/source-map.min.js +2 -0
  476. data/vendor/node_modules/source-map/lib/array-set.js +121 -0
  477. data/vendor/node_modules/source-map/lib/base64-vlq.js +140 -0
  478. data/vendor/node_modules/source-map/lib/base64.js +67 -0
  479. data/vendor/node_modules/source-map/lib/binary-search.js +111 -0
  480. data/vendor/node_modules/source-map/lib/mapping-list.js +79 -0
  481. data/vendor/node_modules/source-map/lib/quick-sort.js +114 -0
  482. data/vendor/node_modules/source-map/lib/source-map-consumer.js +1082 -0
  483. data/vendor/node_modules/source-map/lib/source-map-generator.js +416 -0
  484. data/vendor/node_modules/source-map/lib/source-node.js +413 -0
  485. data/vendor/node_modules/source-map/lib/util.js +417 -0
  486. data/vendor/node_modules/source-map/package.json +72 -0
  487. data/vendor/node_modules/source-map/source-map.js +8 -0
  488. data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.es.js +129 -0
  489. data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.umd.js +140 -0
  490. data/vendor/node_modules/sourcemap-codec/dist/types/sourcemap-codec.d.ts +5 -0
  491. data/vendor/node_modules/sourcemap-codec/package.json +52 -0
  492. data/vendor/node_modules/supports-color/browser.js +5 -0
  493. data/vendor/node_modules/supports-color/index.js +135 -0
  494. data/vendor/node_modules/supports-color/package.json +53 -0
  495. data/vendor/node_modules/time-zone/index.js +10 -0
  496. data/vendor/node_modules/time-zone/package.json +35 -0
  497. data/vendor/node_modules/vlq/dist/types/vlq.d.ts +2 -0
  498. data/vendor/node_modules/vlq/dist/vlq.es.js +64 -0
  499. data/vendor/node_modules/vlq/dist/vlq.js +75 -0
  500. data/vendor/node_modules/vlq/package.json +30 -0
  501. data/vendor/package.json +15 -0
  502. data/vendor/yarn.lock +453 -0
  503. metadata +641 -0
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "chalk",
3
+ "version": "2.3.2",
4
+ "description": "Terminal string styling done right",
5
+ "license": "MIT",
6
+ "repository": "chalk/chalk",
7
+ "engines": {
8
+ "node": ">=4"
9
+ },
10
+ "scripts": {
11
+ "test": "xo && tsc --project types && nyc ava",
12
+ "bench": "matcha benchmark.js",
13
+ "coveralls": "nyc report --reporter=text-lcov | coveralls"
14
+ },
15
+ "files": [
16
+ "index.js",
17
+ "templates.js",
18
+ "types/index.d.ts"
19
+ ],
20
+ "keywords": [
21
+ "color",
22
+ "colour",
23
+ "colors",
24
+ "terminal",
25
+ "console",
26
+ "cli",
27
+ "string",
28
+ "str",
29
+ "ansi",
30
+ "style",
31
+ "styles",
32
+ "tty",
33
+ "formatting",
34
+ "rgb",
35
+ "256",
36
+ "shell",
37
+ "xterm",
38
+ "log",
39
+ "logging",
40
+ "command-line",
41
+ "text"
42
+ ],
43
+ "dependencies": {
44
+ "ansi-styles": "^3.2.1",
45
+ "escape-string-regexp": "^1.0.5",
46
+ "supports-color": "^5.3.0"
47
+ },
48
+ "devDependencies": {
49
+ "ava": "*",
50
+ "coveralls": "^3.0.0",
51
+ "execa": "^0.9.0",
52
+ "import-fresh": "^2.0.0",
53
+ "matcha": "^0.7.0",
54
+ "nyc": "^11.0.2",
55
+ "resolve-from": "^4.0.0",
56
+ "typescript": "^2.5.3",
57
+ "xo": "*"
58
+ },
59
+ "types": "types/index.d.ts",
60
+ "xo": {
61
+ "envs": [
62
+ "node",
63
+ "mocha"
64
+ ]
65
+ }
66
+ }
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+ const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
3
+ const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
4
+ const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
5
+ const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
6
+
7
+ const ESCAPES = new Map([
8
+ ['n', '\n'],
9
+ ['r', '\r'],
10
+ ['t', '\t'],
11
+ ['b', '\b'],
12
+ ['f', '\f'],
13
+ ['v', '\v'],
14
+ ['0', '\0'],
15
+ ['\\', '\\'],
16
+ ['e', '\u001B'],
17
+ ['a', '\u0007']
18
+ ]);
19
+
20
+ function unescape(c) {
21
+ if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
22
+ return String.fromCharCode(parseInt(c.slice(1), 16));
23
+ }
24
+
25
+ return ESCAPES.get(c) || c;
26
+ }
27
+
28
+ function parseArguments(name, args) {
29
+ const results = [];
30
+ const chunks = args.trim().split(/\s*,\s*/g);
31
+ let matches;
32
+
33
+ for (const chunk of chunks) {
34
+ if (!isNaN(chunk)) {
35
+ results.push(Number(chunk));
36
+ } else if ((matches = chunk.match(STRING_REGEX))) {
37
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
38
+ } else {
39
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
40
+ }
41
+ }
42
+
43
+ return results;
44
+ }
45
+
46
+ function parseStyle(style) {
47
+ STYLE_REGEX.lastIndex = 0;
48
+
49
+ const results = [];
50
+ let matches;
51
+
52
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
53
+ const name = matches[1];
54
+
55
+ if (matches[2]) {
56
+ const args = parseArguments(name, matches[2]);
57
+ results.push([name].concat(args));
58
+ } else {
59
+ results.push([name]);
60
+ }
61
+ }
62
+
63
+ return results;
64
+ }
65
+
66
+ function buildStyle(chalk, styles) {
67
+ const enabled = {};
68
+
69
+ for (const layer of styles) {
70
+ for (const style of layer.styles) {
71
+ enabled[style[0]] = layer.inverse ? null : style.slice(1);
72
+ }
73
+ }
74
+
75
+ let current = chalk;
76
+ for (const styleName of Object.keys(enabled)) {
77
+ if (Array.isArray(enabled[styleName])) {
78
+ if (!(styleName in current)) {
79
+ throw new Error(`Unknown Chalk style: ${styleName}`);
80
+ }
81
+
82
+ if (enabled[styleName].length > 0) {
83
+ current = current[styleName].apply(current, enabled[styleName]);
84
+ } else {
85
+ current = current[styleName];
86
+ }
87
+ }
88
+ }
89
+
90
+ return current;
91
+ }
92
+
93
+ module.exports = (chalk, tmp) => {
94
+ const styles = [];
95
+ const chunks = [];
96
+ let chunk = [];
97
+
98
+ // eslint-disable-next-line max-params
99
+ tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
100
+ if (escapeChar) {
101
+ chunk.push(unescape(escapeChar));
102
+ } else if (style) {
103
+ const str = chunk.join('');
104
+ chunk = [];
105
+ chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
106
+ styles.push({inverse, styles: parseStyle(style)});
107
+ } else if (close) {
108
+ if (styles.length === 0) {
109
+ throw new Error('Found extraneous } in Chalk template literal');
110
+ }
111
+
112
+ chunks.push(buildStyle(chalk, styles)(chunk.join('')));
113
+ chunk = [];
114
+ styles.pop();
115
+ } else {
116
+ chunk.push(chr);
117
+ }
118
+ });
119
+
120
+ chunks.push(chunk.join(''));
121
+
122
+ if (styles.length > 0) {
123
+ const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
124
+ throw new Error(errMsg);
125
+ }
126
+
127
+ return chunks.join('');
128
+ };
@@ -0,0 +1,97 @@
1
+ // Type definitions for Chalk
2
+ // Definitions by: Thomas Sauer <https://github.com/t-sauer>
3
+
4
+ export const enum Level {
5
+ None = 0,
6
+ Basic = 1,
7
+ Ansi256 = 2,
8
+ TrueColor = 3
9
+ }
10
+
11
+ export interface ChalkOptions {
12
+ enabled?: boolean;
13
+ level?: Level;
14
+ }
15
+
16
+ export interface ChalkConstructor {
17
+ new (options?: ChalkOptions): Chalk;
18
+ (options?: ChalkOptions): Chalk;
19
+ }
20
+
21
+ export interface ColorSupport {
22
+ level: Level;
23
+ hasBasic: boolean;
24
+ has256: boolean;
25
+ has16m: boolean;
26
+ }
27
+
28
+ export interface Chalk {
29
+ (...text: string[]): string;
30
+ (text: TemplateStringsArray, ...placeholders: string[]): string;
31
+ constructor: ChalkConstructor;
32
+ enabled: boolean;
33
+ level: Level;
34
+ rgb(r: number, g: number, b: number): this;
35
+ hsl(h: number, s: number, l: number): this;
36
+ hsv(h: number, s: number, v: number): this;
37
+ hwb(h: number, w: number, b: number): this;
38
+ bgHex(color: string): this;
39
+ bgKeyword(color: string): this;
40
+ bgRgb(r: number, g: number, b: number): this;
41
+ bgHsl(h: number, s: number, l: number): this;
42
+ bgHsv(h: number, s: number, v: number): this;
43
+ bgHwb(h: number, w: number, b: number): this;
44
+ hex(color: string): this;
45
+ keyword(color: string): this;
46
+
47
+ readonly reset: this;
48
+ readonly bold: this;
49
+ readonly dim: this;
50
+ readonly italic: this;
51
+ readonly underline: this;
52
+ readonly inverse: this;
53
+ readonly hidden: this;
54
+ readonly strikethrough: this;
55
+
56
+ readonly visible: this;
57
+
58
+ readonly black: this;
59
+ readonly red: this;
60
+ readonly green: this;
61
+ readonly yellow: this;
62
+ readonly blue: this;
63
+ readonly magenta: this;
64
+ readonly cyan: this;
65
+ readonly white: this;
66
+ readonly gray: this;
67
+ readonly grey: this;
68
+ readonly blackBright: this;
69
+ readonly redBright: this;
70
+ readonly greenBright: this;
71
+ readonly yellowBright: this;
72
+ readonly blueBright: this;
73
+ readonly magentaBright: this;
74
+ readonly cyanBright: this;
75
+ readonly whiteBright: this;
76
+
77
+ readonly bgBlack: this;
78
+ readonly bgRed: this;
79
+ readonly bgGreen: this;
80
+ readonly bgYellow: this;
81
+ readonly bgBlue: this;
82
+ readonly bgMagenta: this;
83
+ readonly bgCyan: this;
84
+ readonly bgWhite: this;
85
+ readonly bgBlackBright: this;
86
+ readonly bgRedBright: this;
87
+ readonly bgGreenBright: this;
88
+ readonly bgYellowBright: this;
89
+ readonly bgBlueBright: this;
90
+ readonly bgMagentaBright: this;
91
+ readonly bgCyanBright: this;
92
+ readonly bgWhiteBright: this;
93
+ }
94
+
95
+ declare const chalk: Chalk & { supportsColor: ColorSupport };
96
+
97
+ export default chalk
@@ -0,0 +1,861 @@
1
+ /* MIT license */
2
+ var cssKeywords = require('color-name');
3
+
4
+ // NOTE: conversions should only return primitive values (i.e. arrays, or
5
+ // values that give correct `typeof` results).
6
+ // do not use box values types (i.e. Number(), String(), etc.)
7
+
8
+ var reverseKeywords = {};
9
+ for (var key in cssKeywords) {
10
+ if (cssKeywords.hasOwnProperty(key)) {
11
+ reverseKeywords[cssKeywords[key]] = key;
12
+ }
13
+ }
14
+
15
+ var convert = module.exports = {
16
+ rgb: {channels: 3, labels: 'rgb'},
17
+ hsl: {channels: 3, labels: 'hsl'},
18
+ hsv: {channels: 3, labels: 'hsv'},
19
+ hwb: {channels: 3, labels: 'hwb'},
20
+ cmyk: {channels: 4, labels: 'cmyk'},
21
+ xyz: {channels: 3, labels: 'xyz'},
22
+ lab: {channels: 3, labels: 'lab'},
23
+ lch: {channels: 3, labels: 'lch'},
24
+ hex: {channels: 1, labels: ['hex']},
25
+ keyword: {channels: 1, labels: ['keyword']},
26
+ ansi16: {channels: 1, labels: ['ansi16']},
27
+ ansi256: {channels: 1, labels: ['ansi256']},
28
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
29
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
30
+ gray: {channels: 1, labels: ['gray']}
31
+ };
32
+
33
+ // hide .channels and .labels properties
34
+ for (var model in convert) {
35
+ if (convert.hasOwnProperty(model)) {
36
+ if (!('channels' in convert[model])) {
37
+ throw new Error('missing channels property: ' + model);
38
+ }
39
+
40
+ if (!('labels' in convert[model])) {
41
+ throw new Error('missing channel labels property: ' + model);
42
+ }
43
+
44
+ if (convert[model].labels.length !== convert[model].channels) {
45
+ throw new Error('channel and label counts mismatch: ' + model);
46
+ }
47
+
48
+ var channels = convert[model].channels;
49
+ var labels = convert[model].labels;
50
+ delete convert[model].channels;
51
+ delete convert[model].labels;
52
+ Object.defineProperty(convert[model], 'channels', {value: channels});
53
+ Object.defineProperty(convert[model], 'labels', {value: labels});
54
+ }
55
+ }
56
+
57
+ convert.rgb.hsl = function (rgb) {
58
+ var r = rgb[0] / 255;
59
+ var g = rgb[1] / 255;
60
+ var b = rgb[2] / 255;
61
+ var min = Math.min(r, g, b);
62
+ var max = Math.max(r, g, b);
63
+ var delta = max - min;
64
+ var h;
65
+ var s;
66
+ var l;
67
+
68
+ if (max === min) {
69
+ h = 0;
70
+ } else if (r === max) {
71
+ h = (g - b) / delta;
72
+ } else if (g === max) {
73
+ h = 2 + (b - r) / delta;
74
+ } else if (b === max) {
75
+ h = 4 + (r - g) / delta;
76
+ }
77
+
78
+ h = Math.min(h * 60, 360);
79
+
80
+ if (h < 0) {
81
+ h += 360;
82
+ }
83
+
84
+ l = (min + max) / 2;
85
+
86
+ if (max === min) {
87
+ s = 0;
88
+ } else if (l <= 0.5) {
89
+ s = delta / (max + min);
90
+ } else {
91
+ s = delta / (2 - max - min);
92
+ }
93
+
94
+ return [h, s * 100, l * 100];
95
+ };
96
+
97
+ convert.rgb.hsv = function (rgb) {
98
+ var r = rgb[0];
99
+ var g = rgb[1];
100
+ var b = rgb[2];
101
+ var min = Math.min(r, g, b);
102
+ var max = Math.max(r, g, b);
103
+ var delta = max - min;
104
+ var h;
105
+ var s;
106
+ var v;
107
+
108
+ if (max === 0) {
109
+ s = 0;
110
+ } else {
111
+ s = (delta / max * 1000) / 10;
112
+ }
113
+
114
+ if (max === min) {
115
+ h = 0;
116
+ } else if (r === max) {
117
+ h = (g - b) / delta;
118
+ } else if (g === max) {
119
+ h = 2 + (b - r) / delta;
120
+ } else if (b === max) {
121
+ h = 4 + (r - g) / delta;
122
+ }
123
+
124
+ h = Math.min(h * 60, 360);
125
+
126
+ if (h < 0) {
127
+ h += 360;
128
+ }
129
+
130
+ v = ((max / 255) * 1000) / 10;
131
+
132
+ return [h, s, v];
133
+ };
134
+
135
+ convert.rgb.hwb = function (rgb) {
136
+ var r = rgb[0];
137
+ var g = rgb[1];
138
+ var b = rgb[2];
139
+ var h = convert.rgb.hsl(rgb)[0];
140
+ var w = 1 / 255 * Math.min(r, Math.min(g, b));
141
+
142
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
143
+
144
+ return [h, w * 100, b * 100];
145
+ };
146
+
147
+ convert.rgb.cmyk = function (rgb) {
148
+ var r = rgb[0] / 255;
149
+ var g = rgb[1] / 255;
150
+ var b = rgb[2] / 255;
151
+ var c;
152
+ var m;
153
+ var y;
154
+ var k;
155
+
156
+ k = Math.min(1 - r, 1 - g, 1 - b);
157
+ c = (1 - r - k) / (1 - k) || 0;
158
+ m = (1 - g - k) / (1 - k) || 0;
159
+ y = (1 - b - k) / (1 - k) || 0;
160
+
161
+ return [c * 100, m * 100, y * 100, k * 100];
162
+ };
163
+
164
+ /**
165
+ * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
166
+ * */
167
+ function comparativeDistance(x, y) {
168
+ return (
169
+ Math.pow(x[0] - y[0], 2) +
170
+ Math.pow(x[1] - y[1], 2) +
171
+ Math.pow(x[2] - y[2], 2)
172
+ );
173
+ }
174
+
175
+ convert.rgb.keyword = function (rgb) {
176
+ var reversed = reverseKeywords[rgb];
177
+ if (reversed) {
178
+ return reversed;
179
+ }
180
+
181
+ var currentClosestDistance = Infinity;
182
+ var currentClosestKeyword;
183
+
184
+ for (var keyword in cssKeywords) {
185
+ if (cssKeywords.hasOwnProperty(keyword)) {
186
+ var value = cssKeywords[keyword];
187
+
188
+ // Compute comparative distance
189
+ var distance = comparativeDistance(rgb, value);
190
+
191
+ // Check if its less, if so set as closest
192
+ if (distance < currentClosestDistance) {
193
+ currentClosestDistance = distance;
194
+ currentClosestKeyword = keyword;
195
+ }
196
+ }
197
+ }
198
+
199
+ return currentClosestKeyword;
200
+ };
201
+
202
+ convert.keyword.rgb = function (keyword) {
203
+ return cssKeywords[keyword];
204
+ };
205
+
206
+ convert.rgb.xyz = function (rgb) {
207
+ var r = rgb[0] / 255;
208
+ var g = rgb[1] / 255;
209
+ var b = rgb[2] / 255;
210
+
211
+ // assume sRGB
212
+ r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
213
+ g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
214
+ b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
215
+
216
+ var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
217
+ var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
218
+ var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
219
+
220
+ return [x * 100, y * 100, z * 100];
221
+ };
222
+
223
+ convert.rgb.lab = function (rgb) {
224
+ var xyz = convert.rgb.xyz(rgb);
225
+ var x = xyz[0];
226
+ var y = xyz[1];
227
+ var z = xyz[2];
228
+ var l;
229
+ var a;
230
+ var b;
231
+
232
+ x /= 95.047;
233
+ y /= 100;
234
+ z /= 108.883;
235
+
236
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
237
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
238
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
239
+
240
+ l = (116 * y) - 16;
241
+ a = 500 * (x - y);
242
+ b = 200 * (y - z);
243
+
244
+ return [l, a, b];
245
+ };
246
+
247
+ convert.hsl.rgb = function (hsl) {
248
+ var h = hsl[0] / 360;
249
+ var s = hsl[1] / 100;
250
+ var l = hsl[2] / 100;
251
+ var t1;
252
+ var t2;
253
+ var t3;
254
+ var rgb;
255
+ var val;
256
+
257
+ if (s === 0) {
258
+ val = l * 255;
259
+ return [val, val, val];
260
+ }
261
+
262
+ if (l < 0.5) {
263
+ t2 = l * (1 + s);
264
+ } else {
265
+ t2 = l + s - l * s;
266
+ }
267
+
268
+ t1 = 2 * l - t2;
269
+
270
+ rgb = [0, 0, 0];
271
+ for (var i = 0; i < 3; i++) {
272
+ t3 = h + 1 / 3 * -(i - 1);
273
+ if (t3 < 0) {
274
+ t3++;
275
+ }
276
+ if (t3 > 1) {
277
+ t3--;
278
+ }
279
+
280
+ if (6 * t3 < 1) {
281
+ val = t1 + (t2 - t1) * 6 * t3;
282
+ } else if (2 * t3 < 1) {
283
+ val = t2;
284
+ } else if (3 * t3 < 2) {
285
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
286
+ } else {
287
+ val = t1;
288
+ }
289
+
290
+ rgb[i] = val * 255;
291
+ }
292
+
293
+ return rgb;
294
+ };
295
+
296
+ convert.hsl.hsv = function (hsl) {
297
+ var h = hsl[0];
298
+ var s = hsl[1] / 100;
299
+ var l = hsl[2] / 100;
300
+ var smin = s;
301
+ var lmin = Math.max(l, 0.01);
302
+ var sv;
303
+ var v;
304
+
305
+ l *= 2;
306
+ s *= (l <= 1) ? l : 2 - l;
307
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
308
+ v = (l + s) / 2;
309
+ sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
310
+
311
+ return [h, sv * 100, v * 100];
312
+ };
313
+
314
+ convert.hsv.rgb = function (hsv) {
315
+ var h = hsv[0] / 60;
316
+ var s = hsv[1] / 100;
317
+ var v = hsv[2] / 100;
318
+ var hi = Math.floor(h) % 6;
319
+
320
+ var f = h - Math.floor(h);
321
+ var p = 255 * v * (1 - s);
322
+ var q = 255 * v * (1 - (s * f));
323
+ var t = 255 * v * (1 - (s * (1 - f)));
324
+ v *= 255;
325
+
326
+ switch (hi) {
327
+ case 0:
328
+ return [v, t, p];
329
+ case 1:
330
+ return [q, v, p];
331
+ case 2:
332
+ return [p, v, t];
333
+ case 3:
334
+ return [p, q, v];
335
+ case 4:
336
+ return [t, p, v];
337
+ case 5:
338
+ return [v, p, q];
339
+ }
340
+ };
341
+
342
+ convert.hsv.hsl = function (hsv) {
343
+ var h = hsv[0];
344
+ var s = hsv[1] / 100;
345
+ var v = hsv[2] / 100;
346
+ var vmin = Math.max(v, 0.01);
347
+ var lmin;
348
+ var sl;
349
+ var l;
350
+
351
+ l = (2 - s) * v;
352
+ lmin = (2 - s) * vmin;
353
+ sl = s * vmin;
354
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
355
+ sl = sl || 0;
356
+ l /= 2;
357
+
358
+ return [h, sl * 100, l * 100];
359
+ };
360
+
361
+ // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
362
+ convert.hwb.rgb = function (hwb) {
363
+ var h = hwb[0] / 360;
364
+ var wh = hwb[1] / 100;
365
+ var bl = hwb[2] / 100;
366
+ var ratio = wh + bl;
367
+ var i;
368
+ var v;
369
+ var f;
370
+ var n;
371
+
372
+ // wh + bl cant be > 1
373
+ if (ratio > 1) {
374
+ wh /= ratio;
375
+ bl /= ratio;
376
+ }
377
+
378
+ i = Math.floor(6 * h);
379
+ v = 1 - bl;
380
+ f = 6 * h - i;
381
+
382
+ if ((i & 0x01) !== 0) {
383
+ f = 1 - f;
384
+ }
385
+
386
+ n = wh + f * (v - wh); // linear interpolation
387
+
388
+ var r;
389
+ var g;
390
+ var b;
391
+ switch (i) {
392
+ default:
393
+ case 6:
394
+ case 0: r = v; g = n; b = wh; break;
395
+ case 1: r = n; g = v; b = wh; break;
396
+ case 2: r = wh; g = v; b = n; break;
397
+ case 3: r = wh; g = n; b = v; break;
398
+ case 4: r = n; g = wh; b = v; break;
399
+ case 5: r = v; g = wh; b = n; break;
400
+ }
401
+
402
+ return [r * 255, g * 255, b * 255];
403
+ };
404
+
405
+ convert.cmyk.rgb = function (cmyk) {
406
+ var c = cmyk[0] / 100;
407
+ var m = cmyk[1] / 100;
408
+ var y = cmyk[2] / 100;
409
+ var k = cmyk[3] / 100;
410
+ var r;
411
+ var g;
412
+ var b;
413
+
414
+ r = 1 - Math.min(1, c * (1 - k) + k);
415
+ g = 1 - Math.min(1, m * (1 - k) + k);
416
+ b = 1 - Math.min(1, y * (1 - k) + k);
417
+
418
+ return [r * 255, g * 255, b * 255];
419
+ };
420
+
421
+ convert.xyz.rgb = function (xyz) {
422
+ var x = xyz[0] / 100;
423
+ var y = xyz[1] / 100;
424
+ var z = xyz[2] / 100;
425
+ var r;
426
+ var g;
427
+ var b;
428
+
429
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
430
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
431
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
432
+
433
+ // assume sRGB
434
+ r = r > 0.0031308
435
+ ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
436
+ : r * 12.92;
437
+
438
+ g = g > 0.0031308
439
+ ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
440
+ : g * 12.92;
441
+
442
+ b = b > 0.0031308
443
+ ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
444
+ : b * 12.92;
445
+
446
+ r = Math.min(Math.max(0, r), 1);
447
+ g = Math.min(Math.max(0, g), 1);
448
+ b = Math.min(Math.max(0, b), 1);
449
+
450
+ return [r * 255, g * 255, b * 255];
451
+ };
452
+
453
+ convert.xyz.lab = function (xyz) {
454
+ var x = xyz[0];
455
+ var y = xyz[1];
456
+ var z = xyz[2];
457
+ var l;
458
+ var a;
459
+ var b;
460
+
461
+ x /= 95.047;
462
+ y /= 100;
463
+ z /= 108.883;
464
+
465
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
466
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
467
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
468
+
469
+ l = (116 * y) - 16;
470
+ a = 500 * (x - y);
471
+ b = 200 * (y - z);
472
+
473
+ return [l, a, b];
474
+ };
475
+
476
+ convert.lab.xyz = function (lab) {
477
+ var l = lab[0];
478
+ var a = lab[1];
479
+ var b = lab[2];
480
+ var x;
481
+ var y;
482
+ var z;
483
+
484
+ y = (l + 16) / 116;
485
+ x = a / 500 + y;
486
+ z = y - b / 200;
487
+
488
+ var y2 = Math.pow(y, 3);
489
+ var x2 = Math.pow(x, 3);
490
+ var z2 = Math.pow(z, 3);
491
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
492
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
493
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
494
+
495
+ x *= 95.047;
496
+ y *= 100;
497
+ z *= 108.883;
498
+
499
+ return [x, y, z];
500
+ };
501
+
502
+ convert.lab.lch = function (lab) {
503
+ var l = lab[0];
504
+ var a = lab[1];
505
+ var b = lab[2];
506
+ var hr;
507
+ var h;
508
+ var c;
509
+
510
+ hr = Math.atan2(b, a);
511
+ h = hr * 360 / 2 / Math.PI;
512
+
513
+ if (h < 0) {
514
+ h += 360;
515
+ }
516
+
517
+ c = Math.sqrt(a * a + b * b);
518
+
519
+ return [l, c, h];
520
+ };
521
+
522
+ convert.lch.lab = function (lch) {
523
+ var l = lch[0];
524
+ var c = lch[1];
525
+ var h = lch[2];
526
+ var a;
527
+ var b;
528
+ var hr;
529
+
530
+ hr = h / 360 * 2 * Math.PI;
531
+ a = c * Math.cos(hr);
532
+ b = c * Math.sin(hr);
533
+
534
+ return [l, a, b];
535
+ };
536
+
537
+ convert.rgb.ansi16 = function (args) {
538
+ var r = args[0];
539
+ var g = args[1];
540
+ var b = args[2];
541
+ var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
542
+
543
+ value = Math.round(value / 50);
544
+
545
+ if (value === 0) {
546
+ return 30;
547
+ }
548
+
549
+ var ansi = 30
550
+ + ((Math.round(b / 255) << 2)
551
+ | (Math.round(g / 255) << 1)
552
+ | Math.round(r / 255));
553
+
554
+ if (value === 2) {
555
+ ansi += 60;
556
+ }
557
+
558
+ return ansi;
559
+ };
560
+
561
+ convert.hsv.ansi16 = function (args) {
562
+ // optimization here; we already know the value and don't need to get
563
+ // it converted for us.
564
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
565
+ };
566
+
567
+ convert.rgb.ansi256 = function (args) {
568
+ var r = args[0];
569
+ var g = args[1];
570
+ var b = args[2];
571
+
572
+ // we use the extended greyscale palette here, with the exception of
573
+ // black and white. normal palette only has 4 greyscale shades.
574
+ if (r === g && g === b) {
575
+ if (r < 8) {
576
+ return 16;
577
+ }
578
+
579
+ if (r > 248) {
580
+ return 231;
581
+ }
582
+
583
+ return Math.round(((r - 8) / 247) * 24) + 232;
584
+ }
585
+
586
+ var ansi = 16
587
+ + (36 * Math.round(r / 255 * 5))
588
+ + (6 * Math.round(g / 255 * 5))
589
+ + Math.round(b / 255 * 5);
590
+
591
+ return ansi;
592
+ };
593
+
594
+ convert.ansi16.rgb = function (args) {
595
+ var color = args % 10;
596
+
597
+ // handle greyscale
598
+ if (color === 0 || color === 7) {
599
+ if (args > 50) {
600
+ color += 3.5;
601
+ }
602
+
603
+ color = color / 10.5 * 255;
604
+
605
+ return [color, color, color];
606
+ }
607
+
608
+ var mult = (~~(args > 50) + 1) * 0.5;
609
+ var r = ((color & 1) * mult) * 255;
610
+ var g = (((color >> 1) & 1) * mult) * 255;
611
+ var b = (((color >> 2) & 1) * mult) * 255;
612
+
613
+ return [r, g, b];
614
+ };
615
+
616
+ convert.ansi256.rgb = function (args) {
617
+ // handle greyscale
618
+ if (args >= 232) {
619
+ var c = (args - 232) * 10 + 8;
620
+ return [c, c, c];
621
+ }
622
+
623
+ args -= 16;
624
+
625
+ var rem;
626
+ var r = Math.floor(args / 36) / 5 * 255;
627
+ var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
628
+ var b = (rem % 6) / 5 * 255;
629
+
630
+ return [r, g, b];
631
+ };
632
+
633
+ convert.rgb.hex = function (args) {
634
+ var integer = ((Math.round(args[0]) & 0xFF) << 16)
635
+ + ((Math.round(args[1]) & 0xFF) << 8)
636
+ + (Math.round(args[2]) & 0xFF);
637
+
638
+ var string = integer.toString(16).toUpperCase();
639
+ return '000000'.substring(string.length) + string;
640
+ };
641
+
642
+ convert.hex.rgb = function (args) {
643
+ var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
644
+ if (!match) {
645
+ return [0, 0, 0];
646
+ }
647
+
648
+ var colorString = match[0];
649
+
650
+ if (match[0].length === 3) {
651
+ colorString = colorString.split('').map(function (char) {
652
+ return char + char;
653
+ }).join('');
654
+ }
655
+
656
+ var integer = parseInt(colorString, 16);
657
+ var r = (integer >> 16) & 0xFF;
658
+ var g = (integer >> 8) & 0xFF;
659
+ var b = integer & 0xFF;
660
+
661
+ return [r, g, b];
662
+ };
663
+
664
+ convert.rgb.hcg = function (rgb) {
665
+ var r = rgb[0] / 255;
666
+ var g = rgb[1] / 255;
667
+ var b = rgb[2] / 255;
668
+ var max = Math.max(Math.max(r, g), b);
669
+ var min = Math.min(Math.min(r, g), b);
670
+ var chroma = (max - min);
671
+ var grayscale;
672
+ var hue;
673
+
674
+ if (chroma < 1) {
675
+ grayscale = min / (1 - chroma);
676
+ } else {
677
+ grayscale = 0;
678
+ }
679
+
680
+ if (chroma <= 0) {
681
+ hue = 0;
682
+ } else
683
+ if (max === r) {
684
+ hue = ((g - b) / chroma) % 6;
685
+ } else
686
+ if (max === g) {
687
+ hue = 2 + (b - r) / chroma;
688
+ } else {
689
+ hue = 4 + (r - g) / chroma + 4;
690
+ }
691
+
692
+ hue /= 6;
693
+ hue %= 1;
694
+
695
+ return [hue * 360, chroma * 100, grayscale * 100];
696
+ };
697
+
698
+ convert.hsl.hcg = function (hsl) {
699
+ var s = hsl[1] / 100;
700
+ var l = hsl[2] / 100;
701
+ var c = 1;
702
+ var f = 0;
703
+
704
+ if (l < 0.5) {
705
+ c = 2.0 * s * l;
706
+ } else {
707
+ c = 2.0 * s * (1.0 - l);
708
+ }
709
+
710
+ if (c < 1.0) {
711
+ f = (l - 0.5 * c) / (1.0 - c);
712
+ }
713
+
714
+ return [hsl[0], c * 100, f * 100];
715
+ };
716
+
717
+ convert.hsv.hcg = function (hsv) {
718
+ var s = hsv[1] / 100;
719
+ var v = hsv[2] / 100;
720
+
721
+ var c = s * v;
722
+ var f = 0;
723
+
724
+ if (c < 1.0) {
725
+ f = (v - c) / (1 - c);
726
+ }
727
+
728
+ return [hsv[0], c * 100, f * 100];
729
+ };
730
+
731
+ convert.hcg.rgb = function (hcg) {
732
+ var h = hcg[0] / 360;
733
+ var c = hcg[1] / 100;
734
+ var g = hcg[2] / 100;
735
+
736
+ if (c === 0.0) {
737
+ return [g * 255, g * 255, g * 255];
738
+ }
739
+
740
+ var pure = [0, 0, 0];
741
+ var hi = (h % 1) * 6;
742
+ var v = hi % 1;
743
+ var w = 1 - v;
744
+ var mg = 0;
745
+
746
+ switch (Math.floor(hi)) {
747
+ case 0:
748
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
749
+ case 1:
750
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
751
+ case 2:
752
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
753
+ case 3:
754
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
755
+ case 4:
756
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
757
+ default:
758
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
759
+ }
760
+
761
+ mg = (1.0 - c) * g;
762
+
763
+ return [
764
+ (c * pure[0] + mg) * 255,
765
+ (c * pure[1] + mg) * 255,
766
+ (c * pure[2] + mg) * 255
767
+ ];
768
+ };
769
+
770
+ convert.hcg.hsv = function (hcg) {
771
+ var c = hcg[1] / 100;
772
+ var g = hcg[2] / 100;
773
+
774
+ var v = c + g * (1.0 - c);
775
+ var f = 0;
776
+
777
+ if (v > 0.0) {
778
+ f = c / v;
779
+ }
780
+
781
+ return [hcg[0], f * 100, v * 100];
782
+ };
783
+
784
+ convert.hcg.hsl = function (hcg) {
785
+ var c = hcg[1] / 100;
786
+ var g = hcg[2] / 100;
787
+
788
+ var l = g * (1.0 - c) + 0.5 * c;
789
+ var s = 0;
790
+
791
+ if (l > 0.0 && l < 0.5) {
792
+ s = c / (2 * l);
793
+ } else
794
+ if (l >= 0.5 && l < 1.0) {
795
+ s = c / (2 * (1 - l));
796
+ }
797
+
798
+ return [hcg[0], s * 100, l * 100];
799
+ };
800
+
801
+ convert.hcg.hwb = function (hcg) {
802
+ var c = hcg[1] / 100;
803
+ var g = hcg[2] / 100;
804
+ var v = c + g * (1.0 - c);
805
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
806
+ };
807
+
808
+ convert.hwb.hcg = function (hwb) {
809
+ var w = hwb[1] / 100;
810
+ var b = hwb[2] / 100;
811
+ var v = 1 - b;
812
+ var c = v - w;
813
+ var g = 0;
814
+
815
+ if (c < 1) {
816
+ g = (v - c) / (1 - c);
817
+ }
818
+
819
+ return [hwb[0], c * 100, g * 100];
820
+ };
821
+
822
+ convert.apple.rgb = function (apple) {
823
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
824
+ };
825
+
826
+ convert.rgb.apple = function (rgb) {
827
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
828
+ };
829
+
830
+ convert.gray.rgb = function (args) {
831
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
832
+ };
833
+
834
+ convert.gray.hsl = convert.gray.hsv = function (args) {
835
+ return [0, 0, args[0]];
836
+ };
837
+
838
+ convert.gray.hwb = function (gray) {
839
+ return [0, 100, gray[0]];
840
+ };
841
+
842
+ convert.gray.cmyk = function (gray) {
843
+ return [0, 0, 0, gray[0]];
844
+ };
845
+
846
+ convert.gray.lab = function (gray) {
847
+ return [gray[0], 0, 0];
848
+ };
849
+
850
+ convert.gray.hex = function (gray) {
851
+ var val = Math.round(gray[0] / 100 * 255) & 0xFF;
852
+ var integer = (val << 16) + (val << 8) + val;
853
+
854
+ var string = integer.toString(16).toUpperCase();
855
+ return '000000'.substring(string.length) + string;
856
+ };
857
+
858
+ convert.rgb.gray = function (rgb) {
859
+ var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
860
+ return [val / 255 * 100];
861
+ };