@galadrim/galadmin 0.1.33 → 0.1.34

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.
Files changed (179) hide show
  1. package/dist/api.js +1 -0
  2. package/dist/api.js.map +1 -1
  3. package/dist/tsconfig.tsbuildinfo +1 -1
  4. package/package.json +1 -1
  5. package/src/api.ts +1 -0
  6. package/src/front/node_modules/.cache/.eslintcache +1 -1
  7. package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/6c/19/fe86ba5d7c4062f185480ad22dd3b9fae9b30149827224339f9a633a9a94 +1 -1
  8. package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/87/08/421190bfe6e50816e059da6c33526c9943732ef856ebd2752d0cbfb4a852 +1 -1
  9. package/src/front/node_modules/.cache/terser-webpack-plugin/index-v5/c2/e5/5451dd89bb0fd48f988bf27c7ee614c66eb91f7085c5b5c8cb33048d0c32 +1 -1
  10. package/src/front/node_modules/.package-lock.json +115 -74
  11. package/src/front/node_modules/@babel/code-frame/README.md +1 -1
  12. package/src/front/node_modules/@babel/code-frame/lib/index.js +15 -1
  13. package/src/front/node_modules/@babel/code-frame/lib/index.js.map +1 -1
  14. package/src/front/node_modules/@babel/code-frame/node_modules/ansi-styles/index.js +165 -0
  15. package/src/front/node_modules/@babel/code-frame/node_modules/ansi-styles/license +9 -0
  16. package/src/front/node_modules/@babel/code-frame/node_modules/ansi-styles/package.json +56 -0
  17. package/src/front/node_modules/@babel/code-frame/node_modules/ansi-styles/readme.md +147 -0
  18. package/src/front/node_modules/@babel/code-frame/node_modules/chalk/index.js +228 -0
  19. package/src/front/node_modules/@babel/code-frame/node_modules/chalk/index.js.flow +93 -0
  20. package/src/front/node_modules/@babel/code-frame/node_modules/chalk/license +9 -0
  21. package/src/front/node_modules/@babel/code-frame/node_modules/chalk/package.json +71 -0
  22. package/src/front/node_modules/@babel/code-frame/node_modules/chalk/readme.md +314 -0
  23. package/src/front/node_modules/@babel/code-frame/node_modules/chalk/templates.js +128 -0
  24. package/src/front/node_modules/@babel/code-frame/node_modules/chalk/types/index.d.ts +97 -0
  25. package/src/front/node_modules/@babel/code-frame/node_modules/supports-color/browser.js +5 -0
  26. package/src/front/node_modules/@babel/code-frame/node_modules/supports-color/index.js +131 -0
  27. package/src/front/node_modules/@babel/code-frame/node_modules/supports-color/license +9 -0
  28. package/src/front/node_modules/@babel/code-frame/node_modules/supports-color/package.json +53 -0
  29. package/src/front/node_modules/@babel/code-frame/node_modules/supports-color/readme.md +66 -0
  30. package/src/front/node_modules/@babel/code-frame/package.json +3 -2
  31. package/src/front/node_modules/@babel/compat-data/data/plugin-bugfixes.json +2 -0
  32. package/src/front/node_modules/@babel/compat-data/data/plugins.json +8 -0
  33. package/src/front/node_modules/@babel/compat-data/package.json +1 -1
  34. package/src/front/node_modules/@babel/core/cjs-proxy.cjs +3 -1
  35. package/src/front/node_modules/@babel/core/lib/config/config-chain.js +7 -4
  36. package/src/front/node_modules/@babel/core/lib/config/config-chain.js.map +1 -1
  37. package/src/front/node_modules/@babel/core/lib/config/config-descriptors.js +2 -1
  38. package/src/front/node_modules/@babel/core/lib/config/config-descriptors.js.map +1 -1
  39. package/src/front/node_modules/@babel/core/lib/config/files/module-types.js +5 -5
  40. package/src/front/node_modules/@babel/core/lib/config/files/module-types.js.map +1 -1
  41. package/src/front/node_modules/@babel/core/lib/config/full.js.map +1 -1
  42. package/src/front/node_modules/@babel/core/lib/config/helpers/config-api.js +4 -4
  43. package/src/front/node_modules/@babel/core/lib/config/helpers/config-api.js.map +1 -1
  44. package/src/front/node_modules/@babel/core/lib/config/index.js.map +1 -1
  45. package/src/front/node_modules/@babel/core/lib/config/item.js.map +1 -1
  46. package/src/front/node_modules/@babel/core/lib/config/printer.js.map +1 -1
  47. package/src/front/node_modules/@babel/core/lib/config/validation/options.js.map +1 -1
  48. package/src/front/node_modules/@babel/core/lib/config/validation/plugins.js.map +1 -1
  49. package/src/front/node_modules/@babel/core/lib/index.js +2 -1
  50. package/src/front/node_modules/@babel/core/lib/index.js.map +1 -1
  51. package/src/front/node_modules/@babel/core/lib/transformation/file/file.js +5 -5
  52. package/src/front/node_modules/@babel/core/lib/transformation/file/file.js.map +1 -1
  53. package/src/front/node_modules/@babel/core/lib/transformation/file/generate.js.map +1 -1
  54. package/src/front/node_modules/@babel/core/lib/transformation/index.js +3 -1
  55. package/src/front/node_modules/@babel/core/lib/transformation/index.js.map +1 -1
  56. package/src/front/node_modules/@babel/core/lib/transformation/plugin-pass.js.map +1 -1
  57. package/src/front/node_modules/{@nicolo-ribaudo/semver-v6 → @babel/core/node_modules/semver}/README.md +2 -13
  58. package/src/front/node_modules/@babel/core/node_modules/semver/package.json +38 -0
  59. package/src/front/node_modules/{@nicolo-ribaudo/semver-v6 → @babel/core/node_modules/semver}/semver.js +54 -20
  60. package/src/front/node_modules/@babel/core/package.json +13 -13
  61. package/src/front/node_modules/@babel/generator/lib/buffer.js.map +1 -1
  62. package/src/front/node_modules/@babel/generator/lib/generators/classes.js +6 -6
  63. package/src/front/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
  64. package/src/front/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
  65. package/src/front/node_modules/@babel/generator/lib/generators/types.js.map +1 -1
  66. package/src/front/node_modules/@babel/generator/lib/index.js +2 -1
  67. package/src/front/node_modules/@babel/generator/lib/index.js.map +1 -1
  68. package/src/front/node_modules/@babel/generator/lib/printer.js +2 -2
  69. package/src/front/node_modules/@babel/generator/lib/printer.js.map +1 -1
  70. package/src/front/node_modules/@babel/generator/lib/source-map.js.map +1 -1
  71. package/src/front/node_modules/@babel/generator/package.json +4 -4
  72. package/src/front/node_modules/@babel/helper-compilation-targets/lib/debug.js +2 -2
  73. package/src/front/node_modules/@babel/helper-compilation-targets/lib/debug.js.map +1 -1
  74. package/src/front/node_modules/@babel/helper-compilation-targets/lib/filter-items.js +3 -3
  75. package/src/front/node_modules/@babel/helper-compilation-targets/lib/filter-items.js.map +1 -1
  76. package/src/front/node_modules/@babel/helper-compilation-targets/lib/pretty.js +2 -2
  77. package/src/front/node_modules/@babel/helper-compilation-targets/lib/pretty.js.map +1 -1
  78. package/src/front/node_modules/@babel/helper-compilation-targets/lib/utils.js +3 -3
  79. package/src/front/node_modules/@babel/helper-compilation-targets/lib/utils.js.map +1 -1
  80. package/src/front/node_modules/@babel/helper-compilation-targets/node_modules/semver/LICENSE +15 -0
  81. package/src/front/node_modules/@babel/helper-compilation-targets/node_modules/semver/README.md +443 -0
  82. package/src/front/node_modules/@babel/helper-compilation-targets/node_modules/semver/bin/semver.js +174 -0
  83. package/src/front/node_modules/@babel/helper-compilation-targets/node_modules/semver/package.json +38 -0
  84. package/src/front/node_modules/@babel/helper-compilation-targets/node_modules/semver/range.bnf +16 -0
  85. package/src/front/node_modules/@babel/helper-compilation-targets/node_modules/semver/semver.js +1643 -0
  86. package/src/front/node_modules/@babel/helper-compilation-targets/package.json +4 -8
  87. package/src/front/node_modules/@babel/helper-module-transforms/README.md +1 -1
  88. package/src/front/node_modules/@babel/helper-module-transforms/lib/dynamic-import.js +11 -12
  89. package/src/front/node_modules/@babel/helper-module-transforms/lib/dynamic-import.js.map +1 -1
  90. package/src/front/node_modules/@babel/helper-module-transforms/lib/index.js +15 -16
  91. package/src/front/node_modules/@babel/helper-module-transforms/lib/index.js.map +1 -1
  92. package/src/front/node_modules/@babel/helper-module-transforms/lib/rewrite-live-references.js +3 -4
  93. package/src/front/node_modules/@babel/helper-module-transforms/lib/rewrite-live-references.js.map +1 -1
  94. package/src/front/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js +4 -5
  95. package/src/front/node_modules/@babel/helper-module-transforms/lib/rewrite-this.js.map +1 -1
  96. package/src/front/node_modules/@babel/helper-module-transforms/package.json +10 -6
  97. package/src/front/node_modules/@babel/helpers/lib/helpers/regeneratorRuntime.js +2 -4
  98. package/src/front/node_modules/@babel/helpers/lib/helpers/regeneratorRuntime.js.map +1 -1
  99. package/src/front/node_modules/@babel/helpers/lib/helpers-generated.js +1 -1
  100. package/src/front/node_modules/@babel/helpers/lib/helpers-generated.js.map +1 -1
  101. package/src/front/node_modules/@babel/helpers/package.json +6 -6
  102. package/src/front/node_modules/@babel/highlight/README.md +1 -1
  103. package/src/front/node_modules/@babel/highlight/lib/index.js +20 -10
  104. package/src/front/node_modules/@babel/highlight/lib/index.js.map +1 -1
  105. package/src/front/node_modules/@babel/highlight/package.json +2 -3
  106. package/src/front/node_modules/@babel/parser/lib/index.js +115 -160
  107. package/src/front/node_modules/@babel/parser/lib/index.js.map +1 -1
  108. package/src/front/node_modules/@babel/parser/lib/options.js +6 -2
  109. package/src/front/node_modules/@babel/parser/lib/options.js.map +1 -1
  110. package/src/front/node_modules/@babel/parser/lib/parser/expression.js +4 -4
  111. package/src/front/node_modules/@babel/parser/lib/parser/expression.js.map +1 -1
  112. package/src/front/node_modules/@babel/parser/lib/parser/lval.js +6 -6
  113. package/src/front/node_modules/@babel/parser/lib/parser/lval.js.map +1 -1
  114. package/src/front/node_modules/@babel/parser/lib/parser/statement.js +20 -19
  115. package/src/front/node_modules/@babel/parser/lib/parser/statement.js.map +1 -1
  116. package/src/front/node_modules/@babel/parser/lib/parser/util.js +1 -1
  117. package/src/front/node_modules/@babel/parser/lib/parser/util.js.map +1 -1
  118. package/src/front/node_modules/@babel/parser/lib/plugins/flow/index.js +7 -7
  119. package/src/front/node_modules/@babel/parser/lib/plugins/flow/index.js.map +1 -1
  120. package/src/front/node_modules/@babel/parser/lib/plugins/flow/scope.js +2 -2
  121. package/src/front/node_modules/@babel/parser/lib/plugins/flow/scope.js.map +1 -1
  122. package/src/front/node_modules/@babel/parser/lib/plugins/placeholders.js +2 -1
  123. package/src/front/node_modules/@babel/parser/lib/plugins/placeholders.js.map +1 -1
  124. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/index.js +16 -16
  125. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/index.js.map +1 -1
  126. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/scope.js +16 -14
  127. package/src/front/node_modules/@babel/parser/lib/plugins/typescript/scope.js.map +1 -1
  128. package/src/front/node_modules/@babel/parser/lib/util/class-scope.js +5 -5
  129. package/src/front/node_modules/@babel/parser/lib/util/class-scope.js.map +1 -1
  130. package/src/front/node_modules/@babel/parser/lib/util/expression-scope.js +7 -12
  131. package/src/front/node_modules/@babel/parser/lib/util/expression-scope.js.map +1 -1
  132. package/src/front/node_modules/@babel/parser/lib/util/scope.js +23 -23
  133. package/src/front/node_modules/@babel/parser/lib/util/scope.js.map +1 -1
  134. package/src/front/node_modules/@babel/parser/lib/util/scopeflags.js +60 -99
  135. package/src/front/node_modules/@babel/parser/lib/util/scopeflags.js.map +1 -1
  136. package/src/front/node_modules/@babel/parser/package.json +3 -3
  137. package/src/front/node_modules/@babel/traverse/lib/cache.js +24 -3
  138. package/src/front/node_modules/@babel/traverse/lib/cache.js.map +1 -1
  139. package/src/front/node_modules/@babel/traverse/lib/index.js +5 -3
  140. package/src/front/node_modules/@babel/traverse/lib/index.js.map +1 -1
  141. package/src/front/node_modules/@babel/traverse/lib/path/context.js.map +1 -1
  142. package/src/front/node_modules/@babel/traverse/lib/path/conversion.js +1 -4
  143. package/src/front/node_modules/@babel/traverse/lib/path/conversion.js.map +1 -1
  144. package/src/front/node_modules/@babel/traverse/lib/path/index.js +2 -6
  145. package/src/front/node_modules/@babel/traverse/lib/path/index.js.map +1 -1
  146. package/src/front/node_modules/@babel/traverse/lib/path/lib/hoister.js.map +1 -1
  147. package/src/front/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js +9 -7
  148. package/src/front/node_modules/@babel/traverse/lib/path/lib/virtual-types-validator.js.map +1 -1
  149. package/src/front/node_modules/@babel/traverse/lib/path/modification.js +3 -2
  150. package/src/front/node_modules/@babel/traverse/lib/path/modification.js.map +1 -1
  151. package/src/front/node_modules/@babel/traverse/lib/path/removal.js +3 -1
  152. package/src/front/node_modules/@babel/traverse/lib/path/removal.js.map +1 -1
  153. package/src/front/node_modules/@babel/traverse/lib/path/replacement.js +4 -4
  154. package/src/front/node_modules/@babel/traverse/lib/path/replacement.js.map +1 -1
  155. package/src/front/node_modules/@babel/traverse/lib/scope/index.js +2 -1
  156. package/src/front/node_modules/@babel/traverse/lib/scope/index.js.map +1 -1
  157. package/src/front/node_modules/@babel/traverse/lib/traverse-node.js +6 -2
  158. package/src/front/node_modules/@babel/traverse/lib/traverse-node.js.map +1 -1
  159. package/src/front/node_modules/@babel/traverse/lib/visitors.js.map +1 -1
  160. package/src/front/node_modules/@babel/traverse/package.json +6 -5
  161. package/src/front/node_modules/@babel/types/README.md +1 -1
  162. package/src/front/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -1
  163. package/src/front/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -1
  164. package/src/front/node_modules/@babel/types/lib/definitions/core.js +8 -1
  165. package/src/front/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
  166. package/src/front/node_modules/@babel/types/lib/index.d.ts +11 -10
  167. package/src/front/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -1
  168. package/src/front/node_modules/@babel/types/lib/validators/isType.js +1 -0
  169. package/src/front/node_modules/@babel/types/lib/validators/isType.js.map +1 -1
  170. package/src/front/node_modules/@babel/types/package.json +3 -4
  171. package/src/front/node_modules/react-scripts/node_modules/@babel/core/node_modules/semver/package.json +19 -9
  172. package/src/front/node_modules/react-scripts/node_modules/@babel/core/node_modules/semver/semver.js +68 -26
  173. package/src/front/package-lock.json +216 -142
  174. package/src/front/node_modules/@nicolo-ribaudo/semver-v6/CHANGELOG.md +0 -70
  175. package/src/front/node_modules/@nicolo-ribaudo/semver-v6/package.json +0 -28
  176. package/src/front/node_modules/react-scripts/node_modules/@babel/core/node_modules/semver/CHANGELOG.md +0 -39
  177. /package/src/front/node_modules/{@nicolo-ribaudo/semver-v6 → @babel/core/node_modules/semver}/LICENSE +0 -0
  178. /package/src/front/node_modules/{@nicolo-ribaudo/semver-v6 → @babel/core/node_modules/semver}/bin/semver.js +0 -0
  179. /package/src/front/node_modules/{@nicolo-ribaudo/semver-v6 → @babel/core/node_modules/semver}/range.bnf +0 -0
