@aws-solutions-constructs/core 2.51.0 → 2.52.1

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 (200) hide show
  1. package/.eslintignore +2 -0
  2. package/.jsii +49 -4
  3. package/node_modules/ansi-regex/index.js +8 -2
  4. package/node_modules/ansi-regex/license +4 -16
  5. package/node_modules/ansi-regex/package.json +53 -62
  6. package/node_modules/ansi-regex/readme.md +48 -9
  7. package/node_modules/aproba/index.js +33 -33
  8. package/node_modules/aproba/package.json +5 -4
  9. package/node_modules/are-we-there-yet/LICENSE.md +18 -0
  10. package/node_modules/are-we-there-yet/README.md +16 -3
  11. package/node_modules/are-we-there-yet/lib/tracker-base.js +13 -0
  12. package/node_modules/are-we-there-yet/lib/tracker-group.js +112 -0
  13. package/node_modules/are-we-there-yet/lib/tracker-stream.js +42 -0
  14. package/node_modules/are-we-there-yet/lib/tracker.js +34 -0
  15. package/node_modules/are-we-there-yet/package.json +38 -20
  16. package/node_modules/color-support/README.md +129 -0
  17. package/node_modules/color-support/bin.js +3 -0
  18. package/node_modules/color-support/browser.js +14 -0
  19. package/node_modules/color-support/index.js +134 -0
  20. package/node_modules/color-support/package.json +36 -0
  21. package/node_modules/gauge/LICENSE.md +20 -0
  22. package/node_modules/gauge/README.md +19 -16
  23. package/node_modules/gauge/{base-theme.js → lib/base-theme.js} +7 -3
  24. package/node_modules/gauge/lib/has-color.js +4 -0
  25. package/node_modules/gauge/{index.js → lib/index.js} +90 -34
  26. package/node_modules/gauge/{plumbing.js → lib/plumbing.js} +3 -1
  27. package/node_modules/gauge/{progress-bar.js → lib/progress-bar.js} +12 -6
  28. package/node_modules/gauge/{render-template.js → lib/render-template.js} +69 -28
  29. package/node_modules/gauge/{template-item.js → lib/template-item.js} +21 -7
  30. package/node_modules/gauge/{theme-set.js → lib/theme-set.js} +31 -24
  31. package/node_modules/gauge/lib/themes.js +56 -0
  32. package/node_modules/gauge/{wide-truncate.js → lib/wide-truncate.js} +9 -3
  33. package/node_modules/gauge/package.json +47 -42
  34. package/node_modules/is-fullwidth-code-point/index.js +40 -36
  35. package/node_modules/is-fullwidth-code-point/license +4 -16
  36. package/node_modules/is-fullwidth-code-point/package.json +40 -43
  37. package/node_modules/is-fullwidth-code-point/readme.md +8 -8
  38. package/node_modules/npmlog/LICENSE.md +20 -0
  39. package/node_modules/npmlog/{log.js → lib/log.js} +149 -58
  40. package/node_modules/npmlog/package.json +36 -12
  41. package/node_modules/signal-exit/LICENSE.txt +1 -1
  42. package/node_modules/signal-exit/README.md +56 -21
  43. package/node_modules/signal-exit/dist/cjs/browser.d.ts +12 -0
  44. package/node_modules/signal-exit/dist/cjs/browser.d.ts.map +1 -0
  45. package/node_modules/signal-exit/dist/cjs/browser.js +10 -0
  46. package/node_modules/signal-exit/dist/cjs/browser.js.map +1 -0
  47. package/node_modules/signal-exit/dist/cjs/index.d.ts +48 -0
  48. package/node_modules/signal-exit/dist/cjs/index.d.ts.map +1 -0
  49. package/node_modules/signal-exit/dist/cjs/index.js +279 -0
  50. package/node_modules/signal-exit/dist/cjs/index.js.map +1 -0
  51. package/node_modules/signal-exit/dist/cjs/package.json +3 -0
  52. package/node_modules/signal-exit/dist/cjs/signals.d.ts +29 -0
  53. package/node_modules/signal-exit/dist/cjs/signals.d.ts.map +1 -0
  54. package/node_modules/signal-exit/dist/cjs/signals.js +42 -0
  55. package/node_modules/signal-exit/dist/cjs/signals.js.map +1 -0
  56. package/node_modules/signal-exit/dist/mjs/browser.d.ts +12 -0
  57. package/node_modules/signal-exit/dist/mjs/browser.d.ts.map +1 -0
  58. package/node_modules/signal-exit/dist/mjs/browser.js +4 -0
  59. package/node_modules/signal-exit/dist/mjs/browser.js.map +1 -0
  60. package/node_modules/signal-exit/dist/mjs/index.d.ts +48 -0
  61. package/node_modules/signal-exit/dist/mjs/index.d.ts.map +1 -0
  62. package/node_modules/signal-exit/dist/mjs/index.js +275 -0
  63. package/node_modules/signal-exit/dist/mjs/index.js.map +1 -0
  64. package/node_modules/signal-exit/dist/mjs/package.json +3 -0
  65. package/node_modules/signal-exit/dist/mjs/signals.d.ts +29 -0
  66. package/node_modules/signal-exit/dist/mjs/signals.d.ts.map +1 -0
  67. package/node_modules/signal-exit/dist/mjs/signals.js +39 -0
  68. package/node_modules/signal-exit/dist/mjs/signals.js.map +1 -0
  69. package/node_modules/signal-exit/package.json +87 -19
  70. package/node_modules/string-width/index.js +29 -19
  71. package/node_modules/string-width/license +4 -16
  72. package/node_modules/string-width/package.json +54 -54
  73. package/node_modules/string-width/readme.md +17 -9
  74. package/node_modules/strip-ansi/index.js +2 -4
  75. package/node_modules/strip-ansi/license +4 -16
  76. package/node_modules/strip-ansi/package.json +52 -55
  77. package/node_modules/strip-ansi/readme.md +20 -7
  78. package/package.json +8 -7
  79. package/test/test-helper.d.ts +1 -1
  80. package/test/test-helper.js +5 -5
  81. package/node_modules/are-we-there-yet/CHANGES.md +0 -37
  82. package/node_modules/are-we-there-yet/LICENSE +0 -5
  83. package/node_modules/are-we-there-yet/tracker-base.js +0 -11
  84. package/node_modules/are-we-there-yet/tracker-group.js +0 -107
  85. package/node_modules/are-we-there-yet/tracker-stream.js +0 -36
  86. package/node_modules/are-we-there-yet/tracker.js +0 -30
  87. package/node_modules/code-point-at/index.js +0 -32
  88. package/node_modules/code-point-at/license +0 -21
  89. package/node_modules/code-point-at/package.json +0 -38
  90. package/node_modules/code-point-at/readme.md +0 -32
  91. package/node_modules/core-util-is/LICENSE +0 -19
  92. package/node_modules/core-util-is/README.md +0 -3
  93. package/node_modules/core-util-is/lib/util.js +0 -107
  94. package/node_modules/core-util-is/package.json +0 -38
  95. package/node_modules/delegates/.npmignore +0 -1
  96. package/node_modules/delegates/History.md +0 -22
  97. package/node_modules/delegates/License +0 -20
  98. package/node_modules/delegates/Makefile +0 -8
  99. package/node_modules/delegates/Readme.md +0 -94
  100. package/node_modules/delegates/index.js +0 -121
  101. package/node_modules/delegates/package.json +0 -13
  102. package/node_modules/delegates/test/index.js +0 -94
  103. package/node_modules/gauge/CHANGELOG.md +0 -160
  104. package/node_modules/gauge/LICENSE +0 -13
  105. package/node_modules/gauge/has-color.js +0 -12
  106. package/node_modules/gauge/themes.js +0 -54
  107. package/node_modules/inherits/LICENSE +0 -16
  108. package/node_modules/inherits/README.md +0 -42
  109. package/node_modules/inherits/inherits.js +0 -9
  110. package/node_modules/inherits/inherits_browser.js +0 -27
  111. package/node_modules/inherits/package.json +0 -29
  112. package/node_modules/isarray/.npmignore +0 -1
  113. package/node_modules/isarray/.travis.yml +0 -4
  114. package/node_modules/isarray/Makefile +0 -6
  115. package/node_modules/isarray/README.md +0 -60
  116. package/node_modules/isarray/component.json +0 -19
  117. package/node_modules/isarray/index.js +0 -5
  118. package/node_modules/isarray/package.json +0 -45
  119. package/node_modules/isarray/test.js +0 -20
  120. package/node_modules/number-is-nan/index.js +0 -4
  121. package/node_modules/number-is-nan/license +0 -21
  122. package/node_modules/number-is-nan/package.json +0 -35
  123. package/node_modules/number-is-nan/readme.md +0 -28
  124. package/node_modules/object-assign/index.js +0 -90
  125. package/node_modules/object-assign/license +0 -21
  126. package/node_modules/object-assign/package.json +0 -42
  127. package/node_modules/object-assign/readme.md +0 -61
  128. package/node_modules/process-nextick-args/index.js +0 -45
  129. package/node_modules/process-nextick-args/license.md +0 -19
  130. package/node_modules/process-nextick-args/package.json +0 -25
  131. package/node_modules/process-nextick-args/readme.md +0 -18
  132. package/node_modules/readable-stream/.travis.yml +0 -34
  133. package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  134. package/node_modules/readable-stream/GOVERNANCE.md +0 -136
  135. package/node_modules/readable-stream/LICENSE +0 -47
  136. package/node_modules/readable-stream/README.md +0 -58
  137. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  138. package/node_modules/readable-stream/duplex-browser.js +0 -1
  139. package/node_modules/readable-stream/duplex.js +0 -1
  140. package/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
  141. package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
  142. package/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
  143. package/node_modules/readable-stream/lib/_stream_transform.js +0 -214
  144. package/node_modules/readable-stream/lib/_stream_writable.js +0 -685
  145. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -78
  146. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -84
  147. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  148. package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  149. package/node_modules/readable-stream/package.json +0 -52
  150. package/node_modules/readable-stream/passthrough.js +0 -1
  151. package/node_modules/readable-stream/readable-browser.js +0 -7
  152. package/node_modules/readable-stream/readable.js +0 -19
  153. package/node_modules/readable-stream/transform.js +0 -1
  154. package/node_modules/readable-stream/writable-browser.js +0 -1
  155. package/node_modules/readable-stream/writable.js +0 -8
  156. package/node_modules/safe-buffer/LICENSE +0 -21
  157. package/node_modules/safe-buffer/README.md +0 -584
  158. package/node_modules/safe-buffer/index.d.ts +0 -187
  159. package/node_modules/safe-buffer/index.js +0 -62
  160. package/node_modules/safe-buffer/package.json +0 -37
  161. package/node_modules/signal-exit/index.js +0 -202
  162. package/node_modules/signal-exit/signals.js +0 -53
  163. package/node_modules/string_decoder/.travis.yml +0 -50
  164. package/node_modules/string_decoder/LICENSE +0 -48
  165. package/node_modules/string_decoder/README.md +0 -47
  166. package/node_modules/string_decoder/lib/string_decoder.js +0 -296
  167. package/node_modules/string_decoder/package.json +0 -31
  168. package/node_modules/util-deprecate/History.md +0 -16
  169. package/node_modules/util-deprecate/LICENSE +0 -24
  170. package/node_modules/util-deprecate/README.md +0 -53
  171. package/node_modules/util-deprecate/browser.js +0 -67
  172. package/node_modules/util-deprecate/node.js +0 -6
  173. package/node_modules/util-deprecate/package.json +0 -27
  174. package/node_modules/wide-align/node_modules/ansi-regex/index.js +0 -10
  175. package/node_modules/wide-align/node_modules/ansi-regex/license +0 -9
  176. package/node_modules/wide-align/node_modules/ansi-regex/package.json +0 -55
  177. package/node_modules/wide-align/node_modules/ansi-regex/readme.md +0 -78
  178. package/node_modules/wide-align/node_modules/is-fullwidth-code-point/index.js +0 -50
  179. package/node_modules/wide-align/node_modules/is-fullwidth-code-point/license +0 -9
  180. package/node_modules/wide-align/node_modules/is-fullwidth-code-point/package.json +0 -42
  181. package/node_modules/wide-align/node_modules/is-fullwidth-code-point/readme.md +0 -39
  182. package/node_modules/wide-align/node_modules/string-width/index.js +0 -47
  183. package/node_modules/wide-align/node_modules/string-width/license +0 -9
  184. package/node_modules/wide-align/node_modules/string-width/package.json +0 -56
  185. package/node_modules/wide-align/node_modules/string-width/readme.md +0 -50
  186. package/node_modules/wide-align/node_modules/strip-ansi/index.js +0 -4
  187. package/node_modules/wide-align/node_modules/strip-ansi/license +0 -9
  188. package/node_modules/wide-align/node_modules/strip-ansi/package.json +0 -54
  189. package/node_modules/wide-align/node_modules/strip-ansi/readme.md +0 -46
  190. /package/node_modules/{wide-align/node_modules/ansi-regex → ansi-regex}/index.d.ts +0 -0
  191. /package/node_modules/are-we-there-yet/{index.js → lib/index.js} +0 -0
  192. /package/node_modules/{npmlog → color-support}/LICENSE +0 -0
  193. /package/node_modules/gauge/{error.js → lib/error.js} +0 -0
  194. /package/node_modules/gauge/{process.js → lib/process.js} +0 -0
  195. /package/node_modules/gauge/{set-immediate.js → lib/set-immediate.js} +0 -0
  196. /package/node_modules/gauge/{set-interval.js → lib/set-interval.js} +0 -0
  197. /package/node_modules/gauge/{spin.js → lib/spin.js} +0 -0
  198. /package/node_modules/{wide-align/node_modules/is-fullwidth-code-point → is-fullwidth-code-point}/index.d.ts +0 -0
  199. /package/node_modules/{wide-align/node_modules/string-width → string-width}/index.d.ts +0 -0
  200. /package/node_modules/{wide-align/node_modules/strip-ansi → strip-ansi}/index.d.ts +0 -0
