1
0
mirror of https://github.com/garraflavatra/trmclr.git synced 2025-01-18 11:07:57 +00:00

Big refactor

This commit is contained in:
Romein van Buren 2024-08-09 15:17:30 +02:00
parent 94bd33c40d
commit ae00bdb3a7
No known key found for this signature in database
5 changed files with 433 additions and 335 deletions

322
index.d.ts vendored
View File

@ -1,322 +0,0 @@
/**
* Enable or disable terminal coloring.
* @param {boolean} value Whether to enable color output.
*/
export function setColorEnabled(value: boolean): void;
export function getColorEnabled(): boolean;
/**
* Reset color.
* @param {string} str String to color.
* @returns Colored string.
*/
export function reset(str: string): string;
/**
* Make str bold.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bold(str: string): string;
/**
* Dim str.
* @param {string} str String to color.
* @returns Colored string.
*/
export function dim(str: string): string;
/**
* Make str italic.
* @param {string} str String to color.
* @returns Colored string.
*/
export function italic(str: string): string;
/**
* Underline str.
* @param {string} str String to color.
* @returns Colored string.
*/
export function underline(str: string): string;
/**
* Invert the color of str.
* @param {string} str String to color.
* @returns Colored string.
*/
export function inverse(str: string): string;
/**
* Hide str.
* @param {string} str String to color.
* @returns Colored string.
*/
export function hidden(str: string): string;
/**
* Strike str.
* @param {string} str String to color.
* @returns Colored string.
*/
export function strikethrough(str: string): string;
/**
* Make str black.
* @param {string} str String to color.
* @returns Colored string.
*/
export function black(str: string): string;
/**
* Make str red.
* @param {string} str String to color.
* @returns Colored string.
*/
export function red(str: string): string;
/**
* Make str green.
* @param {string} str String to color.
* @returns Colored string.
*/
export function green(str: string): string;
/**
* Make str yellow.
* @param {string} str String to color.
* @returns Colored string.
*/
export function yellow(str: string): string;
/**
* Make str blue.
* @param {string} str String to color.
* @returns Colored string.
*/
export function blue(str: string): string;
/**
* Make str magenta.
* @param {string} str String to color.
* @returns Colored string.
*/
export function magenta(str: string): string;
/**
* Make str cyan.
* @param {string} str String to color.
* @returns Colored string.
*/
export function cyan(str: string): string;
/**
* Make str white.
* @param {string} str String to color.
* @returns Colored string.
*/
export function white(str: string): string;
/**
* Make str gray.
* @param {string} str String to color.
* @returns Colored string.
*/
export function gray(str: string): string;
/**
* Make str bright black.
* @param {string} str String to color.
* @returns Colored string.
*/
export function brightBlack(str: string): string;
/**
* Make str bright red.
* @param {string} str String to color.
* @returns Colored string.
*/
export function brightRed(str: string): string;
/**
* Make str bright rgeen.
* @param {string} str String to color.
* @returns Colored string.
*/
export function brightGreen(str: string): string;
/**
* Make str bright yellow.
* @param {string} str String to color.
* @returns Colored string.
*/
export function brightYellow(str: string): string;
/**
* Make str bright blue.
* @param {string} str String to color.
* @returns Colored string.
*/
export function brightBlue(str: string): string;
/**
* Make str bright magenta.
* @param {string} str String to color.
* @returns Colored string.
*/
export function brightMagenta(str: string): string;
/**
* Make str bright cyan.
* @param {string} str String to color.
* @returns Colored string.
*/
export function brightCyan(str: string): string;
/**
* Make str bright white.
* @param {string} str String to color.
* @returns Colored string.
*/
export function brightWhite(str: string): string;
/**
* Give str a black background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBlack(str: string): string;
/**
* Give str a red background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgRed(str: string): string;
/**
* Give str a green background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgGreen(str: string): string;
/**
* Give str a yellow background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgYellow(str: string): string;
/**
* Give str a blue background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBlue(str: string): string;
/**
* Give str a magenta background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgMagenta(str: string): string;
/**
* Give str a cyan background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgCyan(str: string): string;
/**
* Give str a white background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgWhite(str: string): string;
/**
* Give str a bright black background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBrightBlack(str: string): string;
/**
* Give str a bright red background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBrightRed(str: string): string;
/**
* Give str a bright green background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBrightGreen(str: string): string;
/**
* Give str a bright yellow background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBrightYellow(str: string): string;
/**
* Give str a bright blue background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBrightBlue(str: string): string;
/**
* Give str a bright magenta background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBrightMagenta(str: string): string;
/**
* Give str a bright cyan background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBrightCyan(str: string): string;
/**
* Give str a bright white background.
* @param {string} str String to color.
* @returns Colored string.
*/
export function bgBrightWhite(str: string): string;
/**
* Set str's color using paletted 8-bit colors.
* @see https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
*
* @param {string} str String to color.
* @param {number} color 8-bit RGB color
* @returns Colored string.
*/
export function rgb8(str: string, color: number): string;
/**
* Set str's background color using paletted 8-bit colors.
* @see https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
*
* @param {string} str String to color.
* @param {number} color 8-bit RGB color
* @returns Colored string.
*/
export function bgRgb8(str: string, color: number): string;
/**
* Set str's color using paletted 8-bit colors.
* @see https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
*
* @param {string} str String to color.
* @param {number | RGB} color 8-bit RGB color
* @returns Colored string.
*/
export function rgb24(str: string, color: number | RGB): string;
/**
* Set str's background using paletted 24-bit colors.
* @see https://en.wikipedia.org/wiki/ANSI_escape_code#24-bit
*
* @param {string} str String to color.
* @param {number | RGB} color 24-bit RGB color
* @returns Colored string.
*/
export function bgRgb24(str: string, color: number | RGB): string;
/**
* Remove all colors and decorations from str.
*
* @param {string} str String to uncolor.
* @returns Uncolored string.
*/
export function stripColor(str: string): string;
/**
* @typedef Color
* @property {string} open
* @property {string} close
* @property {RegExp} regexp
*/
/**
* @typedef RGB
* @property {number} r
* @property {number} g
* @property {number} b
*/
/**
* True if `NO_COLOR` is set.
* @see https://no-color.org/
*/
export const noColor: boolean;
export type Color = {
open: string;
close: string;
regexp: RegExp;
};
export type RGB = {
r: number;
g: number;
b: number;
};

