feat: init
This commit is contained in:
9
node_modules/@poppinss/colors/LICENSE.md
generated
vendored
Normal file
9
node_modules/@poppinss/colors/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# The MIT License
|
||||
|
||||
Copyright 2021 Harminder Virk, contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
95
node_modules/@poppinss/colors/README.md
generated
vendored
Normal file
95
node_modules/@poppinss/colors/README.md
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
# @poppinss/colors
|
||||
> Wrapper over [kleur](https://www.npmjs.com/package/kleur) with better support for testing
|
||||
|
||||
[![gh-workflow-image]][gh-workflow-url] [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
|
||||
|
||||
## Why this package exists?
|
||||
This package is a wrapper over [kleur](https://www.npmjs.com/package/kleur) with additional implementations to make testing easier and work seamlessly with terminals/stdout streams that do not support colors.
|
||||
|
||||
## Usage
|
||||
Install the package from the npm registry as follows.
|
||||
|
||||
```sh
|
||||
npm i @poppinss/colors
|
||||
```
|
||||
|
||||
And use it as follows. The `ansi` method returns an instance of the [kleur](https://www.npmjs.com/package/kleur) package.
|
||||
|
||||
```ts
|
||||
import useColors from '@poppinss/colors'
|
||||
const colors = useColors.ansi()
|
||||
|
||||
console.log(colors.red('this is an error'))
|
||||
console.log(colors.cyan('hello world'))
|
||||
```
|
||||
|
||||
Chaining methods
|
||||
|
||||
```ts
|
||||
const colors = useColors.ansi()
|
||||
console.log(colors.red().bgBlack('this is an error'))
|
||||
```
|
||||
|
||||
### Raw implementation
|
||||
The raw implementation is ideal for testing. Instead of outputting ANSI escape codes, we wrap the string with transformation names. For example:
|
||||
|
||||
```ts
|
||||
import useColors from '@poppinss/colors'
|
||||
const colors = useColors.raw()
|
||||
|
||||
console.log(colors.red('hello world'))
|
||||
// OUTPUT: red(hello world)
|
||||
|
||||
console.log(colors.bgBlack().red('hello world'))
|
||||
// OUTPUT: bgBlack(red(hello world))
|
||||
```
|
||||
|
||||
As you can notice, the output is a plain text value, so it is easier to write assertions against it.
|
||||
|
||||
```ts
|
||||
assert.equal(colors.red('hello world'), 'red(hello world)')
|
||||
```
|
||||
|
||||
### Silent output
|
||||
The silent mode does not perform any transformations on the string and returns the value. This is helpful when the output terminal or stdout stream does not support colors.
|
||||
|
||||
```ts
|
||||
import useColors from '@poppinss/colors'
|
||||
const colors = useColors.silent()
|
||||
|
||||
console.log(colors.red('hello world'))
|
||||
// OUTPUT: hello world
|
||||
|
||||
console.log(colors.bgBlack().red('hello world'))
|
||||
// OUTPUT: hello world
|
||||
```
|
||||
|
||||
## Pick based on the runtime environment
|
||||
Ideally, you will use one of the available implementations based on some runtime environment. For example:
|
||||
|
||||
```ts
|
||||
import useColors from '@poppinss/colors'
|
||||
import supportsColor from 'supports-color'
|
||||
|
||||
const isTestEnv = process.env.NODE_ENV === 'test'
|
||||
|
||||
const colors = isTestEnv
|
||||
? useColors.raw() // use raw in test environment
|
||||
: supportsColor.stdout
|
||||
? useColors.ansi() // use kleur when stdout has colors
|
||||
: useColors.silent() // use silent mode
|
||||
|
||||
export default colors
|
||||
```
|
||||
|
||||
[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/poppinss/colors/checks.yml?style=for-the-badge
|
||||
[gh-workflow-url]: https://github.com/poppinss/colors/actions/workflows/checks.yml "Github action"
|
||||
|
||||
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
|
||||
[typescript-url]: "typescript"
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/@poppinss/colors.svg?style=for-the-badge&logo=npm
|
||||
[npm-url]: https://npmjs.org/package/@poppinss/colors 'npm'
|
||||
|
||||
[license-image]: https://img.shields.io/npm/l/@poppinss/colors?color=blueviolet&style=for-the-badge
|
||||
[license-url]: LICENSE.md 'license'
|
||||
15
node_modules/@poppinss/colors/build/index.d.ts
generated
vendored
Normal file
15
node_modules/@poppinss/colors/build/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @poppinss/colors
|
||||
*
|
||||
* (c) Poppinss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
import { type Colors } from './src/base.ts';
|
||||
declare const useColors: {
|
||||
ansi(): Colors;
|
||||
silent(): Colors;
|
||||
raw(): Colors;
|
||||
};
|
||||
export default useColors;
|
||||
139
node_modules/@poppinss/colors/build/index.js
generated
vendored
Normal file
139
node_modules/@poppinss/colors/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
import kleur from "kleur";
|
||||
var Colors = class {
|
||||
black(text) {
|
||||
return this.transform("black", text);
|
||||
}
|
||||
red(text) {
|
||||
return this.transform("red", text);
|
||||
}
|
||||
green(text) {
|
||||
return this.transform("green", text);
|
||||
}
|
||||
yellow(text) {
|
||||
return this.transform("yellow", text);
|
||||
}
|
||||
blue(text) {
|
||||
return this.transform("blue", text);
|
||||
}
|
||||
magenta(text) {
|
||||
return this.transform("magenta", text);
|
||||
}
|
||||
cyan(text) {
|
||||
return this.transform("cyan", text);
|
||||
}
|
||||
white(text) {
|
||||
return this.transform("white", text);
|
||||
}
|
||||
gray(text) {
|
||||
return this.transform("gray", text);
|
||||
}
|
||||
grey(text) {
|
||||
return this.transform("grey", text);
|
||||
}
|
||||
bgBlack(text) {
|
||||
return this.transform("bgBlack", text);
|
||||
}
|
||||
bgRed(text) {
|
||||
return this.transform("bgRed", text);
|
||||
}
|
||||
bgGreen(text) {
|
||||
return this.transform("bgGreen", text);
|
||||
}
|
||||
bgYellow(text) {
|
||||
return this.transform("bgYellow", text);
|
||||
}
|
||||
bgBlue(text) {
|
||||
return this.transform("bgBlue", text);
|
||||
}
|
||||
bgMagenta(text) {
|
||||
return this.transform("bgMagenta", text);
|
||||
}
|
||||
bgCyan(text) {
|
||||
return this.transform("bgCyan", text);
|
||||
}
|
||||
bgWhite(text) {
|
||||
return this.transform("bgWhite", text);
|
||||
}
|
||||
reset(text) {
|
||||
return this.transform("reset", text);
|
||||
}
|
||||
bold(text) {
|
||||
return this.transform("bold", text);
|
||||
}
|
||||
dim(text) {
|
||||
return this.transform("dim", text);
|
||||
}
|
||||
italic(text) {
|
||||
return this.transform("italic", text);
|
||||
}
|
||||
underline(text) {
|
||||
return this.transform("underline", text);
|
||||
}
|
||||
inverse(text) {
|
||||
return this.transform("inverse", text);
|
||||
}
|
||||
hidden(text) {
|
||||
return this.transform("hidden", text);
|
||||
}
|
||||
strikethrough(text) {
|
||||
return this.transform("strikethrough", text);
|
||||
}
|
||||
};
|
||||
var Raw = class extends Colors {
|
||||
#transformations = [];
|
||||
#dispose(value, callback) {
|
||||
callback();
|
||||
return value;
|
||||
}
|
||||
transform(transformation, text) {
|
||||
this.#transformations.push(transformation);
|
||||
if (text !== void 0) {
|
||||
const transformations = this.#transformations.concat([text]).join("(");
|
||||
const closingWrapping = new Array(this.#transformations.length + 1).join(")");
|
||||
return this.#dispose(`${transformations}${closingWrapping}`, () => {
|
||||
this.#transformations = [];
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
var Kleur = class extends Colors {
|
||||
#chain;
|
||||
constructor() {
|
||||
super();
|
||||
kleur.enabled = true;
|
||||
}
|
||||
#dispose(value, callback) {
|
||||
callback();
|
||||
return value;
|
||||
}
|
||||
transform(transformation, text) {
|
||||
if (text !== void 0) {
|
||||
if (this.#chain) return this.#dispose(this.#chain[transformation](text), () => {
|
||||
this.#chain = void 0;
|
||||
});
|
||||
return kleur[transformation](text);
|
||||
}
|
||||
if (this.#chain) this.#chain = this.#chain[transformation]();
|
||||
else this.#chain = kleur[transformation]();
|
||||
return this;
|
||||
}
|
||||
};
|
||||
var Silent = class extends Colors {
|
||||
transform(_, text) {
|
||||
if (text !== void 0) return String(text);
|
||||
return this;
|
||||
}
|
||||
};
|
||||
var colors_default = {
|
||||
ansi() {
|
||||
return new Kleur();
|
||||
},
|
||||
silent() {
|
||||
return new Silent();
|
||||
},
|
||||
raw() {
|
||||
return new Raw();
|
||||
}
|
||||
};
|
||||
export { colors_default as default };
|
||||
68
node_modules/@poppinss/colors/build/src/base.d.ts
generated
vendored
Normal file
68
node_modules/@poppinss/colors/build/src/base.d.ts
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @poppinss/colors
|
||||
*
|
||||
* (c) Poppinss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
/**
|
||||
* Abstract implementation of the colors class.
|
||||
*/
|
||||
export declare abstract class Colors {
|
||||
protected abstract transform(transformation: string): this;
|
||||
protected abstract transform(transformation: string, text: string | number): string;
|
||||
protected abstract transform(transformation: string, text?: string | number): this | string;
|
||||
black(): this;
|
||||
black(text: string): string;
|
||||
red(): this;
|
||||
red(text: string): string;
|
||||
green(): this;
|
||||
green(text: string): string;
|
||||
yellow(): this;
|
||||
yellow(text: string): string;
|
||||
blue(): this;
|
||||
blue(text: string): string;
|
||||
magenta(): this;
|
||||
magenta(text: string): string;
|
||||
cyan(): this;
|
||||
cyan(text: string): string;
|
||||
white(): this;
|
||||
white(text: string): string;
|
||||
gray(): this;
|
||||
gray(text: string): string;
|
||||
grey(): this;
|
||||
grey(text: string): string;
|
||||
bgBlack(): this;
|
||||
bgBlack(text: string): string;
|
||||
bgRed(): this;
|
||||
bgRed(text: string): string;
|
||||
bgGreen(): this;
|
||||
bgGreen(text: string): string;
|
||||
bgYellow(): this;
|
||||
bgYellow(text: string): string;
|
||||
bgBlue(): this;
|
||||
bgBlue(text: string): string;
|
||||
bgMagenta(): this;
|
||||
bgMagenta(text: string): string;
|
||||
bgCyan(): this;
|
||||
bgCyan(text: string): string;
|
||||
bgWhite(): this;
|
||||
bgWhite(text: string): string;
|
||||
reset(): this;
|
||||
reset(text: string): string;
|
||||
bold(): this;
|
||||
bold(text: string): string;
|
||||
dim(): this;
|
||||
dim(text: string): string;
|
||||
italic(): this;
|
||||
italic(text: string): string;
|
||||
underline(): this;
|
||||
underline(text: string): string;
|
||||
inverse(): this;
|
||||
inverse(text: string): string;
|
||||
hidden(): this;
|
||||
hidden(text: string): string;
|
||||
strikethrough(): this;
|
||||
strikethrough(text: string): string;
|
||||
}
|
||||
23
node_modules/@poppinss/colors/build/src/kleur.d.ts
generated
vendored
Normal file
23
node_modules/@poppinss/colors/build/src/kleur.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @poppinss/colors
|
||||
*
|
||||
* (c) Poppinss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
import { Colors } from './base.ts';
|
||||
import { type ColorTransformations } from './types.ts';
|
||||
/**
|
||||
* Concrete implementation of the Colors class using Kleur
|
||||
*/
|
||||
export declare class Kleur extends Colors {
|
||||
#private;
|
||||
constructor();
|
||||
/**
|
||||
* Perform the given transformation. The abstract Color class calls this
|
||||
* method
|
||||
*/
|
||||
protected transform(transformation: ColorTransformations): this;
|
||||
protected transform(transformation: ColorTransformations, text: string | number): string;
|
||||
}
|
||||
25
node_modules/@poppinss/colors/build/src/raw.d.ts
generated
vendored
Normal file
25
node_modules/@poppinss/colors/build/src/raw.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @poppinss/colors
|
||||
*
|
||||
* (c) Poppinss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
import { Colors } from './base.ts';
|
||||
import { type ColorTransformations } from './types.ts';
|
||||
/**
|
||||
* Concrete implementation of the Colors class that prefixes the
|
||||
* applied transformations to the final text as string.
|
||||
*
|
||||
* This class is meant to be used at the time of testing
|
||||
*/
|
||||
export declare class Raw extends Colors {
|
||||
#private;
|
||||
/**
|
||||
* Perform the given transformation. The base class will
|
||||
* invoke this method
|
||||
*/
|
||||
protected transform(transformation: ColorTransformations): this;
|
||||
protected transform(transformation: ColorTransformations, text: string | number): string;
|
||||
}
|
||||
22
node_modules/@poppinss/colors/build/src/silent.d.ts
generated
vendored
Normal file
22
node_modules/@poppinss/colors/build/src/silent.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @poppinss/colors
|
||||
*
|
||||
* (c) Poppinss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
import { Colors } from './base.ts';
|
||||
import { type ColorTransformations } from './types.ts';
|
||||
/**
|
||||
* Concrete implementation of the Colors class that returns
|
||||
* the value as it is.
|
||||
*/
|
||||
export declare class Silent extends Colors {
|
||||
/**
|
||||
* Perform the given transformation. The abstract Color class calls this
|
||||
* method
|
||||
*/
|
||||
protected transform(transformation: ColorTransformations): this;
|
||||
protected transform(transformation: ColorTransformations, text: string | number): string;
|
||||
}
|
||||
11
node_modules/@poppinss/colors/build/src/types.d.ts
generated
vendored
Normal file
11
node_modules/@poppinss/colors/build/src/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @poppinss/colors
|
||||
*
|
||||
* (c) Poppinss
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
import { type Colors } from './base.ts';
|
||||
export type { Colors } from './base.ts';
|
||||
export type ColorTransformations = keyof Colors;
|
||||
1
node_modules/@poppinss/colors/build/src/types.js
generated
vendored
Normal file
1
node_modules/@poppinss/colors/build/src/types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
38
node_modules/@poppinss/colors/node_modules/kleur/colors.d.ts
generated
vendored
Normal file
38
node_modules/@poppinss/colors/node_modules/kleur/colors.d.ts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
declare function print(input: string | boolean | number): string;
|
||||
declare function print(input: undefined | void): undefined;
|
||||
declare function print(input: null): null;
|
||||
type Colorize = typeof print;
|
||||
|
||||
export declare const $: { enabled: boolean };
|
||||
|
||||
// Colors
|
||||
export declare const black: Colorize;
|
||||
export declare const red: Colorize;
|
||||
export declare const green: Colorize;
|
||||
export declare const yellow: Colorize;
|
||||
export declare const blue: Colorize;
|
||||
export declare const magenta: Colorize;
|
||||
export declare const cyan: Colorize;
|
||||
export declare const white: Colorize;
|
||||
export declare const gray: Colorize;
|
||||
export declare const grey: Colorize;
|
||||
|
||||
// Backgrounds
|
||||
export declare const bgBlack: Colorize;
|
||||
export declare const bgRed: Colorize;
|
||||
export declare const bgGreen: Colorize;
|
||||
export declare const bgYellow: Colorize;
|
||||
export declare const bgBlue: Colorize;
|
||||
export declare const bgMagenta: Colorize;
|
||||
export declare const bgCyan: Colorize;
|
||||
export declare const bgWhite: Colorize;
|
||||
|
||||
// Modifiers
|
||||
export declare const reset: Colorize;
|
||||
export declare const bold: Colorize;
|
||||
export declare const dim: Colorize;
|
||||
export declare const italic: Colorize;
|
||||
export declare const underline: Colorize;
|
||||
export declare const inverse: Colorize;
|
||||
export declare const hidden: Colorize;
|
||||
export declare const strikethrough: Colorize;
|
||||
53
node_modules/@poppinss/colors/node_modules/kleur/colors.js
generated
vendored
Normal file
53
node_modules/@poppinss/colors/node_modules/kleur/colors.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;
|
||||
if (typeof process !== 'undefined') {
|
||||
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
||||
isTTY = process.stdout && process.stdout.isTTY;
|
||||
}
|
||||
|
||||
const $ = exports.$ = {
|
||||
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (
|
||||
FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY
|
||||
)
|
||||
}
|
||||
|
||||
function init(x, y) {
|
||||
let rgx = new RegExp(`\\x1b\\[${y}m`, 'g');
|
||||
let open = `\x1b[${x}m`, close = `\x1b[${y}m`;
|
||||
|
||||
return function (txt) {
|
||||
if (!$.enabled || txt == null) return txt;
|
||||
return open + (!!~(''+txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
|
||||
};
|
||||
}
|
||||
|
||||
// modifiers
|
||||
exports.reset = init(0, 0);
|
||||
exports.bold = init(1, 22);
|
||||
exports.dim = init(2, 22);
|
||||
exports.italic = init(3, 23);
|
||||
exports.underline = init(4, 24);
|
||||
exports.inverse = init(7, 27);
|
||||
exports.hidden = init(8, 28);
|
||||
exports.strikethrough = init(9, 29);
|
||||
|
||||
// colors
|
||||
exports.black = init(30, 39);
|
||||
exports.red = init(31, 39);
|
||||
exports.green = init(32, 39);
|
||||
exports.yellow = init(33, 39);
|
||||
exports.blue = init(34, 39);
|
||||
exports.magenta = init(35, 39);
|
||||
exports.cyan = init(36, 39);
|
||||
exports.white = init(37, 39);
|
||||
exports.gray = init(90, 39);
|
||||
exports.grey = init(90, 39);
|
||||
|
||||
// background colors
|
||||
exports.bgBlack = init(40, 49);
|
||||
exports.bgRed = init(41, 49);
|
||||
exports.bgGreen = init(42, 49);
|
||||
exports.bgYellow = init(43, 49);
|
||||
exports.bgBlue = init(44, 49);
|
||||
exports.bgMagenta = init(45, 49);
|
||||
exports.bgCyan = init(46, 49);
|
||||
exports.bgWhite = init(47, 49);
|
||||
53
node_modules/@poppinss/colors/node_modules/kleur/colors.mjs
generated
vendored
Normal file
53
node_modules/@poppinss/colors/node_modules/kleur/colors.mjs
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;
|
||||
if (typeof process !== 'undefined') {
|
||||
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
||||
isTTY = process.stdout && process.stdout.isTTY;
|
||||
}
|
||||
|
||||
export const $ = {
|
||||
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (
|
||||
FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY
|
||||
)
|
||||
}
|
||||
|
||||
function init(x, y) {
|
||||
let rgx = new RegExp(`\\x1b\\[${y}m`, 'g');
|
||||
let open = `\x1b[${x}m`, close = `\x1b[${y}m`;
|
||||
|
||||
return function (txt) {
|
||||
if (!$.enabled || txt == null) return txt;
|
||||
return open + (!!~(''+txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
|
||||
};
|
||||
}
|
||||
|
||||
// modifiers
|
||||
export const reset = init(0, 0);
|
||||
export const bold = init(1, 22);
|
||||
export const dim = init(2, 22);
|
||||
export const italic = init(3, 23);
|
||||
export const underline = init(4, 24);
|
||||
export const inverse = init(7, 27);
|
||||
export const hidden = init(8, 28);
|
||||
export const strikethrough = init(9, 29);
|
||||
|
||||
// colors
|
||||
export const black = init(30, 39);
|
||||
export const red = init(31, 39);
|
||||
export const green = init(32, 39);
|
||||
export const yellow = init(33, 39);
|
||||
export const blue = init(34, 39);
|
||||
export const magenta = init(35, 39);
|
||||
export const cyan = init(36, 39);
|
||||
export const white = init(37, 39);
|
||||
export const gray = init(90, 39);
|
||||
export const grey = init(90, 39);
|
||||
|
||||
// background colors
|
||||
export const bgBlack = init(40, 49);
|
||||
export const bgRed = init(41, 49);
|
||||
export const bgGreen = init(42, 49);
|
||||
export const bgYellow = init(43, 49);
|
||||
export const bgBlue = init(44, 49);
|
||||
export const bgMagenta = init(45, 49);
|
||||
export const bgCyan = init(46, 49);
|
||||
export const bgWhite = init(47, 49);
|
||||
45
node_modules/@poppinss/colors/node_modules/kleur/index.d.ts
generated
vendored
Normal file
45
node_modules/@poppinss/colors/node_modules/kleur/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
// Originally by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Adapted by: Madhav Varshney <https://github.com/madhavarshney>
|
||||
declare namespace kleur {
|
||||
interface Color {
|
||||
(x: string | number): string;
|
||||
(): Kleur;
|
||||
}
|
||||
|
||||
interface Kleur {
|
||||
// Colors
|
||||
black: Color;
|
||||
red: Color;
|
||||
green: Color;
|
||||
yellow: Color;
|
||||
blue: Color;
|
||||
magenta: Color;
|
||||
cyan: Color;
|
||||
white: Color;
|
||||
gray: Color;
|
||||
grey: Color;
|
||||
|
||||
// Backgrounds
|
||||
bgBlack: Color;
|
||||
bgRed: Color;
|
||||
bgGreen: Color;
|
||||
bgYellow: Color;
|
||||
bgBlue: Color;
|
||||
bgMagenta: Color;
|
||||
bgCyan: Color;
|
||||
bgWhite: Color;
|
||||
|
||||
// Modifiers
|
||||
reset: Color;
|
||||
bold: Color;
|
||||
dim: Color;
|
||||
italic: Color;
|
||||
underline: Color;
|
||||
inverse: Color;
|
||||
hidden: Color;
|
||||
strikethrough: Color;
|
||||
}
|
||||
}
|
||||
|
||||
declare let kleur: kleur.Kleur & { enabled: boolean };
|
||||
export = kleur;
|
||||
110
node_modules/@poppinss/colors/node_modules/kleur/index.js
generated
vendored
Normal file
110
node_modules/@poppinss/colors/node_modules/kleur/index.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
'use strict';
|
||||
|
||||
let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;
|
||||
if (typeof process !== 'undefined') {
|
||||
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
||||
isTTY = process.stdout && process.stdout.isTTY;
|
||||
}
|
||||
|
||||
const $ = {
|
||||
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (
|
||||
FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY
|
||||
),
|
||||
|
||||
// modifiers
|
||||
reset: init(0, 0),
|
||||
bold: init(1, 22),
|
||||
dim: init(2, 22),
|
||||
italic: init(3, 23),
|
||||
underline: init(4, 24),
|
||||
inverse: init(7, 27),
|
||||
hidden: init(8, 28),
|
||||
strikethrough: init(9, 29),
|
||||
|
||||
// colors
|
||||
black: init(30, 39),
|
||||
red: init(31, 39),
|
||||
green: init(32, 39),
|
||||
yellow: init(33, 39),
|
||||
blue: init(34, 39),
|
||||
magenta: init(35, 39),
|
||||
cyan: init(36, 39),
|
||||
white: init(37, 39),
|
||||
gray: init(90, 39),
|
||||
grey: init(90, 39),
|
||||
|
||||
// background colors
|
||||
bgBlack: init(40, 49),
|
||||
bgRed: init(41, 49),
|
||||
bgGreen: init(42, 49),
|
||||
bgYellow: init(43, 49),
|
||||
bgBlue: init(44, 49),
|
||||
bgMagenta: init(45, 49),
|
||||
bgCyan: init(46, 49),
|
||||
bgWhite: init(47, 49)
|
||||
};
|
||||
|
||||
function run(arr, str) {
|
||||
let i=0, tmp, beg='', end='';
|
||||
for (; i < arr.length; i++) {
|
||||
tmp = arr[i];
|
||||
beg += tmp.open;
|
||||
end += tmp.close;
|
||||
if (!!~str.indexOf(tmp.close)) {
|
||||
str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
||||
}
|
||||
}
|
||||
return beg + str + end;
|
||||
}
|
||||
|
||||
function chain(has, keys) {
|
||||
let ctx = { has, keys };
|
||||
|
||||
ctx.reset = $.reset.bind(ctx);
|
||||
ctx.bold = $.bold.bind(ctx);
|
||||
ctx.dim = $.dim.bind(ctx);
|
||||
ctx.italic = $.italic.bind(ctx);
|
||||
ctx.underline = $.underline.bind(ctx);
|
||||
ctx.inverse = $.inverse.bind(ctx);
|
||||
ctx.hidden = $.hidden.bind(ctx);
|
||||
ctx.strikethrough = $.strikethrough.bind(ctx);
|
||||
|
||||
ctx.black = $.black.bind(ctx);
|
||||
ctx.red = $.red.bind(ctx);
|
||||
ctx.green = $.green.bind(ctx);
|
||||
ctx.yellow = $.yellow.bind(ctx);
|
||||
ctx.blue = $.blue.bind(ctx);
|
||||
ctx.magenta = $.magenta.bind(ctx);
|
||||
ctx.cyan = $.cyan.bind(ctx);
|
||||
ctx.white = $.white.bind(ctx);
|
||||
ctx.gray = $.gray.bind(ctx);
|
||||
ctx.grey = $.grey.bind(ctx);
|
||||
|
||||
ctx.bgBlack = $.bgBlack.bind(ctx);
|
||||
ctx.bgRed = $.bgRed.bind(ctx);
|
||||
ctx.bgGreen = $.bgGreen.bind(ctx);
|
||||
ctx.bgYellow = $.bgYellow.bind(ctx);
|
||||
ctx.bgBlue = $.bgBlue.bind(ctx);
|
||||
ctx.bgMagenta = $.bgMagenta.bind(ctx);
|
||||
ctx.bgCyan = $.bgCyan.bind(ctx);
|
||||
ctx.bgWhite = $.bgWhite.bind(ctx);
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
function init(open, close) {
|
||||
let blk = {
|
||||
open: `\x1b[${open}m`,
|
||||
close: `\x1b[${close}m`,
|
||||
rgx: new RegExp(`\\x1b\\[${close}m`, 'g')
|
||||
};
|
||||
return function (txt) {
|
||||
if (this !== void 0 && this.has !== void 0) {
|
||||
!!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk));
|
||||
return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+'';
|
||||
}
|
||||
return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = $;
|
||||
110
node_modules/@poppinss/colors/node_modules/kleur/index.mjs
generated
vendored
Normal file
110
node_modules/@poppinss/colors/node_modules/kleur/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
'use strict';
|
||||
|
||||
let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;
|
||||
if (typeof process !== 'undefined') {
|
||||
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
||||
isTTY = process.stdout && process.stdout.isTTY;
|
||||
}
|
||||
|
||||
const $ = {
|
||||
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (
|
||||
FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY
|
||||
),
|
||||
|
||||
// modifiers
|
||||
reset: init(0, 0),
|
||||
bold: init(1, 22),
|
||||
dim: init(2, 22),
|
||||
italic: init(3, 23),
|
||||
underline: init(4, 24),
|
||||
inverse: init(7, 27),
|
||||
hidden: init(8, 28),
|
||||
strikethrough: init(9, 29),
|
||||
|
||||
// colors
|
||||
black: init(30, 39),
|
||||
red: init(31, 39),
|
||||
green: init(32, 39),
|
||||
yellow: init(33, 39),
|
||||
blue: init(34, 39),
|
||||
magenta: init(35, 39),
|
||||
cyan: init(36, 39),
|
||||
white: init(37, 39),
|
||||
gray: init(90, 39),
|
||||
grey: init(90, 39),
|
||||
|
||||
// background colors
|
||||
bgBlack: init(40, 49),
|
||||
bgRed: init(41, 49),
|
||||
bgGreen: init(42, 49),
|
||||
bgYellow: init(43, 49),
|
||||
bgBlue: init(44, 49),
|
||||
bgMagenta: init(45, 49),
|
||||
bgCyan: init(46, 49),
|
||||
bgWhite: init(47, 49)
|
||||
};
|
||||
|
||||
function run(arr, str) {
|
||||
let i=0, tmp, beg='', end='';
|
||||
for (; i < arr.length; i++) {
|
||||
tmp = arr[i];
|
||||
beg += tmp.open;
|
||||
end += tmp.close;
|
||||
if (!!~str.indexOf(tmp.close)) {
|
||||
str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
||||
}
|
||||
}
|
||||
return beg + str + end;
|
||||
}
|
||||
|
||||
function chain(has, keys) {
|
||||
let ctx = { has, keys };
|
||||
|
||||
ctx.reset = $.reset.bind(ctx);
|
||||
ctx.bold = $.bold.bind(ctx);
|
||||
ctx.dim = $.dim.bind(ctx);
|
||||
ctx.italic = $.italic.bind(ctx);
|
||||
ctx.underline = $.underline.bind(ctx);
|
||||
ctx.inverse = $.inverse.bind(ctx);
|
||||
ctx.hidden = $.hidden.bind(ctx);
|
||||
ctx.strikethrough = $.strikethrough.bind(ctx);
|
||||
|
||||
ctx.black = $.black.bind(ctx);
|
||||
ctx.red = $.red.bind(ctx);
|
||||
ctx.green = $.green.bind(ctx);
|
||||
ctx.yellow = $.yellow.bind(ctx);
|
||||
ctx.blue = $.blue.bind(ctx);
|
||||
ctx.magenta = $.magenta.bind(ctx);
|
||||
ctx.cyan = $.cyan.bind(ctx);
|
||||
ctx.white = $.white.bind(ctx);
|
||||
ctx.gray = $.gray.bind(ctx);
|
||||
ctx.grey = $.grey.bind(ctx);
|
||||
|
||||
ctx.bgBlack = $.bgBlack.bind(ctx);
|
||||
ctx.bgRed = $.bgRed.bind(ctx);
|
||||
ctx.bgGreen = $.bgGreen.bind(ctx);
|
||||
ctx.bgYellow = $.bgYellow.bind(ctx);
|
||||
ctx.bgBlue = $.bgBlue.bind(ctx);
|
||||
ctx.bgMagenta = $.bgMagenta.bind(ctx);
|
||||
ctx.bgCyan = $.bgCyan.bind(ctx);
|
||||
ctx.bgWhite = $.bgWhite.bind(ctx);
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
function init(open, close) {
|
||||
let blk = {
|
||||
open: `\x1b[${open}m`,
|
||||
close: `\x1b[${close}m`,
|
||||
rgx: new RegExp(`\\x1b\\[${close}m`, 'g')
|
||||
};
|
||||
return function (txt) {
|
||||
if (this !== void 0 && this.has !== void 0) {
|
||||
!!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk));
|
||||
return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+'';
|
||||
}
|
||||
return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';
|
||||
};
|
||||
}
|
||||
|
||||
export default $;
|
||||
21
node_modules/@poppinss/colors/node_modules/kleur/license
generated
vendored
Normal file
21
node_modules/@poppinss/colors/node_modules/kleur/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
51
node_modules/@poppinss/colors/node_modules/kleur/package.json
generated
vendored
Normal file
51
node_modules/@poppinss/colors/node_modules/kleur/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "kleur",
|
||||
"version": "4.1.5",
|
||||
"repository": "lukeed/kleur",
|
||||
"description": "The fastest Node.js library for formatting terminal text with ANSI colors~!",
|
||||
"module": "index.mjs",
|
||||
"types": "index.d.ts",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.mjs",
|
||||
"require": "./index.js"
|
||||
},
|
||||
"./colors": {
|
||||
"types": "./colors.d.ts",
|
||||
"import": "./colors.mjs",
|
||||
"require": "./colors.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"colors.*",
|
||||
"index.*"
|
||||
],
|
||||
"author": {
|
||||
"name": "Luke Edwards",
|
||||
"email": "luke.edwards05@gmail.com",
|
||||
"url": "https://lukeed.com"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node build",
|
||||
"test": "uvu -r esm -i utils -i xyz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"cli",
|
||||
"color",
|
||||
"colors",
|
||||
"console",
|
||||
"terminal"
|
||||
],
|
||||
"devDependencies": {
|
||||
"esm": "3.2.25",
|
||||
"uvu": "0.3.3"
|
||||
}
|
||||
}
|
||||
232
node_modules/@poppinss/colors/node_modules/kleur/readme.md
generated
vendored
Normal file
232
node_modules/@poppinss/colors/node_modules/kleur/readme.md
generated
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
<div align="center">
|
||||
<img src="shots/logo.png" alt="kleur" height="120" />
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://npmjs.org/package/kleur">
|
||||
<img src="https://badgen.now.sh/npm/v/kleur" alt="version" />
|
||||
</a>
|
||||
<a href="https://github.com/lukeed/kleur/actions?query=workflow%3ACI">
|
||||
<img src="https://github.com/lukeed/kleur/workflows/CI/badge.svg?event=push" alt="CI" />
|
||||
</a>
|
||||
<a href="https://npmjs.org/package/kleur">
|
||||
<img src="https://badgen.now.sh/npm/dm/kleur" alt="downloads" />
|
||||
</a>
|
||||
<a href="https://packagephobia.now.sh/result?p=kleur">
|
||||
<img src="https://packagephobia.now.sh/badge?p=kleur" alt="install size" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div align="center">The fastest Node.js library for formatting terminal text with ANSI colors~!</div>
|
||||
|
||||
## Features
|
||||
|
||||
* No dependencies
|
||||
* Super [lightweight](#load-time) & [performant](#performance)
|
||||
* Supports [nested](#nested-methods) & [chained](#chained-methods) colors
|
||||
* No `String.prototype` modifications
|
||||
* Conditional [color support](#conditional-support)
|
||||
* [Fully treeshakable](#individual-colors)
|
||||
* Familiar [API](#api)
|
||||
|
||||
---
|
||||
|
||||
As of `v3.0` the Chalk-style syntax (magical getter) is no longer used.<br>Please visit [History](#history) for migration paths supporting that syntax.
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save kleur
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import kleur from 'kleur';
|
||||
|
||||
// basic usage
|
||||
kleur.red('red text');
|
||||
|
||||
// chained methods
|
||||
kleur.blue().bold().underline('howdy partner');
|
||||
|
||||
// nested methods
|
||||
kleur.bold(`${ white().bgRed('[ERROR]') } ${ kleur.red().italic('Something happened')}`);
|
||||
```
|
||||
|
||||
### Chained Methods
|
||||
|
||||
```js
|
||||
const { bold, green } = require('kleur');
|
||||
|
||||
console.log(bold().red('this is a bold red message'));
|
||||
console.log(bold().italic('this is a bold italicized message'));
|
||||
console.log(bold().yellow().bgRed().italic('this is a bold yellow italicized message'));
|
||||
console.log(green().bold().underline('this is a bold green underlined message'));
|
||||
```
|
||||
|
||||
<img src="shots/1.png" width="300" />
|
||||
|
||||
### Nested Methods
|
||||
|
||||
```js
|
||||
const { yellow, red, cyan } = require('kleur');
|
||||
|
||||
console.log(yellow(`foo ${red().bold('red')} bar ${cyan('cyan')} baz`));
|
||||
console.log(yellow('foo ' + red().bold('red') + ' bar ' + cyan('cyan') + ' baz'));
|
||||
```
|
||||
|
||||
<img src="shots/2.png" width="300" />
|
||||
|
||||
|
||||
### Conditional Support
|
||||
|
||||
Toggle color support as needed; `kleur` includes simple auto-detection which may not cover all cases.
|
||||
|
||||
> **Note:** Both `kleur` and `kleur/colors` share the same detection logic.
|
||||
|
||||
```js
|
||||
import kleur from 'kleur';
|
||||
|
||||
// manually disable
|
||||
kleur.enabled = false;
|
||||
|
||||
// or use another library to detect support
|
||||
kleur.enabled = require('color-support').level > 0;
|
||||
|
||||
console.log(kleur.red('I will only be colored red if the terminal supports colors'));
|
||||
```
|
||||
|
||||
> **Important:** <br>Colors will be disabled automatically in non [TTY contexts](https://nodejs.org/api/process.html#process_a_note_on_process_i_o). For example, spawning another process or piping output into another process will disable colorization automatically. To force colors in your piped output, you may do so with the `FORCE_COLOR=1` environment variable:
|
||||
|
||||
```sh
|
||||
$ node app.js #=> COLORS
|
||||
$ node app.js > log.txt #=> NO COLORS
|
||||
$ FORCE_COLOR=1 node app.js > log.txt #=> COLORS
|
||||
$ FORCE_COLOR=0 node app.js > log.txt #=> NO COLORS
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Any `kleur` method returns a `String` when invoked with input; otherwise chaining is expected.
|
||||
|
||||
> It's up to the developer to pass the output to destinations like `console.log`, `process.stdout.write`, etc.
|
||||
|
||||
The methods below are grouped by type for legibility purposes only. They each can be [chained](#chained-methods) or [nested](#nested-methods) with one another.
|
||||
|
||||
***Colors:***
|
||||
> black — red — green — yellow — blue — magenta — cyan — white — gray — grey
|
||||
|
||||
***Backgrounds:***
|
||||
> bgBlack — bgRed — bgGreen — bgYellow — bgBlue — bgMagenta — bgCyan — bgWhite
|
||||
|
||||
***Modifiers:***
|
||||
> reset — bold — dim — italic* — underline — inverse — hidden — strikethrough*
|
||||
|
||||
<sup>* <em>Not widely supported</em></sup>
|
||||
|
||||
|
||||
## Individual Colors
|
||||
|
||||
When you only need a few colors, it doesn't make sense to import _all_ of `kleur` because, as small as it is, `kleur` is not treeshakeable, and so most of its code will be doing nothing. In order to fix this, you can import from the `kleur/colors` submodule which _fully_ supports tree-shaking.
|
||||
|
||||
The caveat with this approach is that color functions **are not** chainable~!<br>Each function receives and colorizes its input. You may combine colors, backgrounds, and modifiers by nesting function calls within other functions.
|
||||
|
||||
```js
|
||||
// or: import * as kleur from 'kleur/colors';
|
||||
import { red, underline, bgWhite } from 'kleur/colors';
|
||||
|
||||
red('red text');
|
||||
//~> kleur.red('red text');
|
||||
|
||||
underline(red('red underlined text'));
|
||||
//~> kleur.underline().red('red underlined text');
|
||||
|
||||
bgWhite(underline(red('red underlined text w/ white background')));
|
||||
//~> kleur.bgWhite().underline().red('red underlined text w/ white background');
|
||||
```
|
||||
|
||||
> **Note:** All the same [colors, backgrounds, and modifiers](#api) are available.
|
||||
|
||||
***Conditional Support***
|
||||
|
||||
The `kleur/colors` submodule also allows you to toggle color support, as needed.<br>
|
||||
It includes the same initial assumptions as `kleur`, in an attempt to have colors enabled by default.
|
||||
|
||||
Unlike `kleur`, this setting exists as `kleur.$.enabled` instead of `kleur.enabled`:
|
||||
|
||||
```js
|
||||
import * as kleur from 'kleur/colors';
|
||||
// or: import { $, red } from 'kleur/colors';
|
||||
|
||||
// manually disabled
|
||||
kleur.$.enabled = false;
|
||||
|
||||
// or use another library to detect support
|
||||
kleur.$.enabled = require('color-support').level > 0;
|
||||
|
||||
console.log(red('I will only be colored red if the terminal supports colors'));
|
||||
```
|
||||
|
||||
|
||||
## Benchmarks
|
||||
|
||||
> Using Node v10.13.0
|
||||
|
||||
### Load time
|
||||
|
||||
```
|
||||
chalk :: 5.303ms
|
||||
kleur :: 0.488ms
|
||||
kleur/colors :: 0.369ms
|
||||
ansi-colors :: 1.504ms
|
||||
```
|
||||
|
||||
### Performance
|
||||
|
||||
```
|
||||
# All Colors
|
||||
ansi-colors x 177,625 ops/sec ±1.47% (92 runs sampled)
|
||||
chalk x 611,907 ops/sec ±0.20% (92 runs sampled)
|
||||
kleur x 742,509 ops/sec ±1.47% (93 runs sampled)
|
||||
kleur/colors x 881,742 ops/sec ±0.19% (98 runs sampled)
|
||||
|
||||
# Stacked colors
|
||||
ansi-colors x 23,331 ops/sec ±1.81% (94 runs sampled)
|
||||
chalk x 337,178 ops/sec ±0.20% (98 runs sampled)
|
||||
kleur x 78,299 ops/sec ±1.01% (97 runs sampled)
|
||||
kleur/colors x 104,431 ops/sec ±0.22% (97 runs sampled)
|
||||
|
||||
# Nested colors
|
||||
ansi-colors x 67,181 ops/sec ±1.15% (92 runs sampled)
|
||||
chalk x 116,361 ops/sec ±0.63% (94 runs sampled)
|
||||
kleur x 139,514 ops/sec ±0.76% (95 runs sampled)
|
||||
kleur/colors x 145,716 ops/sec ±0.97% (97 runs sampled)
|
||||
```
|
||||
|
||||
|
||||
## History
|
||||
|
||||
This project originally forked [`ansi-colors`](https://github.com/doowb/ansi-colors).
|
||||
|
||||
Beginning with `kleur@3.0`, the Chalk-style syntax (magical getter) has been replaced with function calls per key:
|
||||
|
||||
```js
|
||||
// Old:
|
||||
c.red.bold.underline('old');
|
||||
|
||||
// New:
|
||||
c.red().bold().underline('new');
|
||||
```
|
||||
> <sup><em>As I work more with Rust, the newer syntax feels so much better & more natural!</em></sup>
|
||||
|
||||
If you prefer the old syntax, you may migrate to `ansi-colors` or newer `chalk` releases.<br>Versions below `kleur@3.0` have been officially deprecated.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Luke Edwards](https://lukeed.com)
|
||||
118
node_modules/@poppinss/colors/package.json
generated
vendored
Normal file
118
node_modules/@poppinss/colors/package.json
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"name": "@poppinss/colors",
|
||||
"version": "4.1.6",
|
||||
"description": "A wrapper on top of kleur with ability to write test against the color functions",
|
||||
"main": "build/index.js",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"build",
|
||||
"!build/tests",
|
||||
"!build/bin"
|
||||
],
|
||||
"exports": {
|
||||
".": "./build/index.js",
|
||||
"./types": "./build/src/types.js"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "npm run lint",
|
||||
"test": "c8 npm run quick:test",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --write .",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"precompile": "npm run lint && npm run clean",
|
||||
"compile": "tsdown && tsc --emitDeclarationOnly --declaration",
|
||||
"clean": "del-cli build",
|
||||
"build": "npm run compile",
|
||||
"version": "npm run build",
|
||||
"prepublishOnly": "npm run build",
|
||||
"release": "release-it",
|
||||
"quick:test": "node --import=@poppinss/ts-exec --enable-source-maps bin/test.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@adonisjs/eslint-config": "^3.0.0-next.5",
|
||||
"@adonisjs/prettier-config": "^1.4.5",
|
||||
"@adonisjs/tsconfig": "^2.0.0-next.3",
|
||||
"@japa/assert": "^4.1.1",
|
||||
"@japa/runner": "^4.4.0",
|
||||
"@poppinss/ts-exec": "^1.4.1",
|
||||
"@release-it/conventional-changelog": "^10.0.3",
|
||||
"@types/node": "^25.0.1",
|
||||
"c8": "^10.1.3",
|
||||
"del-cli": "^7.0.0",
|
||||
"eslint": "^9.39.1",
|
||||
"prettier": "^3.7.4",
|
||||
"release-it": "^19.1.0",
|
||||
"tsdown": "^0.17.3",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"kleur": "^4.1.5"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/poppinss/colors.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/poppinss/colors/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"kleur",
|
||||
"colors"
|
||||
],
|
||||
"author": "virk",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/poppinss/colors#readme",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"provenance": true
|
||||
},
|
||||
"tsdown": {
|
||||
"entry": [
|
||||
"./index.ts",
|
||||
"./src/types.ts"
|
||||
],
|
||||
"outDir": "./build",
|
||||
"clean": true,
|
||||
"format": "esm",
|
||||
"minify": "dce-only",
|
||||
"fixedExtension": false,
|
||||
"dts": false,
|
||||
"treeshake": false,
|
||||
"sourcemaps": false,
|
||||
"target": "esnext"
|
||||
},
|
||||
"release-it": {
|
||||
"git": {
|
||||
"requireCleanWorkingDir": true,
|
||||
"requireUpstream": true,
|
||||
"commitMessage": "chore(release): ${version}",
|
||||
"tagAnnotation": "v${version}",
|
||||
"push": true,
|
||||
"tagName": "v${version}"
|
||||
},
|
||||
"github": {
|
||||
"release": true
|
||||
},
|
||||
"npm": {
|
||||
"publish": true,
|
||||
"skipChecks": true
|
||||
},
|
||||
"plugins": {
|
||||
"@release-it/conventional-changelog": {
|
||||
"preset": {
|
||||
"name": "angular"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"c8": {
|
||||
"reporter": [
|
||||
"text",
|
||||
"html"
|
||||
],
|
||||
"exclude": [
|
||||
"tests/**"
|
||||
]
|
||||
},
|
||||
"prettier": "@adonisjs/prettier-config"
|
||||
}
|
||||
Reference in New Issue
Block a user