@@ -0,0 +1,93 @@
1
+ // @flow strict
2
+
3
+ type TemplateStringsArray = $ReadOnlyArray<string>;
4
+
5
+ export type Level = $Values<{
6
+ None: 0,
7
+ Basic: 1,
8
+ Ansi256: 2,
9
+ TrueColor: 3
10
+ }>;
11
+
12
+ export type ChalkOptions = {|
13
+ enabled?: boolean,
14
+ level?: Level
15
+ |};
16
+
17
+ export type ColorSupport = {|
18
+ level: Level,
19
+ hasBasic: boolean,
20
+ has256: boolean,
21
+ has16m: boolean
22
+ |};
23
+
24
+ export interface Chalk {
25
+ (...text: string[]): string,
26
+ (text: TemplateStringsArray, ...placeholders: string[]): string,
27
+ constructor(options?: ChalkOptions): Chalk,
28
+ enabled: boolean,
29
+ level: Level,
30
+ rgb(r: number, g: number, b: number): Chalk,
31
+ hsl(h: number, s: number, l: number): Chalk,
32
+ hsv(h: number, s: number, v: number): Chalk,
33
+ hwb(h: number, w: number, b: number): Chalk,
34
+ bgHex(color: string): Chalk,
35
+ bgKeyword(color: string): Chalk,
36
+ bgRgb(r: number, g: number, b: number): Chalk,
37
+ bgHsl(h: number, s: number, l: number): Chalk,
38
+ bgHsv(h: number, s: number, v: number): Chalk,
39
+ bgHwb(h: number, w: number, b: number): Chalk,
40
+ hex(color: string): Chalk,
41
+ keyword(color: string): Chalk,
42
+
43
+ +reset: Chalk,
44
+ +bold: Chalk,
45
+ +dim: Chalk,
46
+ +italic: Chalk,
47
+ +underline: Chalk,
48
+ +inverse: Chalk,
49
+ +hidden: Chalk,
50
+ +strikethrough: Chalk,
51
+
52
+ +visible: Chalk,
53
+
54
+ +black: Chalk,
55
+ +red: Chalk,
56
+ +green: Chalk,
57
+ +yellow: Chalk,
58
+ +blue: Chalk,
59
+ +magenta: Chalk,
60
+ +cyan: Chalk,
61
+ +white: Chalk,
62
+ +gray: Chalk,
63
+ +grey: Chalk,
64
+ +blackBright: Chalk,
65
+ +redBright: Chalk,
66
+ +greenBright: Chalk,
67
+ +yellowBright: Chalk,
68
+ +blueBright: Chalk,
69
+ +magentaBright: Chalk,
70
+ +cyanBright: Chalk,
71
+ +whiteBright: Chalk,
72
+
73
+ +bgBlack: Chalk,
74
+ +bgRed: Chalk,
75
+ +bgGreen: Chalk,
76
+ +bgYellow: Chalk,
77
+ +bgBlue: Chalk,
78
+ +bgMagenta: Chalk,
79
+ +bgCyan: Chalk,
80
+ +bgWhite: Chalk,
81
+ +bgBlackBright: Chalk,
82
+ +bgRedBright: Chalk,
83
+ +bgGreenBright: Chalk,
84
+ +bgYellowBright: Chalk,
85
+ +bgBlueBright: Chalk,
86
+ +bgMagentaBright: Chalk,
87
+ +bgCyanBright: Chalk,
88
+ +bgWhiteBrigh: Chalk,
89
+
90
+ supportsColor: ColorSupport
91
+ };
92
+
93
+ declare module.exports: Chalk;
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
+
5
+ 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:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ 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.
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "chalk",
3
+ "version": "2.4.2",
4
+ "description": "Terminal string styling done right",
5
+ "license": "MIT",
6
+ "repository": "chalk/chalk",
7
+ "engines": {
8
+ "node": ">=4"
9
+ },
10
+ "scripts": {
11
+ "test": "xo && tsc --project types && flow --max-warnings=0 && nyc ava",
12
+ "bench": "matcha benchmark.js",
13
+ "coveralls": "nyc report --reporter=text-lcov | coveralls"
14
+ },
15
+ "files": [
16
+ "index.js",
17
+ "templates.js",
18
+ "types/index.d.ts",
19
+ "index.js.flow"
20
+ ],
21
+ "keywords": [
22
+ "color",
23
+ "colour",
24
+ "colors",
25
+ "terminal",
26
+ "console",
27
+ "cli",
28
+ "string",
29
+ "str",
30
+ "ansi",
31
+ "style",
32
+ "styles",
33
+ "tty",
34
+ "formatting",
35
+ "rgb",
36
+ "256",
37
+ "shell",
38
+ "xterm",
39
+ "log",
40
+ "logging",
41
+ "command-line",
42
+ "text"
43
+ ],
44
+ "dependencies": {
45
+ "ansi-styles": "^3.2.1",
46
+ "escape-string-regexp": "^1.0.5",
47
+ "supports-color": "^5.3.0"
48
+ },
49
+ "devDependencies": {
50
+ "ava": "*",
51
+ "coveralls": "^3.0.0",
52
+ "execa": "^0.9.0",
53
+ "flow-bin": "^0.68.0",
54
+ "import-fresh": "^2.0.0",
55
+ "matcha": "^0.7.0",
56
+ "nyc": "^11.0.2",
57
+ "resolve-from": "^4.0.0",
58
+ "typescript": "^2.5.3",
59
+ "xo": "*"
60
+ },
61
+ "types": "types/index.d.ts",
62
+ "xo": {
63
+ "envs": [
64
+ "node",
65
+ "mocha"
66
+ ],
67
+ "ignores": [
68
+ "test/_flow.js"
69
+ ]
70
+ }
71
+ }
@@ -0,0 +1,314 @@
1
+ <h1 align="center">
2
+ <br>
3
+ <br>
4
+ <img width="320" src="media/logo.svg" alt="Chalk">
5
+ <br>
6
+ <br>
7
+ <br>
8
+ </h1>
9
+
10
+ > Terminal string styling done right
11
+
12
+ [![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)
13
+
14
+ ### [See what's new in Chalk 2](https://github.com/chalk/chalk/releases/tag/v2.0.0)
15
+
16
+ <img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" alt="" width="900">
17
+
18
+
19
+ ## Highlights
20
+
21
+ - Expressive API
22
+ - Highly performant
23
+ - Ability to nest styles
24
+ - [256/Truecolor color support](#256-and-truecolor-color-support)
25
+ - Auto-detects color support
26
+ - Doesn't extend `String.prototype`
27
+ - Clean and focused
28
+ - Actively maintained
29
+ - [Used by ~23,000 packages](https://www.npmjs.com/browse/depended/chalk) as of December 31, 2017
30
+
31
+
32
+ ## Install
33
+
34
+ ```console
35
+ $ npm install chalk
36
+ ```
37
+
38
+ <a href="https://www.patreon.com/sindresorhus">
39
+ <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
40
+ </a>
41
+
42
+
43
+ ## Usage
44
+
45
+ ```js
46
+ const chalk = require('chalk');
47
+
48
+ console.log(chalk.blue('Hello world!'));
49
+ ```
50
+
51
+ Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
52
+
53
+ ```js
54
+ const chalk = require('chalk');
55
+ const log = console.log;
56
+
57
+ // Combine styled and normal strings
58
+ log(chalk.blue('Hello') + ' World' + chalk.red('!'));
59
+
60
+ // Compose multiple styles using the chainable API
61
+ log(chalk.blue.bgRed.bold('Hello world!'));
62
+
63
+ // Pass in multiple arguments
64
+ log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
65
+
66
+ // Nest styles
67
+ log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
68
+
69
+ // Nest styles of the same type even (color, underline, background)
70
+ log(chalk.green(
71
+ 'I am a green line ' +
72
+ chalk.blue.underline.bold('with a blue substring') +
73
+ ' that becomes green again!'
74
+ ));
75
+
76
+ // ES2015 template literal
77
+ log(`
78
+ CPU: ${chalk.red('90%')}
79
+ RAM: ${chalk.green('40%')}
80
+ DISK: ${chalk.yellow('70%')}
81
+ `);
82
+
83
+ // ES2015 tagged template literal
84
+ log(chalk`
85
+ CPU: {red ${cpu.totalPercent}%}
86
+ RAM: {green ${ram.used / ram.total * 100}%}
87
+ DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
88
+ `);
89
+
90
+ // Use RGB colors in terminal emulators that support it.
91
+ log(chalk.keyword('orange')('Yay for orange colored text!'));
92
+ log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
93
+ log(chalk.hex('#DEADED').bold('Bold gray!'));
94
+ ```
95
+
96
+ Easily define your own themes:
97
+
98
+ ```js
99
+ const chalk = require('chalk');
100
+
101
+ const error = chalk.bold.red;
102
+ const warning = chalk.keyword('orange');
103
+
104
+ console.log(error('Error!'));
105
+ console.log(warning('Warning!'));
106
+ ```
107
+
108
+ Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
109
+
110
+ ```js
111
+ const name = 'Sindre';
112
+ console.log(chalk.green('Hello %s'), name);
113
+ //=> 'Hello Sindre'
114
+ ```
115
+
116
+
117
+ ## API
118
+
119
+ ### chalk.`<style>[.<style>...](string, [string...])`
120
+
121
+ Example: `chalk.red.bold.underline('Hello', 'world');`
122
+
123
+ Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
124
+
125
+ Multiple arguments will be separated by space.
126
+
127
+ ### chalk.enabled
128
+
129
+ Color support is automatically detected, as is the level (see `chalk.level`). However, if you'd like to simply enable/disable Chalk, you can do so via the `.enabled` property.
130
+
131
+ Chalk is enabled by default unless explicitly disabled via the constructor or `chalk.level` is `0`.
132
+
133
+ If you need to change this in a reusable module, create a new instance:
134
+
135
+ ```js
136
+ const ctx = new chalk.constructor({enabled: false});
137
+ ```
138
+
139
+ ### chalk.level
140
+
141
+ Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
142
+
143
+ If you need to change this in a reusable module, create a new instance:
144
+
145
+ ```js
146
+ const ctx = new chalk.constructor({level: 0});
147
+ ```
148
+
149
+ Levels are as follows:
150
+
151
+ 0. All colors disabled
152
+ 1. Basic color support (16 colors)
153
+ 2. 256 color support
154
+ 3. Truecolor support (16 million colors)
155
+
156
+ ### chalk.supportsColor
157
+
158
+ Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
159
+
160
+ Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
161
+
162
+ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
163
+
164
+
165
+ ## Styles
166
+
167
+ ### Modifiers
168
+
169
+ - `reset`
170
+ - `bold`
171
+ - `dim`
172
+ - `italic` *(Not widely supported)*
173
+ - `underline`
174
+ - `inverse`
175
+ - `hidden`
176
+ - `strikethrough` *(Not widely supported)*
177
+ - `visible` (Text is emitted only if enabled)
178
+
179
+ ### Colors
180
+
181
+ - `black`
182
+ - `red`
183
+ - `green`
184
+ - `yellow`
185
+ - `blue` *(On Windows the bright version is used since normal blue is illegible)*
186
+ - `magenta`
187
+ - `cyan`
188
+ - `white`
189
+ - `gray` ("bright black")
190
+ - `redBright`
191
+ - `greenBright`
192
+ - `yellowBright`
193
+ - `blueBright`
194
+ - `magentaBright`
195
+ - `cyanBright`
196
+ - `whiteBright`
197
+
198
+ ### Background colors
199
+
200
+ - `bgBlack`
201
+ - `bgRed`
202
+ - `bgGreen`
203
+ - `bgYellow`
204
+ - `bgBlue`
205
+ - `bgMagenta`
206
+ - `bgCyan`
207
+ - `bgWhite`
208
+ - `bgBlackBright`
209
+ - `bgRedBright`
210
+ - `bgGreenBright`
211
+ - `bgYellowBright`
212
+ - `bgBlueBright`
213
+ - `bgMagentaBright`
214
+ - `bgCyanBright`
215
+ - `bgWhiteBright`
216
+
217
+
218
+ ## Tagged template literal
219
+
220
+ Chalk can be used as a [tagged template literal](http://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
221
+
222
+ ```js
223
+ const chalk = require('chalk');
224
+
225
+ const miles = 18;
226
+ const calculateFeet = miles => miles * 5280;
227
+
228
+ console.log(chalk`
229
+ There are {bold 5280 feet} in a mile.
230
+ In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
231
+ `);
232
+ ```
233
+
234
+ Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
235
+
236
+ Template styles are chained exactly like normal Chalk styles. The following two statements are equivalent:
237
+
238
+ ```js
239
+ console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
240
+ console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
241
+ ```
242
+
243
+ Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
244
+
245
+ All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
246
+
247
+
248
+ ## 256 and Truecolor color support
249
+
250
+ Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
251
+
252
+ Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
253
+
254
+ Examples:
255
+
256
+ - `chalk.hex('#DEADED').underline('Hello, world!')`
257
+ - `chalk.keyword('orange')('Some orange text')`
258
+ - `chalk.rgb(15, 100, 204).inverse('Hello!')`
259
+
260
+ Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
261
+
262
+ - `chalk.bgHex('#DEADED').underline('Hello, world!')`
263
+ - `chalk.bgKeyword('orange')('Some orange text')`
264
+ - `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
265
+
266
+ The following color models can be used:
267
+
268
+ - [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
269
+ - [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
270
+ - [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
271
+ - [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
272
+ - [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
273
+ - [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
274
+ - `ansi16`
275
+ - `ansi256`
276
+
277
+
278
+ ## Windows
279
+
280
+ If you're on Windows, do yourself a favor and use [`cmder`](http://cmder.net/) instead of `cmd.exe`.
281
+
282
+
283
+ ## Origin story
284
+
285
+ [colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
286
+
287
+
288
+ ## Related
289
+
290
+ - [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
291
+ - [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
292
+ - [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
293
+ - [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
294
+ - [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
295
+ - [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
296
+ - [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
297
+ - [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
298
+ - [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
299
+ - [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
300
+ - [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
301
+ - [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
302
+ - [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
303
+ - [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
304
+
305
+
306
+ ## Maintainers
307
+
308
+ - [Sindre Sorhus](https://github.com/sindresorhus)
309
+ - [Josh Junon](https://github.com/qix-)
310
+
311
+
312
+ ## License
313
+
314
+ MIT
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+ const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
3
+ const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
4
+ const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
5
+ const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
6
+
7
+ const ESCAPES = new Map([
8
+ ['n', '\n'],
9
+ ['r', '\r'],
10
+ ['t', '\t'],
11
+ ['b', '\b'],
12
+ ['f', '\f'],
13
+ ['v', '\v'],
14
+ ['0', '\0'],
15
+ ['\\', '\\'],
16
+ ['e', '\u001B'],
17
+ ['a', '\u0007']
18
+ ]);
19
+
20
+ function unescape(c) {
21
+ if ((c[0] === 'u' && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
22
+ return String.fromCharCode(parseInt(c.slice(1), 16));
23
+ }
24
+
25
+ return ESCAPES.get(c) || c;
26
+ }
27
+
28
+ function parseArguments(name, args) {
29
+ const results = [];
30
+ const chunks = args.trim().split(/\s*,\s*/g);
31
+ let matches;
32
+
33
+ for (const chunk of chunks) {
34
+ if (!isNaN(chunk)) {
35
+ results.push(Number(chunk));
36
+ } else if ((matches = chunk.match(STRING_REGEX))) {
37
+ results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
38
+ } else {
39
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
40
+ }
41
+ }
42
+
43
+ return results;
44
+ }
45
+
46
+ function parseStyle(style) {
47
+ STYLE_REGEX.lastIndex = 0;
48
+
49
+ const results = [];
50
+ let matches;
51
+
52
+ while ((matches = STYLE_REGEX.exec(style)) !== null) {
53
+ const name = matches[1];
54
+
55
+ if (matches[2]) {
56
+ const args = parseArguments(name, matches[2]);
57
+ results.push([name].concat(args));
58
+ } else {
59
+ results.push([name]);
60
+ }
61
+ }
62
+
63
+ return results;
64
+ }
65
+
66
+ function buildStyle(chalk, styles) {
67
+ const enabled = {};
68
+
69
+ for (const layer of styles) {
70
+ for (const style of layer.styles) {
71
+ enabled[style[0]] = layer.inverse ? null : style.slice(1);
72
+ }
73
+ }
74
+
75
+ let current = chalk;
76
+ for (const styleName of Object.keys(enabled)) {
77
+ if (Array.isArray(enabled[styleName])) {
78
+ if (!(styleName in current)) {
79
+ throw new Error(`Unknown Chalk style: ${styleName}`);
80
+ }
81
+
82
+ if (enabled[styleName].length > 0) {
83
+ current = current[styleName].apply(current, enabled[styleName]);
84
+ } else {
85
+ current = current[styleName];
86
+ }
87
+ }
88
+ }
89
+
90
+ return current;
91
+ }
92
+
93
+ module.exports = (chalk, tmp) => {
94
+ const styles = [];
95
+ const chunks = [];
96
+ let chunk = [];
97
+
98
+ // eslint-disable-next-line max-params
99
+ tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
100
+ if (escapeChar) {
101
+ chunk.push(unescape(escapeChar));
102
+ } else if (style) {
103
+ const str = chunk.join('');
104
+ chunk = [];
105
+ chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
106
+ styles.push({inverse, styles: parseStyle(style)});
107
+ } else if (close) {
108
+ if (styles.length === 0) {
109
+ throw new Error('Found extraneous } in Chalk template literal');
110
+ }
111
+
112
+ chunks.push(buildStyle(chalk, styles)(chunk.join('')));
113
+ chunk = [];
114
+ styles.pop();
115
+ } else {
116
+ chunk.push(chr);
117
+ }
118
+ });
119
+
120
+ chunks.push(chunk.join(''));
121
+
122
+ if (styles.length > 0) {
123
+ const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
124
+ throw new Error(errMsg);
125
+ }
126
+
127
+ return chunks.join('');
128
+ };