Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 04fdbd6

Browse files
committed
Bundle dependencies
1 parent d7c4aac commit 04fdbd6

File tree

10 files changed

+667
-10
lines changed

10 files changed

+667
-10
lines changed

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
"funding": "https://github.com/chalk/chalk?sponsor=1",
88
"type": "module",
99
"exports": "./source/index.js",
10+
"imports": {
11+
"#ansi-styles": "./source/vendor/ansi-styles/index.js",
12+
"#supports-color": {
13+
"node": "./source/vendor/supports-color/index.js",
14+
"default": "./source/vendor/supports-color/browser.js"
15+
}
16+
},
1017
"engines": {
1118
"node": "^12.17.0 || ^14.13 || >=16.0.0"
1219
},
@@ -40,10 +47,6 @@
4047
"command-line",
4148
"text"
4249
],
43-
"dependencies": {
44-
"ansi-styles": "^6.1.0",
45-
"supports-color": "^9.1.0"
46-
},
4750
"devDependencies": {
4851
"ava": "^3.15.0",
4952
"color-convert": "^2.0.1",

source/index.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import {ColorInfo, ColorSupportLevel} from 'supports-color';
1+
// TODO: Make it this when TS suports that.
2+
// import {ColorInfo, ColorSupportLevel} from '#supports-color';
3+
import {ColorInfo, ColorSupportLevel} from './vendor/supports-color/index.js';
24

35
/**
46
Basic foreground colors.
@@ -310,6 +312,7 @@ export {
310312
ColorInfo,
311313
ColorSupport,
312314
ColorSupportLevel,
313-
} from 'supports-color';
315+
// } from '#supports-color';
316+
} from './vendor/supports-color/index.js';
314317

315318
export default chalk;

source/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import ansiStyles from 'ansi-styles';
2-
import supportsColor from 'supports-color';
3-
import {
1+
import ansiStyles from '#ansi-styles';
2+
import supportsColor from '#supports-color';
3+
import { // eslint-disable-line import/order
44
stringReplaceAll,
55
stringEncaseCRLFWithFirstIndex,
6-
} from './util.js';
6+
} from './utilities.js';
77

88
const {stdout: stdoutColor, stderr: stderrColor} = supportsColor;
99

File renamed without changes.
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
export interface CSPair { // eslint-disable-line @typescript-eslint/naming-convention
2+
/**
3+
The ANSI terminal control sequence for starting this style.
4+
*/
5+
readonly open: string;
6+
7+
/**
8+
The ANSI terminal control sequence for ending this style.
9+
*/
10+
readonly close: string;
11+
}
12+
13+
export interface ColorBase {
14+
/**
15+
The ANSI terminal control sequence for ending this color.
16+
*/
17+
readonly close: string;
18+
19+
ansi(code: number): string;
20+
21+
ansi256(code: number): string;
22+
23+
ansi16m(red: number, green: number, blue: number): string;
24+
}
25+
26+
export interface Modifier {
27+
/**
28+
Resets the current color chain.
29+
*/
30+
readonly reset: CSPair;
31+
32+
/**
33+
Make text bold.
34+
*/
35+
readonly bold: CSPair;
36+
37+
/**
38+
Emitting only a small amount of light.
39+
*/
40+
readonly dim: CSPair;
41+
42+
/**
43+
Make text italic. (Not widely supported)
44+
*/
45+
readonly italic: CSPair;
46+
47+
/**
48+
Make text underline. (Not widely supported)
49+
*/
50+
readonly underline: CSPair;
51+
52+
/**
53+
Make text overline.
54+
55+
Supported on VTE-based terminals, the GNOME terminal, mintty, and Git Bash.
56+
*/
57+
readonly overline: CSPair;
58+
59+
/**
60+
Inverse background and foreground colors.
61+
*/
62+
readonly inverse: CSPair;
63+
64+
/**
65+
Prints the text, but makes it invisible.
66+
*/
67+
readonly hidden: CSPair;
68+
69+
/**
70+
Puts a horizontal line through the center of the text. (Not widely supported)
71+
*/
72+
readonly strikethrough: CSPair;
73+
}
74+
75+
export interface ForegroundColor {
76+
readonly black: CSPair;
77+
readonly red: CSPair;
78+
readonly green: CSPair;
79+
readonly yellow: CSPair;
80+
readonly blue: CSPair;
81+
readonly cyan: CSPair;
82+
readonly magenta: CSPair;
83+
readonly white: CSPair;
84+
85+
/**
86+
Alias for `blackBright`.
87+
*/
88+
readonly gray: CSPair;
89+
90+
/**
91+
Alias for `blackBright`.
92+
*/
93+
readonly grey: CSPair;
94+
95+
readonly blackBright: CSPair;
96+
readonly redBright: CSPair;
97+
readonly greenBright: CSPair;
98+
readonly yellowBright: CSPair;
99+
readonly blueBright: CSPair;
100+
readonly cyanBright: CSPair;
101+
readonly magentaBright: CSPair;
102+
readonly whiteBright: CSPair;
103+
}
104+
105+
export interface BackgroundColor {
106+
readonly bgBlack: CSPair;
107+
readonly bgRed: CSPair;
108+
readonly bgGreen: CSPair;
109+
readonly bgYellow: CSPair;
110+
readonly bgBlue: CSPair;
111+
readonly bgCyan: CSPair;
112+
readonly bgMagenta: CSPair;
113+
readonly bgWhite: CSPair;
114+
115+
/**
116+
Alias for `bgBlackBright`.
117+
*/
118+
readonly bgGray: CSPair;
119+
120+
/**
121+
Alias for `bgBlackBright`.
122+
*/
123+
readonly bgGrey: CSPair;
124+
125+
readonly bgBlackBright: CSPair;
126+
readonly bgRedBright: CSPair;
127+
readonly bgGreenBright: CSPair;
128+
readonly bgYellowBright: CSPair;
129+
readonly bgBlueBright: CSPair;
130+
readonly bgCyanBright: CSPair;
131+
readonly bgMagentaBright: CSPair;
132+
readonly bgWhiteBright: CSPair;
133+
}
134+
135+
export interface ConvertColor {
136+
/**
137+
Convert from the RGB color space to the ANSI 256 color space.
138+
139+
@param red - (`0...255`)
140+
@param green - (`0...255`)
141+
@param blue - (`0...255`)
142+
*/
143+
rgbToAnsi256(red: number, green: number, blue: number): number;
144+
145+
/**
146+
Convert from the RGB HEX color space to the RGB color space.
147+
148+
@param hex - A hexadecimal string containing RGB data.
149+
*/
150+
hexToRgb(hex: string): [red: number, green: number, blue: number];
151+
152+
/**
153+
Convert from the RGB HEX color space to the ANSI 256 color space.
154+
155+
@param hex - A hexadecimal string containing RGB data.
156+
*/
157+
hexToAnsi256(hex: string): number;
158+
159+
/**
160+
Convert from the ANSI 256 color space to the ANSI 16 color space.
161+
162+
@param code - A number representing the ANSI 256 color.
163+
*/
164+
ansi256ToAnsi(code: number): number;
165+
166+
/**
167+
Convert from the RGB color space to the ANSI 16 color space.
168+
169+
@param red - (`0...255`)
170+
@param green - (`0...255`)
171+
@param blue - (`0...255`)
172+
*/
173+
rgbToAnsi(red: number, green: number, blue: number): number;
174+
175+
/**
176+
Convert from the RGB HEX color space to the ANSI 16 color space.
177+
178+
@param hex - A hexadecimal string containing RGB data.
179+
*/
180+
hexToAnsi(hex: string): number;
181+
}
182+
183+
declare const ansiStyles: {
184+
readonly modifier: Modifier;
185+
readonly color: ColorBase & ForegroundColor;
186+
readonly bgColor: ColorBase & BackgroundColor;
187+
readonly codes: ReadonlyMap<number, number>;
188+
} & ForegroundColor & BackgroundColor & Modifier & ConvertColor;
189+
190+
export default ansiStyles;

0 commit comments

Comments
 (0)