1 line
15 KiB
JSON
1 line
15 KiB
JSON
|
{"ast":null,"code":"'use strict';\n\nvar colorConvert = require('color-convert');\n\nvar wrapAnsi16 = function wrapAnsi16(fn, offset) {\n return function () {\n var code = fn.apply(colorConvert, arguments);\n return \"\\x1B[\".concat(code + offset, \"m\");\n };\n};\n\nvar wrapAnsi256 = function wrapAnsi256(fn, offset) {\n return function () {\n var code = fn.apply(colorConvert, arguments);\n return \"\\x1B[\".concat(38 + offset, \";5;\").concat(code, \"m\");\n };\n};\n\nvar wrapAnsi16m = function wrapAnsi16m(fn, offset) {\n return function () {\n var rgb = fn.apply(colorConvert, arguments);\n return \"\\x1B[\".concat(38 + offset, \";2;\").concat(rgb[0], \";\").concat(rgb[1], \";\").concat(rgb[2], \"m\");\n };\n};\n\nfunction assembleStyles() {\n var codes = new Map();\n var styles = {\n modifier: {\n reset: [0, 0],\n // 21 isn't widely supported and 22 does the same thing\n bold: [1, 22],\n dim: [2, 22],\n italic: [3, 23],\n underline: [4, 24],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29]\n },\n color: {\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n gray: [90, 39],\n // Bright color\n redBright: [91, 39],\n greenBright: [92, 39],\n yellowBright: [93, 39],\n blueBright: [94, 39],\n magentaBright: [95, 39],\n cyanBright: [96, 39],\n whiteBright: [97, 39]\n },\n bgColor: {\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49],\n // Bright color\n bgBlackBright: [100, 49],\n bgRedBright: [101, 49],\n bgGreenBright: [102, 49],\n bgYellowBright: [103, 49],\n bgBlueBright: [104, 49],\n bgMagentaBright: [105, 49],\n bgCyanBright: [106, 49],\n bgWhiteBright: [107, 49]\n }\n }; // Fix humans\n\n styles.color.grey = styles.color.gray;\n\n for (var _i = 0, _Object$keys = Object.keys(styles); _i < _Object$keys.length; _i++) {\n var groupName = _Object$keys[_i];\n var group = styles[groupName];\n\n for (var _i2 = 0, _Object$keys2 = Object.keys(group); _i2 < _Object$keys2.length; _i2++) {\n var styleName = _Object$keys2[_i2];\n var style = group[styleName];\n styles[styleName] = {\n open: \"\\x1B[\".concat(style[0], \"m\"),\n close: \"\\x1B[\".concat(style[1], \"m\")\n };\n group[styleName] = styles[styleName];\n codes.set(style[0], style[1]);\n }\n\n Object.defineProperty(styles, groupName, {\n value: group,\n enumerable: false\n });\n Object.defineProperty(styles, 'codes', {\n value: codes,\n enumerable: false\n });\n }\n\n var ansi2ansi = function ansi2ansi(n) {\n return n;\n };\n\n var rgb2rgb = function rgb2rgb(r, g, b) {\n return [r, g, b];\n };\n\n styles.color.close = \"\\x1B[39m\";\n styles.bgColor.close = \"\\x1B[49m\";\n styles.color.ansi = {\n ansi: wrapAnsi16(ansi2ansi, 0)\n };\n styles.color.ansi256 = {\n ansi256: wrapAnsi256(ansi2ansi, 0)\n };\n styles.color.ansi16m = {\n rgb: wrapAnsi16m(rgb2rgb, 0)\n };\n styles.bgColor.ansi = {\n ansi: wrapAnsi16(ansi2ansi, 10)\n };\n styles.bgColor.ansi256 = {\n ansi256: wrapAnsi256(ansi2ansi, 10)\n };\n styles.bgColor.ansi16m = {\n rgb: wrapAnsi16m(rgb2rgb, 10)\n };\n\n for (var _i3 = 0, _Object$keys3 = Object.keys(colorConvert); _i3 < _Object$keys3.length; _i3++) {\n var key = _Object$keys3[_i3];\n\n if (typeof colorConvert[key] !== 'object') {\n continue;\n }\n\n var suite = colorConvert[key];\n\n if (key === 'ansi16') {\n key = 'ansi';\n }\n\n if ('ansi16' in suite) {\n styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);\n styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);\n }\n\n if ('ansi256' in suite)
|