@@ -0,0 +1,42 @@
1
+ 'use strict'
2
+ const stream = require('stream')
3
+ const Tracker = require('./tracker.js')
4
+
5
+ class TrackerStream extends stream.Transform {
6
+ constructor (name, size, options) {
7
+ super(options)
8
+ this.tracker = new Tracker(name, size)
9
+ this.name = name
10
+ this.id = this.tracker.id
11
+ this.tracker.on('change', this.trackerChange.bind(this))
12
+ }
13
+
14
+ trackerChange (name, completion) {
15
+ this.emit('change', name, completion, this)
16
+ }
17
+
18
+ _transform (data, encoding, cb) {
19
+ this.tracker.completeWork(data.length ? data.length : 1)
20
+ this.push(data)
21
+ cb()
22
+ }
23
+
24
+ _flush (cb) {
25
+ this.tracker.finish()
26
+ cb()
27
+ }
28
+
29
+ completed () {
30
+ return this.tracker.completed()
31
+ }
32
+
33
+ addWork (work) {
34
+ return this.tracker.addWork(work)
35
+ }
36
+
37
+ finish () {
38
+ return this.tracker.finish()
39
+ }
40
+ }
41
+
42
+ module.exports = TrackerStream
@@ -0,0 +1,34 @@
1
+ 'use strict'
2
+ const TrackerBase = require('./tracker-base.js')
3
+
4
+ class Tracker extends TrackerBase {
5
+ constructor (name, todo) {
6
+ super(name)
7
+ this.workDone = 0
8
+ this.workTodo = todo || 0
9
+ }
10
+
11
+ completed () {
12
+ return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
13
+ }
14
+
15
+ addWork (work) {
16
+ this.workTodo += work
17
+ this.emit('change', this.name, this.completed(), this)
18
+ }
19
+
20
+ completeWork (work) {
21
+ this.workDone += work
22
+ if (this.workDone > this.workTodo) {
23
+ this.workDone = this.workTodo
24
+ }
25
+ this.emit('change', this.name, this.completed(), this)
26
+ }
27
+
28
+ finish () {
29
+ this.workTodo = this.workDone = 1
30
+ this.emit('change', this.name, 1, this)
31
+ }
32
+ }
33
+
34
+ module.exports = Tracker
@@ -1,35 +1,53 @@
1
1
  {
2
2
  "name": "are-we-there-yet",
3
- "version": "1.1.7",
3
+ "version": "4.0.2",
4
4
  "description": "Keep track of the overall completion of many disparate processes",
5
- "main": "index.js",
5
+ "main": "lib/index.js",
6
6
  "scripts": {
7
- "test": "standard && tap test/*.js"
7
+ "test": "tap",
8
+ "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
9
+ "lintfix": "npm run lint -- --fix",
10
+ "posttest": "npm run lint",
11
+ "postsnap": "npm run lintfix --",
12
+ "snap": "tap",
13
+ "postlint": "template-oss-check",
14
+ "template-oss-apply": "template-oss-apply --force"
8
15
  },
9
16
  "repository": {
10
17
  "type": "git",
11
- "url": "https://github.com/iarna/are-we-there-yet.git"
18
+ "url": "https://github.com/npm/are-we-there-yet.git"
12
19
  },
13
- "author": "Rebecca Turner (http://re-becca.org)",
20
+ "author": "GitHub Inc.",
14
21
  "license": "ISC",
15
22
  "bugs": {
16
- "url": "https://github.com/iarna/are-we-there-yet/issues"
23
+ "url": "https://github.com/npm/are-we-there-yet/issues"
17
24
  },
18
- "homepage": "https://github.com/iarna/are-we-there-yet",
25
+ "homepage": "https://github.com/npm/are-we-there-yet",
19
26
  "devDependencies": {
20
- "standard": "^11.0.1",
21
- "tap": "^12.0.1"
22
- },
23
- "dependencies": {
24
- "delegates": "^1.0.0",
25
- "readable-stream": "^2.0.6"
27
+ "@npmcli/eslint-config": "^4.0.0",
28
+ "@npmcli/template-oss": "4.21.3",
29
+ "tap": "^16.0.1"
26
30
  },
27
31
  "files": [
28
- "index.js",
29
- "tracker-base.js",
30
- "tracker-group.js",
31
- "tracker-stream.js",
32
- "tracker.js",
33
- "CHANGES.md"
34
- ]
32
+ "bin/",
33
+ "lib/"
34
+ ],
35
+ "engines": {
36
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
37
+ },
38
+ "tap": {
39
+ "branches": 68,
40
+ "statements": 92,
41
+ "functions": 86,
42
+ "lines": 92,
43
+ "nyc-arg": [
44
+ "--exclude",
45
+ "tap-snapshots/**"
46
+ ]
47
+ },
48
+ "templateOSS": {
49
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
50
+ "version": "4.21.3",
51
+ "publish": true
52
+ }
35
53
  }
