-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support
consola/utils
subpath (#149)
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
type ConsolaUtils = typeof import("consola/utils"); | ||
|
||
// TODO: https://github.com/unjs/consola/issues/263 | ||
|
||
const _colorize = String; | ||
|
||
export const colorize: ConsolaUtils["colorize"] = (color, str) => | ||
_colorize(str); | ||
|
||
export const getColor: ConsolaUtils["getColor"] = (color, fallback) => () => | ||
_colorize(color); | ||
|
||
export const stripAnsi: ConsolaUtils["stripAnsi"] = (str) => str; | ||
|
||
export const box: ConsolaUtils["box"] = (str, opts) => str; | ||
|
||
export const align: ConsolaUtils["align"] = (alignment, str, len, space) => str; | ||
export const leftAlign: ConsolaUtils["leftAlign"] = (str, len, space?) => str; | ||
export const rightAlign: ConsolaUtils["rightAlign"] = (str, len, space?) => str; | ||
export const centerAlign: ConsolaUtils["centerAlign"] = (str, len, space?) => | ||
str; | ||
|
||
export const colors = new Proxy<ConsolaUtils["colors"]>({} as any, { | ||
get(_, colorName) { | ||
return _colorize; | ||
}, | ||
}); | ||
|
||
export default <ConsolaUtils>{ | ||
colorize, | ||
getColor, | ||
stripAnsi, | ||
align, | ||
leftAlign, | ||
rightAlign, | ||
centerAlign, | ||
box, | ||
colors, | ||
}; |