View File

@ -1,4 +1,4 @@
/* global process, Deno */ /* global globalThis */
/** /**
* @typedef Color * @typedef Color
@ -19,7 +19,7 @@
* @see https://no-color.org/ * @see https://no-color.org/
*/ */
// @ts-expect-error Depends on environment. // @ts-expect-error Depends on environment.
export const noColor = !!process?.env?.NO_COLOR || !!Deno?.noColor; export const noColor = !!globalThis.process?.env?.NO_COLOR || !!globalThis.Deno?.noColor;
let enabled = !noColor; let enabled = !noColor;

415
package-lock.json generated
View File

@ -13,6 +13,7 @@
"@types/node": "^22.1.0", "@types/node": "^22.1.0",
"@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/eslint-plugin": "^6.21.0",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"rollup": "^4.20.0",
"typescript": "^5.5.4" "typescript": "^5.5.4"
} }
}, },
@ -172,6 +173,220 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.20.0.tgz",
"integrity": "sha512-TSpWzflCc4VGAUJZlPpgAJE1+V60MePDQnBd7PPkpuEmOy8i87aL6tinFGKBFKuEDikYpig72QzdT3QPYIi+oA==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"android"
]
},
"node_modules/@rollup/rollup-android-arm64": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.20.0.tgz",
"integrity": "sha512-u00Ro/nok7oGzVuh/FMYfNoGqxU5CPWz1mxV85S2w9LxHR8OoMQBuSk+3BKVIDYgkpeOET5yXkx90OYFc+ytpQ==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"android"
]
},
"node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.20.0.tgz",
"integrity": "sha512-uFVfvzvsdGtlSLuL0ZlvPJvl6ZmrH4CBwLGEFPe7hUmf7htGAN+aXo43R/V6LATyxlKVC/m6UsLb7jbG+LG39Q==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@rollup/rollup-darwin-x64": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.20.0.tgz",
"integrity": "sha512-xbrMDdlev53vNXexEa6l0LffojxhqDTBeL+VUxuuIXys4x6xyvbKq5XqTXBCEUA8ty8iEJblHvFaWRJTk/icAQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.20.0.tgz",
"integrity": "sha512-jMYvxZwGmoHFBTbr12Xc6wOdc2xA5tF5F2q6t7Rcfab68TT0n+r7dgawD4qhPEvasDsVpQi+MgDzj2faOLsZjA==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-arm-musleabihf": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.20.0.tgz",
"integrity": "sha512-1asSTl4HKuIHIB1GcdFHNNZhxAYEdqML/MW4QmPS4G0ivbEcBr1JKlFLKsIRqjSwOBkdItn3/ZDlyvZ/N6KPlw==",
"cpu": [
"arm"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.20.0.tgz",
"integrity": "sha512-COBb8Bkx56KldOYJfMf6wKeYJrtJ9vEgBRAOkfw6Ens0tnmzPqvlpjZiLgkhg6cA3DGzCmLmmd319pmHvKWWlQ==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-arm64-musl": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.20.0.tgz",
"integrity": "sha512-+it+mBSyMslVQa8wSPvBx53fYuZK/oLTu5RJoXogjk6x7Q7sz1GNRsXWjn6SwyJm8E/oMjNVwPhmNdIjwP135Q==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.20.0.tgz",
"integrity": "sha512-yAMvqhPfGKsAxHN8I4+jE0CpLWD8cv4z7CK7BMmhjDuz606Q2tFKkWRY8bHR9JQXYcoLfopo5TTqzxgPUjUMfw==",
"cpu": [
"ppc64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-riscv64-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.20.0.tgz",
"integrity": "sha512-qmuxFpfmi/2SUkAw95TtNq/w/I7Gpjurx609OOOV7U4vhvUhBcftcmXwl3rqAek+ADBwSjIC4IVNLiszoj3dPA==",
"cpu": [
"riscv64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-s390x-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.20.0.tgz",
"integrity": "sha512-I0BtGXddHSHjV1mqTNkgUZLnS3WtsqebAXv11D5BZE/gfw5KoyXSAXVqyJximQXNvNzUo4GKlCK/dIwXlz+jlg==",
"cpu": [
"s390x"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.20.0.tgz",
"integrity": "sha512-y+eoL2I3iphUg9tN9GB6ku1FA8kOfmF4oUEWhztDJ4KXJy1agk/9+pejOuZkNFhRwHAOxMsBPLbXPd6mJiCwew==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.20.0.tgz",
"integrity": "sha512-hM3nhW40kBNYUkZb/r9k2FKK+/MnKglX7UYd4ZUy5DJs8/sMsIbqWK2piZtVGE3kcXVNj3B2IrUYROJMMCikNg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-win32-arm64-msvc": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.20.0.tgz",
"integrity": "sha512-psegMvP+Ik/Bg7QRJbv8w8PAytPA7Uo8fpFjXyCRHWm6Nt42L+JtoqH8eDQ5hRP7/XW2UiIriy1Z46jf0Oa1kA==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"win32"
]
},
"node_modules/@rollup/rollup-win32-ia32-msvc": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.20.0.tgz",
"integrity": "sha512-GabekH3w4lgAJpVxkk7hUzUf2hICSQO0a/BLFA11/RMxQT92MabKAqyubzDZmMOC/hcJNlc+rrypzNzYl4Dx7A==",
"cpu": [
"ia32"
],
"dev": true,
"optional": true,
"os": [
"win32"
]
},
"node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.20.0.tgz",
"integrity": "sha512-aJ1EJSuTdGnM6qbVC4B5DSmozPTqIag9fSzXRNNo+humQLG89XpPgdt16Ia56ORD7s+H8Pmyx44uczDQ0yDzpg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
]
},
"node_modules/@types/estree": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
"dev": true
},
"node_modules/@types/json-schema": { "node_modules/@types/json-schema": {
"version": "7.0.15", "version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@ -1418,6 +1633,20 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true "dev": true
}, },
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": { "node_modules/function-bind": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
@ -2472,6 +2701,41 @@
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/rollup": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.20.0.tgz",
"integrity": "sha512-6rbWBChcnSGzIlXeIdNIZTopKYad8ZG8ajhl78lGRLsI2rX8IkaotQhVas2Ma+GPxJav19wrSzvRvuiv0YKzWw==",
"dev": true,
"dependencies": {
"@types/estree": "1.0.5"
},
"bin": {
"rollup": "dist/bin/rollup"
},
"engines": {
"node": ">=18.0.0",
"npm": ">=8.0.0"
},
"optionalDependencies": {
"@rollup/rollup-android-arm-eabi": "4.20.0",
"@rollup/rollup-android-arm64": "4.20.0",
"@rollup/rollup-darwin-arm64": "4.20.0",
"@rollup/rollup-darwin-x64": "4.20.0",
"@rollup/rollup-linux-arm-gnueabihf": "4.20.0",
"@rollup/rollup-linux-arm-musleabihf": "4.20.0",
"@rollup/rollup-linux-arm64-gnu": "4.20.0",
"@rollup/rollup-linux-arm64-musl": "4.20.0",
"@rollup/rollup-linux-powerpc64le-gnu": "4.20.0",
"@rollup/rollup-linux-riscv64-gnu": "4.20.0",
"@rollup/rollup-linux-s390x-gnu": "4.20.0",
"@rollup/rollup-linux-x64-gnu": "4.20.0",
"@rollup/rollup-linux-x64-musl": "4.20.0",
"@rollup/rollup-win32-arm64-msvc": "4.20.0",
"@rollup/rollup-win32-ia32-msvc": "4.20.0",
"@rollup/rollup-win32-x64-msvc": "4.20.0",
"fsevents": "~2.3.2"
}
},
"node_modules/run-parallel": { "node_modules/run-parallel": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
@ -3082,6 +3346,124 @@
"fastq": "^1.6.0" "fastq": "^1.6.0"
} }
}, },
"@rollup/rollup-android-arm-eabi": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.20.0.tgz",
"integrity": "sha512-TSpWzflCc4VGAUJZlPpgAJE1+V60MePDQnBd7PPkpuEmOy8i87aL6tinFGKBFKuEDikYpig72QzdT3QPYIi+oA==",
"dev": true,
"optional": true
},
"@rollup/rollup-android-arm64": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.20.0.tgz",
"integrity": "sha512-u00Ro/nok7oGzVuh/FMYfNoGqxU5CPWz1mxV85S2w9LxHR8OoMQBuSk+3BKVIDYgkpeOET5yXkx90OYFc+ytpQ==",
"dev": true,
"optional": true
},
"@rollup/rollup-darwin-arm64": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.20.0.tgz",
"integrity": "sha512-uFVfvzvsdGtlSLuL0ZlvPJvl6ZmrH4CBwLGEFPe7hUmf7htGAN+aXo43R/V6LATyxlKVC/m6UsLb7jbG+LG39Q==",
"dev": true,
"optional": true
},
"@rollup/rollup-darwin-x64": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.20.0.tgz",
"integrity": "sha512-xbrMDdlev53vNXexEa6l0LffojxhqDTBeL+VUxuuIXys4x6xyvbKq5XqTXBCEUA8ty8iEJblHvFaWRJTk/icAQ==",
"dev": true,
"optional": true
},
"@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.20.0.tgz",
"integrity": "sha512-jMYvxZwGmoHFBTbr12Xc6wOdc2xA5tF5F2q6t7Rcfab68TT0n+r7dgawD4qhPEvasDsVpQi+MgDzj2faOLsZjA==",
"dev": true,
"optional": true
},
"@rollup/rollup-linux-arm-musleabihf": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.20.0.tgz",
"integrity": "sha512-1asSTl4HKuIHIB1GcdFHNNZhxAYEdqML/MW4QmPS4G0ivbEcBr1JKlFLKsIRqjSwOBkdItn3/ZDlyvZ/N6KPlw==",
"dev": true,
"optional": true
},
"@rollup/rollup-linux-arm64-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.20.0.tgz",
"integrity": "sha512-COBb8Bkx56KldOYJfMf6wKeYJrtJ9vEgBRAOkfw6Ens0tnmzPqvlpjZiLgkhg6cA3DGzCmLmmd319pmHvKWWlQ==",
"dev": true,
"optional": true
},
"@rollup/rollup-linux-arm64-musl": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.20.0.tgz",
"integrity": "sha512-+it+mBSyMslVQa8wSPvBx53fYuZK/oLTu5RJoXogjk6x7Q7sz1GNRsXWjn6SwyJm8E/oMjNVwPhmNdIjwP135Q==",
"dev": true,
"optional": true
},
"@rollup/rollup-linux-powerpc64le-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.20.0.tgz",
"integrity": "sha512-yAMvqhPfGKsAxHN8I4+jE0CpLWD8cv4z7CK7BMmhjDuz606Q2tFKkWRY8bHR9JQXYcoLfopo5TTqzxgPUjUMfw==",
"dev": true,
"optional": true
},
"@rollup/rollup-linux-riscv64-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.20.0.tgz",
"integrity": "sha512-qmuxFpfmi/2SUkAw95TtNq/w/I7Gpjurx609OOOV7U4vhvUhBcftcmXwl3rqAek+ADBwSjIC4IVNLiszoj3dPA==",
"dev": true,
"optional": true
},
"@rollup/rollup-linux-s390x-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.20.0.tgz",
"integrity": "sha512-I0BtGXddHSHjV1mqTNkgUZLnS3WtsqebAXv11D5BZE/gfw5KoyXSAXVqyJximQXNvNzUo4GKlCK/dIwXlz+jlg==",
"dev": true,
"optional": true
},
"@rollup/rollup-linux-x64-gnu": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.20.0.tgz",
"integrity": "sha512-y+eoL2I3iphUg9tN9GB6ku1FA8kOfmF4oUEWhztDJ4KXJy1agk/9+pejOuZkNFhRwHAOxMsBPLbXPd6mJiCwew==",
"dev": true,
"optional": true
},
"@rollup/rollup-linux-x64-musl": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.20.0.tgz",
"integrity": "sha512-hM3nhW40kBNYUkZb/r9k2FKK+/MnKglX7UYd4ZUy5DJs8/sMsIbqWK2piZtVGE3kcXVNj3B2IrUYROJMMCikNg==",
"dev": true,
"optional": true
},
"@rollup/rollup-win32-arm64-msvc": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.20.0.tgz",
"integrity": "sha512-psegMvP+Ik/Bg7QRJbv8w8PAytPA7Uo8fpFjXyCRHWm6Nt42L+JtoqH8eDQ5hRP7/XW2UiIriy1Z46jf0Oa1kA==",
"dev": true,
"optional": true
},
"@rollup/rollup-win32-ia32-msvc": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.20.0.tgz",
"integrity": "sha512-GabekH3w4lgAJpVxkk7hUzUf2hICSQO0a/BLFA11/RMxQT92MabKAqyubzDZmMOC/hcJNlc+rrypzNzYl4Dx7A==",
"dev": true,
"optional": true
},
"@rollup/rollup-win32-x64-msvc": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.20.0.tgz",
"integrity": "sha512-aJ1EJSuTdGnM6qbVC4B5DSmozPTqIag9fSzXRNNo+humQLG89XpPgdt16Ia56ORD7s+H8Pmyx44uczDQ0yDzpg==",
"dev": true,
"optional": true
},
"@types/estree": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
"integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
"dev": true
},
"@types/json-schema": { "@types/json-schema": {
"version": "7.0.15", "version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@ -3988,6 +4370,13 @@
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true "dev": true
}, },
"fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"optional": true
},
"function-bind": { "function-bind": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
@ -4703,6 +5092,32 @@
"glob": "^7.1.3" "glob": "^7.1.3"
} }
}, },
"rollup": {
"version": "4.20.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.20.0.tgz",
"integrity": "sha512-6rbWBChcnSGzIlXeIdNIZTopKYad8ZG8ajhl78lGRLsI2rX8IkaotQhVas2Ma+GPxJav19wrSzvRvuiv0YKzWw==",
"dev": true,
"requires": {
"@rollup/rollup-android-arm-eabi": "4.20.0",
"@rollup/rollup-android-arm64": "4.20.0",
"@rollup/rollup-darwin-arm64": "4.20.0",
"@rollup/rollup-darwin-x64": "4.20.0",
"@rollup/rollup-linux-arm-gnueabihf": "4.20.0",
"@rollup/rollup-linux-arm-musleabihf": "4.20.0",
"@rollup/rollup-linux-arm64-gnu": "4.20.0",
"@rollup/rollup-linux-arm64-musl": "4.20.0",
"@rollup/rollup-linux-powerpc64le-gnu": "4.20.0",
"@rollup/rollup-linux-riscv64-gnu": "4.20.0",
"@rollup/rollup-linux-s390x-gnu": "4.20.0",
"@rollup/rollup-linux-x64-gnu": "4.20.0",
"@rollup/rollup-linux-x64-musl": "4.20.0",
"@rollup/rollup-win32-arm64-msvc": "4.20.0",
"@rollup/rollup-win32-ia32-msvc": "4.20.0",
"@rollup/rollup-win32-x64-msvc": "4.20.0",
"@types/estree": "1.0.5",
"fsevents": "~2.3.2"
}
},
"run-parallel": { "run-parallel": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",

View File

@ -2,11 +2,15 @@
"name": "trmclr", "name": "trmclr",
"version": "1.0.1", "version": "1.0.1",
"description": "Terminal colors but easier", "description": "Terminal colors but easier",
"main": "index.js", "author": "Romein van Buren <romein@vburen.nl>",
"types": "index.d.ts", "license": "MIT",
"main": "dist/index.cjs",
"module": "index.mjs",
"types": "dist/index.d.mts",
"type": "module",
"files": [ "files": [
"index.js", "index.mjs",
"index.d.ts" "dist"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
@ -18,14 +22,12 @@
"terminal", "terminal",
"console" "console"
], ],
"author": "Romein van Buren <romein@vburen.nl>",
"license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/garraflavatra/trmclr/issues" "url": "https://github.com/garraflavatra/trmclr/issues"
}, },
"homepage": "https://github.com/garraflavatra/trmclr#readme", "homepage": "https://github.com/garraflavatra/trmclr#readme",
"scripts": { "scripts": {
"build": "tsc", "build": "rm -rf dist && tsc && rollup index.mjs -f umd -n trmclr -o dist/index.cjs",
"lint": "eslint index.js" "lint": "eslint index.js"
}, },
"devDependencies": { "devDependencies": {
@ -33,10 +35,14 @@
"@types/node": "^22.1.0", "@types/node": "^22.1.0",
"@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/eslint-plugin": "^6.21.0",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"rollup": "^4.20.0",
"typescript": "^5.5.4" "typescript": "^5.5.4"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "./node_modules/@garraflavatra/yeslint/configs/generic.js", "extends": "./node_modules/@garraflavatra/yeslint/configs/generic.js",
"ignorePatterns": [
"dist"
],
"parserOptions": { "parserOptions": {
"sourceType": "module" "sourceType": "module"
} }

View File

@ -1,13 +1,12 @@
{ {
"include": [ "include": [
"index.js" "index.mjs"
], ],
"compilerOptions": { "compilerOptions": {
// Rread JS files, as normally they are ignored as source files "module": "Node16",
"outDir": "dist",
"allowJs": true, "allowJs": true,
// Generate d.ts files
"declaration": true, "declaration": true,
// Only output d.ts files
"emitDeclarationOnly": true "emitDeclarationOnly": true
} }
} }