@@ -0,0 +1,129 @@
1
+ # color-support
2
+
3
+ A module which will endeavor to guess your terminal's level of color
4
+ support.
5
+
6
+ [![Build Status](https://travis-ci.org/isaacs/color-support.svg?branch=master)](https://travis-ci.org/isaacs/color-support) [![Coverage Status](https://coveralls.io/repos/github/isaacs/color-support/badge.svg?branch=master)](https://coveralls.io/github/isaacs/color-support?branch=master)
7
+
8
+ This is similar to `supports-color`, but it does not read
9
+ `process.argv`.
10
+
11
+ 1. If not in a node environment, not supported.
12
+
13
+ 2. If stdout is not a TTY, not supported, unless the `ignoreTTY`
14
+ option is set.
15
+
16
+ 3. If the `TERM` environ is `dumb`, not supported, unless the
17
+ `ignoreDumb` option is set.
18
+
19
+ 4. If on Windows, then support 16 colors.
20
+
21
+ 5. If using Tmux, then support 256 colors.
22
+
23
+ 7. Handle continuous-integration servers. If `CI` or
24
+ `TEAMCITY_VERSION` are set in the environment, and `TRAVIS` is not
25
+ set, then color is not supported, unless `ignoreCI` option is set.
26
+
27
+ 6. Guess based on the `TERM_PROGRAM` environ. These terminals support
28
+ 16m colors:
29
+
30
+ - `iTerm.app` version 3.x supports 16m colors, below support 256
31
+ - `MacTerm` supports 16m colors
32
+ - `Apple_Terminal` supports 256 colors
33
+ - Have more things that belong on this list? Send a PR!
34
+
35
+ 8. Make a guess based on the `TERM` environment variable. Any
36
+ `xterm-256color` will get 256 colors. Any screen, xterm, vt100,
37
+ color, ansi, cygwin, or linux `TERM` will get 16 colors.
38
+
39
+ 9. If `COLORTERM` environment variable is set, then support 16 colors.
40
+
41
+ 10. At this point, we assume that color is not supported.
42
+
43
+ ## USAGE
44
+
45
+ ```javascript
46
+ var testColorSupport = require('color-support')
47
+ var colorSupport = testColorSupport(/* options object */)
48
+
49
+ if (!colorSupport) {
50
+ console.log('color is not supported')
51
+ } else if (colorSupport.has16m) {
52
+ console.log('\x1b[38;2;102;194;255m16m colors\x1b[0m')
53
+ } else if (colorSupport.has256) {
54
+ console.log('\x1b[38;5;119m256 colors\x1b[0m')
55
+ } else if (colorSupport.hasBasic) {
56
+ console.log('\x1b[31mbasic colors\x1b[0m')
57
+ } else {
58
+ console.log('this is impossible, but colors are not supported')
59
+ }
60
+ ```
61
+
62
+ If you don't have any options to set, you can also just look at the
63
+ flags which will all be set on the test function itself. (Of course,
64
+ this doesn't return a falsey value when colors aren't supported, and
65
+ doesn't allow you to set options.)
66
+
67
+ ```javascript
68
+ var colorSupport = require('color-support')
69
+
70
+ if (colorSupport.has16m) {
71
+ console.log('\x1b[38;2;102;194;255m16m colors\x1b[0m')
72
+ } else if (colorSupport.has256) {
73
+ console.log('\x1b[38;5;119m256 colors\x1b[0m')
74
+ } else if (colorSupport.hasBasic) {
75
+ console.log('\x1b[31mbasic colors\x1b[0m')
76
+ } else {
77
+ console.log('colors are not supported')
78
+ }
79
+ ```
80
+
81
+ ## Options
82
+
83
+ You can pass in the following options.
84
+
85
+ * ignoreTTY - default false. Ignore the `isTTY` check.
86
+ * ignoreDumb - default false. Ignore `TERM=dumb` environ check.
87
+ * ignoreCI - default false. Ignore `CI` environ check.
88
+ * env - Object for environment vars. Defaults to `process.env`.
89
+ * stream - Stream for `isTTY` check. Defaults to `process.stdout`.
90
+ * term - String for `TERM` checking. Defaults to `env.TERM`.
91
+ * alwaysReturn - default false. Return an object when colors aren't
92
+ supported (instead of returning `false`).
93
+ * level - A number from 0 to 3. This will return a result for the
94
+ specified level. This is useful if you want to be able to set the
95
+ color support level explicitly as a number in an environment
96
+ variable or config, but then use the object flags in your program.
97
+ Except for `alwaysReturn` to return an object for level 0, all other
98
+ options are ignored, since no checking is done if a level is
99
+ explicitly set.
100
+
101
+ ## Return Value
102
+
103
+ If no color support is available, then `false` is returned by default,
104
+ unless the `alwaysReturn` flag is set to `true`. This is so that the
105
+ simple question of "can I use colors or not" can treat any truthy
106
+ return as "yes".
107
+
108
+ Otherwise, the return object has the following fields:
109
+
110
+ * `level` - A number from 0 to 3
111
+ * `0` - No color support
112
+ * `1` - Basic (16) color support
113
+ * `2` - 256 color support
114
+ * `3` - 16 million (true) color support
115
+ * `hasBasic` - Boolean
116
+ * `has256` - Boolean
117
+ * `has16m` - Boolean
118
+
119
+ ## CLI
120
+
121
+ You can run the `color-support` bin from the command line which will
122
+ just dump the values as this module calculates them in whatever env
123
+ it's run. It takes no command line arguments.
124
+
125
+ ## Credits
126
+
127
+ This is a spiritual, if not actual, fork of
128
+ [supports-color](http://npm.im/supports-color) by the ever prolific
129
+ [Sindre Sorhus](http://npm.im/~sindresorhus).
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ var colorSupport = require('./')({alwaysReturn: true })
3
+ console.log(JSON.stringify(colorSupport, null, 2))
@@ -0,0 +1,14 @@
1
+ module.exports = colorSupport({ alwaysReturn: true }, colorSupport)
2
+
3
+ function colorSupport(options, obj) {
4
+ obj = obj || {}
5
+ options = options || {}
6
+ obj.level = 0
7
+ obj.hasBasic = false
8
+ obj.has256 = false
9
+ obj.has16m = false
10
+ if (!options.alwaysReturn) {
11
+ return false
12
+ }
13
+ return obj
14
+ }
@@ -0,0 +1,134 @@
1
+ // call it on itself so we can test the export val for basic stuff
2
+ module.exports = colorSupport({ alwaysReturn: true }, colorSupport)
3
+
4
+ function hasNone (obj, options) {
5
+ obj.level = 0
6
+ obj.hasBasic = false
7
+ obj.has256 = false
8
+ obj.has16m = false
9
+ if (!options.alwaysReturn) {
10
+ return false
11
+ }
12
+ return obj
13
+ }
14
+
15
+ function hasBasic (obj) {
16
+ obj.hasBasic = true
17
+ obj.has256 = false
18
+ obj.has16m = false
19
+ obj.level = 1
20
+ return obj
21
+ }
22
+
23
+ function has256 (obj) {
24
+ obj.hasBasic = true
25
+ obj.has256 = true
26
+ obj.has16m = false
27
+ obj.level = 2
28
+ return obj
29
+ }
30
+
31
+ function has16m (obj) {
32
+ obj.hasBasic = true
33
+ obj.has256 = true
34
+ obj.has16m = true
35
+ obj.level = 3
36
+ return obj
37
+ }
38
+
39
+ function colorSupport (options, obj) {
40
+ options = options || {}
41
+
42
+ obj = obj || {}
43
+
44
+ // if just requesting a specific level, then return that.
45
+ if (typeof options.level === 'number') {
46
+ switch (options.level) {
47
+ case 0:
48
+ return hasNone(obj, options)
49
+ case 1:
50
+ return hasBasic(obj)
51
+ case 2:
52
+ return has256(obj)
53
+ case 3:
54
+ return has16m(obj)
55
+ }
56
+ }
57
+
58
+ obj.level = 0
59
+ obj.hasBasic = false
60
+ obj.has256 = false
61
+ obj.has16m = false
62
+
63
+ if (typeof process === 'undefined' ||
64
+ !process ||
65
+ !process.stdout ||
66
+ !process.env ||
67
+ !process.platform) {
68
+ return hasNone(obj, options)
69
+ }
70
+
71
+ var env = options.env || process.env
72
+ var stream = options.stream || process.stdout
73
+ var term = options.term || env.TERM || ''
74
+ var platform = options.platform || process.platform
75
+
76
+ if (!options.ignoreTTY && !stream.isTTY) {
77
+ return hasNone(obj, options)
78
+ }
79
+
80
+ if (!options.ignoreDumb && term === 'dumb' && !env.COLORTERM) {
81
+ return hasNone(obj, options)
82
+ }
83
+
84
+ if (platform === 'win32') {
85
+ return hasBasic(obj)
86
+ }
87
+
88
+ if (env.TMUX) {
89
+ return has256(obj)
90
+ }
91
+
92
+ if (!options.ignoreCI && (env.CI || env.TEAMCITY_VERSION)) {
93
+ if (env.TRAVIS) {
94
+ return has256(obj)
95
+ } else {
96
+ return hasNone(obj, options)
97
+ }
98
+ }
99
+
100
+ // TODO: add more term programs
101
+ switch (env.TERM_PROGRAM) {
102
+ case 'iTerm.app':
103
+ var ver = env.TERM_PROGRAM_VERSION || '0.'
104
+ if (/^[0-2]\./.test(ver)) {
105
+ return has256(obj)
106
+ } else {
107
+ return has16m(obj)
108
+ }
109
+
110
+ case 'HyperTerm':
111
+ case 'Hyper':
112
+ return has16m(obj)
113
+
114
+ case 'MacTerm':
115
+ return has16m(obj)
116
+
117
+ case 'Apple_Terminal':
118
+ return has256(obj)
119
+ }
120
+
121
+ if (/^xterm-256/.test(term)) {
122
+ return has256(obj)
123
+ }
124
+
125
+ if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(term)) {
126
+ return hasBasic(obj)
127
+ }
128
+
129
+ if (env.COLORTERM) {
130
+ return hasBasic(obj)
131
+ }
132
+
133
+ return hasNone(obj, options)
134
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "color-support",
3
+ "version": "1.1.3",
4
+ "description": "A module which will endeavor to guess your terminal's level of color support.",
5
+ "main": "index.js",
6
+ "browser": "browser.js",
7
+ "bin": "bin.js",
8
+ "devDependencies": {
9
+ "tap": "^10.3.3"
10
+ },
11
+ "scripts": {
12
+ "test": "tap test/*.js --100 -J",
13
+ "preversion": "npm test",
14
+ "postversion": "npm publish",
15
+ "postpublish": "git push origin --all; git push origin --tags"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/isaacs/color-support.git"
20
+ },
21
+ "keywords": [
22
+ "terminal",
23
+ "color",
24
+ "support",
25
+ "xterm",
26
+ "truecolor",
27
+ "256"
28
+ ],
29
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
30
+ "license": "ISC",
31
+ "files": [
32
+ "browser.js",
33
+ "index.js",
34
+ "bin.js"
35
+ ]
36
+ }
@@ -0,0 +1,20 @@
1
+ <!-- This file is automatically added by @npmcli/template-oss. Do not edit. -->
2
+
3
+ ISC License
4
+
5
+ Copyright npm, Inc.
6
+
7
+ Permission to use, copy, modify, and/or distribute this
8
+ software for any purpose with or without fee is hereby
9
+ granted, provided that the above copyright notice and this
10
+ permission notice appear in all copies.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL
13
+ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
14
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
15
+ EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
20
+ USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -8,14 +8,17 @@ var Gauge = require("gauge")
8
8
 
9
9
  var gauge = new Gauge()
10
10
 
11
- gauge.show("test", 0.20)
12
-
13
- gauge.pulse("this")
14
-
15
- gauge.hide()
11
+ gauge.show("working…", 0)
12
+ setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.25) }, 500)
13
+ setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.50) }, 1000)
14
+ setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.75) }, 1500)
15
+ setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.99) }, 2000)
16
+ setTimeout(() => gauge.hide(), 2300)
16
17
  ```
17
18
 
18
- ![](gauge-demo.gif)
19
+ See also the [demos](docs/demo.js):
20
+
21
+ ![](./docs/gauge-demo.gif)
19
22
 
20
23
 
21
24
  ### CHANGES FROM 1.x
@@ -46,12 +49,12 @@ if **stream** isn't a tty and a tty isn't explicitly provided.
46
49
 
47
50
  If **stream** is a terminal or if you pass in **tty** to **options** then we
48
51
  will detect terminal resizes and redraw to fit. We do this by watching for
49
- `resize` events on the tty. (To work around a bug in verisons of Node prior
52
+ `resize` events on the tty. (To work around a bug in versions of Node prior
50
53
  to 2.5.0, we watch for them on stdout if the tty is stderr.) Resizes to
51
54
  larger window sizes will be clean, but shrinking the window will always
52
55
  result in some cruft.
53
56
 
54
- **IMPORTANT:** If you prevously were passing in a non-tty stream but you still
57
+ **IMPORTANT:** If you previously were passing in a non-tty stream but you still
55
58
  want output (for example, a stream wrapped by the `ansi` module) then you
56
59
  need to pass in the **tty** option below, as `gauge` needs access to
57
60
  the underlying tty in order to do things like terminal resizes and terminal
@@ -60,7 +63,7 @@ width detection.
60
63
  The **options** object can have the following properties, all of which are
61
64
  optional:
62
65
 
63
- * **updateInterval**: How often gauge updates should be drawn, in miliseconds.
66
+ * **updateInterval**: How often gauge updates should be drawn, in milliseconds.
64
67
  * **fixedFramerate**: Defaults to false on node 0.8, true on everything
65
68
  else. When this is true a timer is created to trigger once every
66
69
  `updateInterval` ms, when false, updates are printed as soon as they come
@@ -76,7 +79,7 @@ optional:
76
79
  * The name of a theme, which will be looked up in the current *themes*
77
80
  object.
78
81
  * A configuration object with any of `hasUnicode`, `hasColor` or
79
- `platform` keys, which if wlll be used to override our guesses when making
82
+ `platform` keys, which if will be used to override our guesses when making
80
83
  a default theme selection.
81
84
 
82
85
  If no theme is selected then a default is picked using a combination of our
@@ -94,7 +97,7 @@ optional:
94
97
  the gauge starts enabled. If disabled then all update commands are
95
98
  ignored and no gauge will be printed until you call `.enable()`.
96
99
  * **Plumbing**: The class to use to actually generate the gauge for
97
- printing. This defaults to `require('gauge/plumbing')` and ordinarly you
100
+ printing. This defaults to `require('gauge/plumbing')` and ordinarily you
98
101
  shouldn't need to override this.
99
102
  * **cleanupOnExit**: Defaults to true. Ordinarily we register an exit
100
103
  handler to make sure your cursor is turned back on and the progress bar
@@ -162,7 +165,7 @@ Change the active theme, will be displayed with the next show or pulse. This can
162
165
  * The name of a theme, which will be looked up in the current *themes*
163
166
  object.
164
167
  * A configuration object with any of `hasUnicode`, `hasColor` or
165
- `platform` keys, which if wlll be used to override our guesses when making
168
+ `platform` keys, which if will be used to override our guesses when making
166
169
  a default theme selection.
167
170
 
168
171
  If no theme is selected then a default is picked using a combination of our
@@ -194,7 +197,7 @@ var ourTheme = themes({hasUnicode: true, hasColor: false, platform: 'darwin'})
194
197
 
195
198
  // create a new theme based on the color ascii theme for this platform
196
199
  // that brackets the progress bar with arrows
197
- var ourTheme = themes.newTheme(theme(hasUnicode: false, hasColor: true}), {
200
+ var ourTheme = themes.newTheme(themes({hasUnicode: false, hasColor: true}), {
198
201
  preProgressbar: '→',
199
202
  postProgressbar: '←'
200
203
  })
@@ -207,7 +210,7 @@ var ThemeSet = require('gauge/theme-set')
207
210
  var themes = new ThemeSet()
208
211
  // or
209
212
  var themes = require('gauge/themes')
210
- var mythemes = themes.newThemeset() // creates a new themeset based on the default themes
213
+ var mythemes = themes.newThemeSet() // creates a new themeset based on the default themes
211
214
  ```
