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,40 @@
1
+ {
2
+ "name": "rollup-pluginutils",
3
+ "description": "Functionality commonly needed by Rollup plugins",
4
+ "version": "2.0.1",
5
+ "main": "dist/pluginutils.cjs.js",
6
+ "module": "dist/pluginutils.es.js",
7
+ "jsnext:main": "dist/pluginutils.es.js",
8
+ "files": [
9
+ "src",
10
+ "dist",
11
+ "README.md"
12
+ ],
13
+ "devDependencies": {
14
+ "eslint": "^3.12.2",
15
+ "mocha": "^3.2.0",
16
+ "rollup": "^0.40.0",
17
+ "rollup-plugin-buble": "^0.15.0"
18
+ },
19
+ "scripts": {
20
+ "test": "mocha",
21
+ "build": "rollup -c",
22
+ "pretest": "npm run build",
23
+ "prepublish": "npm test"
24
+ },
25
+ "dependencies": {
26
+ "estree-walker": "^0.3.0",
27
+ "micromatch": "^2.3.11"
28
+ },
29
+ "repository": "rollup/rollup-pluginutils",
30
+ "keywords": [
31
+ "rollup",
32
+ "utils"
33
+ ],
34
+ "author": "Rich Harris <richard.a.harris@gmail.com>",
35
+ "license": "MIT",
36
+ "bugs": {
37
+ "url": "https://github.com/rollup/rollup-pluginutils/issues"
38
+ },
39
+ "homepage": "https://github.com/rollup/rollup-pluginutils#readme"
40
+ }
@@ -0,0 +1,6 @@
1
+ import { extname } from 'path';
2
+
3
+ export default function addExtension ( filename, ext = '.js' ) {
4
+ if ( !extname( filename ) ) filename += ext;
5
+ return filename;
6
+ }
@@ -0,0 +1,147 @@
1
+ import { walk } from 'estree-walker';
2
+
3
+ const blockDeclarations = {
4
+ 'const': true,
5
+ 'let': true
6
+ };
7
+
8
+ const extractors = {
9
+ Identifier ( names, param ) {
10
+ names.push( param.name );
11
+ },
12
+
13
+ ObjectPattern ( names, param ) {
14
+ param.properties.forEach( prop => {
15
+ extractors[ prop.key.type ]( names, prop.key );
16
+ });
17
+ },
18
+
19
+ ArrayPattern ( names, param ) {
20
+ param.elements.forEach( element => {
21
+ if ( element ) extractors[ element.type ]( names, element );
22
+ });
23
+ },
24
+
25
+ RestElement ( names, param ) {
26
+ extractors[ param.argument.type ]( names, param.argument );
27
+ },
28
+
29
+ AssignmentPattern ( names, param ) {
30
+ return extractors[ param.left.type ]( names, param.left );
31
+ }
32
+ };
33
+
34
+ function extractNames ( param ) {
35
+ let names = [];
36
+
37
+ extractors[ param.type ]( names, param );
38
+ return names;
39
+ }
40
+
41
+ class Scope {
42
+ constructor ( options ) {
43
+ options = options || {};
44
+
45
+ this.parent = options.parent;
46
+ this.isBlockScope = !!options.block;
47
+
48
+ this.declarations = Object.create( null );
49
+
50
+ if ( options.params ) {
51
+ options.params.forEach( param => {
52
+ extractNames( param ).forEach( name => {
53
+ this.declarations[ name ] = true;
54
+ });
55
+ });
56
+ }
57
+ }
58
+
59
+ addDeclaration ( node, isBlockDeclaration, isVar ) {
60
+ if ( !isBlockDeclaration && this.isBlockScope ) {
61
+ // it's a `var` or function node, and this
62
+ // is a block scope, so we need to go up
63
+ this.parent.addDeclaration( node, isBlockDeclaration, isVar );
64
+ } else {
65
+ extractNames( node.id ).forEach( name => {
66
+ this.declarations[ name ] = true;
67
+ });
68
+ }
69
+ }
70
+
71
+ contains ( name ) {
72
+ return this.declarations[ name ] ||
73
+ ( this.parent ? this.parent.contains( name ) : false );
74
+ }
75
+ }
76
+
77
+
78
+ export default function attachScopes ( ast, propertyName = 'scope' ) {
79
+ let scope = new Scope();
80
+
81
+ walk( ast, {
82
+ enter ( node, parent ) {
83
+ // function foo () {...}
84
+ // class Foo {...}
85
+ if ( /(Function|Class)Declaration/.test( node.type ) ) {
86
+ scope.addDeclaration( node, false, false );
87
+ }
88
+
89
+ // var foo = 1
90
+ if ( node.type === 'VariableDeclaration' ) {
91
+ const isBlockDeclaration = blockDeclarations[ node.kind ];
92
+
93
+ node.declarations.forEach( declaration => {
94
+ scope.addDeclaration( declaration, isBlockDeclaration, true );
95
+ });
96
+ }
97
+
98
+ let newScope;
99
+
100
+ // create new function scope
101
+ if ( /Function/.test( node.type ) ) {
102
+ newScope = new Scope({
103
+ parent: scope,
104
+ block: false,
105
+ params: node.params
106
+ });
107
+
108
+ // named function expressions - the name is considered
109
+ // part of the function's scope
110
+ if ( node.type === 'FunctionExpression' && node.id ) {
111
+ newScope.addDeclaration( node, false, false );
112
+ }
113
+ }
114
+
115
+ // create new block scope
116
+ if ( node.type === 'BlockStatement' && !/Function/.test( parent.type ) ) {
117
+ newScope = new Scope({
118
+ parent: scope,
119
+ block: true
120
+ });
121
+ }
122
+
123
+ // catch clause has its own block scope
124
+ if ( node.type === 'CatchClause' ) {
125
+ newScope = new Scope({
126
+ parent: scope,
127
+ params: [ node.param ],
128
+ block: true
129
+ });
130
+ }
131
+
132
+ if ( newScope ) {
133
+ Object.defineProperty( node, propertyName, {
134
+ value: newScope,
135
+ configurable: true
136
+ });
137
+
138
+ scope = newScope;
139
+ }
140
+ },
141
+ leave ( node ) {
142
+ if ( node[ propertyName ] ) scope = scope.parent;
143
+ }
144
+ });
145
+
146
+ return scope;
147
+ }
@@ -0,0 +1,33 @@
1
+ import { resolve, sep } from 'path';
2
+ import mm from 'micromatch';
3
+ import ensureArray from './utils/ensureArray';
4
+
5
+ export default function createFilter ( include, exclude ) {
6
+ const getMatcher = id => ( isRegexp( id ) ? id : { test: mm.matcher( resolve( id ) ) } );
7
+ include = ensureArray( include ).map( getMatcher );
8
+ exclude = ensureArray( exclude ).map( getMatcher );
9
+
10
+ return function ( id ) {
11
+
12
+ if ( typeof id !== 'string' ) return false;
13
+ if ( /\0/.test( id ) ) return false;
14
+
15
+ id = id.split( sep ).join( '/' );
16
+
17
+ for ( let i = 0; i < exclude.length; ++i ) {
18
+ const matcher = exclude[i];
19
+ if ( matcher.test( id ) ) return false;
20
+ }
21
+
22
+ for ( let i = 0; i < include.length; ++i ) {
23
+ const matcher = include[i];
24
+ if ( matcher.test( id ) ) return true;
25
+ }
26
+
27
+ return !include.length;
28
+ };
29
+ }
30
+
31
+ function isRegexp ( val ) {
32
+ return val instanceof RegExp;
33
+ }
@@ -0,0 +1,4 @@
1
+ export { default as addExtension } from './addExtension';
2
+ export { default as attachScopes } from './attachScopes';
3
+ export { default as createFilter } from './createFilter';
4
+ export { default as makeLegalIdentifier } from './makeLegalIdentifier';
@@ -0,0 +1,15 @@
1
+ const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split( ' ' );
2
+ const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split( ' ' );
3
+
4
+ let blacklisted = Object.create( null );
5
+ reservedWords.concat( builtins ).forEach( word => blacklisted[ word ] = true );
6
+
7
+ export default function makeLegalIdentifier ( str ) {
8
+ str = str
9
+ .replace( /-(\w)/g, ( _, letter ) => letter.toUpperCase() )
10
+ .replace( /[^$_a-zA-Z0-9]/g, '_' );
11
+
12
+ if ( /\d/.test( str[0] ) || blacklisted[ str ] ) str = `_${str}`;
13
+
14
+ return str;
15
+ }
@@ -0,0 +1,5 @@
1
+ export default function ensureArray ( thing ) {
2
+ if ( Array.isArray( thing ) ) return thing;
3
+ if ( thing == undefined ) return [];
4
+ return [ thing ];
5
+ }
@@ -0,0 +1,4085 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
5
+
6
+ var path = require('path');
7
+ var path__default = _interopDefault(path);
8
+ var module$1 = _interopDefault(require('module'));
9
+ var os = _interopDefault(require('os'));
10
+ var rollup = require('../dist/rollup.js');
11
+ var assert = _interopDefault(require('assert'));
12
+ var events = _interopDefault(require('events'));
13
+ var fs = require('fs');
14
+ var fs__default = _interopDefault(fs);
15
+
16
+ var minimist = function (args, opts) {
17
+ if (!opts) opts = {};
18
+
19
+ var flags = { bools : {}, strings : {}, unknownFn: null };
20
+
21
+ if (typeof opts['unknown'] === 'function') {
22
+ flags.unknownFn = opts['unknown'];
23
+ }
24
+
25
+ if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
26
+ flags.allBools = true;
27
+ } else {
28
+ [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
29
+ flags.bools[key] = true;
30
+ });
31
+ }
32
+
33
+ var aliases = {};
34
+ Object.keys(opts.alias || {}).forEach(function (key) {
35
+ aliases[key] = [].concat(opts.alias[key]);
36
+ aliases[key].forEach(function (x) {
37
+ aliases[x] = [key].concat(aliases[key].filter(function (y) {
38
+ return x !== y;
39
+ }));
40
+ });
41
+ });
42
+
43
+ [].concat(opts.string).filter(Boolean).forEach(function (key) {
44
+ flags.strings[key] = true;
45
+ if (aliases[key]) {
46
+ flags.strings[aliases[key]] = true;
47
+ }
48
+ });
49
+
50
+ var defaults = opts['default'] || {};
51
+
52
+ var argv = { _ : [] };
53
+ Object.keys(flags.bools).forEach(function (key) {
54
+ setArg(key, defaults[key] === undefined ? false : defaults[key]);
55
+ });
56
+
57
+ var notFlags = [];
58
+
59
+ if (args.indexOf('--') !== -1) {
60
+ notFlags = args.slice(args.indexOf('--')+1);
61
+ args = args.slice(0, args.indexOf('--'));
62
+ }
63
+
64
+ function argDefined(key, arg) {
65
+ return (flags.allBools && /^--[^=]+$/.test(arg)) ||
66
+ flags.strings[key] || flags.bools[key] || aliases[key];
67
+ }
68
+
69
+ function setArg (key, val, arg) {
70
+ if (arg && flags.unknownFn && !argDefined(key, arg)) {
71
+ if (flags.unknownFn(arg) === false) return;
72
+ }
73
+
74
+ var value = !flags.strings[key] && isNumber(val)
75
+ ? Number(val) : val
76
+ ;
77
+ setKey(argv, key.split('.'), value);
78
+
79
+ (aliases[key] || []).forEach(function (x) {
80
+ setKey(argv, x.split('.'), value);
81
+ });
82
+ }
83
+
84
+ function setKey (obj, keys, value) {
85
+ var o = obj;
86
+ keys.slice(0,-1).forEach(function (key) {
87
+ if (o[key] === undefined) o[key] = {};
88
+ o = o[key];
89
+ });
90
+
91
+ var key = keys[keys.length - 1];
92
+ if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
93
+ o[key] = value;
94
+ }
95
+ else if (Array.isArray(o[key])) {
96
+ o[key].push(value);
97
+ }
98
+ else {
99
+ o[key] = [ o[key], value ];
100
+ }
101
+ }
102
+
103
+ function aliasIsBoolean(key) {
104
+ return aliases[key].some(function (x) {
105
+ return flags.bools[x];
106
+ });
107
+ }
108
+
109
+ for (var i = 0; i < args.length; i++) {
110
+ var arg = args[i];
111
+
112
+ if (/^--.+=/.test(arg)) {
113
+ // Using [\s\S] instead of . because js doesn't support the
114
+ // 'dotall' regex modifier. See:
115
+ // http://stackoverflow.com/a/1068308/13216
116
+ var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
117
+ var key = m[1];
118
+ var value = m[2];
119
+ if (flags.bools[key]) {
120
+ value = value !== 'false';
121
+ }
122
+ setArg(key, value, arg);
123
+ }
124
+ else if (/^--no-.+/.test(arg)) {
125
+ var key = arg.match(/^--no-(.+)/)[1];
126
+ setArg(key, false, arg);
127
+ }
128
+ else if (/^--.+/.test(arg)) {
129
+ var key = arg.match(/^--(.+)/)[1];
130
+ var next = args[i + 1];
131
+ if (next !== undefined && !/^-/.test(next)
132
+ && !flags.bools[key]
133
+ && !flags.allBools
134
+ && (aliases[key] ? !aliasIsBoolean(key) : true)) {
135
+ setArg(key, next, arg);
136
+ i++;
137
+ }
138
+ else if (/^(true|false)$/.test(next)) {
139
+ setArg(key, next === 'true', arg);
140
+ i++;
141
+ }
142
+ else {
143
+ setArg(key, flags.strings[key] ? '' : true, arg);
144
+ }
145
+ }
146
+ else if (/^-[^-]+/.test(arg)) {
147
+ var letters = arg.slice(1,-1).split('');
148
+
149
+ var broken = false;
150
+ for (var j = 0; j < letters.length; j++) {
151
+ var next = arg.slice(j+2);
152
+
153
+ if (next === '-') {
154
+ setArg(letters[j], next, arg);
155
+ continue;
156
+ }
157
+
158
+ if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
159
+ setArg(letters[j], next.split('=')[1], arg);
160
+ broken = true;
161
+ break;
162
+ }
163
+
164
+ if (/[A-Za-z]/.test(letters[j])
165
+ && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
166
+ setArg(letters[j], next, arg);
167
+ broken = true;
168
+ break;
169
+ }
170
+
171
+ if (letters[j+1] && letters[j+1].match(/\W/)) {
172
+ setArg(letters[j], arg.slice(j+2), arg);
173
+ broken = true;
174
+ break;
175
+ }
176
+ else {
177
+ setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
178
+ }
179
+ }
180
+
181
+ var key = arg.slice(-1)[0];
182
+ if (!broken && key !== '-') {
183
+ if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
184
+ && !flags.bools[key]
185
+ && (aliases[key] ? !aliasIsBoolean(key) : true)) {
186
+ setArg(key, args[i+1], arg);
187
+ i++;
188
+ }
189
+ else if (args[i+1] && /true|false/.test(args[i+1])) {
190
+ setArg(key, args[i+1] === 'true', arg);
191
+ i++;
192
+ }
193
+ else {
194
+ setArg(key, flags.strings[key] ? '' : true, arg);
195
+ }
196
+ }
197
+ }
198
+ else {
199
+ if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
200
+ argv._.push(
201
+ flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
202
+ );
203
+ }
204
+ if (opts.stopEarly) {
205
+ argv._.push.apply(argv._, args.slice(i + 1));
206
+ break;
207
+ }
208
+ }
209
+ }
210
+
211
+ Object.keys(defaults).forEach(function (key) {
212
+ if (!hasKey(argv, key.split('.'))) {
213
+ setKey(argv, key.split('.'), defaults[key]);
214
+
215
+ (aliases[key] || []).forEach(function (x) {
216
+ setKey(argv, x.split('.'), defaults[key]);
217
+ });
218
+ }
219
+ });
220
+
221
+ if (opts['--']) {
222
+ argv['--'] = new Array();
223
+ notFlags.forEach(function(key) {
224
+ argv['--'].push(key);
225
+ });
226
+ }
227
+ else {
228
+ notFlags.forEach(function(key) {
229
+ argv._.push(key);
230
+ });
231
+ }
232
+
233
+ return argv;
234
+ };
235
+
236
+ function hasKey (obj, keys) {
237
+ var o = obj;
238
+ keys.slice(0,-1).forEach(function (key) {
239
+ o = (o[key] || {});
240
+ });
241
+
242
+ var key = keys[keys.length - 1];
243
+ return key in o;
244
+ }
245
+
246
+ function isNumber (x) {
247
+ if (typeof x === 'number') return true;
248
+ if (/^0x[0-9a-f]+$/i.test(x)) return true;
249
+ return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
250
+ }
251
+
252
+ var help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-v, --version Show version number\n-h, --help Show this help message\n-c, --config Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-w, --watch Watch files in bundle and rebuild on changes\n-i, --input Input (alternative to <entry file>)\n-o, --file <output> Output (if absent, prints to stdout)\n-f, --format [es] Type of output (amd, cjs, es, iife, umd)\n-e, --external Comma-separate list of module IDs to exclude\n-g, --globals Comma-separate list of `module ID:Global` pairs\n Any module IDs defined here are added to external\n-n, --name Name for UMD export\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-l, --legacy Support IE8\n--amd.id ID for AMD module (default is anonymous)\n--amd.define Function to use in place of `define`\n--no-strict Don't emit a `\"use strict\";` in the generated modules.\n--no-indent Don't indent result\n--environment <values> Settings passed to config file (see example)\n--no-conflict Generate a noConflict method for UMD globals\n--no-treeshake Disable tree-shaking\n--silent Don't print warnings\n--intro Content to insert at top of bundle (inside wrapper)\n--outro Content to insert at end of bundle (inside wrapper)\n--banner Content to insert at top of bundle (outside wrapper)\n--footer Content to insert at end of bundle (outside wrapper)\n--no-interop Do not include interop block\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
253
+
254
+ var version = "0.57.1";
255
+
256
+ var modules = {};
257
+
258
+ var getModule = function(dir) {
259
+ var rootPath = dir ? path__default.resolve(dir) : process.cwd();
260
+ var rootName = path__default.join(rootPath, '@root');
261
+ var root = modules[rootName];
262
+ if (!root) {
263
+ root = new module$1(rootName);
264
+ root.filename = rootName;
265
+ root.paths = module$1._nodeModulePaths(rootPath);
266
+ modules[rootName] = root;
267
+ }
268
+ return root;
269
+ };
270
+
271
+ var requireRelative = function(requested, relativeTo) {
272
+ var root = getModule(relativeTo);
273
+ return root.require(requested);
274
+ };
275
+
276
+ requireRelative.resolve = function(requested, relativeTo) {
277
+ var root = getModule(relativeTo);
278
+ return module$1._resolveFilename(requested, root);
279
+ };
280
+
281
+ var requireRelative_1 = requireRelative;
282
+
283
+ function createCommonjsModule(fn, module) {
284
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
285
+ }
286
+
287
+ var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
288
+
289
+ var escapeStringRegexp = function (str) {
290
+ if (typeof str !== 'string') {
291
+ throw new TypeError('Expected a string');
292
+ }
293
+
294
+ return str.replace(matchOperatorsRe, '\\$&');
295
+ };
296
+
297
+ var colorName = {
298
+ "aliceblue": [240, 248, 255],
299
+ "antiquewhite": [250, 235, 215],
300
+ "aqua": [0, 255, 255],
301
+ "aquamarine": [127, 255, 212],
302
+ "azure": [240, 255, 255],
303
+ "beige": [245, 245, 220],
304
+ "bisque": [255, 228, 196],
305
+ "black": [0, 0, 0],
306
+ "blanchedalmond": [255, 235, 205],
307
+ "blue": [0, 0, 255],
308
+ "blueviolet": [138, 43, 226],
309
+ "brown": [165, 42, 42],
310
+ "burlywood": [222, 184, 135],
311
+ "cadetblue": [95, 158, 160],
312
+ "chartreuse": [127, 255, 0],
313
+ "chocolate": [210, 105, 30],
314
+ "coral": [255, 127, 80],
315
+ "cornflowerblue": [100, 149, 237],
316
+ "cornsilk": [255, 248, 220],
317
+ "crimson": [220, 20, 60],
318
+ "cyan": [0, 255, 255],
319
+ "darkblue": [0, 0, 139],
320
+ "darkcyan": [0, 139, 139],
321
+ "darkgoldenrod": [184, 134, 11],
322
+ "darkgray": [169, 169, 169],
323
+ "darkgreen": [0, 100, 0],
324
+ "darkgrey": [169, 169, 169],
325
+ "darkkhaki": [189, 183, 107],
326
+ "darkmagenta": [139, 0, 139],
327
+ "darkolivegreen": [85, 107, 47],
328
+ "darkorange": [255, 140, 0],
329
+ "darkorchid": [153, 50, 204],
330
+ "darkred": [139, 0, 0],
331
+ "darksalmon": [233, 150, 122],
332
+ "darkseagreen": [143, 188, 143],
333
+ "darkslateblue": [72, 61, 139],
334
+ "darkslategray": [47, 79, 79],
335
+ "darkslategrey": [47, 79, 79],
336
+ "darkturquoise": [0, 206, 209],
337
+ "darkviolet": [148, 0, 211],
338
+ "deeppink": [255, 20, 147],
339
+ "deepskyblue": [0, 191, 255],
340
+ "dimgray": [105, 105, 105],
341
+ "dimgrey": [105, 105, 105],
342
+ "dodgerblue": [30, 144, 255],
343
+ "firebrick": [178, 34, 34],
344
+ "floralwhite": [255, 250, 240],
345
+ "forestgreen": [34, 139, 34],
346
+ "fuchsia": [255, 0, 255],
347
+ "gainsboro": [220, 220, 220],
348
+ "ghostwhite": [248, 248, 255],
349
+ "gold": [255, 215, 0],
350
+ "goldenrod": [218, 165, 32],
351
+ "gray": [128, 128, 128],
352
+ "green": [0, 128, 0],
353
+ "greenyellow": [173, 255, 47],
354
+ "grey": [128, 128, 128],
355
+ "honeydew": [240, 255, 240],
356
+ "hotpink": [255, 105, 180],
357
+ "indianred": [205, 92, 92],
358
+ "indigo": [75, 0, 130],
359
+ "ivory": [255, 255, 240],
360
+ "khaki": [240, 230, 140],
361
+ "lavender": [230, 230, 250],
362
+ "lavenderblush": [255, 240, 245],
363
+ "lawngreen": [124, 252, 0],
364
+ "lemonchiffon": [255, 250, 205],
365
+ "lightblue": [173, 216, 230],
366
+ "lightcoral": [240, 128, 128],
367
+ "lightcyan": [224, 255, 255],
368
+ "lightgoldenrodyellow": [250, 250, 210],
369
+ "lightgray": [211, 211, 211],
370
+ "lightgreen": [144, 238, 144],
371
+ "lightgrey": [211, 211, 211],
372
+ "lightpink": [255, 182, 193],
373
+ "lightsalmon": [255, 160, 122],
374
+ "lightseagreen": [32, 178, 170],
375
+ "lightskyblue": [135, 206, 250],
376
+ "lightslategray": [119, 136, 153],
377
+ "lightslategrey": [119, 136, 153],
378
+ "lightsteelblue": [176, 196, 222],
379
+ "lightyellow": [255, 255, 224],
380
+ "lime": [0, 255, 0],
381
+ "limegreen": [50, 205, 50],
382
+ "linen": [250, 240, 230],
383
+ "magenta": [255, 0, 255],
384
+ "maroon": [128, 0, 0],
385
+ "mediumaquamarine": [102, 205, 170],
386
+ "mediumblue": [0, 0, 205],
387
+ "mediumorchid": [186, 85, 211],
388
+ "mediumpurple": [147, 112, 219],
389
+ "mediumseagreen": [60, 179, 113],
390
+ "mediumslateblue": [123, 104, 238],
391
+ "mediumspringgreen": [0, 250, 154],
392
+ "mediumturquoise": [72, 209, 204],
393
+ "mediumvioletred": [199, 21, 133],
394
+ "midnightblue": [25, 25, 112],
395
+ "mintcream": [245, 255, 250],
396
+ "mistyrose": [255, 228, 225],
397
+ "moccasin": [255, 228, 181],
398
+ "navajowhite": [255, 222, 173],
399
+ "navy": [0, 0, 128],
400
+ "oldlace": [253, 245, 230],
401
+ "olive": [128, 128, 0],
402
+ "olivedrab": [107, 142, 35],
403
+ "orange": [255, 165, 0],
404
+ "orangered": [255, 69, 0],
405
+ "orchid": [218, 112, 214],
406
+ "palegoldenrod": [238, 232, 170],
407
+ "palegreen": [152, 251, 152],
408
+ "paleturquoise": [175, 238, 238],
409
+ "palevioletred": [219, 112, 147],
410
+ "papayawhip": [255, 239, 213],
411
+ "peachpuff": [255, 218, 185],
412
+ "peru": [205, 133, 63],
413
+ "pink": [255, 192, 203],
414
+ "plum": [221, 160, 221],
415
+ "powderblue": [176, 224, 230],
416
+ "purple": [128, 0, 128],
417
+ "rebeccapurple": [102, 51, 153],
418
+ "red": [255, 0, 0],
419
+ "rosybrown": [188, 143, 143],
420
+ "royalblue": [65, 105, 225],
421
+ "saddlebrown": [139, 69, 19],
422
+ "salmon": [250, 128, 114],
423
+ "sandybrown": [244, 164, 96],
424
+ "seagreen": [46, 139, 87],
425
+ "seashell": [255, 245, 238],
426
+ "sienna": [160, 82, 45],
427
+ "silver": [192, 192, 192],
428
+ "skyblue": [135, 206, 235],
429
+ "slateblue": [106, 90, 205],
430
+ "slategray": [112, 128, 144],
431
+ "slategrey": [112, 128, 144],
432
+ "snow": [255, 250, 250],
433
+ "springgreen": [0, 255, 127],
434
+ "steelblue": [70, 130, 180],
435
+ "tan": [210, 180, 140],
436
+ "teal": [0, 128, 128],
437
+ "thistle": [216, 191, 216],
438
+ "tomato": [255, 99, 71],
439
+ "turquoise": [64, 224, 208],
440
+ "violet": [238, 130, 238],
441
+ "wheat": [245, 222, 179],
442
+ "white": [255, 255, 255],
443
+ "whitesmoke": [245, 245, 245],
444
+ "yellow": [255, 255, 0],
445
+ "yellowgreen": [154, 205, 50]
446
+ };
447
+
448
+ var conversions = createCommonjsModule(function (module) {
449
+ /* MIT license */
450
+
451
+
452
+ // NOTE: conversions should only return primitive values (i.e. arrays, or
453
+ // values that give correct `typeof` results).
454
+ // do not use box values types (i.e. Number(), String(), etc.)
455
+
456
+ var reverseKeywords = {};
457
+ for (var key in colorName) {
458
+ if (colorName.hasOwnProperty(key)) {
459
+ reverseKeywords[colorName[key]] = key;
460
+ }
461
+ }
462
+
463
+ var convert = module.exports = {
464
+ rgb: {channels: 3, labels: 'rgb'},
465
+ hsl: {channels: 3, labels: 'hsl'},
466
+ hsv: {channels: 3, labels: 'hsv'},
467
+ hwb: {channels: 3, labels: 'hwb'},
468
+ cmyk: {channels: 4, labels: 'cmyk'},
469
+ xyz: {channels: 3, labels: 'xyz'},
470
+ lab: {channels: 3, labels: 'lab'},
471
+ lch: {channels: 3, labels: 'lch'},
472
+ hex: {channels: 1, labels: ['hex']},
473
+ keyword: {channels: 1, labels: ['keyword']},
474
+ ansi16: {channels: 1, labels: ['ansi16']},
475
+ ansi256: {channels: 1, labels: ['ansi256']},
476
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
477
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
478
+ gray: {channels: 1, labels: ['gray']}
479
+ };
480
+
481
+ // hide .channels and .labels properties
482
+ for (var model in convert) {
483
+ if (convert.hasOwnProperty(model)) {
484
+ if (!('channels' in convert[model])) {
485
+ throw new Error('missing channels property: ' + model);
486
+ }
487
+
488
+ if (!('labels' in convert[model])) {
489
+ throw new Error('missing channel labels property: ' + model);
490
+ }
491
+
492
+ if (convert[model].labels.length !== convert[model].channels) {
493
+ throw new Error('channel and label counts mismatch: ' + model);
494
+ }
495
+
496
+ var channels = convert[model].channels;
497
+ var labels = convert[model].labels;
498
+ delete convert[model].channels;
499
+ delete convert[model].labels;
500
+ Object.defineProperty(convert[model], 'channels', {value: channels});
501
+ Object.defineProperty(convert[model], 'labels', {value: labels});
502
+ }
503
+ }
504
+
505
+ convert.rgb.hsl = function (rgb) {
506
+ var r = rgb[0] / 255;
507
+ var g = rgb[1] / 255;
508
+ var b = rgb[2] / 255;
509
+ var min = Math.min(r, g, b);
510
+ var max = Math.max(r, g, b);
511
+ var delta = max - min;
512
+ var h;
513
+ var s;
514
+ var l;
515
+
516
+ if (max === min) {
517
+ h = 0;
518
+ } else if (r === max) {
519
+ h = (g - b) / delta;
520
+ } else if (g === max) {
521
+ h = 2 + (b - r) / delta;
522
+ } else if (b === max) {
523
+ h = 4 + (r - g) / delta;
524
+ }
525
+
526
+ h = Math.min(h * 60, 360);
527
+
528
+ if (h < 0) {
529
+ h += 360;
530
+ }
531
+
532
+ l = (min + max) / 2;
533
+
534
+ if (max === min) {
535
+ s = 0;
536
+ } else if (l <= 0.5) {
537
+ s = delta / (max + min);
538
+ } else {
539
+ s = delta / (2 - max - min);
540
+ }
541
+
542
+ return [h, s * 100, l * 100];
543
+ };
544
+
545
+ convert.rgb.hsv = function (rgb) {
546
+ var r = rgb[0];
547
+ var g = rgb[1];
548
+ var b = rgb[2];
549
+ var min = Math.min(r, g, b);
550
+ var max = Math.max(r, g, b);
551
+ var delta = max - min;
552
+ var h;
553
+ var s;
554
+ var v;
555
+
556
+ if (max === 0) {
557
+ s = 0;
558
+ } else {
559
+ s = (delta / max * 1000) / 10;
560
+ }
561
+
562
+ if (max === min) {
563
+ h = 0;
564
+ } else if (r === max) {
565
+ h = (g - b) / delta;
566
+ } else if (g === max) {
567
+ h = 2 + (b - r) / delta;
568
+ } else if (b === max) {
569
+ h = 4 + (r - g) / delta;
570
+ }
571
+
572
+ h = Math.min(h * 60, 360);
573
+
574
+ if (h < 0) {
575
+ h += 360;
576
+ }
577
+
578
+ v = ((max / 255) * 1000) / 10;
579
+
580
+ return [h, s, v];
581
+ };
582
+
583
+ convert.rgb.hwb = function (rgb) {
584
+ var r = rgb[0];
585
+ var g = rgb[1];
586
+ var b = rgb[2];
587
+ var h = convert.rgb.hsl(rgb)[0];
588
+ var w = 1 / 255 * Math.min(r, Math.min(g, b));
589
+
590
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
591
+
592
+ return [h, w * 100, b * 100];
593
+ };
594
+
595
+ convert.rgb.cmyk = function (rgb) {
596
+ var r = rgb[0] / 255;
597
+ var g = rgb[1] / 255;
598
+ var b = rgb[2] / 255;
599
+ var c;
600
+ var m;
601
+ var y;
602
+ var k;
603
+
604
+ k = Math.min(1 - r, 1 - g, 1 - b);
605
+ c = (1 - r - k) / (1 - k) || 0;
606
+ m = (1 - g - k) / (1 - k) || 0;
607
+ y = (1 - b - k) / (1 - k) || 0;
608
+
609
+ return [c * 100, m * 100, y * 100, k * 100];
610
+ };
611
+
612
+ /**
613
+ * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
614
+ * */
615
+ function comparativeDistance(x, y) {
616
+ return (
617
+ Math.pow(x[0] - y[0], 2) +
618
+ Math.pow(x[1] - y[1], 2) +
619
+ Math.pow(x[2] - y[2], 2)
620
+ );
621
+ }
622
+
623
+ convert.rgb.keyword = function (rgb) {
624
+ var reversed = reverseKeywords[rgb];
625
+ if (reversed) {
626
+ return reversed;
627
+ }
628
+
629
+ var currentClosestDistance = Infinity;
630
+ var currentClosestKeyword;
631
+
632
+ for (var keyword in colorName) {
633
+ if (colorName.hasOwnProperty(keyword)) {
634
+ var value = colorName[keyword];
635
+
636
+ // Compute comparative distance
637
+ var distance = comparativeDistance(rgb, value);
638
+
639
+ // Check if its less, if so set as closest
640
+ if (distance < currentClosestDistance) {
641
+ currentClosestDistance = distance;
642
+ currentClosestKeyword = keyword;
643
+ }
644
+ }
645
+ }
646
+
647
+ return currentClosestKeyword;
648
+ };
649
+
650
+ convert.keyword.rgb = function (keyword) {
651
+ return colorName[keyword];
652
+ };
653
+
654
+ convert.rgb.xyz = function (rgb) {
655
+ var r = rgb[0] / 255;
656
+ var g = rgb[1] / 255;
657
+ var b = rgb[2] / 255;
658
+
659
+ // assume sRGB
660
+ r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
661
+ g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
662
+ b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
663
+
664
+ var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
665
+ var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
666
+ var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
667
+
668
+ return [x * 100, y * 100, z * 100];
669
+ };
670
+
671
+ convert.rgb.lab = function (rgb) {
672
+ var xyz = convert.rgb.xyz(rgb);
673
+ var x = xyz[0];
674
+ var y = xyz[1];
675
+ var z = xyz[2];
676
+ var l;
677
+ var a;
678
+ var b;
679
+
680
+ x /= 95.047;
681
+ y /= 100;
682
+ z /= 108.883;
683
+
684
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
685
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
686
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
687
+
688
+ l = (116 * y) - 16;
689
+ a = 500 * (x - y);
690
+ b = 200 * (y - z);
691
+
692
+ return [l, a, b];
693
+ };
694
+
695
+ convert.hsl.rgb = function (hsl) {
696
+ var h = hsl[0] / 360;
697
+ var s = hsl[1] / 100;
698
+ var l = hsl[2] / 100;
699
+ var t1;
700
+ var t2;
701
+ var t3;
702
+ var rgb;
703
+ var val;
704
+
705
+ if (s === 0) {
706
+ val = l * 255;
707
+ return [val, val, val];
708
+ }
709
+
710
+ if (l < 0.5) {
711
+ t2 = l * (1 + s);
712
+ } else {
713
+ t2 = l + s - l * s;
714
+ }
715
+
716
+ t1 = 2 * l - t2;
717
+
718
+ rgb = [0, 0, 0];
719
+ for (var i = 0; i < 3; i++) {
720
+ t3 = h + 1 / 3 * -(i - 1);
721
+ if (t3 < 0) {
722
+ t3++;
723
+ }
724
+ if (t3 > 1) {
725
+ t3--;
726
+ }
727
+
728
+ if (6 * t3 < 1) {
729
+ val = t1 + (t2 - t1) * 6 * t3;
730
+ } else if (2 * t3 < 1) {
731
+ val = t2;
732
+ } else if (3 * t3 < 2) {
733
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
734
+ } else {
735
+ val = t1;
736
+ }
737
+
738
+ rgb[i] = val * 255;
739
+ }
740
+
741
+ return rgb;
742
+ };
743
+
744
+ convert.hsl.hsv = function (hsl) {
745
+ var h = hsl[0];
746
+ var s = hsl[1] / 100;
747
+ var l = hsl[2] / 100;
748
+ var smin = s;
749
+ var lmin = Math.max(l, 0.01);
750
+ var sv;
751
+ var v;
752
+
753
+ l *= 2;
754
+ s *= (l <= 1) ? l : 2 - l;
755
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
756
+ v = (l + s) / 2;
757
+ sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
758
+
759
+ return [h, sv * 100, v * 100];
760
+ };
761
+
762
+ convert.hsv.rgb = function (hsv) {
763
+ var h = hsv[0] / 60;
764
+ var s = hsv[1] / 100;
765
+ var v = hsv[2] / 100;
766
+ var hi = Math.floor(h) % 6;
767
+
768
+ var f = h - Math.floor(h);
769
+ var p = 255 * v * (1 - s);
770
+ var q = 255 * v * (1 - (s * f));
771
+ var t = 255 * v * (1 - (s * (1 - f)));
772
+ v *= 255;
773
+
774
+ switch (hi) {
775
+ case 0:
776
+ return [v, t, p];
777
+ case 1:
778
+ return [q, v, p];
779
+ case 2:
780
+ return [p, v, t];
781
+ case 3:
782
+ return [p, q, v];
783
+ case 4:
784
+ return [t, p, v];
785
+ case 5:
786
+ return [v, p, q];
787
+ }
788
+ };
789
+
790
+ convert.hsv.hsl = function (hsv) {
791
+ var h = hsv[0];
792
+ var s = hsv[1] / 100;
793
+ var v = hsv[2] / 100;
794
+ var vmin = Math.max(v, 0.01);
795
+ var lmin;
796
+ var sl;
797
+ var l;
798
+
799
+ l = (2 - s) * v;
800
+ lmin = (2 - s) * vmin;
801
+ sl = s * vmin;
802
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
803
+ sl = sl || 0;
804
+ l /= 2;
805
+
806
+ return [h, sl * 100, l * 100];
807
+ };
808
+
809
+ // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
810
+ convert.hwb.rgb = function (hwb) {
811
+ var h = hwb[0] / 360;
812
+ var wh = hwb[1] / 100;
813
+ var bl = hwb[2] / 100;
814
+ var ratio = wh + bl;
815
+ var i;
816
+ var v;
817
+ var f;
818
+ var n;
819
+
820
+ // wh + bl cant be > 1
821
+ if (ratio > 1) {
822
+ wh /= ratio;
823
+ bl /= ratio;
824
+ }
825
+
826
+ i = Math.floor(6 * h);
827
+ v = 1 - bl;
828
+ f = 6 * h - i;
829
+
830
+ if ((i & 0x01) !== 0) {
831
+ f = 1 - f;
832
+ }
833
+
834
+ n = wh + f * (v - wh); // linear interpolation
835
+
836
+ var r;
837
+ var g;
838
+ var b;
839
+ switch (i) {
840
+ default:
841
+ case 6:
842
+ case 0: r = v; g = n; b = wh; break;
843
+ case 1: r = n; g = v; b = wh; break;
844
+ case 2: r = wh; g = v; b = n; break;
845
+ case 3: r = wh; g = n; b = v; break;
846
+ case 4: r = n; g = wh; b = v; break;
847
+ case 5: r = v; g = wh; b = n; break;
848
+ }
849
+
850
+ return [r * 255, g * 255, b * 255];
851
+ };
852
+
853
+ convert.cmyk.rgb = function (cmyk) {
854
+ var c = cmyk[0] / 100;
855
+ var m = cmyk[1] / 100;
856
+ var y = cmyk[2] / 100;
857
+ var k = cmyk[3] / 100;
858
+ var r;
859
+ var g;
860
+ var b;
861
+
862
+ r = 1 - Math.min(1, c * (1 - k) + k);
863
+ g = 1 - Math.min(1, m * (1 - k) + k);
864
+ b = 1 - Math.min(1, y * (1 - k) + k);
865
+
866
+ return [r * 255, g * 255, b * 255];
867
+ };
868
+
869
+ convert.xyz.rgb = function (xyz) {
870
+ var x = xyz[0] / 100;
871
+ var y = xyz[1] / 100;
872
+ var z = xyz[2] / 100;
873
+ var r;
874
+ var g;
875
+ var b;
876
+
877
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
878
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
879
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
880
+
881
+ // assume sRGB
882
+ r = r > 0.0031308
883
+ ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
884
+ : r * 12.92;
885
+
886
+ g = g > 0.0031308
887
+ ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
888
+ : g * 12.92;
889
+
890
+ b = b > 0.0031308
891
+ ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
892
+ : b * 12.92;
893
+
894
+ r = Math.min(Math.max(0, r), 1);
895
+ g = Math.min(Math.max(0, g), 1);
896
+ b = Math.min(Math.max(0, b), 1);
897
+
898
+ return [r * 255, g * 255, b * 255];
899
+ };
900
+
901
+ convert.xyz.lab = function (xyz) {
902
+ var x = xyz[0];
903
+ var y = xyz[1];
904
+ var z = xyz[2];
905
+ var l;
906
+ var a;
907
+ var b;
908
+
909
+ x /= 95.047;
910
+ y /= 100;
911
+ z /= 108.883;
912
+
913
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
914
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
915
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
916
+
917
+ l = (116 * y) - 16;
918
+ a = 500 * (x - y);
919
+ b = 200 * (y - z);
920
+
921
+ return [l, a, b];
922
+ };
923
+
924
+ convert.lab.xyz = function (lab) {
925
+ var l = lab[0];
926
+ var a = lab[1];
927
+ var b = lab[2];
928
+ var x;
929
+ var y;
930
+ var z;
931
+
932
+ y = (l + 16) / 116;
933
+ x = a / 500 + y;
934
+ z = y - b / 200;
935
+
936
+ var y2 = Math.pow(y, 3);
937
+ var x2 = Math.pow(x, 3);
938
+ var z2 = Math.pow(z, 3);
939
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
940
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
941
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
942
+
943
+ x *= 95.047;
944
+ y *= 100;
945
+ z *= 108.883;
946
+
947
+ return [x, y, z];
948
+ };
949
+
950
+ convert.lab.lch = function (lab) {
951
+ var l = lab[0];
952
+ var a = lab[1];
953
+ var b = lab[2];
954
+ var hr;
955
+ var h;
956
+ var c;
957
+
958
+ hr = Math.atan2(b, a);
959
+ h = hr * 360 / 2 / Math.PI;
960
+
961
+ if (h < 0) {
962
+ h += 360;
963
+ }
964
+
965
+ c = Math.sqrt(a * a + b * b);
966
+
967
+ return [l, c, h];
968
+ };
969
+
970
+ convert.lch.lab = function (lch) {
971
+ var l = lch[0];
972
+ var c = lch[1];
973
+ var h = lch[2];
974
+ var a;
975
+ var b;
976
+ var hr;
977
+
978
+ hr = h / 360 * 2 * Math.PI;
979
+ a = c * Math.cos(hr);
980
+ b = c * Math.sin(hr);
981
+
982
+ return [l, a, b];
983
+ };
984
+
985
+ convert.rgb.ansi16 = function (args) {
986
+ var r = args[0];
987
+ var g = args[1];
988
+ var b = args[2];
989
+ var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
990
+
991
+ value = Math.round(value / 50);
992
+
993
+ if (value === 0) {
994
+ return 30;
995
+ }
996
+
997
+ var ansi = 30
998
+ + ((Math.round(b / 255) << 2)
999
+ | (Math.round(g / 255) << 1)
1000
+ | Math.round(r / 255));
1001
+
1002
+ if (value === 2) {
1003
+ ansi += 60;
1004
+ }
1005
+
1006
+ return ansi;
1007
+ };
1008
+
1009
+ convert.hsv.ansi16 = function (args) {
1010
+ // optimization here; we already know the value and don't need to get
1011
+ // it converted for us.
1012
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
1013
+ };
1014
+
1015
+ convert.rgb.ansi256 = function (args) {
1016
+ var r = args[0];
1017
+ var g = args[1];
1018
+ var b = args[2];
1019
+
1020
+ // we use the extended greyscale palette here, with the exception of
1021
+ // black and white. normal palette only has 4 greyscale shades.
1022
+ if (r === g && g === b) {
1023
+ if (r < 8) {
1024
+ return 16;
1025
+ }
1026
+
1027
+ if (r > 248) {
1028
+ return 231;
1029
+ }
1030
+
1031
+ return Math.round(((r - 8) / 247) * 24) + 232;
1032
+ }
1033
+
1034
+ var ansi = 16
1035
+ + (36 * Math.round(r / 255 * 5))
1036
+ + (6 * Math.round(g / 255 * 5))
1037
+ + Math.round(b / 255 * 5);
1038
+
1039
+ return ansi;
1040
+ };
1041
+
1042
+ convert.ansi16.rgb = function (args) {
1043
+ var color = args % 10;
1044
+
1045
+ // handle greyscale
1046
+ if (color === 0 || color === 7) {
1047
+ if (args > 50) {
1048
+ color += 3.5;
1049
+ }
1050
+
1051
+ color = color / 10.5 * 255;
1052
+
1053
+ return [color, color, color];
1054
+ }
1055
+
1056
+ var mult = (~~(args > 50) + 1) * 0.5;
1057
+ var r = ((color & 1) * mult) * 255;
1058
+ var g = (((color >> 1) & 1) * mult) * 255;
1059
+ var b = (((color >> 2) & 1) * mult) * 255;
1060
+
1061
+ return [r, g, b];
1062
+ };
1063
+
1064
+ convert.ansi256.rgb = function (args) {
1065
+ // handle greyscale
1066
+ if (args >= 232) {
1067
+ var c = (args - 232) * 10 + 8;
1068
+ return [c, c, c];
1069
+ }
1070
+
1071
+ args -= 16;
1072
+
1073
+ var rem;
1074
+ var r = Math.floor(args / 36) / 5 * 255;
1075
+ var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
1076
+ var b = (rem % 6) / 5 * 255;
1077
+
1078
+ return [r, g, b];
1079
+ };
1080
+
1081
+ convert.rgb.hex = function (args) {
1082
+ var integer = ((Math.round(args[0]) & 0xFF) << 16)
1083
+ + ((Math.round(args[1]) & 0xFF) << 8)
1084
+ + (Math.round(args[2]) & 0xFF);
1085
+
1086
+ var string = integer.toString(16).toUpperCase();
1087
+ return '000000'.substring(string.length) + string;
1088
+ };
1089
+
1090
+ convert.hex.rgb = function (args) {
1091
+ var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1092
+ if (!match) {
1093
+ return [0, 0, 0];
1094
+ }
1095
+
1096
+ var colorString = match[0];
1097
+
1098
+ if (match[0].length === 3) {
1099
+ colorString = colorString.split('').map(function (char) {
1100
+ return char + char;
1101
+ }).join('');
1102
+ }
1103
+
1104
+ var integer = parseInt(colorString, 16);
1105
+ var r = (integer >> 16) & 0xFF;
1106
+ var g = (integer >> 8) & 0xFF;
1107
+ var b = integer & 0xFF;
1108
+
1109
+ return [r, g, b];
1110
+ };
1111
+
1112
+ convert.rgb.hcg = function (rgb) {
1113
+ var r = rgb[0] / 255;
1114
+ var g = rgb[1] / 255;
1115
+ var b = rgb[2] / 255;
1116
+ var max = Math.max(Math.max(r, g), b);
1117
+ var min = Math.min(Math.min(r, g), b);
1118
+ var chroma = (max - min);
1119
+ var grayscale;
1120
+ var hue;
1121
+
1122
+ if (chroma < 1) {
1123
+ grayscale = min / (1 - chroma);
1124
+ } else {
1125
+ grayscale = 0;
1126
+ }
1127
+
1128
+ if (chroma <= 0) {
1129
+ hue = 0;
1130
+ } else
1131
+ if (max === r) {
1132
+ hue = ((g - b) / chroma) % 6;
1133
+ } else
1134
+ if (max === g) {
1135
+ hue = 2 + (b - r) / chroma;
1136
+ } else {
1137
+ hue = 4 + (r - g) / chroma + 4;
1138
+ }
1139
+
1140
+ hue /= 6;
1141
+ hue %= 1;
1142
+
1143
+ return [hue * 360, chroma * 100, grayscale * 100];
1144
+ };
1145
+
1146
+ convert.hsl.hcg = function (hsl) {
1147
+ var s = hsl[1] / 100;
1148
+ var l = hsl[2] / 100;
1149
+ var c = 1;
1150
+ var f = 0;
1151
+
1152
+ if (l < 0.5) {
1153
+ c = 2.0 * s * l;
1154
+ } else {
1155
+ c = 2.0 * s * (1.0 - l);
1156
+ }
1157
+
1158
+ if (c < 1.0) {
1159
+ f = (l - 0.5 * c) / (1.0 - c);
1160
+ }
1161
+
1162
+ return [hsl[0], c * 100, f * 100];
1163
+ };
1164
+
1165
+ convert.hsv.hcg = function (hsv) {
1166
+ var s = hsv[1] / 100;
1167
+ var v = hsv[2] / 100;
1168
+
1169
+ var c = s * v;
1170
+ var f = 0;
1171
+
1172
+ if (c < 1.0) {
1173
+ f = (v - c) / (1 - c);
1174
+ }
1175
+
1176
+ return [hsv[0], c * 100, f * 100];
1177
+ };
1178
+
1179
+ convert.hcg.rgb = function (hcg) {
1180
+ var h = hcg[0] / 360;
1181
+ var c = hcg[1] / 100;
1182
+ var g = hcg[2] / 100;
1183
+
1184
+ if (c === 0.0) {
1185
+ return [g * 255, g * 255, g * 255];
1186
+ }
1187
+
1188
+ var pure = [0, 0, 0];
1189
+ var hi = (h % 1) * 6;
1190
+ var v = hi % 1;
1191
+ var w = 1 - v;
1192
+ var mg = 0;
1193
+
1194
+ switch (Math.floor(hi)) {
1195
+ case 0:
1196
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
1197
+ case 1:
1198
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
1199
+ case 2:
1200
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
1201
+ case 3:
1202
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
1203
+ case 4:
1204
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
1205
+ default:
1206
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
1207
+ }
1208
+
1209
+ mg = (1.0 - c) * g;
1210
+
1211
+ return [
1212
+ (c * pure[0] + mg) * 255,
1213
+ (c * pure[1] + mg) * 255,
1214
+ (c * pure[2] + mg) * 255
1215
+ ];
1216
+ };
1217
+
1218
+ convert.hcg.hsv = function (hcg) {
1219
+ var c = hcg[1] / 100;
1220
+ var g = hcg[2] / 100;
1221
+
1222
+ var v = c + g * (1.0 - c);
1223
+ var f = 0;
1224
+
1225
+ if (v > 0.0) {
1226
+ f = c / v;
1227
+ }
1228
+
1229
+ return [hcg[0], f * 100, v * 100];
1230
+ };
1231
+
1232
+ convert.hcg.hsl = function (hcg) {
1233
+ var c = hcg[1] / 100;
1234
+ var g = hcg[2] / 100;
1235
+
1236
+ var l = g * (1.0 - c) + 0.5 * c;
1237
+ var s = 0;
1238
+
1239
+ if (l > 0.0 && l < 0.5) {
1240
+ s = c / (2 * l);
1241
+ } else
1242
+ if (l >= 0.5 && l < 1.0) {
1243
+ s = c / (2 * (1 - l));
1244
+ }
1245
+
1246
+ return [hcg[0], s * 100, l * 100];
1247
+ };
1248
+
1249
+ convert.hcg.hwb = function (hcg) {
1250
+ var c = hcg[1] / 100;
1251
+ var g = hcg[2] / 100;
1252
+ var v = c + g * (1.0 - c);
1253
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
1254
+ };
1255
+
1256
+ convert.hwb.hcg = function (hwb) {
1257
+ var w = hwb[1] / 100;
1258
+ var b = hwb[2] / 100;
1259
+ var v = 1 - b;
1260
+ var c = v - w;
1261
+ var g = 0;
1262
+
1263
+ if (c < 1) {
1264
+ g = (v - c) / (1 - c);
1265
+ }
1266
+
1267
+ return [hwb[0], c * 100, g * 100];
1268
+ };
1269
+
1270
+ convert.apple.rgb = function (apple) {
1271
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
1272
+ };
1273
+
1274
+ convert.rgb.apple = function (rgb) {
1275
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
1276
+ };
1277
+
1278
+ convert.gray.rgb = function (args) {
1279
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1280
+ };
1281
+
1282
+ convert.gray.hsl = convert.gray.hsv = function (args) {
1283
+ return [0, 0, args[0]];
1284
+ };
1285
+
1286
+ convert.gray.hwb = function (gray) {
1287
+ return [0, 100, gray[0]];
1288
+ };
1289
+
1290
+ convert.gray.cmyk = function (gray) {
1291
+ return [0, 0, 0, gray[0]];
1292
+ };
1293
+
1294
+ convert.gray.lab = function (gray) {
1295
+ return [gray[0], 0, 0];
1296
+ };
1297
+
1298
+ convert.gray.hex = function (gray) {
1299
+ var val = Math.round(gray[0] / 100 * 255) & 0xFF;
1300
+ var integer = (val << 16) + (val << 8) + val;
1301
+
1302
+ var string = integer.toString(16).toUpperCase();
1303
+ return '000000'.substring(string.length) + string;
1304
+ };
1305
+
1306
+ convert.rgb.gray = function (rgb) {
1307
+ var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1308
+ return [val / 255 * 100];
1309
+ };
1310
+ });
1311
+ var conversions_1 = conversions.rgb;
1312
+ var conversions_2 = conversions.hsl;
1313
+ var conversions_3 = conversions.hsv;
1314
+ var conversions_4 = conversions.hwb;
1315
+ var conversions_5 = conversions.cmyk;
1316
+ var conversions_6 = conversions.xyz;
1317
+ var conversions_7 = conversions.lab;
1318
+ var conversions_8 = conversions.lch;
1319
+ var conversions_9 = conversions.hex;
1320
+ var conversions_10 = conversions.keyword;
1321
+ var conversions_11 = conversions.ansi16;
1322
+ var conversions_12 = conversions.ansi256;
1323
+ var conversions_13 = conversions.hcg;
1324
+ var conversions_14 = conversions.apple;
1325
+ var conversions_15 = conversions.gray;
1326
+
1327
+ /*
1328
+ this function routes a model to all other models.
1329
+
1330
+ all functions that are routed have a property `.conversion` attached
1331
+ to the returned synthetic function. This property is an array
1332
+ of strings, each with the steps in between the 'from' and 'to'
1333
+ color models (inclusive).
1334
+
1335
+ conversions that are not possible simply are not included.
1336
+ */
1337
+
1338
+ function buildGraph() {
1339
+ var graph = {};
1340
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
1341
+ var models = Object.keys(conversions);
1342
+
1343
+ for (var len = models.length, i = 0; i < len; i++) {
1344
+ graph[models[i]] = {
1345
+ // http://jsperf.com/1-vs-infinity
1346
+ // micro-opt, but this is simple.
1347
+ distance: -1,
1348
+ parent: null
1349
+ };
1350
+ }
1351
+
1352
+ return graph;
1353
+ }
1354
+
1355
+ // https://en.wikipedia.org/wiki/Breadth-first_search
1356
+ function deriveBFS(fromModel) {
1357
+ var graph = buildGraph();
1358
+ var queue = [fromModel]; // unshift -> queue -> pop
1359
+
1360
+ graph[fromModel].distance = 0;
1361
+
1362
+ while (queue.length) {
1363
+ var current = queue.pop();
1364
+ var adjacents = Object.keys(conversions[current]);
1365
+
1366
+ for (var len = adjacents.length, i = 0; i < len; i++) {
1367
+ var adjacent = adjacents[i];
1368
+ var node = graph[adjacent];
1369
+
1370
+ if (node.distance === -1) {
1371
+ node.distance = graph[current].distance + 1;
1372
+ node.parent = current;
1373
+ queue.unshift(adjacent);
1374
+ }
1375
+ }
1376
+ }
1377
+
1378
+ return graph;
1379
+ }
1380
+
1381
+ function link(from, to) {
1382
+ return function (args) {
1383
+ return to(from(args));
1384
+ };
1385
+ }
1386
+
1387
+ function wrapConversion(toModel, graph) {
1388
+ var path$$1 = [graph[toModel].parent, toModel];
1389
+ var fn = conversions[graph[toModel].parent][toModel];
1390
+
1391
+ var cur = graph[toModel].parent;
1392
+ while (graph[cur].parent) {
1393
+ path$$1.unshift(graph[cur].parent);
1394
+ fn = link(conversions[graph[cur].parent][cur], fn);
1395
+ cur = graph[cur].parent;
1396
+ }
1397
+
1398
+ fn.conversion = path$$1;
1399
+ return fn;
1400
+ }
1401
+
1402
+ var route = function (fromModel) {
1403
+ var graph = deriveBFS(fromModel);
1404
+ var conversion = {};
1405
+
1406
+ var models = Object.keys(graph);
1407
+ for (var len = models.length, i = 0; i < len; i++) {
1408
+ var toModel = models[i];
1409
+ var node = graph[toModel];
1410
+
1411
+ if (node.parent === null) {
1412
+ // no possible conversion, or this node is the source model.
1413
+ continue;
1414
+ }
1415
+
1416
+ conversion[toModel] = wrapConversion(toModel, graph);
1417
+ }
1418
+
1419
+ return conversion;
1420
+ };
1421
+
1422
+ var convert = {};
1423
+
1424
+ var models = Object.keys(conversions);
1425
+
1426
+ function wrapRaw(fn) {
1427
+ var wrappedFn = function (args) {
1428
+ if (args === undefined || args === null) {
1429
+ return args;
1430
+ }
1431
+
1432
+ if (arguments.length > 1) {
1433
+ args = Array.prototype.slice.call(arguments);
1434
+ }
1435
+
1436
+ return fn(args);
1437
+ };
1438
+
1439
+ // preserve .conversion property if there is one
1440
+ if ('conversion' in fn) {
1441
+ wrappedFn.conversion = fn.conversion;
1442
+ }
1443
+
1444
+ return wrappedFn;
1445
+ }
1446
+
1447
+ function wrapRounded(fn) {
1448
+ var wrappedFn = function (args) {
1449
+ if (args === undefined || args === null) {
1450
+ return args;
1451
+ }
1452
+
1453
+ if (arguments.length > 1) {
1454
+ args = Array.prototype.slice.call(arguments);
1455
+ }
1456
+
1457
+ var result = fn(args);
1458
+
1459
+ // we're assuming the result is an array here.
1460
+ // see notice in conversions.js; don't use box types
1461
+ // in conversion functions.
1462
+ if (typeof result === 'object') {
1463
+ for (var len = result.length, i = 0; i < len; i++) {
1464
+ result[i] = Math.round(result[i]);
1465
+ }
1466
+ }
1467
+
1468
+ return result;
1469
+ };
1470
+
1471
+ // preserve .conversion property if there is one
1472
+ if ('conversion' in fn) {
1473
+ wrappedFn.conversion = fn.conversion;
1474
+ }
1475
+
1476
+ return wrappedFn;
1477
+ }
1478
+
1479
+ models.forEach(function (fromModel) {
1480
+ convert[fromModel] = {};
1481
+
1482
+ Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
1483
+ Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
1484
+
1485
+ var routes = route(fromModel);
1486
+ var routeModels = Object.keys(routes);
1487
+
1488
+ routeModels.forEach(function (toModel) {
1489
+ var fn = routes[toModel];
1490
+
1491
+ convert[fromModel][toModel] = wrapRounded(fn);
1492
+ convert[fromModel][toModel].raw = wrapRaw(fn);
1493
+ });
1494
+ });
1495
+
1496
+ var colorConvert = convert;
1497
+
1498
+ var ansiStyles = createCommonjsModule(function (module) {
1499
+
1500
+
1501
+ const wrapAnsi16 = (fn, offset) => function () {
1502
+ const code = fn.apply(colorConvert, arguments);
1503
+ return `\u001B[${code + offset}m`;
1504
+ };
1505
+
1506
+ const wrapAnsi256 = (fn, offset) => function () {
1507
+ const code = fn.apply(colorConvert, arguments);
1508
+ return `\u001B[${38 + offset};5;${code}m`;
1509
+ };
1510
+
1511
+ const wrapAnsi16m = (fn, offset) => function () {
1512
+ const rgb = fn.apply(colorConvert, arguments);
1513
+ return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1514
+ };
1515
+
1516
+ function assembleStyles() {
1517
+ const codes = new Map();
1518
+ const styles = {
1519
+ modifier: {
1520
+ reset: [0, 0],
1521
+ // 21 isn't widely supported and 22 does the same thing
1522
+ bold: [1, 22],
1523
+ dim: [2, 22],
1524
+ italic: [3, 23],
1525
+ underline: [4, 24],
1526
+ inverse: [7, 27],
1527
+ hidden: [8, 28],
1528
+ strikethrough: [9, 29]
1529
+ },
1530
+ color: {
1531
+ black: [30, 39],
1532
+ red: [31, 39],
1533
+ green: [32, 39],
1534
+ yellow: [33, 39],
1535
+ blue: [34, 39],
1536
+ magenta: [35, 39],
1537
+ cyan: [36, 39],
1538
+ white: [37, 39],
1539
+ gray: [90, 39],
1540
+
1541
+ // Bright color
1542
+ redBright: [91, 39],
1543
+ greenBright: [92, 39],
1544
+ yellowBright: [93, 39],
1545
+ blueBright: [94, 39],
1546
+ magentaBright: [95, 39],
1547
+ cyanBright: [96, 39],
1548
+ whiteBright: [97, 39]
1549
+ },
1550
+ bgColor: {
1551
+ bgBlack: [40, 49],
1552
+ bgRed: [41, 49],
1553
+ bgGreen: [42, 49],
1554
+ bgYellow: [43, 49],
1555
+ bgBlue: [44, 49],
1556
+ bgMagenta: [45, 49],
1557
+ bgCyan: [46, 49],
1558
+ bgWhite: [47, 49],
1559
+
1560
+ // Bright color
1561
+ bgBlackBright: [100, 49],
1562
+ bgRedBright: [101, 49],
1563
+ bgGreenBright: [102, 49],
1564
+ bgYellowBright: [103, 49],
1565
+ bgBlueBright: [104, 49],
1566
+ bgMagentaBright: [105, 49],
1567
+ bgCyanBright: [106, 49],
1568
+ bgWhiteBright: [107, 49]
1569
+ }
1570
+ };
1571
+
1572
+ // Fix humans
1573
+ styles.color.grey = styles.color.gray;
1574
+
1575
+ for (const groupName of Object.keys(styles)) {
1576
+ const group = styles[groupName];
1577
+
1578
+ for (const styleName of Object.keys(group)) {
1579
+ const style = group[styleName];
1580
+
1581
+ styles[styleName] = {
1582
+ open: `\u001B[${style[0]}m`,
1583
+ close: `\u001B[${style[1]}m`
1584
+ };
1585
+
1586
+ group[styleName] = styles[styleName];
1587
+
1588
+ codes.set(style[0], style[1]);
1589
+ }
1590
+
1591
+ Object.defineProperty(styles, groupName, {
1592
+ value: group,
1593
+ enumerable: false
1594
+ });
1595
+
1596
+ Object.defineProperty(styles, 'codes', {
1597
+ value: codes,
1598
+ enumerable: false
1599
+ });
1600
+ }
1601
+
1602
+ const ansi2ansi = n => n;
1603
+ const rgb2rgb = (r, g, b) => [r, g, b];
1604
+
1605
+ styles.color.close = '\u001B[39m';
1606
+ styles.bgColor.close = '\u001B[49m';
1607
+
1608
+ styles.color.ansi = {
1609
+ ansi: wrapAnsi16(ansi2ansi, 0)
1610
+ };
1611
+ styles.color.ansi256 = {
1612
+ ansi256: wrapAnsi256(ansi2ansi, 0)
1613
+ };
1614
+ styles.color.ansi16m = {
1615
+ rgb: wrapAnsi16m(rgb2rgb, 0)
1616
+ };
1617
+
1618
+ styles.bgColor.ansi = {
1619
+ ansi: wrapAnsi16(ansi2ansi, 10)
1620
+ };
1621
+ styles.bgColor.ansi256 = {
1622
+ ansi256: wrapAnsi256(ansi2ansi, 10)
1623
+ };
1624
+ styles.bgColor.ansi16m = {
1625
+ rgb: wrapAnsi16m(rgb2rgb, 10)
1626
+ };
1627
+
1628
+ for (let key of Object.keys(colorConvert)) {
1629
+ if (typeof colorConvert[key] !== 'object') {
1630
+ continue;
1631
+ }
1632
+
1633
+ const suite = colorConvert[key];
1634
+
1635
+ if (key === 'ansi16') {
1636
+ key = 'ansi';
1637
+ }
1638
+
1639
+ if ('ansi16' in suite) {
1640
+ styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
1641
+ styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
1642
+ }
1643
+
1644
+ if ('ansi256' in suite) {
1645
+ styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
1646
+ styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
1647
+ }
1648
+
1649
+ if ('rgb' in suite) {
1650
+ styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
1651
+ styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
1652
+ }
1653
+ }
1654
+
1655
+ return styles;
1656
+ }
1657
+
1658
+ // Make the export immutable
1659
+ Object.defineProperty(module, 'exports', {
1660
+ enumerable: true,
1661
+ get: assembleStyles
1662
+ });
1663
+ });
1664
+
1665
+ var hasFlag = (flag, argv) => {
1666
+ argv = argv || process.argv;
1667
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
1668
+ const pos = argv.indexOf(prefix + flag);
1669
+ const terminatorPos = argv.indexOf('--');
1670
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
1671
+ };
1672
+
1673
+ const env = process.env;
1674
+
1675
+ let forceColor;
1676
+ if (hasFlag('no-color') ||
1677
+ hasFlag('no-colors') ||
1678
+ hasFlag('color=false')) {
1679
+ forceColor = false;
1680
+ } else if (hasFlag('color') ||
1681
+ hasFlag('colors') ||
1682
+ hasFlag('color=true') ||
1683
+ hasFlag('color=always')) {
1684
+ forceColor = true;
1685
+ }
1686
+ if ('FORCE_COLOR' in env) {
1687
+ forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
1688
+ }
1689
+
1690
+ function translateLevel(level) {
1691
+ if (level === 0) {
1692
+ return false;
1693
+ }
1694
+
1695
+ return {
1696
+ level,
1697
+ hasBasic: true,
1698
+ has256: level >= 2,
1699
+ has16m: level >= 3
1700
+ };
1701
+ }
1702
+
1703
+ function supportsColor(stream) {
1704
+ if (forceColor === false) {
1705
+ return 0;
1706
+ }
1707
+
1708
+ if (hasFlag('color=16m') ||
1709
+ hasFlag('color=full') ||
1710
+ hasFlag('color=truecolor')) {
1711
+ return 3;
1712
+ }
1713
+
1714
+ if (hasFlag('color=256')) {
1715
+ return 2;
1716
+ }
1717
+
1718
+ if (stream && !stream.isTTY && forceColor !== true) {
1719
+ // VS code debugger doesn't have isTTY set
1720
+ if (env.VSCODE_PID) {
1721
+ return 1;
1722
+ }
1723
+ return 0;
1724
+ }
1725
+
1726
+ const min = forceColor ? 1 : 0;
1727
+
1728
+ if (process.platform === 'win32') {
1729
+ // Node.js 7.5.0 is the first version of Node.js to include a patch to
1730
+ // libuv that enables 256 color output on Windows. Anything earlier and it
1731
+ // won't work. However, here we target Node.js 8 at minimum as it is an LTS
1732
+ // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
1733
+ // release that supports 256 colors. Windows 10 build 14931 is the first release
1734
+ // that supports 16m/TrueColor.
1735
+ const osRelease = os.release().split('.');
1736
+ if (
1737
+ Number(process.versions.node.split('.')[0]) >= 8 &&
1738
+ Number(osRelease[0]) >= 10 &&
1739
+ Number(osRelease[2]) >= 10586
1740
+ ) {
1741
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
1742
+ }
1743
+
1744
+ return 1;
1745
+ }
1746
+
1747
+ if ('CI' in env) {
1748
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
1749
+ return 1;
1750
+ }
1751
+
1752
+ return min;
1753
+ }
1754
+
1755
+ if ('TEAMCITY_VERSION' in env) {
1756
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
1757
+ }
1758
+
1759
+ if (env.COLORTERM === 'truecolor') {
1760
+ return 3;
1761
+ }
1762
+
1763
+ if ('TERM_PROGRAM' in env) {
1764
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
1765
+
1766
+ switch (env.TERM_PROGRAM) {
1767
+ case 'iTerm.app':
1768
+ return version >= 3 ? 3 : 2;
1769
+ case 'Apple_Terminal':
1770
+ return 2;
1771
+ // No default
1772
+ }
1773
+ }
1774
+
1775
+ if (/-256(color)?$/i.test(env.TERM)) {
1776
+ return 2;
1777
+ }
1778
+
1779
+ if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
1780
+ return 1;
1781
+ }
1782
+
1783
+ if ('COLORTERM' in env) {
1784
+ return 1;
1785
+ }
1786
+
1787
+ if (env.TERM === 'dumb') {
1788
+ return min;
1789
+ }
1790
+
1791
+ return min;
1792
+ }
1793
+
1794
+ function getSupportLevel(stream) {
1795
+ const level = supportsColor(stream);
1796
+ return translateLevel(level);
1797
+ }
1798
+
1799
+ var supportsColor_1 = {
1800
+ supportsColor: getSupportLevel,
1801
+ stdout: getSupportLevel(process.stdout),
1802
+ stderr: getSupportLevel(process.stderr)
1803
+ };
1804
+
1805
+ const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
1806
+ const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
1807
+ const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
1808
+ const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
1809
+
1810
+ const ESCAPES = new Map([
1811
+ ['n', '\n'],
1812
+ ['r', '\r'],
1813
+ ['t', '\t'],
1814
+ ['b', '\b'],
1815
+ ['f', '\f'],
1816
+ ['v', '\v'],
1817
+ ['0', '\0'],
1818
+ ['\\', '\\'],
1819
+ ['e', '\u001B'],
1820
+ ['a', '\u0007']
1821
+ ]);
1822
+
1823
+ function unescape(c) {
1824
+ if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
1825
+ return String.fromCharCode(parseInt(c.slice(1), 16));
1826
+ }
1827
+
1828
+ return ESCAPES.get(c) || c;
1829
+ }
1830
+
1831
+ function parseArguments(name, args) {
1832
+ const results = [];
1833
+ const chunks = args.trim().split(/\s*,\s*/g);
1834
+ let matches;
1835
+
1836
+ for (const chunk of chunks) {
1837
+ if (!isNaN(chunk)) {
1838
+ results.push(Number(chunk));
1839
+ } else if ((matches = chunk.match(STRING_REGEX))) {
1840
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
1841
+ } else {
1842
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
1843
+ }
1844
+ }
1845
+
1846
+ return results;
1847
+ }
1848
+
1849
+ function parseStyle(style) {
1850
+ STYLE_REGEX.lastIndex = 0;
1851
+
1852
+ const results = [];
1853
+ let matches;
1854
+
1855
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
1856
+ const name = matches[1];
1857
+
1858
+ if (matches[2]) {
1859
+ const args = parseArguments(name, matches[2]);
1860
+ results.push([name].concat(args));
1861
+ } else {
1862
+ results.push([name]);
1863
+ }
1864
+ }
1865
+
1866
+ return results;
1867
+ }
1868
+
1869
+ function buildStyle(chalk, styles) {
1870
+ const enabled = {};
1871
+
1872
+ for (const layer of styles) {
1873
+ for (const style of layer.styles) {
1874
+ enabled[style[0]] = layer.inverse ? null : style.slice(1);
1875
+ }
1876
+ }
1877
+
1878
+ let current = chalk;
1879
+ for (const styleName of Object.keys(enabled)) {
1880
+ if (Array.isArray(enabled[styleName])) {
1881
+ if (!(styleName in current)) {
1882
+ throw new Error(`Unknown Chalk style: ${styleName}`);
1883
+ }
1884
+
1885
+ if (enabled[styleName].length > 0) {
1886
+ current = current[styleName].apply(current, enabled[styleName]);
1887
+ } else {
1888
+ current = current[styleName];
1889
+ }
1890
+ }
1891
+ }
1892
+
1893
+ return current;
1894
+ }
1895
+
1896
+ var templates = (chalk, tmp) => {
1897
+ const styles = [];
1898
+ const chunks = [];
1899
+ let chunk = [];
1900
+
1901
+ // eslint-disable-next-line max-params
1902
+ tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
1903
+ if (escapeChar) {
1904
+ chunk.push(unescape(escapeChar));
1905
+ } else if (style) {
1906
+ const str = chunk.join('');
1907
+ chunk = [];
1908
+ chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
1909
+ styles.push({inverse, styles: parseStyle(style)});
1910
+ } else if (close) {
1911
+ if (styles.length === 0) {
1912
+ throw new Error('Found extraneous } in Chalk template literal');
1913
+ }
1914
+
1915
+ chunks.push(buildStyle(chalk, styles)(chunk.join('')));
1916
+ chunk = [];
1917
+ styles.pop();
1918
+ } else {
1919
+ chunk.push(chr);
1920
+ }
1921
+ });
1922
+
1923
+ chunks.push(chunk.join(''));
1924
+
1925
+ if (styles.length > 0) {
1926
+ const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
1927
+ throw new Error(errMsg);
1928
+ }
1929
+
1930
+ return chunks.join('');
1931
+ };
1932
+
1933
+ var chalk = createCommonjsModule(function (module) {
1934
+
1935
+
1936
+ const stdoutColor = supportsColor_1.stdout;
1937
+
1938
+
1939
+
1940
+ const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm');
1941
+
1942
+ // `supportsColor.level` → `ansiStyles.color[name]` mapping
1943
+ const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
1944
+
1945
+ // `color-convert` models to exclude from the Chalk API due to conflicts and such
1946
+ const skipModels = new Set(['gray']);
1947
+
1948
+ const styles = Object.create(null);
1949
+
1950
+ function applyOptions(obj, options) {
1951
+ options = options || {};
1952
+
1953
+ // Detect level if not set manually
1954
+ const scLevel = stdoutColor ? stdoutColor.level : 0;
1955
+ obj.level = options.level === undefined ? scLevel : options.level;
1956
+ obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
1957
+ }
1958
+
1959
+ function Chalk(options) {
1960
+ // We check for this.template here since calling `chalk.constructor()`
1961
+ // by itself will have a `this` of a previously constructed chalk object
1962
+ if (!this || !(this instanceof Chalk) || this.template) {
1963
+ const chalk = {};
1964
+ applyOptions(chalk, options);
1965
+
1966
+ chalk.template = function () {
1967
+ const args = [].slice.call(arguments);
1968
+ return chalkTag.apply(null, [chalk.template].concat(args));
1969
+ };
1970
+
1971
+ Object.setPrototypeOf(chalk, Chalk.prototype);
1972
+ Object.setPrototypeOf(chalk.template, chalk);
1973
+
1974
+ chalk.template.constructor = Chalk;
1975
+
1976
+ return chalk.template;
1977
+ }
1978
+
1979
+ applyOptions(this, options);
1980
+ }
1981
+
1982
+ // Use bright blue on Windows as the normal blue color is illegible
1983
+ if (isSimpleWindowsTerm) {
1984
+ ansiStyles.blue.open = '\u001B[94m';
1985
+ }
1986
+
1987
+ for (const key of Object.keys(ansiStyles)) {
1988
+ ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
1989
+
1990
+ styles[key] = {
1991
+ get() {
1992
+ const codes = ansiStyles[key];
1993
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
1994
+ }
1995
+ };
1996
+ }
1997
+
1998
+ styles.visible = {
1999
+ get() {
2000
+ return build.call(this, this._styles || [], true, 'visible');
2001
+ }
2002
+ };
2003
+
2004
+ ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
2005
+ for (const model of Object.keys(ansiStyles.color.ansi)) {
2006
+ if (skipModels.has(model)) {
2007
+ continue;
2008
+ }
2009
+
2010
+ styles[model] = {
2011
+ get() {
2012
+ const level = this.level;
2013
+ return function () {
2014
+ const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
2015
+ const codes = {
2016
+ open,
2017
+ close: ansiStyles.color.close,
2018
+ closeRe: ansiStyles.color.closeRe
2019
+ };
2020
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2021
+ };
2022
+ }
2023
+ };
2024
+ }
2025
+
2026
+ ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
2027
+ for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
2028
+ if (skipModels.has(model)) {
2029
+ continue;
2030
+ }
2031
+
2032
+ const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
2033
+ styles[bgModel] = {
2034
+ get() {
2035
+ const level = this.level;
2036
+ return function () {
2037
+ const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
2038
+ const codes = {
2039
+ open,
2040
+ close: ansiStyles.bgColor.close,
2041
+ closeRe: ansiStyles.bgColor.closeRe
2042
+ };
2043
+ return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2044
+ };
2045
+ }
2046
+ };
2047
+ }
2048
+
2049
+ const proto = Object.defineProperties(() => {}, styles);
2050
+
2051
+ function build(_styles, _empty, key) {
2052
+ const builder = function () {
2053
+ return applyStyle.apply(builder, arguments);
2054
+ };
2055
+
2056
+ builder._styles = _styles;
2057
+ builder._empty = _empty;
2058
+
2059
+ const self = this;
2060
+
2061
+ Object.defineProperty(builder, 'level', {
2062
+ enumerable: true,
2063
+ get() {
2064
+ return self.level;
2065
+ },
2066
+ set(level) {
2067
+ self.level = level;
2068
+ }
2069
+ });
2070
+
2071
+ Object.defineProperty(builder, 'enabled', {
2072
+ enumerable: true,
2073
+ get() {
2074
+ return self.enabled;
2075
+ },
2076
+ set(enabled) {
2077
+ self.enabled = enabled;
2078
+ }
2079
+ });
2080
+
2081
+ // See below for fix regarding invisible grey/dim combination on Windows
2082
+ builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey';
2083
+
2084
+ // `__proto__` is used because we must return a function, but there is
2085
+ // no way to create a function with a different prototype
2086
+ builder.__proto__ = proto; // eslint-disable-line no-proto
2087
+
2088
+ return builder;
2089
+ }
2090
+
2091
+ function applyStyle() {
2092
+ // Support varags, but simply cast to string in case there's only one arg
2093
+ const args = arguments;
2094
+ const argsLen = args.length;
2095
+ let str = String(arguments[0]);
2096
+
2097
+ if (argsLen === 0) {
2098
+ return '';
2099
+ }
2100
+
2101
+ if (argsLen > 1) {
2102
+ // Don't slice `arguments`, it prevents V8 optimizations
2103
+ for (let a = 1; a < argsLen; a++) {
2104
+ str += ' ' + args[a];
2105
+ }
2106
+ }
2107
+
2108
+ if (!this.enabled || this.level <= 0 || !str) {
2109
+ return this._empty ? '' : str;
2110
+ }
2111
+
2112
+ // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
2113
+ // see https://github.com/chalk/chalk/issues/58
2114
+ // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
2115
+ const originalDim = ansiStyles.dim.open;
2116
+ if (isSimpleWindowsTerm && this.hasGrey) {
2117
+ ansiStyles.dim.open = '';
2118
+ }
2119
+
2120
+ for (const code of this._styles.slice().reverse()) {
2121
+ // Replace any instances already present with a re-opening code
2122
+ // otherwise only the part of the string until said closing code
2123
+ // will be colored, and the rest will simply be 'plain'.
2124
+ str = code.open + str.replace(code.closeRe, code.open) + code.close;
2125
+
2126
+ // Close the styling before a linebreak and reopen
2127
+ // after next line to fix a bleed issue on macOS
2128
+ // https://github.com/chalk/chalk/pull/92
2129
+ str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
2130
+ }
2131
+
2132
+ // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
2133
+ ansiStyles.dim.open = originalDim;
2134
+
2135
+ return str;
2136
+ }
2137
+
2138
+ function chalkTag(chalk, strings) {
2139
+ if (!Array.isArray(strings)) {
2140
+ // If chalk() was called by itself or with a string,
2141
+ // return the string itself as a string.
2142
+ return [].slice.call(arguments, 1).join(' ');
2143
+ }
2144
+
2145
+ const args = [].slice.call(arguments, 2);
2146
+ const parts = [strings.raw[0]];
2147
+
2148
+ for (let i = 1; i < strings.length; i++) {
2149
+ parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
2150
+ parts.push(String(strings.raw[i]));
2151
+ }
2152
+
2153
+ return templates(chalk, parts.join(''));
2154
+ }
2155
+
2156
+ Object.defineProperties(Chalk.prototype, styles);
2157
+
2158
+ module.exports = Chalk(); // eslint-disable-line new-cap
2159
+ module.exports.supportsColor = stdoutColor;
2160
+ module.exports.default = module.exports; // For TypeScript
2161
+ });
2162
+ var chalk_1 = chalk.supportsColor;
2163
+
2164
+ var absolutePath = /^(?:\/|(?:[A-Za-z]:)?[\\|/])/;
2165
+ function isAbsolute(path$$1) {
2166
+ return absolutePath.test(path$$1);
2167
+ }
2168
+
2169
+ function relativeId(id) {
2170
+ if (typeof process === 'undefined' || !isAbsolute(id))
2171
+ return id;
2172
+ return path.relative(process.cwd(), id);
2173
+ }
2174
+
2175
+ if (!chalk.supportsColor)
2176
+ chalk.enabled = false;
2177
+ // log to stderr to keep `rollup main.js > bundle.js` from breaking
2178
+ var stderr = console.error.bind(console); // eslint-disable-line no-console
2179
+ function handleError(err, recover) {
2180
+ if (recover === void 0) { recover = false; }
2181
+ var description = err.message || err;
2182
+ if (err.name)
2183
+ description = err.name + ": " + description;
2184
+ var message = (err.plugin
2185
+ ? "(" + err.plugin + " plugin) " + description
2186
+ : description) || err;
2187
+ stderr(chalk.bold.red("[!] " + chalk.bold(message.toString())));
2188
+ // TODO should this be "err.url || (err.file && err.loc.file) || err.id"?
2189
+ if (err.url) {
2190
+ stderr(chalk.cyan(err.url));
2191
+ }
2192
+ if (err.loc) {
2193
+ stderr(relativeId(err.loc.file || err.id) + " (" + err.loc.line + ":" + err.loc.column + ")");
2194
+ }
2195
+ else if (err.id) {
2196
+ stderr(relativeId(err.id));
2197
+ }
2198
+ if (err.frame) {
2199
+ stderr(chalk.dim(err.frame));
2200
+ }
2201
+ else if (err.stack) {
2202
+ stderr(chalk.dim(err.stack));
2203
+ }
2204
+ stderr('');
2205
+ if (!recover)
2206
+ process.exit(1);
2207
+ }
2208
+
2209
+ function ensureArray(thing) {
2210
+ if (Array.isArray(thing))
2211
+ return thing;
2212
+ if (thing == undefined)
2213
+ return [];
2214
+ return [thing];
2215
+ }
2216
+
2217
+ function deprecateOptions(options, deprecateConfig) {
2218
+ var deprecations = [];
2219
+ if (deprecateConfig.input)
2220
+ deprecateInputOptions();
2221
+ if (deprecateConfig.output)
2222
+ deprecateOutputOptions();
2223
+ return deprecations;
2224
+ function deprecateInputOptions() {
2225
+ if (!options.input && options.entry)
2226
+ deprecate('entry', 'input', false);
2227
+ if (options.moduleName)
2228
+ deprecate('moduleName', 'output.name', true);
2229
+ if (options.name)
2230
+ deprecate('name', 'output.name', true);
2231
+ if (options.extend)
2232
+ deprecate('extend', 'output.extend', true);
2233
+ if (options.globals)
2234
+ deprecate('globals', 'output.globals', true);
2235
+ if (options.indent)
2236
+ deprecate('indent', 'output.indent', true);
2237
+ if (options.noConflict)
2238
+ deprecate('noConflict', 'output.noConflict', true);
2239
+ if (options.paths)
2240
+ deprecate('paths', 'output.paths', true);
2241
+ if (options.sourcemap)
2242
+ deprecate('sourcemap', 'output.sourcemap', true);
2243
+ if (options.sourceMap)
2244
+ deprecate('sourceMap', 'output.sourcemap', true);
2245
+ if (options.sourceMapFile)
2246
+ deprecate('sourceMapFile', 'output.sourcemapFile', true);
2247
+ if (options.useStrict)
2248
+ deprecate('useStrict', 'output.strict', true);
2249
+ if (options.strict)
2250
+ deprecate('strict', 'output.strict', true);
2251
+ if (options.format)
2252
+ deprecate('format', 'output.format', true);
2253
+ if (options.banner)
2254
+ deprecate('banner', 'output.banner', false);
2255
+ if (options.footer)
2256
+ deprecate('footer', 'output.footer', false);
2257
+ if (options.intro)
2258
+ deprecate('intro', 'output.intro', false);
2259
+ if (options.outro)
2260
+ deprecate('outro', 'output.outro', false);
2261
+ if (options.interop)
2262
+ deprecate('interop', 'output.interop', true);
2263
+ if (options.freeze)
2264
+ deprecate('freeze', 'output.freeze', true);
2265
+ if (options.exports)
2266
+ deprecate('exports', 'output.exports', true);
2267
+ if (options.targets) {
2268
+ deprecations.push({ old: 'targets', new: 'output' });
2269
+ // as targets is an array and we need to merge other output options
2270
+ // like sourcemap etc.
2271
+ options.output = options.targets.map(function (target) {
2272
+ return Object.assign({}, target, options.output);
2273
+ });
2274
+ delete options.targets;
2275
+ var deprecatedDest_1 = false;
2276
+ options.output.forEach(function (outputEntry) {
2277
+ if (outputEntry.dest) {
2278
+ if (!deprecatedDest_1) {
2279
+ deprecations.push({ old: 'targets.dest', new: 'output.file' });
2280
+ deprecatedDest_1 = true;
2281
+ }
2282
+ outputEntry.file = outputEntry.dest;
2283
+ delete outputEntry.dest;
2284
+ }
2285
+ });
2286
+ }
2287
+ else if (options.dest) {
2288
+ deprecations.push({ old: 'dest', new: 'output.file' });
2289
+ options.output = {
2290
+ file: options.dest,
2291
+ format: options.format
2292
+ };
2293
+ delete options.dest;
2294
+ }
2295
+ if (options.pureExternalModules) {
2296
+ deprecations.push({
2297
+ old: 'pureExternalModules',
2298
+ new: 'treeshake.pureExternalModules'
2299
+ });
2300
+ if (options.treeshake === undefined) {
2301
+ options.treeshake = {};
2302
+ }
2303
+ if (options.treeshake) {
2304
+ options.treeshake.pureExternalModules = options.pureExternalModules;
2305
+ }
2306
+ delete options.pureExternalModules;
2307
+ }
2308
+ }
2309
+ function deprecateOutputOptions() {
2310
+ if (options.output && options.output.moduleId) {
2311
+ options.output.amd = { id: options.moduleId };
2312
+ deprecations.push({ old: 'moduleId', new: 'amd' });
2313
+ delete options.output.moduleId;
2314
+ }
2315
+ }
2316
+ // a utility function to add deprecations for straightforward options
2317
+ function deprecate(oldOption, newOption, shouldDelete) {
2318
+ deprecations.push({ new: newOption, old: oldOption });
2319
+ if (newOption.indexOf('output') > -1) {
2320
+ options.output = options.output || {};
2321
+ options.output[newOption.replace(/output\./, '')] = options[oldOption];
2322
+ }
2323
+ else {
2324
+ options[newOption] = options[oldOption];
2325
+ }
2326
+ if (shouldDelete)
2327
+ delete options[oldOption];
2328
+ }
2329
+ }
2330
+
2331
+ var createGetOption = function (config, command) { return function (name, defaultValue) {
2332
+ return command[name] !== undefined
2333
+ ? command[name]
2334
+ : config[name] !== undefined ? config[name] : defaultValue;
2335
+ }; };
2336
+ var normalizeObjectOptionValue = function (optionValue) {
2337
+ if (!optionValue) {
2338
+ return optionValue;
2339
+ }
2340
+ if (typeof optionValue !== 'object') {
2341
+ return {};
2342
+ }
2343
+ return optionValue;
2344
+ };
2345
+ var getObjectOption = function (config, command, name) {
2346
+ var commandOption = normalizeObjectOptionValue(command[name]);
2347
+ var configOption = normalizeObjectOptionValue(config[name]);
2348
+ if (commandOption !== undefined) {
2349
+ return commandOption && configOption
2350
+ ? Object.assign({}, configOption, commandOption)
2351
+ : commandOption;
2352
+ }
2353
+ return configOption;
2354
+ };
2355
+ var defaultOnWarn = function (warning) {
2356
+ if (typeof warning === 'string') {
2357
+ console.warn(warning); // eslint-disable-line no-console
2358
+ }
2359
+ else {
2360
+ console.warn(warning.message); // eslint-disable-line no-console
2361
+ }
2362
+ };
2363
+ var getOnWarn = function (config, command, defaultOnWarnHandler) {
2364
+ if (defaultOnWarnHandler === void 0) { defaultOnWarnHandler = defaultOnWarn; }
2365
+ return command.silent
2366
+ ? function () { }
2367
+ : config.onwarn
2368
+ ? function (warning) { return config.onwarn(warning, defaultOnWarnHandler); }
2369
+ : defaultOnWarnHandler;
2370
+ };
2371
+ var getExternal = function (config, command) {
2372
+ var configExternal = config.external;
2373
+ return typeof configExternal === 'function'
2374
+ ? function (id) {
2375
+ var rest = [];
2376
+ for (var _i = 1; _i < arguments.length; _i++) {
2377
+ rest[_i - 1] = arguments[_i];
2378
+ }
2379
+ return configExternal.apply(void 0, [id].concat(rest)) || command.external.indexOf(id) !== -1;
2380
+ }
2381
+ : (configExternal || []).concat(command.external);
2382
+ };
2383
+ var commandAliases = {
2384
+ c: 'config',
2385
+ d: 'indent',
2386
+ e: 'external',
2387
+ f: 'format',
2388
+ g: 'globals',
2389
+ h: 'help',
2390
+ i: 'input',
2391
+ l: 'legacy',
2392
+ m: 'sourcemap',
2393
+ n: 'name',
2394
+ o: 'file',
2395
+ v: 'version',
2396
+ w: 'watch'
2397
+ };
2398
+ function mergeOptions(_a) {
2399
+ var _b = _a.config, config = _b === void 0 ? {} : _b, _c = _a.command, rawCommandOptions = _c === void 0 ? {} : _c, deprecateConfig = _a.deprecateConfig, defaultOnWarnHandler = _a.defaultOnWarnHandler;
2400
+ var deprecations = deprecate(config, rawCommandOptions, deprecateConfig);
2401
+ var command = getCommandOptions(rawCommandOptions);
2402
+ var inputOptions = getInputOptions(config, command, defaultOnWarnHandler);
2403
+ if (command.output) {
2404
+ Object.assign(command, command.output);
2405
+ }
2406
+ var normalizedOutputOptions = ensureArray(config.output);
2407
+ if (normalizedOutputOptions.length === 0)
2408
+ normalizedOutputOptions.push({});
2409
+ var outputOptions = normalizedOutputOptions.map(function (singleOutputOptions) {
2410
+ return getOutputOptions(singleOutputOptions, command);
2411
+ });
2412
+ var unknownOptionErrors = [];
2413
+ var validInputOptions = Object.keys(inputOptions);
2414
+ addUnknownOptionErrors(unknownOptionErrors, Object.keys(config), validInputOptions, 'input option', /^output$/);
2415
+ var validOutputOptions = Object.keys(outputOptions[0]);
2416
+ addUnknownOptionErrors(unknownOptionErrors, outputOptions.reduce(function (allKeys, options) { return allKeys.concat(Object.keys(options)); }, []), validOutputOptions, 'output option');
2417
+ addUnknownOptionErrors(unknownOptionErrors, Object.keys(command), validInputOptions.concat(validOutputOptions, Object.keys(commandAliases), 'config', 'environment', 'silent'), 'CLI flag', /^_|output|(config.*)$/);
2418
+ return {
2419
+ inputOptions: inputOptions,
2420
+ outputOptions: outputOptions,
2421
+ deprecations: deprecations,
2422
+ optionError: unknownOptionErrors.length > 0 ? unknownOptionErrors.join('\n') : null
2423
+ };
2424
+ }
2425
+ function addUnknownOptionErrors(errors, options, validOptions, optionType, ignoredKeys) {
2426
+ if (ignoredKeys === void 0) { ignoredKeys = /$./; }
2427
+ var unknownOptions = options.filter(function (key) { return validOptions.indexOf(key) === -1 && !ignoredKeys.test(key); });
2428
+ if (unknownOptions.length > 0)
2429
+ errors.push("Unknown " + optionType + ": " + unknownOptions.join(', ') + ". Allowed options: " + validOptions.sort().join(', '));
2430
+ }
2431
+ function getCommandOptions(rawCommandOptions) {
2432
+ var command = Object.assign({}, rawCommandOptions);
2433
+ command.external = (rawCommandOptions.external || '').split(',');
2434
+ if (rawCommandOptions.globals) {
2435
+ command.globals = Object.create(null);
2436
+ rawCommandOptions.globals.split(',').forEach(function (str) {
2437
+ var names = str.split(':');
2438
+ command.globals[names[0]] = names[1];
2439
+ // Add missing Module IDs to external.
2440
+ if (command.external.indexOf(names[0]) === -1) {
2441
+ command.external.push(names[0]);
2442
+ }
2443
+ });
2444
+ }
2445
+ return command;
2446
+ }
2447
+ function getInputOptions(config, command, defaultOnWarnHandler) {
2448
+ if (command === void 0) { command = {}; }
2449
+ var getOption = createGetOption(config, command);
2450
+ var inputOptions = {
2451
+ acorn: config.acorn,
2452
+ acornInjectPlugins: config.acornInjectPlugins,
2453
+ cache: getOption('cache'),
2454
+ context: config.context,
2455
+ experimentalCodeSplitting: getOption('experimentalCodeSplitting'),
2456
+ experimentalDynamicImport: getOption('experimentalDynamicImport'),
2457
+ experimentalPreserveModules: getOption('experimentalPreserveModules'),
2458
+ external: getExternal(config, command),
2459
+ input: getOption('input'),
2460
+ moduleContext: config.moduleContext,
2461
+ onwarn: getOnWarn(config, command, defaultOnWarnHandler),
2462
+ perf: getOption('perf', false),
2463
+ plugins: config.plugins,
2464
+ preferConst: getOption('preferConst'),
2465
+ preserveSymlinks: getOption('preserveSymlinks'),
2466
+ treeshake: getObjectOption(config, command, 'treeshake'),
2467
+ watch: config.watch
2468
+ };
2469
+ if (inputOptions.experimentalPreserveModules && !Array.isArray(inputOptions.input)) {
2470
+ inputOptions.input = [inputOptions.input];
2471
+ }
2472
+ // legacy to make sure certain plugins still work
2473
+ inputOptions.entry = Array.isArray(inputOptions.input)
2474
+ ? inputOptions.input[0]
2475
+ : inputOptions.input;
2476
+ return inputOptions;
2477
+ }
2478
+ function getOutputOptions(config, command) {
2479
+ if (command === void 0) { command = {}; }
2480
+ var getOption = createGetOption(config, command);
2481
+ return {
2482
+ amd: Object.assign({}, config.amd, command.amd),
2483
+ banner: getOption('banner'),
2484
+ dir: getOption('dir'),
2485
+ exports: getOption('exports'),
2486
+ extend: getOption('extend'),
2487
+ file: getOption('file'),
2488
+ footer: getOption('footer'),
2489
+ format: getOption('format'),
2490
+ freeze: getOption('freeze'),
2491
+ globals: getOption('globals'),
2492
+ indent: getOption('indent', true),
2493
+ interop: getOption('interop', true),
2494
+ intro: getOption('intro'),
2495
+ legacy: getOption('legacy', false),
2496
+ name: getOption('name'),
2497
+ namespaceToStringTag: getOption('namespaceToStringTag'),
2498
+ noConflict: getOption('noConflict'),
2499
+ outro: getOption('outro'),
2500
+ paths: getOption('paths'),
2501
+ sourcemap: getOption('sourcemap'),
2502
+ sourcemapFile: getOption('sourcemapFile'),
2503
+ strict: getOption('strict', true)
2504
+ };
2505
+ }
2506
+ function deprecate(config, command, deprecateConfig) {
2507
+ if (command === void 0) { command = {}; }
2508
+ if (deprecateConfig === void 0) { deprecateConfig = { input: true, output: true }; }
2509
+ var deprecations = [];
2510
+ // CLI
2511
+ if (command.id) {
2512
+ deprecations.push({
2513
+ old: '-u/--id',
2514
+ new: '--amd.id'
2515
+ });
2516
+ (command.amd || (command.amd = {})).id = command.id;
2517
+ }
2518
+ if (typeof command.output === 'string') {
2519
+ deprecations.push({
2520
+ old: '--output',
2521
+ new: '--file'
2522
+ });
2523
+ command.output = { file: command.output };
2524
+ }
2525
+ // config file
2526
+ deprecations.push.apply(deprecations, deprecateOptions(config, deprecateConfig));
2527
+ return deprecations;
2528
+ }
2529
+
2530
+ function batchWarnings() {
2531
+ var allWarnings = new Map();
2532
+ var count = 0;
2533
+ return {
2534
+ get count() {
2535
+ return count;
2536
+ },
2537
+ add: function (warning) {
2538
+ if (typeof warning === 'string') {
2539
+ warning = { code: 'UNKNOWN', message: warning };
2540
+ }
2541
+ if (warning.code in immediateHandlers) {
2542
+ immediateHandlers[warning.code](warning);
2543
+ return;
2544
+ }
2545
+ if (!allWarnings.has(warning.code))
2546
+ allWarnings.set(warning.code, []);
2547
+ allWarnings.get(warning.code).push(warning);
2548
+ count += 1;
2549
+ },
2550
+ flush: function () {
2551
+ if (count === 0)
2552
+ return;
2553
+ var codes = Array.from(allWarnings.keys()).sort(function (a, b) {
2554
+ if (deferredHandlers[a] && deferredHandlers[b]) {
2555
+ return deferredHandlers[a].priority - deferredHandlers[b].priority;
2556
+ }
2557
+ if (deferredHandlers[a])
2558
+ return -1;
2559
+ if (deferredHandlers[b])
2560
+ return 1;
2561
+ return allWarnings.get(b).length - allWarnings.get(a).length;
2562
+ });
2563
+ codes.forEach(function (code) {
2564
+ var handler = deferredHandlers[code];
2565
+ var warnings = allWarnings.get(code);
2566
+ if (handler) {
2567
+ handler.fn(warnings);
2568
+ }
2569
+ else {
2570
+ warnings.forEach(function (warning) {
2571
+ stderr(chalk.bold.yellow('(!)') + " " + chalk.bold.yellow(warning.message));
2572
+ if (warning.url)
2573
+ info(warning.url);
2574
+ var id = (warning.loc && warning.loc.file) || warning.id;
2575
+ if (id) {
2576
+ var loc = warning.loc
2577
+ ? relativeId(id) + ": (" + warning.loc.line + ":" + warning.loc.column + ")"
2578
+ : relativeId(id);
2579
+ stderr(chalk.bold(relativeId(loc)));
2580
+ }
2581
+ if (warning.frame)
2582
+ info(warning.frame);
2583
+ });
2584
+ }
2585
+ });
2586
+ allWarnings = new Map();
2587
+ count = 0;
2588
+ }
2589
+ };
2590
+ }
2591
+ var immediateHandlers = {
2592
+ UNKNOWN_OPTION: function (warning) {
2593
+ title("You have passed an unrecognized option");
2594
+ stderr(warning.message);
2595
+ },
2596
+ DEPRECATED_OPTIONS: function (warning) {
2597
+ title("Some options have been renamed");
2598
+ info("https://gist.github.com/Rich-Harris/d472c50732dab03efeb37472b08a3f32");
2599
+ warning.deprecations.forEach(function (option) {
2600
+ stderr(chalk.bold(option.old) + " is now " + option.new);
2601
+ });
2602
+ },
2603
+ MISSING_NODE_BUILTINS: function (warning) {
2604
+ title("Missing shims for Node.js built-ins");
2605
+ var detail = warning.modules.length === 1
2606
+ ? "'" + warning.modules[0] + "'"
2607
+ : warning.modules
2608
+ .slice(0, -1)
2609
+ .map(function (name) { return "'" + name + "'"; })
2610
+ .join(', ') + " and '" + warning.modules.slice(-1) + "'";
2611
+ stderr("Creating a browser bundle that depends on " + detail + ". You might need to include https://www.npmjs.com/package/rollup-plugin-node-builtins");
2612
+ },
2613
+ MIXED_EXPORTS: function () {
2614
+ title('Mixing named and default exports');
2615
+ stderr("Consumers of your bundle will have to use bundle['default'] to access the default export, which may not be what you want. Use `exports: 'named'` to disable this warning");
2616
+ },
2617
+ EMPTY_BUNDLE: function () {
2618
+ title("Generated an empty bundle");
2619
+ }
2620
+ };
2621
+ // TODO select sensible priorities
2622
+ var deferredHandlers = {
2623
+ UNUSED_EXTERNAL_IMPORT: {
2624
+ priority: 1,
2625
+ fn: function (warnings) {
2626
+ title('Unused external imports');
2627
+ warnings.forEach(function (warning) {
2628
+ stderr(warning.names + " imported from external module '" + warning.source + "' but never used");
2629
+ });
2630
+ }
2631
+ },
2632
+ UNRESOLVED_IMPORT: {
2633
+ priority: 1,
2634
+ fn: function (warnings) {
2635
+ title('Unresolved dependencies');
2636
+ info('https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency');
2637
+ var dependencies = new Map();
2638
+ warnings.forEach(function (warning) {
2639
+ if (!dependencies.has(warning.source))
2640
+ dependencies.set(warning.source, []);
2641
+ dependencies.get(warning.source).push(warning.importer);
2642
+ });
2643
+ Array.from(dependencies.keys()).forEach(function (dependency) {
2644
+ var importers = dependencies.get(dependency);
2645
+ stderr(chalk.bold(dependency) + " (imported by " + importers.join(', ') + ")");
2646
+ });
2647
+ }
2648
+ },
2649
+ MISSING_EXPORT: {
2650
+ priority: 1,
2651
+ fn: function (warnings) {
2652
+ title('Missing exports');
2653
+ info('https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module');
2654
+ warnings.forEach(function (warning) {
2655
+ stderr(chalk.bold(warning.importer));
2656
+ stderr(warning.missing + " is not exported by " + warning.exporter);
2657
+ stderr(chalk.grey(warning.frame));
2658
+ });
2659
+ }
2660
+ },
2661
+ THIS_IS_UNDEFINED: {
2662
+ priority: 1,
2663
+ fn: function (warnings) {
2664
+ title('`this` has been rewritten to `undefined`');
2665
+ info('https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined');
2666
+ showTruncatedWarnings(warnings);
2667
+ }
2668
+ },
2669
+ EVAL: {
2670
+ priority: 1,
2671
+ fn: function (warnings) {
2672
+ title('Use of eval is strongly discouraged');
2673
+ info('https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval');
2674
+ showTruncatedWarnings(warnings);
2675
+ }
2676
+ },
2677
+ NON_EXISTENT_EXPORT: {
2678
+ priority: 1,
2679
+ fn: function (warnings) {
2680
+ title("Import of non-existent " + (warnings.length > 1 ? 'exports' : 'export'));
2681
+ showTruncatedWarnings(warnings);
2682
+ }
2683
+ },
2684
+ NAMESPACE_CONFLICT: {
2685
+ priority: 1,
2686
+ fn: function (warnings) {
2687
+ title("Conflicting re-exports");
2688
+ warnings.forEach(function (warning) {
2689
+ stderr(chalk.bold(relativeId(warning.reexporter)) + " re-exports '" + warning.name + "' from both " + relativeId(warning.sources[0]) + " and " + relativeId(warning.sources[1]) + " (will be ignored)");
2690
+ });
2691
+ }
2692
+ },
2693
+ MISSING_GLOBAL_NAME: {
2694
+ priority: 1,
2695
+ fn: function (warnings) {
2696
+ title("Missing global variable " + (warnings.length > 1 ? 'names' : 'name'));
2697
+ stderr("Use output.globals to specify browser global variable names corresponding to external modules");
2698
+ warnings.forEach(function (warning) {
2699
+ stderr(chalk.bold(warning.source) + " (guessing '" + warning.guess + "')");
2700
+ });
2701
+ }
2702
+ },
2703
+ SOURCEMAP_BROKEN: {
2704
+ priority: 1,
2705
+ fn: function (warnings) {
2706
+ title("Broken sourcemap");
2707
+ info('https://github.com/rollup/rollup/wiki/Troubleshooting#sourcemap-is-likely-to-be-incorrect');
2708
+ var plugins = Array.from(new Set(warnings.map(function (w) { return w.plugin; }).filter(Boolean)));
2709
+ var detail = plugins.length === 0
2710
+ ? ''
2711
+ : plugins.length > 1
2712
+ ? " (such as " + plugins
2713
+ .slice(0, -1)
2714
+ .map(function (p) { return "'" + p + "'"; })
2715
+ .join(', ') + " and '" + plugins.slice(-1) + "')"
2716
+ : " (such as '" + plugins[0] + "')";
2717
+ stderr("Plugins that transform code" + detail + " should generate accompanying sourcemaps");
2718
+ }
2719
+ },
2720
+ PLUGIN_WARNING: {
2721
+ priority: 1,
2722
+ fn: function (warnings) {
2723
+ var nestedByPlugin = nest(warnings, 'plugin');
2724
+ nestedByPlugin.forEach(function (_a) {
2725
+ var plugin = _a.key, items = _a.items;
2726
+ var nestedByMessage = nest(items, 'message');
2727
+ var lastUrl;
2728
+ nestedByMessage.forEach(function (_a) {
2729
+ var message = _a.key, items = _a.items;
2730
+ title(plugin + " plugin: " + message);
2731
+ items.forEach(function (warning) {
2732
+ if (warning.url !== lastUrl)
2733
+ info((lastUrl = warning.url));
2734
+ var loc = warning.loc
2735
+ ? relativeId(warning.id) + ": (" + warning.loc.line + ":" + warning.loc.column + ")"
2736
+ : relativeId(warning.id);
2737
+ stderr(chalk.bold(relativeId(loc)));
2738
+ if (warning.frame)
2739
+ info(warning.frame);
2740
+ });
2741
+ });
2742
+ });
2743
+ }
2744
+ }
2745
+ };
2746
+ function title(str) {
2747
+ stderr(chalk.bold.yellow('(!)') + " " + chalk.bold.yellow(str));
2748
+ }
2749
+ function info(url) {
2750
+ stderr(chalk.grey(url));
2751
+ }
2752
+ function nest(array, prop) {
2753
+ var nested = [];
2754
+ var lookup = new Map();
2755
+ array.forEach(function (item) {
2756
+ var key = item[prop];
2757
+ if (!lookup.has(key)) {
2758
+ lookup.set(key, {
2759
+ key: key,
2760
+ items: []
2761
+ });
2762
+ nested.push(lookup.get(key));
2763
+ }
2764
+ lookup.get(key).items.push(item);
2765
+ });
2766
+ return nested;
2767
+ }
2768
+ function showTruncatedWarnings(warnings) {
2769
+ var nestedByModule = nest(warnings, 'id');
2770
+ var sliced = nestedByModule.length > 5 ? nestedByModule.slice(0, 3) : nestedByModule;
2771
+ sliced.forEach(function (_a) {
2772
+ var id = _a.key, items = _a.items;
2773
+ stderr(chalk.bold(relativeId(id)));
2774
+ stderr(chalk.grey(items[0].frame));
2775
+ if (items.length > 1) {
2776
+ stderr("...and " + (items.length - 1) + " other " + (items.length > 2 ? 'occurrences' : 'occurrence'));
2777
+ }
2778
+ });
2779
+ if (nestedByModule.length > sliced.length) {
2780
+ stderr("\n...and " + (nestedByModule.length - sliced.length) + " other files");
2781
+ }
2782
+ }
2783
+
2784
+ function loadConfigFile(configFile, commandOptions) {
2785
+ if (commandOptions === void 0) { commandOptions = {}; }
2786
+ var silent = commandOptions.silent || false;
2787
+ var warnings = batchWarnings();
2788
+ return rollup.rollup({
2789
+ input: configFile,
2790
+ external: function (id) {
2791
+ return (id[0] !== '.' && !path__default.isAbsolute(id)) || id.slice(-5, id.length) === '.json';
2792
+ },
2793
+ onwarn: warnings.add
2794
+ })
2795
+ .then(function (bundle) {
2796
+ if (!silent && warnings.count > 0) {
2797
+ stderr(chalk.bold("loaded " + relativeId(configFile) + " with warnings"));
2798
+ warnings.flush();
2799
+ }
2800
+ return bundle.generate({
2801
+ format: 'cjs'
2802
+ });
2803
+ })
2804
+ .then(function (_a) {
2805
+ var code = _a.code;
2806
+ // temporarily override require
2807
+ var defaultLoader = require.extensions['.js'];
2808
+ require.extensions['.js'] = function (module, filename) {
2809
+ if (filename === configFile) {
2810
+ module._compile(code, filename);
2811
+ }
2812
+ else {
2813
+ defaultLoader(module, filename);
2814
+ }
2815
+ };
2816
+ delete require.cache[configFile];
2817
+ return Promise.resolve(require(configFile))
2818
+ .then(function (configFileContent) {
2819
+ if (typeof configFileContent === 'function') {
2820
+ return configFileContent(commandOptions);
2821
+ }
2822
+ return configFileContent;
2823
+ })
2824
+ .then(function (configs) {
2825
+ if (Object.keys(configs).length === 0) {
2826
+ handleError({
2827
+ code: 'MISSING_CONFIG',
2828
+ message: 'Config file must export an options object, or an array of options objects',
2829
+ url: 'https://rollupjs.org/#using-config-files'
2830
+ });
2831
+ }
2832
+ require.extensions['.js'] = defaultLoader;
2833
+ return Array.isArray(configs) ? configs : [configs];
2834
+ });
2835
+ });
2836
+ }
2837
+
2838
+ function sequence(array, fn) {
2839
+ var results = [];
2840
+ var promise = Promise.resolve();
2841
+ function next(member, i) {
2842
+ return fn(member).then(function (value) { return (results[i] = value); });
2843
+ }
2844
+ var _loop_1 = function (i) {
2845
+ promise = promise.then(function () { return next(array[i], i); });
2846
+ };
2847
+ for (var i = 0; i < array.length; i += 1) {
2848
+ _loop_1(i);
2849
+ }
2850
+ return promise.then(function () { return results; });
2851
+ }
2852
+
2853
+ var parseMs = function (ms) {
2854
+ if (typeof ms !== 'number') {
2855
+ throw new TypeError('Expected a number');
2856
+ }
2857
+
2858
+ var roundTowardZero = ms > 0 ? Math.floor : Math.ceil;
2859
+
2860
+ return {
2861
+ days: roundTowardZero(ms / 86400000),
2862
+ hours: roundTowardZero(ms / 3600000) % 24,
2863
+ minutes: roundTowardZero(ms / 60000) % 60,
2864
+ seconds: roundTowardZero(ms / 1000) % 60,
2865
+ milliseconds: roundTowardZero(ms) % 1000
2866
+ };
2867
+ };
2868
+
2869
+ var addendum = "addenda";
2870
+ var aircraft = "aircraft";
2871
+ var alga = "algae";
2872
+ var alumna = "alumnae";
2873
+ var alumnus = "alumni";
2874
+ var amoeba = "amoebae";
2875
+ var analysis = "analyses";
2876
+ var antenna = "antennae";
2877
+ var antithesis = "antitheses";
2878
+ var apex = "apices";
2879
+ var appendix = "appendices";
2880
+ var automaton = "automata";
2881
+ var axis = "axes";
2882
+ var bacillus = "bacilli";
2883
+ var bacterium = "bacteria";
2884
+ var barracks = "barracks";
2885
+ var basis = "bases";
2886
+ var beau = "beaux";
2887
+ var bison = "bison";
2888
+ var buffalo = "buffalo";
2889
+ var bureau = "bureaus";
2890
+ var cactus = "cacti";
2891
+ var calf = "calves";
2892
+ var carp = "carp";
2893
+ var census = "censuses";
2894
+ var chassis = "chassis";
2895
+ var cherub = "cherubim";
2896
+ var child = "children";
2897
+ var cod = "cod";
2898
+ var codex = "codices";
2899
+ var concerto = "concerti";
2900
+ var corpus = "corpora";
2901
+ var crisis = "crises";
2902
+ var criterion = "criteria";
2903
+ var curriculum = "curricula";
2904
+ var datum = "data";
2905
+ var deer = "deer";
2906
+ var diagnosis = "diagnoses";
2907
+ var die = "dice";
2908
+ var dwarf = "dwarfs";
2909
+ var echo = "echoes";
2910
+ var elf = "elves";
2911
+ var elk = "elk";
2912
+ var ellipsis = "ellipses";
2913
+ var embargo = "embargoes";
2914
+ var emphasis = "emphases";
2915
+ var erratum = "errata";
2916
+ var fez = "fezes";
2917
+ var firmware = "firmware";
2918
+ var fish = "fish";
2919
+ var focus = "foci";
2920
+ var foot = "feet";
2921
+ var formula = "formulae";
2922
+ var fungus = "fungi";
2923
+ var gallows = "gallows";
2924
+ var genus = "genera";
2925
+ var goose = "geese";
2926
+ var graffito = "graffiti";
2927
+ var grouse = "grouse";
2928
+ var half = "halves";
2929
+ var hero = "heroes";
2930
+ var hoof = "hooves";
2931
+ var hovercraft = "hovercraft";
2932
+ var hypothesis = "hypotheses";
2933
+ var index = "indices";
2934
+ var kakapo = "kakapo";
2935
+ var knife = "knives";
2936
+ var larva = "larvae";
2937
+ var leaf = "leaves";
2938
+ var libretto = "libretti";
2939
+ var life = "lives";
2940
+ var loaf = "loaves";
2941
+ var locus = "loci";
2942
+ var louse = "lice";
2943
+ var man = "men";
2944
+ var matrix = "matrices";
2945
+ var means = "means";
2946
+ var medium = "media";
2947
+ var memorandum = "memoranda";
2948
+ var millennium = "millennia";
2949
+ var minutia = "minutiae";
2950
+ var moose = "moose";
2951
+ var mouse = "mice";
2952
+ var nebula = "nebulae";
2953
+ var nemesis = "nemeses";
2954
+ var neurosis = "neuroses";
2955
+ var news = "news";
2956
+ var nucleus = "nuclei";
2957
+ var oasis = "oases";
2958
+ var offspring = "offspring";
2959
+ var opus = "opera";
2960
+ var ovum = "ova";
2961
+ var ox = "oxen";
2962
+ var paralysis = "paralyses";
2963
+ var parenthesis = "parentheses";
2964
+ var person = "people";
2965
+ var phenomenon = "phenomena";
2966
+ var phylum = "phyla";
2967
+ var pike = "pike";
2968
+ var polyhedron = "polyhedra";
2969
+ var potato = "potatoes";
2970
+ var prognosis = "prognoses";
2971
+ var quiz = "quizzes";
2972
+ var radius = "radii";
2973
+ var referendum = "referenda";
2974
+ var salmon = "salmon";
2975
+ var scarf = "scarves";
2976
+ var self$1 = "selves";
2977
+ var series = "series";
2978
+ var sheep = "sheep";
2979
+ var shelf = "shelves";
2980
+ var shrimp = "shrimp";
2981
+ var spacecraft = "spacecraft";
2982
+ var species = "species";
2983
+ var spectrum = "spectra";
2984
+ var squid = "squid";
2985
+ var stimulus = "stimuli";
2986
+ var stratum = "strata";
2987
+ var swine = "swine";
2988
+ var syllabus = "syllabi";
2989
+ var symposium = "symposia";
2990
+ var synopsis = "synopses";
2991
+ var synthesis = "syntheses";
2992
+ var tableau = "tableaus";
2993
+ var that = "those";
2994
+ var thesis = "theses";
2995
+ var thief = "thieves";
2996
+ var tomato = "tomatoes";
2997
+ var tooth = "teeth";
2998
+ var trout = "trout";
2999
+ var tuna = "tuna";
3000
+ var vertebra = "vertebrae";
3001
+ var vertex = "vertices";
3002
+ var veto = "vetoes";
3003
+ var vita = "vitae";
3004
+ var vortex = "vortices";
3005
+ var watercraft = "watercraft";
3006
+ var wharf = "wharves";
3007
+ var wife = "wives";
3008
+ var wolf = "wolves";
3009
+ var woman = "women";
3010
+ var irregularPlurals = {
3011
+ addendum: addendum,
3012
+ aircraft: aircraft,
3013
+ alga: alga,
3014
+ alumna: alumna,
3015
+ alumnus: alumnus,
3016
+ amoeba: amoeba,
3017
+ analysis: analysis,
3018
+ antenna: antenna,
3019
+ antithesis: antithesis,
3020
+ apex: apex,
3021
+ appendix: appendix,
3022
+ automaton: automaton,
3023
+ axis: axis,
3024
+ bacillus: bacillus,
3025
+ bacterium: bacterium,
3026
+ barracks: barracks,
3027
+ basis: basis,
3028
+ beau: beau,
3029
+ bison: bison,
3030
+ buffalo: buffalo,
3031
+ bureau: bureau,
3032
+ cactus: cactus,
3033
+ calf: calf,
3034
+ carp: carp,
3035
+ census: census,
3036
+ chassis: chassis,
3037
+ cherub: cherub,
3038
+ child: child,
3039
+ cod: cod,
3040
+ codex: codex,
3041
+ concerto: concerto,
3042
+ corpus: corpus,
3043
+ crisis: crisis,
3044
+ criterion: criterion,
3045
+ curriculum: curriculum,
3046
+ datum: datum,
3047
+ deer: deer,
3048
+ diagnosis: diagnosis,
3049
+ die: die,
3050
+ dwarf: dwarf,
3051
+ echo: echo,
3052
+ elf: elf,
3053
+ elk: elk,
3054
+ ellipsis: ellipsis,
3055
+ embargo: embargo,
3056
+ emphasis: emphasis,
3057
+ erratum: erratum,
3058
+ fez: fez,
3059
+ firmware: firmware,
3060
+ fish: fish,
3061
+ focus: focus,
3062
+ foot: foot,
3063
+ formula: formula,
3064
+ fungus: fungus,
3065
+ gallows: gallows,
3066
+ genus: genus,
3067
+ goose: goose,
3068
+ graffito: graffito,
3069
+ grouse: grouse,
3070
+ half: half,
3071
+ hero: hero,
3072
+ hoof: hoof,
3073
+ hovercraft: hovercraft,
3074
+ hypothesis: hypothesis,
3075
+ index: index,
3076
+ kakapo: kakapo,
3077
+ knife: knife,
3078
+ larva: larva,
3079
+ leaf: leaf,
3080
+ libretto: libretto,
3081
+ life: life,
3082
+ loaf: loaf,
3083
+ locus: locus,
3084
+ louse: louse,
3085
+ man: man,
3086
+ matrix: matrix,
3087
+ means: means,
3088
+ medium: medium,
3089
+ memorandum: memorandum,
3090
+ millennium: millennium,
3091
+ minutia: minutia,
3092
+ moose: moose,
3093
+ mouse: mouse,
3094
+ nebula: nebula,
3095
+ nemesis: nemesis,
3096
+ neurosis: neurosis,
3097
+ news: news,
3098
+ nucleus: nucleus,
3099
+ oasis: oasis,
3100
+ offspring: offspring,
3101
+ opus: opus,
3102
+ ovum: ovum,
3103
+ ox: ox,
3104
+ paralysis: paralysis,
3105
+ parenthesis: parenthesis,
3106
+ person: person,
3107
+ phenomenon: phenomenon,
3108
+ phylum: phylum,
3109
+ pike: pike,
3110
+ polyhedron: polyhedron,
3111
+ potato: potato,
3112
+ prognosis: prognosis,
3113
+ quiz: quiz,
3114
+ radius: radius,
3115
+ referendum: referendum,
3116
+ salmon: salmon,
3117
+ scarf: scarf,
3118
+ self: self$1,
3119
+ series: series,
3120
+ sheep: sheep,
3121
+ shelf: shelf,
3122
+ shrimp: shrimp,
3123
+ spacecraft: spacecraft,
3124
+ species: species,
3125
+ spectrum: spectrum,
3126
+ squid: squid,
3127
+ stimulus: stimulus,
3128
+ stratum: stratum,
3129
+ swine: swine,
3130
+ syllabus: syllabus,
3131
+ symposium: symposium,
3132
+ synopsis: synopsis,
3133
+ synthesis: synthesis,
3134
+ tableau: tableau,
3135
+ that: that,
3136
+ thesis: thesis,
3137
+ thief: thief,
3138
+ tomato: tomato,
3139
+ tooth: tooth,
3140
+ trout: trout,
3141
+ tuna: tuna,
3142
+ vertebra: vertebra,
3143
+ vertex: vertex,
3144
+ veto: veto,
3145
+ vita: vita,
3146
+ vortex: vortex,
3147
+ watercraft: watercraft,
3148
+ wharf: wharf,
3149
+ wife: wife,
3150
+ wolf: wolf,
3151
+ woman: woman,
3152
+ "château": "châteaus",
3153
+ "faux pas": "faux pas",
3154
+ "this": "these"
3155
+ };
3156
+
3157
+ var irregularPlurals$1 = Object.freeze({
3158
+ addendum: addendum,
3159
+ aircraft: aircraft,
3160
+ alga: alga,
3161
+ alumna: alumna,
3162
+ alumnus: alumnus,
3163
+ amoeba: amoeba,
3164
+ analysis: analysis,
3165
+ antenna: antenna,
3166
+ antithesis: antithesis,
3167
+ apex: apex,
3168
+ appendix: appendix,
3169
+ automaton: automaton,
3170
+ axis: axis,
3171
+ bacillus: bacillus,
3172
+ bacterium: bacterium,
3173
+ barracks: barracks,
3174
+ basis: basis,
3175
+ beau: beau,
3176
+ bison: bison,
3177
+ buffalo: buffalo,
3178
+ bureau: bureau,
3179
+ cactus: cactus,
3180
+ calf: calf,
3181
+ carp: carp,
3182
+ census: census,
3183
+ chassis: chassis,
3184
+ cherub: cherub,
3185
+ child: child,
3186
+ cod: cod,
3187
+ codex: codex,
3188
+ concerto: concerto,
3189
+ corpus: corpus,
3190
+ crisis: crisis,
3191
+ criterion: criterion,
3192
+ curriculum: curriculum,
3193
+ datum: datum,
3194
+ deer: deer,
3195
+ diagnosis: diagnosis,
3196
+ die: die,
3197
+ dwarf: dwarf,
3198
+ echo: echo,
3199
+ elf: elf,
3200
+ elk: elk,
3201
+ ellipsis: ellipsis,
3202
+ embargo: embargo,
3203
+ emphasis: emphasis,
3204
+ erratum: erratum,
3205
+ fez: fez,
3206
+ firmware: firmware,
3207
+ fish: fish,
3208
+ focus: focus,
3209
+ foot: foot,
3210
+ formula: formula,
3211
+ fungus: fungus,
3212
+ gallows: gallows,
3213
+ genus: genus,
3214
+ goose: goose,
3215
+ graffito: graffito,
3216
+ grouse: grouse,
3217
+ half: half,
3218
+ hero: hero,
3219
+ hoof: hoof,
3220
+ hovercraft: hovercraft,
3221
+ hypothesis: hypothesis,
3222
+ index: index,
3223
+ kakapo: kakapo,
3224
+ knife: knife,
3225
+ larva: larva,
3226
+ leaf: leaf,
3227
+ libretto: libretto,
3228
+ life: life,
3229
+ loaf: loaf,
3230
+ locus: locus,
3231
+ louse: louse,
3232
+ man: man,
3233
+ matrix: matrix,
3234
+ means: means,
3235
+ medium: medium,
3236
+ memorandum: memorandum,
3237
+ millennium: millennium,
3238
+ minutia: minutia,
3239
+ moose: moose,
3240
+ mouse: mouse,
3241
+ nebula: nebula,
3242
+ nemesis: nemesis,
3243
+ neurosis: neurosis,
3244
+ news: news,
3245
+ nucleus: nucleus,
3246
+ oasis: oasis,
3247
+ offspring: offspring,
3248
+ opus: opus,
3249
+ ovum: ovum,
3250
+ ox: ox,
3251
+ paralysis: paralysis,
3252
+ parenthesis: parenthesis,
3253
+ person: person,
3254
+ phenomenon: phenomenon,
3255
+ phylum: phylum,
3256
+ pike: pike,
3257
+ polyhedron: polyhedron,
3258
+ potato: potato,
3259
+ prognosis: prognosis,
3260
+ quiz: quiz,
3261
+ radius: radius,
3262
+ referendum: referendum,
3263
+ salmon: salmon,
3264
+ scarf: scarf,
3265
+ self: self$1,
3266
+ series: series,
3267
+ sheep: sheep,
3268
+ shelf: shelf,
3269
+ shrimp: shrimp,
3270
+ spacecraft: spacecraft,
3271
+ species: species,
3272
+ spectrum: spectrum,
3273
+ squid: squid,
3274
+ stimulus: stimulus,
3275
+ stratum: stratum,
3276
+ swine: swine,
3277
+ syllabus: syllabus,
3278
+ symposium: symposium,
3279
+ synopsis: synopsis,
3280
+ synthesis: synthesis,
3281
+ tableau: tableau,
3282
+ that: that,
3283
+ thesis: thesis,
3284
+ thief: thief,
3285
+ tomato: tomato,
3286
+ tooth: tooth,
3287
+ trout: trout,
3288
+ tuna: tuna,
3289
+ vertebra: vertebra,
3290
+ vertex: vertex,
3291
+ veto: veto,
3292
+ vita: vita,
3293
+ vortex: vortex,
3294
+ watercraft: watercraft,
3295
+ wharf: wharf,
3296
+ wife: wife,
3297
+ wolf: wolf,
3298
+ woman: woman,
3299
+ default: irregularPlurals
3300
+ });
3301
+
3302
+ var irregularPlurals$2 = ( irregularPlurals$1 && irregularPlurals ) || irregularPlurals$1;
3303
+
3304
+ var plur = function (str, plural, count) {
3305
+ if (typeof plural === 'number') {
3306
+ count = plural;
3307
+ }
3308
+
3309
+ if (str in irregularPlurals$2) {
3310
+ plural = irregularPlurals$2[str];
3311
+ } else if (typeof plural !== 'string') {
3312
+ plural = (str.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's')
3313
+ .replace(/i?e?s$/i, function (m) {
3314
+ var isTailLowerCase = str.slice(-1) === str.slice(-1).toLowerCase();
3315
+ return isTailLowerCase ? m.toLowerCase() : m.toUpperCase();
3316
+ });
3317
+ }
3318
+
3319
+ return count === 1 ? str : plural;
3320
+ };
3321
+
3322
+ var prettyMs = (ms, opts) => {
3323
+ if (!Number.isFinite(ms)) {
3324
+ throw new TypeError('Expected a finite number');
3325
+ }
3326
+
3327
+ opts = opts || {};
3328
+
3329
+ if (ms < 1000) {
3330
+ const msDecimalDigits = typeof opts.msDecimalDigits === 'number' ? opts.msDecimalDigits : 0;
3331
+ return (msDecimalDigits ? ms.toFixed(msDecimalDigits) : Math.ceil(ms)) + (opts.verbose ? ' ' + plur('millisecond', Math.ceil(ms)) : 'ms');
3332
+ }
3333
+
3334
+ const ret = [];
3335
+
3336
+ const add = (val, long, short, valStr) => {
3337
+ if (val === 0) {
3338
+ return;
3339
+ }
3340
+
3341
+ const postfix = opts.verbose ? ' ' + plur(long, val) : short;
3342
+
3343
+ ret.push((valStr || val) + postfix);
3344
+ };
3345
+
3346
+ const parsed = parseMs(ms);
3347
+
3348
+ add(Math.trunc(parsed.days / 365), 'year', 'y');
3349
+ add(parsed.days % 365, 'day', 'd');
3350
+ add(parsed.hours, 'hour', 'h');
3351
+ add(parsed.minutes, 'minute', 'm');
3352
+
3353
+ if (opts.compact) {
3354
+ add(parsed.seconds, 'second', 's');
3355
+ return '~' + ret[0];
3356
+ }
3357
+
3358
+ const sec = ms / 1000 % 60;
3359
+ const secDecimalDigits = typeof opts.secDecimalDigits === 'number' ? opts.secDecimalDigits : 1;
3360
+ const secFixed = sec.toFixed(secDecimalDigits);
3361
+ const secStr = opts.keepDecimalsOnWholeSeconds ? secFixed : secFixed.replace(/\.0+$/, '');
3362
+ add(sec, 'second', 's', secStr);
3363
+
3364
+ return ret.join(' ');
3365
+ };
3366
+
3367
+ function mapSequence(array, fn) {
3368
+ var results = [];
3369
+ var promise = Promise.resolve();
3370
+ function next(member, i) {
3371
+ return Promise.resolve(fn(member)).then(function (value) { return (results[i] = value); });
3372
+ }
3373
+ var _loop_1 = function (i) {
3374
+ promise = promise.then(function () { return next(array[i], i); });
3375
+ };
3376
+ for (var i = 0; i < array.length; i += 1) {
3377
+ _loop_1(i);
3378
+ }
3379
+ return promise.then(function () { return results; });
3380
+ }
3381
+
3382
+ var SOURCEMAPPING_URL = 'sourceMa';
3383
+ SOURCEMAPPING_URL += 'ppingURL';
3384
+ var SOURCEMAPPING_URL$1 = SOURCEMAPPING_URL;
3385
+
3386
+ function printTimings(timings) {
3387
+ Object.keys(timings).forEach(function (label) {
3388
+ var color = chalk;
3389
+ if (label[0] === '#') {
3390
+ color = color.bold;
3391
+ if (label[1] !== '#') {
3392
+ color = color.underline;
3393
+ }
3394
+ }
3395
+ console.info(color(label + ": " + timings[label].toFixed(0) + "ms"));
3396
+ });
3397
+ }
3398
+
3399
+ function build(inputOptions, outputOptions, warnings, silent) {
3400
+ if (silent === void 0) { silent = false; }
3401
+ var useStdout = outputOptions.length === 1 &&
3402
+ !outputOptions[0].file &&
3403
+ inputOptions.input instanceof Array === false;
3404
+ var start = Date.now();
3405
+ var files = useStdout ? ['stdout'] : outputOptions.map(function (t) { return relativeId(t.file || t.dir); });
3406
+ if (!silent)
3407
+ stderr(chalk.cyan("\n" + chalk.bold(typeof inputOptions.input === 'string'
3408
+ ? inputOptions.input
3409
+ : inputOptions.input && inputOptions.input.join(', ')) + " \u2192 " + chalk.bold(files.join(', ')) + "..."));
3410
+ return rollup.rollup(inputOptions)
3411
+ .then(function (bundle) {
3412
+ if (useStdout) {
3413
+ var output_1 = outputOptions[0];
3414
+ if (output_1.sourcemap && output_1.sourcemap !== 'inline') {
3415
+ handleError({
3416
+ code: 'MISSING_OUTPUT_OPTION',
3417
+ message: 'You must specify an --output (-o) option when creating a file with a sourcemap'
3418
+ });
3419
+ }
3420
+ return bundle.generate(output_1).then(function (_a) {
3421
+ var code = _a.code, map = _a.map;
3422
+ if (!code)
3423
+ return;
3424
+ if (output_1.sourcemap === 'inline') {
3425
+ code += "\n//# " + SOURCEMAPPING_URL$1 + "=" + map.toUrl() + "\n";
3426
+ }
3427
+ process.stdout.write(code);
3428
+ });
3429
+ }
3430
+ return mapSequence(outputOptions, function (output) { return bundle.write(output); }).then(function () { return bundle; });
3431
+ })
3432
+ .then(function (bundle) {
3433
+ warnings.flush();
3434
+ if (!silent)
3435
+ stderr(chalk.green("created " + chalk.bold(files.join(', ')) + " in " + chalk.bold(prettyMs(Date.now() - start))));
3436
+ if (bundle && bundle.getTimings) {
3437
+ printTimings(bundle.getTimings());
3438
+ }
3439
+ })
3440
+ .catch(handleError);
3441
+ }
3442
+
3443
+ var signals = createCommonjsModule(function (module) {
3444
+ // This is not the set of all possible signals.
3445
+ //
3446
+ // It IS, however, the set of all signals that trigger
3447
+ // an exit on either Linux or BSD systems. Linux is a
3448
+ // superset of the signal names supported on BSD, and
3449
+ // the unknown signals just fail to register, so we can
3450
+ // catch that easily enough.
3451
+ //
3452
+ // Don't bother with SIGKILL. It's uncatchable, which
3453
+ // means that we can't fire any callbacks anyway.
3454
+ //
3455
+ // If a user does happen to register a handler on a non-
3456
+ // fatal signal like SIGWINCH or something, and then
3457
+ // exit, it'll end up firing `process.emit('exit')`, so
3458
+ // the handler will be fired anyway.
3459
+ //
3460
+ // SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
3461
+ // artificially, inherently leave the process in a
3462
+ // state from which it is not safe to try and enter JS
3463
+ // listeners.
3464
+ module.exports = [
3465
+ 'SIGABRT',
3466
+ 'SIGALRM',
3467
+ 'SIGHUP',
3468
+ 'SIGINT',
3469
+ 'SIGTERM'
3470
+ ];
3471
+
3472
+ if (process.platform !== 'win32') {
3473
+ module.exports.push(
3474
+ 'SIGVTALRM',
3475
+ 'SIGXCPU',
3476
+ 'SIGXFSZ',
3477
+ 'SIGUSR2',
3478
+ 'SIGTRAP',
3479
+ 'SIGSYS',
3480
+ 'SIGQUIT',
3481
+ 'SIGIOT'
3482
+ // should detect profiler and enable/disable accordingly.
3483
+ // see #21
3484
+ // 'SIGPROF'
3485
+ );
3486
+ }
3487
+
3488
+ if (process.platform === 'linux') {
3489
+ module.exports.push(
3490
+ 'SIGIO',
3491
+ 'SIGPOLL',
3492
+ 'SIGPWR',
3493
+ 'SIGSTKFLT',
3494
+ 'SIGUNUSED'
3495
+ );
3496
+ }
3497
+ });
3498
+
3499
+ // Note: since nyc uses this module to output coverage, any lines
3500
+ // that are in the direct sync flow of nyc's outputCoverage are
3501
+ // ignored, since we can never get coverage for them.
3502
+
3503
+ var signals$1 = signals;
3504
+
3505
+ var EE = events;
3506
+ /* istanbul ignore if */
3507
+ if (typeof EE !== 'function') {
3508
+ EE = EE.EventEmitter;
3509
+ }
3510
+
3511
+ var emitter;
3512
+ if (process.__signal_exit_emitter__) {
3513
+ emitter = process.__signal_exit_emitter__;
3514
+ } else {
3515
+ emitter = process.__signal_exit_emitter__ = new EE();
3516
+ emitter.count = 0;
3517
+ emitter.emitted = {};
3518
+ }
3519
+
3520
+ // Because this emitter is a global, we have to check to see if a
3521
+ // previous version of this library failed to enable infinite listeners.
3522
+ // I know what you're about to say. But literally everything about
3523
+ // signal-exit is a compromise with evil. Get used to it.
3524
+ if (!emitter.infinite) {
3525
+ emitter.setMaxListeners(Infinity);
3526
+ emitter.infinite = true;
3527
+ }
3528
+
3529
+ var signalExit = function (cb, opts) {
3530
+ assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler');
3531
+
3532
+ if (loaded === false) {
3533
+ load();
3534
+ }
3535
+
3536
+ var ev = 'exit';
3537
+ if (opts && opts.alwaysLast) {
3538
+ ev = 'afterexit';
3539
+ }
3540
+
3541
+ var remove = function () {
3542
+ emitter.removeListener(ev, cb);
3543
+ if (emitter.listeners('exit').length === 0 &&
3544
+ emitter.listeners('afterexit').length === 0) {
3545
+ unload();
3546
+ }
3547
+ };
3548
+ emitter.on(ev, cb);
3549
+
3550
+ return remove
3551
+ };
3552
+
3553
+ var unload_1 = unload;
3554
+ function unload () {
3555
+ if (!loaded) {
3556
+ return
3557
+ }
3558
+ loaded = false;
3559
+
3560
+ signals$1.forEach(function (sig) {
3561
+ try {
3562
+ process.removeListener(sig, sigListeners[sig]);
3563
+ } catch (er) {}
3564
+ });
3565
+ process.emit = originalProcessEmit;
3566
+ process.reallyExit = originalProcessReallyExit;
3567
+ emitter.count -= 1;
3568
+ }
3569
+
3570
+ function emit (event, code, signal) {
3571
+ if (emitter.emitted[event]) {
3572
+ return
3573
+ }
3574
+ emitter.emitted[event] = true;
3575
+ emitter.emit(event, code, signal);
3576
+ }
3577
+
3578
+ // { <signal>: <listener fn>, ... }
3579
+ var sigListeners = {};
3580
+ signals$1.forEach(function (sig) {
3581
+ sigListeners[sig] = function listener () {
3582
+ // If there are no other listeners, an exit is coming!
3583
+ // Simplest way: remove us and then re-send the signal.
3584
+ // We know that this will kill the process, so we can
3585
+ // safely emit now.
3586
+ var listeners = process.listeners(sig);
3587
+ if (listeners.length === emitter.count) {
3588
+ unload();
3589
+ emit('exit', null, sig);
3590
+ /* istanbul ignore next */
3591
+ emit('afterexit', null, sig);
3592
+ /* istanbul ignore next */
3593
+ process.kill(process.pid, sig);
3594
+ }
3595
+ };
3596
+ });
3597
+
3598
+ var signals_1 = function () {
3599
+ return signals$1
3600
+ };
3601
+
3602
+ var load_1 = load;
3603
+
3604
+ var loaded = false;
3605
+
3606
+ function load () {
3607
+ if (loaded) {
3608
+ return
3609
+ }
3610
+ loaded = true;
3611
+
3612
+ // This is the number of onSignalExit's that are in play.
3613
+ // It's important so that we can count the correct number of
3614
+ // listeners on signals, and don't wait for the other one to
3615
+ // handle it instead of us.
3616
+ emitter.count += 1;
3617
+
3618
+ signals$1 = signals$1.filter(function (sig) {
3619
+ try {
3620
+ process.on(sig, sigListeners[sig]);
3621
+ return true
3622
+ } catch (er) {
3623
+ return false
3624
+ }
3625
+ });
3626
+
3627
+ process.emit = processEmit;
3628
+ process.reallyExit = processReallyExit;
3629
+ }
3630
+
3631
+ var originalProcessReallyExit = process.reallyExit;
3632
+ function processReallyExit (code) {
3633
+ process.exitCode = code || 0;
3634
+ emit('exit', process.exitCode, null);
3635
+ /* istanbul ignore next */
3636
+ emit('afterexit', process.exitCode, null);
3637
+ /* istanbul ignore next */
3638
+ originalProcessReallyExit.call(process, process.exitCode);
3639
+ }
3640
+
3641
+ var originalProcessEmit = process.emit;
3642
+ function processEmit (ev, arg) {
3643
+ if (ev === 'exit') {
3644
+ if (arg !== undefined) {
3645
+ process.exitCode = arg;
3646
+ }
3647
+ var ret = originalProcessEmit.apply(this, arguments);
3648
+ emit('exit', process.exitCode, null);
3649
+ /* istanbul ignore next */
3650
+ emit('afterexit', process.exitCode, null);
3651
+ return ret
3652
+ } else {
3653
+ return originalProcessEmit.apply(this, arguments)
3654
+ }
3655
+ }
3656
+ signalExit.unload = unload_1;
3657
+ signalExit.signals = signals_1;
3658
+ signalExit.load = load_1;
3659
+
3660
+ var timeZone = date => {
3661
+ const offset = (date || new Date()).getTimezoneOffset();
3662
+ const absOffset = Math.abs(offset);
3663
+ const hours = Math.floor(absOffset / 60);
3664
+ const minutes = absOffset % 60;
3665
+ const minutesOut = minutes > 0 ? ':' + ('0' + minutes).slice(-2) : '';
3666
+
3667
+ return (offset < 0 ? '+' : '-') + hours + minutesOut;
3668
+ };
3669
+
3670
+ var dateTime = options => {
3671
+ options = Object.assign({
3672
+ date: new Date(),
3673
+ local: true,
3674
+ showTimeZone: false,
3675
+ showMilliseconds: false
3676
+ }, options);
3677
+
3678
+ let date = options.date;
3679
+
3680
+ if (options.local) {
3681
+ // Offset the date so it will return the correct value when getting the ISO string
3682
+ date = new Date(date.getTime() - (date.getTimezoneOffset() * 60000));
3683
+ }
3684
+
3685
+ let end = '';
3686
+
3687
+ if (options.showTimeZone) {
3688
+ end = ' UTC' + (options.local ? timeZone(date) : '');
3689
+ }
3690
+
3691
+ if (options.showMilliseconds && date.getUTCMilliseconds() > 0) {
3692
+ end = ` ${date.getUTCMilliseconds()}ms${end}`;
3693
+ }
3694
+
3695
+ return date
3696
+ .toISOString()
3697
+ .replace(/T/, ' ')
3698
+ .replace(/\..+/, end);
3699
+ };
3700
+
3701
+ var ansiEscapes = createCommonjsModule(function (module) {
3702
+ const x = module.exports;
3703
+ const ESC = '\u001B[';
3704
+ const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
3705
+
3706
+ x.cursorTo = (x, y) => {
3707
+ if (typeof x !== 'number') {
3708
+ throw new TypeError('The `x` argument is required');
3709
+ }
3710
+
3711
+ if (typeof y !== 'number') {
3712
+ return ESC + (x + 1) + 'G';
3713
+ }
3714
+
3715
+ return ESC + (y + 1) + ';' + (x + 1) + 'H';
3716
+ };
3717
+
3718
+ x.cursorMove = (x, y) => {
3719
+ if (typeof x !== 'number') {
3720
+ throw new TypeError('The `x` argument is required');
3721
+ }
3722
+
3723
+ let ret = '';
3724
+
3725
+ if (x < 0) {
3726
+ ret += ESC + (-x) + 'D';
3727
+ } else if (x > 0) {
3728
+ ret += ESC + x + 'C';
3729
+ }
3730
+
3731
+ if (y < 0) {
3732
+ ret += ESC + (-y) + 'A';
3733
+ } else if (y > 0) {
3734
+ ret += ESC + y + 'B';
3735
+ }
3736
+
3737
+ return ret;
3738
+ };
3739
+
3740
+ x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A';
3741
+ x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B';
3742
+ x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C';
3743
+ x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D';
3744
+
3745
+ x.cursorLeft = ESC + 'G';
3746
+ x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's');
3747
+ x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u');
3748
+ x.cursorGetPosition = ESC + '6n';
3749
+ x.cursorNextLine = ESC + 'E';
3750
+ x.cursorPrevLine = ESC + 'F';
3751
+ x.cursorHide = ESC + '?25l';
3752
+ x.cursorShow = ESC + '?25h';
3753
+
3754
+ x.eraseLines = count => {
3755
+ let clear = '';
3756
+
3757
+ for (let i = 0; i < count; i++) {
3758
+ clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : '');
3759
+ }
3760
+
3761
+ if (count) {
3762
+ clear += x.cursorLeft;
3763
+ }
3764
+
3765
+ return clear;
3766
+ };
3767
+
3768
+ x.eraseEndLine = ESC + 'K';
3769
+ x.eraseStartLine = ESC + '1K';
3770
+ x.eraseLine = ESC + '2K';
3771
+ x.eraseDown = ESC + 'J';
3772
+ x.eraseUp = ESC + '1J';
3773
+ x.eraseScreen = ESC + '2J';
3774
+ x.scrollUp = ESC + 'S';
3775
+ x.scrollDown = ESC + 'T';
3776
+
3777
+ x.clearScreen = '\u001Bc';
3778
+ x.beep = '\u0007';
3779
+
3780
+ x.image = (buf, opts) => {
3781
+ opts = opts || {};
3782
+
3783
+ let ret = '\u001B]1337;File=inline=1';
3784
+
3785
+ if (opts.width) {
3786
+ ret += `;width=${opts.width}`;
3787
+ }
3788
+
3789
+ if (opts.height) {
3790
+ ret += `;height=${opts.height}`;
3791
+ }
3792
+
3793
+ if (opts.preserveAspectRatio === false) {
3794
+ ret += ';preserveAspectRatio=0';
3795
+ }
3796
+
3797
+ return ret + ':' + buf.toString('base64') + '\u0007';
3798
+ };
3799
+
3800
+ x.iTerm = {};
3801
+
3802
+ x.iTerm.setCwd = cwd => '\u001B]50;CurrentDir=' + (cwd || process.cwd()) + '\u0007';
3803
+ });
3804
+
3805
+ var SHOW_ALTERNATE_SCREEN = '\u001B[?1049h';
3806
+ var HIDE_ALTERNATE_SCREEN = '\u001B[?1049l';
3807
+ var isWindows = process.platform === 'win32';
3808
+ var isMintty = isWindows && !!(process.env.SHELL || process.env.TERM);
3809
+ var isConEmuAnsiOn = (process.env.ConEmuANSI || '').toLowerCase() === 'on';
3810
+ var supportsAnsi = !isWindows || isMintty || isConEmuAnsiOn;
3811
+ function alternateScreen(enabled) {
3812
+ if (!enabled) {
3813
+ var needAnnounce_1 = true;
3814
+ return {
3815
+ open: function () { },
3816
+ close: function () { },
3817
+ reset: function (heading) {
3818
+ if (needAnnounce_1) {
3819
+ stderr(heading);
3820
+ needAnnounce_1 = false;
3821
+ }
3822
+ }
3823
+ };
3824
+ }
3825
+ return {
3826
+ open: function () {
3827
+ if (supportsAnsi) {
3828
+ process.stderr.write(SHOW_ALTERNATE_SCREEN);
3829
+ }
3830
+ },
3831
+ close: function () {
3832
+ if (supportsAnsi) {
3833
+ process.stderr.write(HIDE_ALTERNATE_SCREEN);
3834
+ }
3835
+ },
3836
+ reset: function (heading) {
3837
+ stderr("" + ansiEscapes.eraseScreen + ansiEscapes.cursorTo(0, 0) + heading);
3838
+ }
3839
+ };
3840
+ }
3841
+
3842
+ function watch(configFile, configs, command, silent) {
3843
+ if (silent === void 0) { silent = false; }
3844
+ var isTTY = Boolean(process.stderr.isTTY);
3845
+ var screen = alternateScreen(isTTY);
3846
+ screen.open();
3847
+ var warnings = batchWarnings();
3848
+ var watcher;
3849
+ var configWatcher;
3850
+ function start(configs) {
3851
+ screen.reset(chalk.underline("rollup v" + rollup.VERSION));
3852
+ var screenWriter = screen.reset;
3853
+ configs = configs.map(function (options) {
3854
+ var merged = mergeOptions({
3855
+ config: options,
3856
+ command: command,
3857
+ defaultOnWarnHandler: warnings.add
3858
+ });
3859
+ var result = Object.assign({}, merged.inputOptions, {
3860
+ output: merged.outputOptions
3861
+ });
3862
+ if (merged.deprecations.length) {
3863
+ if (!result.watch)
3864
+ result.watch = {};
3865
+ result.watch._deprecations = merged.deprecations;
3866
+ }
3867
+ if (merged.optionError)
3868
+ merged.inputOptions.onwarn({
3869
+ message: merged.optionError,
3870
+ code: 'UNKNOWN_OPTION'
3871
+ });
3872
+ if (merged.inputOptions.watch &&
3873
+ merged.inputOptions.watch.clearScreen === false) {
3874
+ screenWriter = stderr;
3875
+ }
3876
+ return result;
3877
+ });
3878
+ watcher = rollup.watch(configs);
3879
+ watcher.on('event', function (event) {
3880
+ switch (event.code) {
3881
+ case 'FATAL':
3882
+ screen.close();
3883
+ handleError(event.error, true);
3884
+ process.exit(1);
3885
+ break;
3886
+ case 'ERROR':
3887
+ warnings.flush();
3888
+ handleError(event.error, true);
3889
+ break;
3890
+ case 'START':
3891
+ screenWriter(chalk.underline("rollup v" + rollup.VERSION));
3892
+ break;
3893
+ case 'BUNDLE_START':
3894
+ if (!silent)
3895
+ stderr(chalk.cyan("bundles " + chalk.bold(typeof event.input === 'string' ? event.input : event.input.join(', ')) + " \u2192 " + chalk.bold(event.output.map(relativeId).join(', ')) + "..."));
3896
+ break;
3897
+ case 'BUNDLE_END':
3898
+ warnings.flush();
3899
+ if (!silent)
3900
+ stderr(chalk.green("created " + chalk.bold(event.output.map(relativeId).join(', ')) + " in " + chalk.bold(prettyMs(event.duration))));
3901
+ break;
3902
+ case 'END':
3903
+ if (!silent && isTTY) {
3904
+ stderr("\n[" + dateTime() + "] waiting for changes...");
3905
+ }
3906
+ }
3907
+ });
3908
+ }
3909
+ // catch ctrl+c, kill, and uncaught errors
3910
+ var removeOnExit = signalExit(close);
3911
+ process.on('uncaughtException', close);
3912
+ // only listen to stdin if it is a pipe
3913
+ if (!process.stdin.isTTY) {
3914
+ process.stdin.on('end', close); // in case we ever support stdin!
3915
+ process.stdin.resume();
3916
+ }
3917
+ function close(err) {
3918
+ if (err) {
3919
+ console.error(err);
3920
+ }
3921
+ removeOnExit();
3922
+ process.removeListener('uncaughtException', close);
3923
+ // removing a non-existent listener is a no-op
3924
+ process.stdin.removeListener('end', close);
3925
+ screen.close();
3926
+ if (watcher)
3927
+ watcher.close();
3928
+ if (configWatcher)
3929
+ configWatcher.close();
3930
+ if (err) {
3931
+ process.exit(1);
3932
+ }
3933
+ }
3934
+ start(configs);
3935
+ if (configFile && !configFile.startsWith('node:')) {
3936
+ var restarting_1 = false;
3937
+ var aborted_1 = false;
3938
+ var configFileData_1 = fs__default.readFileSync(configFile, 'utf-8');
3939
+ var restart_1 = function () {
3940
+ var newConfigFileData = fs__default.readFileSync(configFile, 'utf-8');
3941
+ if (newConfigFileData === configFileData_1)
3942
+ return;
3943
+ configFileData_1 = newConfigFileData;
3944
+ if (restarting_1) {
3945
+ aborted_1 = true;
3946
+ return;
3947
+ }
3948
+ restarting_1 = true;
3949
+ loadConfigFile(configFile, command)
3950
+ .then(function (configs) {
3951
+ restarting_1 = false;
3952
+ if (aborted_1) {
3953
+ aborted_1 = false;
3954
+ restart_1();
3955
+ }
3956
+ else {
3957
+ watcher.close();
3958
+ start(configs);
3959
+ }
3960
+ })
3961
+ .catch(function (err) {
3962
+ handleError(err, true);
3963
+ });
3964
+ };
3965
+ configWatcher = fs__default.watch(configFile, function (event) {
3966
+ if (event === 'change')
3967
+ restart_1();
3968
+ });
3969
+ }
3970
+ }
3971
+
3972
+ function runRollup(command) {
3973
+ if (command._.length >= 1) {
3974
+ if (command.input) {
3975
+ handleError({
3976
+ code: 'DUPLICATE_IMPORT_OPTIONS',
3977
+ message: 'use --input, or pass input path as argument'
3978
+ });
3979
+ }
3980
+ }
3981
+ if (command.output && command.output.dir) {
3982
+ command.input = command._;
3983
+ command._ = [];
3984
+ }
3985
+ else if (command._.length === 1) {
3986
+ command.input = command._[0];
3987
+ }
3988
+ if (command.environment) {
3989
+ var environment = Array.isArray(command.environment)
3990
+ ? command.environment
3991
+ : [command.environment];
3992
+ environment.forEach(function (arg) {
3993
+ arg.split(',').forEach(function (pair) {
3994
+ var _a = pair.split(':'), key = _a[0], value = _a[1];
3995
+ if (value) {
3996
+ process.env[key] = value;
3997
+ }
3998
+ else {
3999
+ process.env[key] = String(true);
4000
+ }
4001
+ });
4002
+ });
4003
+ }
4004
+ var configFile = command.config === true ? 'rollup.config.js' : command.config;
4005
+ if (configFile) {
4006
+ if (configFile.slice(0, 5) === 'node:') {
4007
+ var pkgName = configFile.slice(5);
4008
+ try {
4009
+ configFile = requireRelative_1.resolve("rollup-config-" + pkgName, process.cwd());
4010
+ }
4011
+ catch (err) {
4012
+ try {
4013
+ configFile = requireRelative_1.resolve(pkgName, process.cwd());
4014
+ }
4015
+ catch (err) {
4016
+ if (err.code === 'MODULE_NOT_FOUND') {
4017
+ handleError({
4018
+ code: 'MISSING_EXTERNAL_CONFIG',
4019
+ message: "Could not resolve config file " + configFile
4020
+ });
4021
+ }
4022
+ throw err;
4023
+ }
4024
+ }
4025
+ }
4026
+ else {
4027
+ // find real path of config so it matches what Node provides to callbacks in require.extensions
4028
+ configFile = fs.realpathSync(configFile);
4029
+ }
4030
+ if (command.watch)
4031
+ process.env.ROLLUP_WATCH = 'true';
4032
+ loadConfigFile(configFile, command)
4033
+ .then(function (configs) { return execute(configFile, configs, command); })
4034
+ .catch(handleError);
4035
+ }
4036
+ else {
4037
+ return execute(configFile, [{ input: null }], command);
4038
+ }
4039
+ }
4040
+ function execute(configFile, configs, command) {
4041
+ if (command.watch) {
4042
+ watch(configFile, configs, command, command.silent);
4043
+ }
4044
+ else {
4045
+ return sequence(configs, function (config) {
4046
+ var warnings = batchWarnings();
4047
+ var _a = mergeOptions({
4048
+ config: config,
4049
+ command: command,
4050
+ defaultOnWarnHandler: warnings.add
4051
+ }), inputOptions = _a.inputOptions, outputOptions = _a.outputOptions, deprecations = _a.deprecations, optionError = _a.optionError;
4052
+ if (deprecations.length) {
4053
+ inputOptions.onwarn({
4054
+ code: 'DEPRECATED_OPTIONS',
4055
+ message: "The following options have been renamed \u2014 please update your config: " + deprecations
4056
+ .map(function (option) { return option.old + " -> " + option.new; })
4057
+ .join(', '),
4058
+ deprecations: deprecations
4059
+ });
4060
+ }
4061
+ if (optionError)
4062
+ inputOptions.onwarn({ code: 'UNKNOWN_OPTION', message: optionError });
4063
+ return build(inputOptions, outputOptions, warnings, command.silent);
4064
+ });
4065
+ }
4066
+ }
4067
+
4068
+ var command = minimist(process.argv.slice(2), {
4069
+ alias: commandAliases
4070
+ });
4071
+ if (command.help || (process.argv.length <= 2 && process.stdin.isTTY)) {
4072
+ console.log("\n" + help.replace('__VERSION__', version) + "\n"); // eslint-disable-line no-console
4073
+ }
4074
+ else if (command.version) {
4075
+ console.log("rollup version " + version); // eslint-disable-line no-console
4076
+ }
4077
+ else {
4078
+ try {
4079
+ require('source-map-support').install();
4080
+ }
4081
+ catch (err) {
4082
+ // do nothing
4083
+ }
4084
+ runRollup(command);
4085
+ }