@visulima/colorize 1.4.8 → 1.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/gradient.cjs +2 -2
- package/dist/gradient.cjs.map +1 -1
- package/dist/gradient.js +2 -2
- package/dist/gradient.js.map +1 -1
- package/dist/index.server.cjs +1 -1
- package/dist/index.server.cjs.map +1 -1
- package/dist/index.server.js +3 -3
- package/dist/index.server.js.map +1 -1
- package/dist/template.cjs +2 -2
- package/dist/template.cjs.map +1 -1
- package/dist/template.js +2 -2
- package/dist/template.js.map +1 -1
- package/package.json +4 -4
package/dist/template.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js","../src/util/clamp.ts","../src/util/convert-hex-to-rgb.ts","../src/util/convert-rgb-to-ansi.ts","../src/ansi-codes.ts","../src/util/string-replace-all.ts","../src/colorize.server.ts","../src/template/make-colorize-template.ts","../src/util/unescape.ts","../src/template/make-template.ts","../src/template.ts"],"names":["ansiRegex","onlyFirst","pattern","clamp","number_","min","max","convertHexToRgb","hex","color","length_","rgbToAnsi256","r","g","b","ansi256To16","code","remainder","value","code16","rgbToAnsi16","closeCode","bgCloseCode","bgOffset","supportedColor","isStdoutColorSupported","mono","esc","open","close","createRgbFunction","function_","createHexFunction","createAnsi256","createBgAnsi256","createRgb","createBgRgb","baseStyles","baseColors","styleMethods","stringReplaceAll","string_","searchValue","replaceValue","pos","substringLength","lastPos","result","styles","stylePrototype","wrapText","strings","values","properties","string","currentProperties","createStyle","props","openStack","closeStack","style","Colorize","self","name","arguments_","colorize_server_default","makeColorizeTemplate","template","firstString","parts","index","ESCAPES","unescape","c","u","bracket","TEMPLATE_REGEX","STYLE_REGEX","STRING_REGEX","ESCAPE_REGEX","parseArguments","results","chunks","matches","chunk","number","_","escape","character","parseStyle","buildStyle","colorize","enabled","layer","current","styleName","enabledStyles","makeTemplate","escapeCharacter","inverse","joinedChunk","makeTaggedTemplate","instance","template_default"],"mappings":";;AAAe,SAARA,CAAAA,CAA2B,CAAC,SAAAC,CAAAA,CAAAA,CAAY,EAAK,CAAI,CAAA,EAAI,CAAA,CAC3D,IAAMC,CAAAA,CAAU,CACZ,8HACH,CAAA,0DACD,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA,CAEV,OAAO,IAAI,MAAA,CAAOA,CAASD,CAAAA,CAAAA,CAAY,KAAY,CAAA,CAAA,GAAG,CACvD,CCMO,IAAME,CAAQ,CAAA,CAACC,CAAiBC,CAAAA,CAAAA,CAAaC,CAAyBD,GAAAA,CAAAA,CAAMD,EAAUC,CAAMD,CAAAA,CAAAA,CAAUE,CAAMA,CAAAA,CAAAA,CAAMF,CCYlH,CAAA,IAAMG,EAAmBC,CAA0D,EAAA,CACtF,GAAI,EAAGC,CAAK,EAAI,iBAAkB,CAAA,IAAA,CAAKD,CAAG,CAAK,EAAA,GAGzCE,CAAUD,CAAAA,CAAAA,CAAQA,CAAM,CAAA,MAAA,CAAS,CAEvC,CAAA,GAAIC,IAAY,CACZD,CAAAA,CAAAA,CACMA,CAAiB,CAAA,CAAC,CAClBA,CAAAA,CAAAA,CAAiB,CAAC,CAClBA,CAAAA,CAAAA,CAAiB,CAAC,CAAA,CAClBA,CAAiB,CAAA,CAAC,EAClBA,CAAiB,CAAA,CAAC,CAClBA,CAAAA,CAAAA,CAAiB,CAAC,CAAA,CAAA,KAAA,GACjBC,IAAY,CACnB,CAAA,OAAO,CAAC,CAAA,CAAG,CAAG,CAAA,CAAC,EAInB,IAAMN,CAAAA,CAAU,MAAO,CAAA,QAAA,CAASK,CAAiB,CAAA,EAAE,EAGnD,OAAO,CAAEL,CAAW,EAAA,EAAA,CAAM,GAAMA,CAAAA,CAAAA,EAAW,EAAK,GAAKA,CAAAA,CAAAA,CAAU,GAAG,CACtE,CAAA,CCnCO,IAAMO,CAAe,CAAA,CAAC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AAO,CAAA,MAAA,GAAW,EAAI,EAAK,CAAA,GAAG,CAAU,QAAA,CAAA,CAAA,CAG3H,OAAOkC,CAAAA,CAAO,IAAK,CAAA,EAAE,CACzB,CAAA,CC/JES,IAAAA,CAAAA,CAAyB,IAAI1B,CAAAA,CAGtBoC,GAAsBC,CAC/BpC,EAAAA,CAAAA,CAAqB+B,CAAaK,CAAAA,CAAQ,CAAC,CAAA,CAGlCnC,CAAW8B,CAAAA,CAAAA,CAAaN,CAAQ,CAAA,CAGtCY,EAAQrC,CAAAA,CAAAA,CAAqBC,CAAQ","file":"template.js","sourcesContent":["export default function ansiRegex({onlyFirst = false} = {}) {\n\tconst pattern = [\n\t '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)',\n\t\t'(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-ntqry=><~]))'\n\t].join('|');\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\n/**\n * Clamp a number within the inclusive range specified by min and max.\n * @note: The ternary operator is a tick quicker than Math.min(Math.max(num, min), max).\n */\n\nexport const clamp = (number_: number, min: number, max: number): number => (min > number_ ? min : number_ > max ? max : number_);\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\nimport type { ColorValueHex } from \"../types\";\n\n/**\n * Convert hex color string to RGB values.\n *\n * A hexadecimal color code can be 3 or 6 digits with an optional \"#\" prefix.\n *\n * The 3 digits specifies an RGB doublet data as a fully opaque color.\n * For example, \"#123\" specifies the color that is represented by \"#112233\".\n *\n * The 6 digits specifies a fully opaque color.\n * For example, \"#112233\".\n *\n * @param {string} hex A string that contains the hexadecimal RGB color representation.\n * @return {[number, number, number]} The red, green, blue values in range [0, 255] .\n */\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nexport const convertHexToRgb = (hex: ColorValueHex | string): [number, number, number] => {\n let [, color] = /([a-f\\d]{3,6})/i.exec(hex) ?? [];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const length_ = color ? color.length : 0;\n\n if (length_ === 3) {\n color =\n ((color as string)[0] as string) +\n ((color as string)[0] as string) +\n ((color as string)[1] as string) +\n ((color as string)[1] as string) +\n ((color as string)[2] as string) +\n ((color as string)[2] as string);\n } else if (length_ !== 6) {\n return [0, 0, 0];\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const number_ = Number.parseInt(color as string, 16);\n\n // eslint-disable-next-line no-bitwise\n return [(number_ >> 16) & 255, (number_ >> 8) & 255, number_ & 255];\n};\n","/**\n * Copy of https://github.com/Qix-/color-convert/blob/master/conversions.js#L551\n *\n * MIT License\n *\n * Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>.\n * Copyright (c) 2016-2021 Josh Junon <josh@junon.me>.\n */\n\n/**\n * Convert RGB values to approximate code of ANSI 256 colors.\n *\n */\nexport const rgbToAnsi256 = (r: number, g: number, b: number): number => {\n // greyscale\n if (r === g && g === b) {\n if (r < 8) {\n return 16;\n }\n\n if (r > 248) {\n return 231;\n }\n\n return Math.round(((r - 8) / 247) * 24) + 232;\n }\n\n return (\n 16 +\n // r / 255 * 5 => r / 51\n 36 * Math.round(r / 51) +\n 6 * Math.round(g / 51) +\n Math.round(b / 51)\n );\n};\n\n/**\n * Convert ANSI 256 color code to approximate code of ANSI 16 colors.\n */\nexport const ansi256To16 = (code: number): number => {\n let r;\n let g;\n let b;\n\n if (code < 8) {\n return 30 + code;\n }\n\n if (code < 16) {\n return 90 + (code - 8);\n }\n\n if (code >= 232) {\n // greyscale\n // eslint-disable-next-line no-multi-assign\n r = g = b = ((code - 232) * 10 + 8) / 255;\n } else {\n // eslint-disable-next-line no-param-reassign\n code -= 16;\n\n const remainder = code % 36;\n\n r = Math.floor(code / 36) / 5;\n g = Math.floor(remainder / 6) / 5;\n b = (remainder % 6) / 5;\n }\n\n const value = Math.max(r, g, b) * 2;\n\n if (value === 0) {\n return 30;\n }\n\n // eslint-disable-next-line no-bitwise\n const code16 = 30 + ((Math.round(b) << 2) | (Math.round(g) << 1) | Math.round(r));\n\n return value === 2 ? code16 + 60 : code16;\n};\n\nexport const rgbToAnsi16 = (r: number, g: number, b: number): number => ansi256To16(rgbToAnsi256(r, g, b));\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/ansi-codes.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\nimport type { ColorSupportLevel } from \"@visulima/is-ansi-color-supported\";\nimport { isStdoutColorSupported } from \"@visulima/is-ansi-color-supported\";\n\nimport type { AnsiColors, AnsiStyles, ColorData, ColorValueHex } from \"./types\";\nimport { clamp } from \"./util/clamp\";\nimport { convertHexToRgb } from \"./util/convert-hex-to-rgb\";\nimport { ansi256To16, rgbToAnsi16, rgbToAnsi256 } from \"./util/convert-rgb-to-ansi\";\n\nconst closeCode = 39;\nconst bgCloseCode = 49;\nconst bgOffset = 10;\n\nconst supportedColor: ColorSupportLevel = isStdoutColorSupported();\n\nconst mono = { close: \"\", open: \"\" };\n\nconst esc: (open: number | string, close: number | string) => ColorData =\n supportedColor > 0\n ? (open: number | string, close: number | string): ColorData => {\n return { close: \"\\u001B[\" + close + \"m\", open: \"\\u001B[\" + open + \"m\" };\n }\n : (): ColorData => mono;\n\nconst createRgbFunction = (function_: (code: number | string) => ColorData) => (r: number | string, g: number | string, b: number | string) =>\n function_(rgbToAnsi256(Number(r), Number(g), Number(b)));\n\nconst createHexFunction = (function_: (r: number | string, g: number | string, b: number | string) => ColorData) => (hex: ColorValueHex) => {\n const [r, g, b] = convertHexToRgb(hex);\n\n return function_(r, g, b);\n};\n\nlet createAnsi256 = (code: number | string): ColorData => esc(\"38;5;\" + code, closeCode);\n\nlet createBgAnsi256 = (code: number | string): ColorData => esc(\"48;5;\" + code, bgCloseCode);\n\nlet createRgb = (r: number | string, g: number | string, b: number | string): ColorData => esc(\"38;2;\" + r + \";\" + g + \";\" + b, closeCode);\n\nlet createBgRgb = (r: number | string, g: number | string, b: number | string): ColorData => esc(\"48;2;\" + r + \";\" + g + \";\" + b, bgCloseCode);\n\nif (supportedColor === 1) {\n // ANSI 16 colors\n createAnsi256 = (code: number | string) => esc(ansi256To16(Number(code)), closeCode);\n createBgAnsi256 = (code: number | string) => esc(ansi256To16(Number(code)) + bgOffset, bgCloseCode);\n createRgb = (r: number | string, g: number | string, b: number | string) => esc(rgbToAnsi16(Number(r), Number(g), Number(b)), closeCode);\n createBgRgb = (r: number | string, g: number | string, b: number | string) => esc(rgbToAnsi16(Number(r), Number(g), Number(b)) + bgOffset, bgCloseCode);\n} else if (supportedColor === 2) {\n // ANSI 256 colors\n createRgb = createRgbFunction(createAnsi256);\n createBgRgb = createRgbFunction(createBgAnsi256);\n}\n\nexport const baseStyles: Required<Record<AnsiStyles, ColorData>> = {\n // 21 isn't widely supported and 22 does the same thing\n bold: esc(1, 22),\n dim: esc(2, 22),\n hidden: esc(8, 28),\n inverse: esc(7, 27),\n italic: esc(3, 23),\n overline: esc(53, 55),\n reset: esc(0, 0),\n strike: esc(9, 29), // alias for strikethrough\n strikethrough: esc(9, 29),\n underline: esc(4, 24),\n visible: mono,\n};\n\nexport const baseColors: Required<Record<AnsiColors, ColorData>> = {\n bgBlack: esc(40, bgCloseCode),\n bgBlackBright: esc(100, bgCloseCode),\n bgBlue: esc(44, bgCloseCode),\n bgBlueBright: esc(104, bgCloseCode),\n bgCyan: esc(46, bgCloseCode),\n bgCyanBright: esc(106, bgCloseCode),\n bgGray: esc(100, bgCloseCode), // US spelling alias for bgBlackBright\n bgGreen: esc(42, bgCloseCode),\n bgGreenBright: esc(102, bgCloseCode),\n bgGrey: esc(100, bgCloseCode), // UK spelling alias for bgBlackBright\n bgMagenta: esc(45, bgCloseCode),\n bgMagentaBright: esc(105, bgCloseCode),\n bgRed: esc(41, bgCloseCode),\n bgRedBright: esc(101, bgCloseCode),\n bgWhite: esc(47, bgCloseCode),\n bgWhiteBright: esc(107, bgCloseCode),\n bgYellow: esc(43, bgCloseCode),\n bgYellowBright: esc(103, bgCloseCode),\n black: esc(30, closeCode),\n blackBright: esc(90, closeCode),\n blue: esc(34, closeCode),\n blueBright: esc(94, closeCode),\n cyan: esc(36, closeCode),\n cyanBright: esc(96, closeCode),\n gray: esc(90, closeCode), // US spelling alias for blackBright\n green: esc(32, closeCode),\n greenBright: esc(92, closeCode),\n grey: esc(90, closeCode), // UK spelling alias for blackBright\n magenta: esc(35, closeCode),\n magentaBright: esc(95, closeCode),\n red: esc(31, closeCode),\n redBright: esc(91, closeCode),\n white: esc(37, closeCode),\n whiteBright: esc(97, closeCode),\n yellow: esc(33, closeCode),\n yellowBright: esc(93, closeCode),\n};\n\nexport const styleMethods: {\n bg: (code: number) => ColorData;\n bgHex: (hex: ColorValueHex) => ColorData;\n bgRgb: (r: number, g: number, b: number) => ColorData;\n fg: (code: number) => ColorData;\n hex: (hex: ColorValueHex) => ColorData;\n rgb: (r: number, g: number, b: number) => ColorData;\n} = {\n bg: (code) => createBgAnsi256(clamp(code, 0, 255)),\n\n bgHex: createHexFunction(createBgRgb),\n\n bgRgb: (r, g, b) => createBgRgb(clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255)),\n\n fg: (code) => createAnsi256(clamp(code, 0, 255)),\n\n hex: createHexFunction(createRgb),\n\n rgb: (r, g, b) => createRgb(clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255)),\n};\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\n/**\n * Replace all matched strings.\n * Note: this implementation is over 30% faster than String.replaceAll().\n */\nexport const stringReplaceAll = (string_: string, searchValue: string, replaceValue: string): string => {\n // visible style has empty open/close props\n if (searchValue === \"\") {\n return string_;\n }\n\n let pos = string_.indexOf(searchValue);\n if (pos < 0) {\n return string_;\n }\n\n const substringLength = searchValue.length;\n let lastPos = 0;\n let result = \"\";\n\n // eslint-disable-next-line no-loops/no-loops,no-bitwise\n while (~pos) {\n result += string_.slice(lastPos, pos) + replaceValue;\n lastPos = pos + substringLength;\n pos = string_.indexOf(searchValue, lastPos);\n }\n\n return result + string_.slice(lastPos);\n};\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/index.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport ansiRegex from \"ansi-regex\";\n\nimport { baseColors, baseStyles, styleMethods } from \"./ansi-codes\";\nimport type { ColorData, ColorizeType } from \"./types\";\nimport { stringReplaceAll } from \"./util/string-replace-all\";\n\nconst styles: Record<string, object> = {};\n\nlet stylePrototype: object | null = null;\n\nconst wrapText = (\n strings: ArrayLike<string> | ReadonlyArray<string> | number | string | { raw: ArrayLike<string> | ReadonlyArray<string> },\n values: string[],\n properties: ColorizeProperties,\n) => {\n if (!strings) {\n return \"\";\n }\n\n let string =\n (strings as { raw?: ArrayLike<string> | ReadonlyArray<string> | null }).raw == null\n ? (((strings as number | string) + \"\") as string)\n : String.raw(strings as { raw: ArrayLike<string> | ReadonlyArray<string> }, ...values);\n\n if (string.includes(\"\\u001B\")) {\n // eslint-disable-next-line no-loops/no-loops,@typescript-eslint/no-unnecessary-condition\n for (let currentProperties = properties; currentProperties; currentProperties = currentProperties.props) {\n string = stringReplaceAll(string, currentProperties.close, currentProperties.open);\n }\n }\n\n if (string.includes(\"\\n\")) {\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n string = string.replace(/(\\r*\\n)/g, properties.closeStack + \"$1\" + properties.openStack);\n }\n\n return properties.openStack + string + properties.closeStack;\n};\n\ntype ColorizeProperties = { close: string; closeStack: string; open: string; openStack: string; props: ColorizeProperties };\n\nconst createStyle = (\n { props }: { props?: ColorizeProperties },\n { close, open }: ColorData,\n): {\n (strings: ArrayLike<string> | ReadonlyArray<string> | string, ...values: string[]): string;\n close: string;\n open: string;\n props: { close: string; closeStack: string; open: string; openStack: string; props?: ColorizeProperties };\n} => {\n const openStack: string = (props?.openStack ?? \"\") + open;\n const closeStack: string = close + (props?.closeStack ?? \"\");\n\n const style = (strings: ArrayLike<string> | ReadonlyArray<string> | string, ...values: string[]) => wrapText(strings, values, style.props);\n\n Object.setPrototypeOf(style, stylePrototype);\n\n style.props = { close, closeStack, open, openStack, props } as ColorizeProperties;\n style.open = openStack;\n style.close = closeStack;\n\n return style;\n};\n\n// eslint-disable-next-line func-names\nconst Colorize = function () {\n const self = (string_: number | string) => string_ + \"\";\n\n self.strip = (value: string): string => value.replaceAll(ansiRegex(), \"\");\n\n // eslint-disable-next-line guard-for-in,no-loops/no-loops,no-restricted-syntax\n for (const name in baseColors) {\n // eslint-disable-next-line security/detect-object-injection\n styles[name] = {\n get() {\n const style = createStyle(this, baseColors[name as keyof typeof baseColors]);\n\n Object.defineProperty(this, name, { value: style });\n\n return style;\n },\n };\n }\n\n // eslint-disable-next-line guard-for-in,no-loops/no-loops,no-restricted-syntax\n for (const name in baseStyles) {\n // eslint-disable-next-line security/detect-object-injection\n styles[name] = {\n get() {\n const style = createStyle(this, baseStyles[name as keyof typeof baseStyles]);\n\n Object.defineProperty(this, name, { value: style });\n\n return style;\n },\n };\n }\n\n // This needs to be the last thing we do, so that the prototype is fully populated.\n stylePrototype = Object.defineProperties({}, styles);\n\n Object.setPrototypeOf(self, stylePrototype);\n\n return self;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} as any as new () => ColorizeType;\n\n// eslint-disable-next-line guard-for-in,no-loops/no-loops,no-restricted-syntax\nfor (const name in styleMethods) {\n styles[name as keyof typeof styleMethods] = {\n get() {\n return (...arguments_: (number | string)[]) =>\n // @ts-expect-error: TODO: fix typing of `arguments_`\n createStyle(this, styleMethods[name as keyof typeof styleMethods](...arguments_));\n },\n };\n}\n\nstyles.ansi256 = styles.fg as object;\nstyles.bgAnsi256 = styles.bg as object;\n\n// eslint-disable-next-line import/no-default-export\nexport default Colorize;\n","/**\n * Modified copy of https://github.com/chalk/chalk-template/blob/main/index.js\n *\n * MIT License\n *\n * Copyright (c) Josh Junon\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n */\n\n// prettier-ignore\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const makeColorizeTemplate = (template: (text: string) => string): ((firstString: TemplateStringsArray, ...arguments_: any[]) => string) =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (firstString: TemplateStringsArray, ...arguments_: any[]): string => {\n if (!Array.isArray(firstString) || !Array.isArray(firstString.raw)) {\n // If chalkTemplate() was called by itself or with a string\n throw new TypeError(\"A tagged template literal must be provided\");\n }\n\n const parts = [firstString.raw[0]];\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let index = 1; index < firstString.raw.length; index++) {\n // eslint-disable-next-line security/detect-object-injection\n parts.push(String(arguments_[index - 1]).replaceAll(/[{}\\\\]/g, \"\\\\$&\"), String(firstString.raw[index]));\n }\n\n return template(parts.join(\"\"));\n };\n","/**\n * Modified copy of https://github.com/chalk/chalk-template/blob/main/index.js\n *\n * MIT License\n *\n * Copyright (c) Josh Junon\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n */\n\nconst ESCAPES = new Map([\n [\"\\\\\", \"\\\\\"],\n [\"0\", \"\\0\"],\n [\"a\", \"\\u0007\"],\n [\"b\", \"\\b\"],\n [\"e\", \"\\u001B\"],\n [\"f\", \"\\f\"],\n [\"n\", \"\\n\"],\n [\"r\", \"\\r\"],\n [\"t\", \"\\t\"],\n [\"v\", \"\\v\"],\n]);\n\nexport const unescape = (c: string): string => {\n const u = c.startsWith(\"u\");\n const bracket = c[1] === \"{\";\n\n if ((u && !bracket && c.length === 5) || (c.startsWith(\"x\") && c.length === 3)) {\n return String.fromCodePoint(Number.parseInt(c.slice(1), 16));\n }\n\n if (u && bracket) {\n return String.fromCodePoint(Number.parseInt(c.slice(2, -1), 16));\n }\n\n return ESCAPES.get(c) ?? c;\n};\n","/**\n * Modified copy of https://github.com/chalk/chalk-template/blob/main/index.js\n *\n * MIT License\n *\n * Copyright (c) Josh Junon\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n */\n\nimport type { ColorizeType, ColorValueHex } from \"../types\";\nimport { convertHexToRgb } from \"../util/convert-hex-to-rgb\";\nimport { unescape } from \"../util/unescape\";\n\nconst TEMPLATE_REGEX =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-lazy-ends,regexp/no-dupe-disjunctions\n /\\\\(u(?:[a-f\\d]{4}|\\{[a-f\\d]{1,6}\\})|x[a-f\\d]{2}|.)|\\{(~)?(#?[\\w:]+(?:\\([^)]*\\))?(?:\\.#?[\\w:]+(?:\\([^)]*\\))?)*)(?:[ \\t]|(?=\\r?\\n))|(\\})|((?:.|[\\r\\n\\f])+?)/gi;\n// eslint-disable-next-line security/detect-unsafe-regex,regexp/optimal-lookaround-quantifier\nconst STYLE_REGEX = /(?:^|\\.)(?:(\\w+)(?:\\(([^)]*)\\))?|#(?=[:a-f\\d]{2,})([a-f\\d]{6})?(?::([a-f\\d]{6}))?)/gi;\nconst STRING_REGEX = /^(['\"])((?:\\\\.|(?!\\1)[^\\\\])*)\\1$/;\nconst ESCAPE_REGEX = /\\\\(u(?:[a-f\\d]{4}|\\{[a-f\\d]{1,6}\\})|x[a-f\\d]{2}|.)|([^\\\\])/gi;\n\nconst parseArguments = (name: string, value: string): (number | string)[] => {\n const results: (number | string)[] = [];\n const chunks = value.trim().split(/\\s*,\\s*/);\n\n let matches;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const chunk of chunks) {\n const number = Number(chunk);\n\n if (!Number.isNaN(number)) {\n results.push(number);\n // eslint-disable-next-line no-cond-assign\n } else if ((matches = STRING_REGEX.exec(chunk))) {\n // eslint-disable-next-line unicorn/prefer-string-replace-all,@typescript-eslint/no-unsafe-return\n results.push((matches[2] as string).replace(ESCAPE_REGEX, (_, escape, character) => (escape ? unescape(escape as string) : character)));\n } else {\n throw new Error(`Invalid template style argument: ${chunk} (in style '${name}')`);\n }\n }\n\n return results;\n};\n\nconst parseStyle: (style: string) => (number | string | undefined)[][] = (style: string) => {\n STYLE_REGEX.lastIndex = 0;\n\n const results: (number | string | undefined)[][] = [];\n let matches;\n\n // eslint-disable-next-line no-loops/no-loops,no-cond-assign\n while ((matches = STYLE_REGEX.exec(style)) !== null) {\n const name = matches[1];\n\n if (matches[2]) {\n results.push([name, ...parseArguments(name as string, matches[2])]);\n } else if (matches[3] || matches[4]) {\n if (matches[3]) {\n results.push([\"rgb\", ...convertHexToRgb(matches[3] as ColorValueHex)]);\n }\n\n if (matches[4]) {\n results.push([\"bgRgb\", ...convertHexToRgb(matches[4] as ColorValueHex)]);\n }\n } else {\n results.push([name]);\n }\n }\n\n return results;\n};\n\nconst buildStyle = (\n colorize: ColorizeType,\n styles: {\n inverse: string | undefined;\n styles: (number | string | undefined)[][];\n }[],\n) => {\n const enabled: Record<string, (number | string | undefined)[] | null> = {};\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const layer of styles) {\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const style of layer.styles) {\n enabled[style[0] as string] = layer.inverse ? null : style.slice(1);\n }\n }\n\n let current: ColorizeType = colorize;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const [styleName, enabledStyles] of Object.entries(enabled)) {\n if (!Array.isArray(enabledStyles)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (!(styleName in current)) {\n throw new Error(`Unknown style: ${styleName}`);\n }\n\n // @ts-expect-error - @TODO fix types\n\n current = enabledStyles.length > 0 ? current[styleName as keyof ColorizeType](...enabledStyles) : current[styleName as keyof ColorizeType];\n }\n\n return current;\n};\n\nexport const makeTemplate =\n (colorize: ColorizeType): ((string: string) => string) =>\n (string: string) => {\n const styles: {\n inverse: string | undefined;\n styles: (number | string | undefined)[][];\n }[] = [];\n const chunks = [];\n\n let chunk: string[] = [];\n\n string.replaceAll(\n TEMPLATE_REGEX,\n // @ts-expect-error - TS doesn't understand that the regex args are defined\n (\n _: string,\n escapeCharacter: string | undefined,\n inverse: string | undefined,\n style: string | undefined,\n close: string | undefined,\n character: string | undefined,\n ) => {\n if (escapeCharacter) {\n chunk.push(unescape(escapeCharacter) as string);\n } else if (style) {\n const joinedChunk = chunk.join(\"\");\n\n chunk = [];\n chunks.push(styles.length === 0 ? joinedChunk : buildStyle(colorize, styles)(joinedChunk));\n\n styles.push({ inverse, styles: parseStyle(style) });\n } else if (close) {\n if (styles.length === 0) {\n throw new Error(\"Found extraneous } in template literal\");\n }\n\n chunks.push(buildStyle(colorize, styles)(chunk.join(\"\")));\n chunk = [];\n\n styles.pop();\n } else {\n chunk.push(character as string);\n }\n },\n );\n\n chunks.push(chunk.join(\"\"));\n\n if (styles.length > 0) {\n throw new Error(`template literal is missing ${styles.length} closing bracket${styles.length === 1 ? \"\" : \"s\"} (\\`}\\`)`);\n }\n\n return chunks.join(\"\");\n };\n","import ColorizeImpl from \"./colorize.server\";\nimport { makeColorizeTemplate } from \"./template/make-colorize-template\";\nimport { makeTemplate } from \"./template/make-template\";\nimport type { ColorizeType } from \"./types\";\n\nconst colorize: ColorizeType = new ColorizeImpl() as ColorizeType;\n\n// eslint-disable-next-line import/no-unused-modules,@typescript-eslint/no-explicit-any\nexport const makeTaggedTemplate = (instance: ColorizeType): ((firstString: TemplateStringsArray, ...arguments_: any[]) => string) =>\n makeColorizeTemplate(makeTemplate(instance));\n\n// eslint-disable-next-line import/no-unused-modules\nexport const template = makeTemplate(colorize);\n\n// eslint-disable-next-line import/no-default-export\nexport default makeColorizeTemplate(template);\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/ansi-regex@6.1.0/node_modules/ansi-regex/index.js","../src/util/clamp.ts","../src/util/convert-hex-to-rgb.ts","../src/util/convert-rgb-to-ansi.ts","../src/ansi-codes.ts","../src/util/string-replace-all.ts","../src/colorize.server.ts","../src/template/make-colorize-template.ts","../src/util/unescape.ts","../src/template/make-template.ts","../src/template.ts"],"names":["ansiRegex","onlyFirst","pattern","clamp","number_","min","max","convertHexToRgb","hex","color","length_","rgbToAnsi256","r","g","b","ansi256To16","code","remainder","value","code16","rgbToAnsi16","closeCode","bgCloseCode","bgOffset","supportedColor","isStdoutColorSupported","mono","esc","open","close","createRgbFunction","function_","createHexFunction","createAnsi256","createBgAnsi256","createRgb","createBgRgb","baseStyles","baseColors","styleMethods","stringReplaceAll","string_","searchValue","replaceValue","pos","substringLength","lastPos","result","styles","stylePrototype","wrapText","strings","values","properties","string","currentProperties","createStyle","props","openStack","closeStack","style","Colorize","self","name","arguments_","colorize_server_default","makeColorizeTemplate","template","firstString","parts","index","ESCAPES","unescape","c","u","bracket","TEMPLATE_REGEX","STYLE_REGEX","STRING_REGEX","ESCAPE_REGEX","parseArguments","results","chunks","matches","chunk","number","_","escape","character","parseStyle","buildStyle","colorize","enabled","layer","current","styleName","enabledStyles","makeTemplate","escapeCharacter","inverse","joinedChunk","makeTaggedTemplate","instance","template_default"],"mappings":";;AAAe,SAARA,CAAAA,CAA2B,CAAC,SAAAC,CAAAA,CAAAA,CAAY,EAAK,CAAI,CAAA,EAAI,CAAA,CAG3D,IAAMC,CAAAA,CAAU,CACf,yJACA,CAAA,0DACD,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA,CAEV,OAAO,IAAI,MAAA,CAAOA,CAASD,CAAAA,CAAAA,CAAY,KAAY,CAAA,CAAA,GAAG,CACvD,CCIO,IAAME,CAAQ,CAAA,CAACC,CAAiBC,CAAAA,CAA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= {}) {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = '(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)';\n\tconst pattern = [\n\t\t`[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?${ST})`,\n\t\t'(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))',\n\t].join('|');\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\n/**\n * Clamp a number within the inclusive range specified by min and max.\n * @note: The ternary operator is a tick quicker than Math.min(Math.max(num, min), max).\n */\n\nexport const clamp = (number_: number, min: number, max: number): number => (min > number_ ? min : number_ > max ? max : number_);\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\nimport type { ColorValueHex } from \"../types\";\n\n/**\n * Convert hex color string to RGB values.\n *\n * A hexadecimal color code can be 3 or 6 digits with an optional \"#\" prefix.\n *\n * The 3 digits specifies an RGB doublet data as a fully opaque color.\n * For example, \"#123\" specifies the color that is represented by \"#112233\".\n *\n * The 6 digits specifies a fully opaque color.\n * For example, \"#112233\".\n *\n * @param {string} hex A string that contains the hexadecimal RGB color representation.\n * @return {[number, number, number]} The red, green, blue values in range [0, 255] .\n */\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nexport const convertHexToRgb = (hex: ColorValueHex | string): [number, number, number] => {\n let [, color] = /([a-f\\d]{3,6})/i.exec(hex) ?? [];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const length_ = color ? color.length : 0;\n\n if (length_ === 3) {\n color =\n ((color as string)[0] as string) +\n ((color as string)[0] as string) +\n ((color as string)[1] as string) +\n ((color as string)[1] as string) +\n ((color as string)[2] as string) +\n ((color as string)[2] as string);\n } else if (length_ !== 6) {\n return [0, 0, 0];\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const number_ = Number.parseInt(color as string, 16);\n\n // eslint-disable-next-line no-bitwise\n return [(number_ >> 16) & 255, (number_ >> 8) & 255, number_ & 255];\n};\n","/**\n * Copy of https://github.com/Qix-/color-convert/blob/master/conversions.js#L551\n *\n * MIT License\n *\n * Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>.\n * Copyright (c) 2016-2021 Josh Junon <josh@junon.me>.\n */\n\n/**\n * Convert RGB values to approximate code of ANSI 256 colors.\n *\n */\nexport const rgbToAnsi256 = (r: number, g: number, b: number): number => {\n // greyscale\n if (r === g && g === b) {\n if (r < 8) {\n return 16;\n }\n\n if (r > 248) {\n return 231;\n }\n\n return Math.round(((r - 8) / 247) * 24) + 232;\n }\n\n return (\n 16 +\n // r / 255 * 5 => r / 51\n 36 * Math.round(r / 51) +\n 6 * Math.round(g / 51) +\n Math.round(b / 51)\n );\n};\n\n/**\n * Convert ANSI 256 color code to approximate code of ANSI 16 colors.\n */\nexport const ansi256To16 = (code: number): number => {\n let r;\n let g;\n let b;\n\n if (code < 8) {\n return 30 + code;\n }\n\n if (code < 16) {\n return 90 + (code - 8);\n }\n\n if (code >= 232) {\n // greyscale\n // eslint-disable-next-line no-multi-assign\n r = g = b = ((code - 232) * 10 + 8) / 255;\n } else {\n // eslint-disable-next-line no-param-reassign\n code -= 16;\n\n const remainder = code % 36;\n\n r = Math.floor(code / 36) / 5;\n g = Math.floor(remainder / 6) / 5;\n b = (remainder % 6) / 5;\n }\n\n const value = Math.max(r, g, b) * 2;\n\n if (value === 0) {\n return 30;\n }\n\n // eslint-disable-next-line no-bitwise\n const code16 = 30 + ((Math.round(b) << 2) | (Math.round(g) << 1) | Math.round(r));\n\n return value === 2 ? code16 + 60 : code16;\n};\n\nexport const rgbToAnsi16 = (r: number, g: number, b: number): number => ansi256To16(rgbToAnsi256(r, g, b));\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/ansi-codes.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\nimport type { ColorSupportLevel } from \"@visulima/is-ansi-color-supported\";\nimport { isStdoutColorSupported } from \"@visulima/is-ansi-color-supported\";\n\nimport type { AnsiColors, AnsiStyles, ColorData, ColorValueHex } from \"./types\";\nimport { clamp } from \"./util/clamp\";\nimport { convertHexToRgb } from \"./util/convert-hex-to-rgb\";\nimport { ansi256To16, rgbToAnsi16, rgbToAnsi256 } from \"./util/convert-rgb-to-ansi\";\n\nconst closeCode = 39;\nconst bgCloseCode = 49;\nconst bgOffset = 10;\n\nconst supportedColor: ColorSupportLevel = isStdoutColorSupported();\n\nconst mono = { close: \"\", open: \"\" };\n\nconst esc: (open: number | string, close: number | string) => ColorData =\n supportedColor > 0\n ? (open: number | string, close: number | string): ColorData => {\n return { close: \"\\u001B[\" + close + \"m\", open: \"\\u001B[\" + open + \"m\" };\n }\n : (): ColorData => mono;\n\nconst createRgbFunction = (function_: (code: number | string) => ColorData) => (r: number | string, g: number | string, b: number | string) =>\n function_(rgbToAnsi256(Number(r), Number(g), Number(b)));\n\nconst createHexFunction = (function_: (r: number | string, g: number | string, b: number | string) => ColorData) => (hex: ColorValueHex) => {\n const [r, g, b] = convertHexToRgb(hex);\n\n return function_(r, g, b);\n};\n\nlet createAnsi256 = (code: number | string): ColorData => esc(\"38;5;\" + code, closeCode);\n\nlet createBgAnsi256 = (code: number | string): ColorData => esc(\"48;5;\" + code, bgCloseCode);\n\nlet createRgb = (r: number | string, g: number | string, b: number | string): ColorData => esc(\"38;2;\" + r + \";\" + g + \";\" + b, closeCode);\n\nlet createBgRgb = (r: number | string, g: number | string, b: number | string): ColorData => esc(\"48;2;\" + r + \";\" + g + \";\" + b, bgCloseCode);\n\nif (supportedColor === 1) {\n // ANSI 16 colors\n createAnsi256 = (code: number | string) => esc(ansi256To16(Number(code)), closeCode);\n createBgAnsi256 = (code: number | string) => esc(ansi256To16(Number(code)) + bgOffset, bgCloseCode);\n createRgb = (r: number | string, g: number | string, b: number | string) => esc(rgbToAnsi16(Number(r), Number(g), Number(b)), closeCode);\n createBgRgb = (r: number | string, g: number | string, b: number | string) => esc(rgbToAnsi16(Number(r), Number(g), Number(b)) + bgOffset, bgCloseCode);\n} else if (supportedColor === 2) {\n // ANSI 256 colors\n createRgb = createRgbFunction(createAnsi256);\n createBgRgb = createRgbFunction(createBgAnsi256);\n}\n\nexport const baseStyles: Required<Record<AnsiStyles, ColorData>> = {\n // 21 isn't widely supported and 22 does the same thing\n bold: esc(1, 22),\n dim: esc(2, 22),\n hidden: esc(8, 28),\n inverse: esc(7, 27),\n italic: esc(3, 23),\n overline: esc(53, 55),\n reset: esc(0, 0),\n strike: esc(9, 29), // alias for strikethrough\n strikethrough: esc(9, 29),\n underline: esc(4, 24),\n visible: mono,\n};\n\nexport const baseColors: Required<Record<AnsiColors, ColorData>> = {\n bgBlack: esc(40, bgCloseCode),\n bgBlackBright: esc(100, bgCloseCode),\n bgBlue: esc(44, bgCloseCode),\n bgBlueBright: esc(104, bgCloseCode),\n bgCyan: esc(46, bgCloseCode),\n bgCyanBright: esc(106, bgCloseCode),\n bgGray: esc(100, bgCloseCode), // US spelling alias for bgBlackBright\n bgGreen: esc(42, bgCloseCode),\n bgGreenBright: esc(102, bgCloseCode),\n bgGrey: esc(100, bgCloseCode), // UK spelling alias for bgBlackBright\n bgMagenta: esc(45, bgCloseCode),\n bgMagentaBright: esc(105, bgCloseCode),\n bgRed: esc(41, bgCloseCode),\n bgRedBright: esc(101, bgCloseCode),\n bgWhite: esc(47, bgCloseCode),\n bgWhiteBright: esc(107, bgCloseCode),\n bgYellow: esc(43, bgCloseCode),\n bgYellowBright: esc(103, bgCloseCode),\n black: esc(30, closeCode),\n blackBright: esc(90, closeCode),\n blue: esc(34, closeCode),\n blueBright: esc(94, closeCode),\n cyan: esc(36, closeCode),\n cyanBright: esc(96, closeCode),\n gray: esc(90, closeCode), // US spelling alias for blackBright\n green: esc(32, closeCode),\n greenBright: esc(92, closeCode),\n grey: esc(90, closeCode), // UK spelling alias for blackBright\n magenta: esc(35, closeCode),\n magentaBright: esc(95, closeCode),\n red: esc(31, closeCode),\n redBright: esc(91, closeCode),\n white: esc(37, closeCode),\n whiteBright: esc(97, closeCode),\n yellow: esc(33, closeCode),\n yellowBright: esc(93, closeCode),\n};\n\nexport const styleMethods: {\n bg: (code: number) => ColorData;\n bgHex: (hex: ColorValueHex) => ColorData;\n bgRgb: (r: number, g: number, b: number) => ColorData;\n fg: (code: number) => ColorData;\n hex: (hex: ColorValueHex) => ColorData;\n rgb: (r: number, g: number, b: number) => ColorData;\n} = {\n bg: (code) => createBgAnsi256(clamp(code, 0, 255)),\n\n bgHex: createHexFunction(createBgRgb),\n\n bgRgb: (r, g, b) => createBgRgb(clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255)),\n\n fg: (code) => createAnsi256(clamp(code, 0, 255)),\n\n hex: createHexFunction(createRgb),\n\n rgb: (r, g, b) => createRgb(clamp(r, 0, 255), clamp(g, 0, 255), clamp(b, 0, 255)),\n};\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/utils.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\n/**\n * Replace all matched strings.\n * Note: this implementation is over 30% faster than String.replaceAll().\n */\nexport const stringReplaceAll = (string_: string, searchValue: string, replaceValue: string): string => {\n // visible style has empty open/close props\n if (searchValue === \"\") {\n return string_;\n }\n\n let pos = string_.indexOf(searchValue);\n if (pos < 0) {\n return string_;\n }\n\n const substringLength = searchValue.length;\n let lastPos = 0;\n let result = \"\";\n\n // eslint-disable-next-line no-loops/no-loops,no-bitwise\n while (~pos) {\n result += string_.slice(lastPos, pos) + replaceValue;\n lastPos = pos + substringLength;\n pos = string_.indexOf(searchValue, lastPos);\n }\n\n return result + string_.slice(lastPos);\n};\n","/**\n * Modified copy of https://github.com/webdiscus/ansis/blob/master/src/index.js\n *\n * ISC License\n *\n * Copyright (c) 2023, webdiscus\n */\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport ansiRegex from \"ansi-regex\";\n\nimport { baseColors, baseStyles, styleMethods } from \"./ansi-codes\";\nimport type { ColorData, ColorizeType } from \"./types\";\nimport { stringReplaceAll } from \"./util/string-replace-all\";\n\nconst styles: Record<string, object> = {};\n\nlet stylePrototype: object | null = null;\n\nconst wrapText = (\n strings: ArrayLike<string> | ReadonlyArray<string> | number | string | { raw: ArrayLike<string> | ReadonlyArray<string> },\n values: string[],\n properties: ColorizeProperties,\n) => {\n if (!strings) {\n return \"\";\n }\n\n let string =\n (strings as { raw?: ArrayLike<string> | ReadonlyArray<string> | null }).raw == null\n ? (((strings as number | string) + \"\") as string)\n : String.raw(strings as { raw: ArrayLike<string> | ReadonlyArray<string> }, ...values);\n\n if (string.includes(\"\\u001B\")) {\n // eslint-disable-next-line no-loops/no-loops,@typescript-eslint/no-unnecessary-condition\n for (let currentProperties = properties; currentProperties; currentProperties = currentProperties.props) {\n string = stringReplaceAll(string, currentProperties.close, currentProperties.open);\n }\n }\n\n if (string.includes(\"\\n\")) {\n // eslint-disable-next-line unicorn/prefer-string-replace-all\n string = string.replace(/(\\r*\\n)/g, properties.closeStack + \"$1\" + properties.openStack);\n }\n\n return properties.openStack + string + properties.closeStack;\n};\n\ntype ColorizeProperties = { close: string; closeStack: string; open: string; openStack: string; props: ColorizeProperties };\n\nconst createStyle = (\n { props }: { props?: ColorizeProperties },\n { close, open }: ColorData,\n): {\n (strings: ArrayLike<string> | ReadonlyArray<string> | string, ...values: string[]): string;\n close: string;\n open: string;\n props: { close: string; closeStack: string; open: string; openStack: string; props?: ColorizeProperties };\n} => {\n const openStack: string = (props?.openStack ?? \"\") + open;\n const closeStack: string = close + (props?.closeStack ?? \"\");\n\n const style = (strings: ArrayLike<string> | ReadonlyArray<string> | string, ...values: string[]) => wrapText(strings, values, style.props);\n\n Object.setPrototypeOf(style, stylePrototype);\n\n style.props = { close, closeStack, open, openStack, props } as ColorizeProperties;\n style.open = openStack;\n style.close = closeStack;\n\n return style;\n};\n\n// eslint-disable-next-line func-names\nconst Colorize = function () {\n const self = (string_: number | string) => string_ + \"\";\n\n self.strip = (value: string): string => value.replaceAll(ansiRegex(), \"\");\n\n // eslint-disable-next-line guard-for-in,no-loops/no-loops,no-restricted-syntax\n for (const name in baseColors) {\n // eslint-disable-next-line security/detect-object-injection\n styles[name] = {\n get() {\n const style = createStyle(this, baseColors[name as keyof typeof baseColors]);\n\n Object.defineProperty(this, name, { value: style });\n\n return style;\n },\n };\n }\n\n // eslint-disable-next-line guard-for-in,no-loops/no-loops,no-restricted-syntax\n for (const name in baseStyles) {\n // eslint-disable-next-line security/detect-object-injection\n styles[name] = {\n get() {\n const style = createStyle(this, baseStyles[name as keyof typeof baseStyles]);\n\n Object.defineProperty(this, name, { value: style });\n\n return style;\n },\n };\n }\n\n // This needs to be the last thing we do, so that the prototype is fully populated.\n stylePrototype = Object.defineProperties({}, styles);\n\n Object.setPrototypeOf(self, stylePrototype);\n\n return self;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} as any as new () => ColorizeType;\n\n// eslint-disable-next-line guard-for-in,no-loops/no-loops,no-restricted-syntax\nfor (const name in styleMethods) {\n styles[name as keyof typeof styleMethods] = {\n get() {\n return (...arguments_: (number | string)[]) =>\n // @ts-expect-error: TODO: fix typing of `arguments_`\n createStyle(this, styleMethods[name as keyof typeof styleMethods](...arguments_));\n },\n };\n}\n\nstyles.ansi256 = styles.fg as object;\nstyles.bgAnsi256 = styles.bg as object;\n\n// eslint-disable-next-line import/no-default-export\nexport default Colorize;\n","/**\n * Modified copy of https://github.com/chalk/chalk-template/blob/main/index.js\n *\n * MIT License\n *\n * Copyright (c) Josh Junon\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n */\n\n// prettier-ignore\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const makeColorizeTemplate = (template: (text: string) => string): ((firstString: TemplateStringsArray, ...arguments_: any[]) => string) =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (firstString: TemplateStringsArray, ...arguments_: any[]): string => {\n if (!Array.isArray(firstString) || !Array.isArray(firstString.raw)) {\n // If chalkTemplate() was called by itself or with a string\n throw new TypeError(\"A tagged template literal must be provided\");\n }\n\n const parts = [firstString.raw[0]];\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let index = 1; index < firstString.raw.length; index++) {\n // eslint-disable-next-line security/detect-object-injection\n parts.push(String(arguments_[index - 1]).replaceAll(/[{}\\\\]/g, \"\\\\$&\"), String(firstString.raw[index]));\n }\n\n return template(parts.join(\"\"));\n };\n","/**\n * Modified copy of https://github.com/chalk/chalk-template/blob/main/index.js\n *\n * MIT License\n *\n * Copyright (c) Josh Junon\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n */\n\nconst ESCAPES = new Map([\n [\"\\\\\", \"\\\\\"],\n [\"0\", \"\\0\"],\n [\"a\", \"\\u0007\"],\n [\"b\", \"\\b\"],\n [\"e\", \"\\u001B\"],\n [\"f\", \"\\f\"],\n [\"n\", \"\\n\"],\n [\"r\", \"\\r\"],\n [\"t\", \"\\t\"],\n [\"v\", \"\\v\"],\n]);\n\nexport const unescape = (c: string): string => {\n const u = c.startsWith(\"u\");\n const bracket = c[1] === \"{\";\n\n if ((u && !bracket && c.length === 5) || (c.startsWith(\"x\") && c.length === 3)) {\n return String.fromCodePoint(Number.parseInt(c.slice(1), 16));\n }\n\n if (u && bracket) {\n return String.fromCodePoint(Number.parseInt(c.slice(2, -1), 16));\n }\n\n return ESCAPES.get(c) ?? c;\n};\n","/**\n * Modified copy of https://github.com/chalk/chalk-template/blob/main/index.js\n *\n * MIT License\n *\n * Copyright (c) Josh Junon\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n */\n\nimport type { ColorizeType, ColorValueHex } from \"../types\";\nimport { convertHexToRgb } from \"../util/convert-hex-to-rgb\";\nimport { unescape } from \"../util/unescape\";\n\nconst TEMPLATE_REGEX =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-lazy-ends,regexp/no-dupe-disjunctions\n /\\\\(u(?:[a-f\\d]{4}|\\{[a-f\\d]{1,6}\\})|x[a-f\\d]{2}|.)|\\{(~)?(#?[\\w:]+(?:\\([^)]*\\))?(?:\\.#?[\\w:]+(?:\\([^)]*\\))?)*)(?:[ \\t]|(?=\\r?\\n))|(\\})|((?:.|[\\r\\n\\f])+?)/gi;\n// eslint-disable-next-line security/detect-unsafe-regex,regexp/optimal-lookaround-quantifier\nconst STYLE_REGEX = /(?:^|\\.)(?:(\\w+)(?:\\(([^)]*)\\))?|#(?=[:a-f\\d]{2,})([a-f\\d]{6})?(?::([a-f\\d]{6}))?)/gi;\nconst STRING_REGEX = /^(['\"])((?:\\\\.|(?!\\1)[^\\\\])*)\\1$/;\nconst ESCAPE_REGEX = /\\\\(u(?:[a-f\\d]{4}|\\{[a-f\\d]{1,6}\\})|x[a-f\\d]{2}|.)|([^\\\\])/gi;\n\nconst parseArguments = (name: string, value: string): (number | string)[] => {\n const results: (number | string)[] = [];\n const chunks = value.trim().split(/\\s*,\\s*/);\n\n let matches;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const chunk of chunks) {\n const number = Number(chunk);\n\n if (!Number.isNaN(number)) {\n results.push(number);\n // eslint-disable-next-line no-cond-assign\n } else if ((matches = STRING_REGEX.exec(chunk))) {\n // eslint-disable-next-line unicorn/prefer-string-replace-all,@typescript-eslint/no-unsafe-return\n results.push((matches[2] as string).replace(ESCAPE_REGEX, (_, escape, character) => (escape ? unescape(escape as string) : character)));\n } else {\n throw new Error(`Invalid template style argument: ${chunk} (in style '${name}')`);\n }\n }\n\n return results;\n};\n\nconst parseStyle: (style: string) => (number | string | undefined)[][] = (style: string) => {\n STYLE_REGEX.lastIndex = 0;\n\n const results: (number | string | undefined)[][] = [];\n let matches;\n\n // eslint-disable-next-line no-loops/no-loops,no-cond-assign\n while ((matches = STYLE_REGEX.exec(style)) !== null) {\n const name = matches[1];\n\n if (matches[2]) {\n results.push([name, ...parseArguments(name as string, matches[2])]);\n } else if (matches[3] || matches[4]) {\n if (matches[3]) {\n results.push([\"rgb\", ...convertHexToRgb(matches[3] as ColorValueHex)]);\n }\n\n if (matches[4]) {\n results.push([\"bgRgb\", ...convertHexToRgb(matches[4] as ColorValueHex)]);\n }\n } else {\n results.push([name]);\n }\n }\n\n return results;\n};\n\nconst buildStyle = (\n colorize: ColorizeType,\n styles: {\n inverse: string | undefined;\n styles: (number | string | undefined)[][];\n }[],\n) => {\n const enabled: Record<string, (number | string | undefined)[] | null> = {};\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const layer of styles) {\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const style of layer.styles) {\n enabled[style[0] as string] = layer.inverse ? null : style.slice(1);\n }\n }\n\n let current: ColorizeType = colorize;\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const [styleName, enabledStyles] of Object.entries(enabled)) {\n if (!Array.isArray(enabledStyles)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (!(styleName in current)) {\n throw new Error(`Unknown style: ${styleName}`);\n }\n\n // @ts-expect-error - @TODO fix types\n\n current = enabledStyles.length > 0 ? current[styleName as keyof ColorizeType](...enabledStyles) : current[styleName as keyof ColorizeType];\n }\n\n return current;\n};\n\nexport const makeTemplate =\n (colorize: ColorizeType): ((string: string) => string) =>\n (string: string) => {\n const styles: {\n inverse: string | undefined;\n styles: (number | string | undefined)[][];\n }[] = [];\n const chunks = [];\n\n let chunk: string[] = [];\n\n string.replaceAll(\n TEMPLATE_REGEX,\n // @ts-expect-error - TS doesn't understand that the regex args are defined\n (\n _: string,\n escapeCharacter: string | undefined,\n inverse: string | undefined,\n style: string | undefined,\n close: string | undefined,\n character: string | undefined,\n ) => {\n if (escapeCharacter) {\n chunk.push(unescape(escapeCharacter) as string);\n } else if (style) {\n const joinedChunk = chunk.join(\"\");\n\n chunk = [];\n chunks.push(styles.length === 0 ? joinedChunk : buildStyle(colorize, styles)(joinedChunk));\n\n styles.push({ inverse, styles: parseStyle(style) });\n } else if (close) {\n if (styles.length === 0) {\n throw new Error(\"Found extraneous } in template literal\");\n }\n\n chunks.push(buildStyle(colorize, styles)(chunk.join(\"\")));\n chunk = [];\n\n styles.pop();\n } else {\n chunk.push(character as string);\n }\n },\n );\n\n chunks.push(chunk.join(\"\"));\n\n if (styles.length > 0) {\n throw new Error(`template literal is missing ${styles.length} closing bracket${styles.length === 1 ? \"\" : \"s\"} (\\`}\\`)`);\n }\n\n return chunks.join(\"\");\n };\n","import ColorizeImpl from \"./colorize.server\";\nimport { makeColorizeTemplate } from \"./template/make-colorize-template\";\nimport { makeTemplate } from \"./template/make-template\";\nimport type { ColorizeType } from \"./types\";\n\nconst colorize: ColorizeType = new ColorizeImpl() as ColorizeType;\n\n// eslint-disable-next-line import/no-unused-modules,@typescript-eslint/no-explicit-any\nexport const makeTaggedTemplate = (instance: ColorizeType): ((firstString: TemplateStringsArray, ...arguments_: any[]) => string) =>\n makeColorizeTemplate(makeTemplate(instance));\n\n// eslint-disable-next-line import/no-unused-modules\nexport const template = makeTemplate(colorize);\n\n// eslint-disable-next-line import/no-default-export\nexport default makeColorizeTemplate(template);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/colorize",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "Terminal and Console string styling done right.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"256",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"LICENSE.md"
|
|
139
139
|
],
|
|
140
140
|
"dependencies": {
|
|
141
|
-
"@visulima/is-ansi-color-supported": "2.2.
|
|
141
|
+
"@visulima/is-ansi-color-supported": "2.2.6"
|
|
142
142
|
},
|
|
143
143
|
"devDependencies": {
|
|
144
144
|
"@anolilab/eslint-config": "^15.0.3",
|
|
@@ -150,10 +150,10 @@
|
|
|
150
150
|
"@secretlint/secretlint-rule-preset-recommend": "^8.2.4",
|
|
151
151
|
"@total-typescript/ts-reset": "^0.6.1",
|
|
152
152
|
"@types/node": "18.19.15",
|
|
153
|
-
"@visulima/path": "1.0.
|
|
153
|
+
"@visulima/path": "1.0.8",
|
|
154
154
|
"@vitest/coverage-v8": "^2.0.5",
|
|
155
155
|
"@vitest/ui": "^2.0.5",
|
|
156
|
-
"ansi-regex": "^6.0
|
|
156
|
+
"ansi-regex": "^6.1.0",
|
|
157
157
|
"ansi-styles": "^6.2.1",
|
|
158
158
|
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
159
159
|
"cross-env": "^7.0.3",
|