212
215
 
213
216
  #### themes(opts)
@@ -311,7 +314,7 @@ This *mixes-in* `theme` into all themes currently defined. It also adds it
311
314
  to the default parent theme for this themeset, so future themes added to
312
315
  this themeset will get the values from `theme` by default.
313
316
 
314
- #### themes.newThemeset()
317
+ #### themes.newThemeSet()
315
318
 
316
319
  Copy the current themeset into a new one. This allows you to easily inherit
317
320
  one themeset from another.
@@ -350,7 +353,7 @@ be be included verbatum in the output, or objects with the following properties:
350
353
  * *align* – (Default: left) Possible values "left", "right" and "center". Works
351
354
  as you'd expect from word processors.
352
355
  * *length* – Provides a single value for both *minLength* and *maxLength*. If both
353
- *length* and *minLength or *maxLength* are specifed then the latter take precedence.
356
+ *length* and *minLength or *maxLength* are specified then the latter take precedence.
354
357
  * *value* – A literal value to use for this template item.
355
358
  * *default* – A default value to use for this template item if a value
356
359
  wasn't otherwise passed in.
@@ -4,11 +4,15 @@ var progressBar = require('./progress-bar.js')
4
4
 
5
5
  module.exports = {
6
6
  activityIndicator: function (values, theme, width) {
7
- if (values.spun == null) return
7
+ if (values.spun == null) {
8
+ return
9
+ }
8
10
  return spin(theme, values.spun)
9
11
  },
10
12
  progressbar: function (values, theme, width) {
11
- if (values.completed == null) return
13
+ if (values.completed == null) {
14
+ return
15
+ }
12
16
  return progressBar(theme, width, values.completed)
13
- }
17
+ },
14
18
  }
@@ -0,0 +1,4 @@
1
+ 'use strict'
2
+ var colorSupport = require('color-support')
3
+
4
+ module.exports = colorSupport().hasBasic