@socketsecurity/cli-with-sentry 0.14.137 → 0.14.139

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 (109) hide show
  1. package/dist/blessed/LICENSE +20 -0
  2. package/dist/blessed/lib/alias.js +519 -0
  3. package/dist/blessed/lib/blessed.js +32 -0
  4. package/dist/blessed/lib/colors.js +490 -0
  5. package/dist/blessed/lib/events.js +195 -0
  6. package/dist/blessed/lib/gpmclient.js +245 -0
  7. package/dist/blessed/lib/helpers.js +170 -0
  8. package/dist/blessed/lib/keys.js +512 -0
  9. package/dist/blessed/lib/program.js +4530 -0
  10. package/dist/blessed/lib/tput.js +3111 -0
  11. package/dist/blessed/lib/unicode.js +912 -0
  12. package/dist/blessed/lib/widget.js +60 -0
  13. package/dist/blessed/lib/widgets/ansiimage.js +173 -0
  14. package/dist/blessed/lib/widgets/bigtext.js +170 -0
  15. package/dist/blessed/lib/widgets/box.js +34 -0
  16. package/dist/blessed/lib/widgets/button.js +62 -0
  17. package/dist/blessed/lib/widgets/checkbox.js +95 -0
  18. package/dist/blessed/lib/widgets/element.js +2871 -0
  19. package/dist/blessed/lib/widgets/filemanager.js +223 -0
  20. package/dist/blessed/lib/widgets/form.js +301 -0
  21. package/dist/blessed/lib/widgets/image.js +71 -0
  22. package/dist/blessed/lib/widgets/input.js +34 -0
  23. package/dist/blessed/lib/widgets/layout.js +249 -0
  24. package/dist/blessed/lib/widgets/line.js +59 -0
  25. package/dist/blessed/lib/widgets/list.js +652 -0
  26. package/dist/blessed/lib/widgets/listbar.js +452 -0
  27. package/dist/blessed/lib/widgets/listtable.js +265 -0
  28. package/dist/blessed/lib/widgets/loading.js +88 -0
  29. package/dist/blessed/lib/widgets/log.js +82 -0
  30. package/dist/blessed/lib/widgets/message.js +145 -0
  31. package/dist/blessed/lib/widgets/node.js +314 -0
  32. package/dist/blessed/lib/widgets/overlayimage.js +794 -0
  33. package/dist/blessed/lib/widgets/progressbar.js +166 -0
  34. package/dist/blessed/lib/widgets/prompt.js +127 -0
  35. package/dist/blessed/lib/widgets/question.js +129 -0
  36. package/dist/blessed/lib/widgets/radiobutton.js +62 -0
  37. package/dist/blessed/lib/widgets/radioset.js +36 -0
  38. package/dist/blessed/lib/widgets/screen.js +2485 -0
  39. package/dist/blessed/lib/widgets/scrollablebox.js +415 -0
  40. package/dist/blessed/lib/widgets/scrollabletext.js +35 -0
  41. package/dist/blessed/lib/widgets/table.js +383 -0
  42. package/dist/blessed/lib/widgets/terminal.js +452 -0
  43. package/dist/blessed/lib/widgets/text.js +35 -0
  44. package/dist/blessed/lib/widgets/textarea.js +376 -0
  45. package/dist/blessed/lib/widgets/textbox.js +79 -0
  46. package/dist/blessed/lib/widgets/video.js +130 -0
  47. package/dist/blessed/usr/fonts/AUTHORS +1 -0
  48. package/dist/blessed/usr/fonts/LICENSE +94 -0
  49. package/dist/blessed/usr/fonts/README +340 -0
  50. package/dist/blessed/usr/fonts/ter-u14b.json +17826 -0
  51. package/dist/blessed/usr/fonts/ter-u14n.json +17826 -0
  52. package/dist/blessed/usr/linux +0 -0
  53. package/dist/blessed/usr/windows-ansi +0 -0
  54. package/dist/blessed/usr/xterm +0 -0
  55. package/dist/blessed/usr/xterm-256color +0 -0
  56. package/dist/blessed/usr/xterm.termcap +243 -0
  57. package/dist/blessed/usr/xterm.terminfo +1977 -0
  58. package/dist/blessed/vendor/tng.js +1876 -0
  59. package/dist/blessed-contrib/LICENSE.md +21 -0
  60. package/dist/blessed-contrib/lib/layout/carousel.js +82 -0
  61. package/dist/blessed-contrib/lib/layout/grid.js +46 -0
  62. package/dist/blessed-contrib/lib/server-utils.js +83 -0
  63. package/dist/blessed-contrib/lib/utils.js +73 -0
  64. package/dist/blessed-contrib/lib/widget/canvas.js +52 -0
  65. package/dist/blessed-contrib/lib/widget/charts/bar.js +99 -0
  66. package/dist/blessed-contrib/lib/widget/charts/line.js +311 -0
  67. package/dist/blessed-contrib/lib/widget/charts/stacked-bar.js +245 -0
  68. package/dist/blessed-contrib/lib/widget/donut.js +183 -0
  69. package/dist/blessed-contrib/lib/widget/gauge-list.js +111 -0
  70. package/dist/blessed-contrib/lib/widget/gauge.js +127 -0
  71. package/dist/blessed-contrib/lib/widget/lcd.js +497 -0
  72. package/dist/blessed-contrib/lib/widget/log.js +32 -0
  73. package/dist/blessed-contrib/lib/widget/map.js +97 -0
  74. package/dist/blessed-contrib/lib/widget/markdown.js +68 -0
  75. package/dist/blessed-contrib/lib/widget/picture.js +61 -0
  76. package/dist/blessed-contrib/lib/widget/sparkline.js +66 -0
  77. package/dist/blessed-contrib/lib/widget/table.js +141 -0
  78. package/dist/blessed-contrib/lib/widget/tree.js +179 -0
  79. package/dist/blessed-contrib/node_modules/ansi-regex/index.js +6 -0
  80. package/dist/blessed-contrib/node_modules/ansi-regex/license +21 -0
  81. package/dist/blessed-contrib/node_modules/ansi-regex/package.json +64 -0
  82. package/dist/blessed-contrib/node_modules/ansi-regex/readme.md +39 -0
  83. package/dist/blessed-contrib/node_modules/ansi-styles/index.js +67 -0
  84. package/dist/blessed-contrib/node_modules/ansi-styles/license +21 -0
  85. package/dist/blessed-contrib/node_modules/ansi-styles/package.json +50 -0
  86. package/dist/blessed-contrib/node_modules/ansi-styles/readme.md +86 -0
  87. package/dist/blessed-contrib/node_modules/chalk/index.js +118 -0
  88. package/dist/blessed-contrib/node_modules/chalk/license +21 -0
  89. package/dist/blessed-contrib/node_modules/chalk/package.json +70 -0
  90. package/dist/blessed-contrib/node_modules/chalk/readme.md +213 -0
  91. package/dist/blessed-contrib/node_modules/escape-string-regexp/index.js +13 -0
  92. package/dist/blessed-contrib/node_modules/escape-string-regexp/license +21 -0
  93. package/dist/blessed-contrib/node_modules/escape-string-regexp/package.json +41 -0
  94. package/dist/blessed-contrib/node_modules/escape-string-regexp/readme.md +27 -0
  95. package/dist/blessed-contrib/node_modules/strip-ansi/index.js +8 -0
  96. package/dist/blessed-contrib/node_modules/strip-ansi/license +21 -0
  97. package/dist/blessed-contrib/node_modules/strip-ansi/package.json +57 -0
  98. package/dist/blessed-contrib/node_modules/strip-ansi/readme.md +33 -0
  99. package/dist/blessed-contrib/node_modules/supports-color/index.js +52 -0
  100. package/dist/blessed-contrib/node_modules/supports-color/license +21 -0
  101. package/dist/blessed-contrib/node_modules/supports-color/package.json +49 -0
  102. package/dist/blessed-contrib/node_modules/supports-color/readme.md +36 -0
  103. package/dist/cli.js +9 -8
  104. package/dist/cli.js.map +1 -1
  105. package/dist/instrument-with-sentry.js +2 -2
  106. package/dist/instrument-with-sentry.js.map +1 -1
  107. package/dist/shadow-npm-inject.js +2 -2
  108. package/dist/shadow-npm-inject.js.map +1 -1
  109. package/package.json +4 -4
@@ -0,0 +1,61 @@
1
+ 'use strict'
2
+ const Box = require('../../../blessed/lib/widgets/box'),
3
+ Node = require('../../../blessed/lib/widgets/node'),
4
+ pictureTube = require('picture-tuber'),
5
+ fs = require('node:fs'),
6
+ streams = require('memory-streams'),
7
+ MemoryStream = require('memorystream')
8
+
9
+ function Picture(options) {
10
+ if (!(this instanceof Node)) {
11
+ return new Picture(options)
12
+ }
13
+
14
+ options = options || {}
15
+ options.cols = options.cols || 50
16
+ this.options = options
17
+
18
+ if (options.file || options.base64) {
19
+ this.setImage(options)
20
+ }
21
+
22
+ Box.call(this, options)
23
+ }
24
+
25
+ Picture.prototype = Object.create(Box.prototype)
26
+
27
+ Picture.prototype.setImage = function (options) {
28
+ const tube = pictureTube({ cols: options.cols })
29
+
30
+ if (options.file) {
31
+ fs.createReadStream(options.file).pipe(tube)
32
+ } else if (options.base64) {
33
+ const memStream = new MemoryStream()
34
+ memStream.pipe(tube)
35
+ const buf = new Buffer(options.base64, 'base64')
36
+ memStream.write(buf)
37
+ memStream.end()
38
+ }
39
+
40
+ this.writer = new streams.WritableStream()
41
+ tube.pipe(this.writer)
42
+
43
+ tube.on('end', function () {
44
+ if (options.onReady) {
45
+ options.onReady()
46
+ }
47
+ })
48
+ }
49
+
50
+ Picture.prototype.render = function () {
51
+ this.setContent(this.writer.toString())
52
+ return this._render()
53
+ }
54
+
55
+ Picture.prototype.getOptionsPrototype = function () {
56
+ return { base64: 'AAAA', cols: 1 }
57
+ }
58
+
59
+ Picture.prototype.type = 'picture'
60
+
61
+ module.exports = Picture
@@ -0,0 +1,66 @@
1
+ 'use strict'
2
+ const Box = require('../../../blessed/lib/widgets/box'),
3
+ Node = require('../../../blessed/lib/widgets/node'),
4
+ sparkline = require('sparkline')
5
+
6
+ function Sparkline(options) {
7
+ const self = this
8
+
9
+ if (!(this instanceof Node)) {
10
+ return new Sparkline(options)
11
+ }
12
+
13
+ options = options || {}
14
+ options.bufferLength = options.bufferLength || 30
15
+ options.style = options.style || {}
16
+ options.style.titleFg = options.style.titleFg || 'white'
17
+ this.options = options
18
+ Box.call(this, options)
19
+
20
+ this.on('attach', function () {
21
+ if (self.options.data) {
22
+ self.setData(self.options.data.titles, self.options.data.data)
23
+ }
24
+ })
25
+ }
26
+
27
+ Sparkline.prototype = Object.create(Box.prototype)
28
+
29
+ Sparkline.prototype.setData = function (titles, datasets) {
30
+ let res = '\r\n'
31
+ for (let i = 0; i < titles.length; i++) {
32
+ res +=
33
+ '{bold}{' +
34
+ this.options.style.titleFg +
35
+ '-fg}' +
36
+ titles[i] +
37
+ ':{/' +
38
+ this.options.style.titleFg +
39
+ '-fg}{/bold}\r\n'
40
+ res += sparkline(datasets[i].slice(0, this.width - 2)) + '\r\n\r\n'
41
+ }
42
+
43
+ this.setContent(res)
44
+ }
45
+
46
+ Sparkline.prototype.getOptionsPrototype = function () {
47
+ return {
48
+ label: 'Sparkline',
49
+ tags: true,
50
+ border: { type: 'line', fg: 'cyan' },
51
+ width: '50%',
52
+ height: '50%',
53
+ style: { fg: 'blue' },
54
+ data: {
55
+ titles: ['Sparkline1', 'Sparkline2'],
56
+ data: [
57
+ [10, 20, 30, 20, 50, 70, 60, 30, 35, 38],
58
+ [40, 10, 40, 50, 20, 30, 20, 20, 19, 40]
59
+ ]
60
+ }
61
+ }
62
+ }
63
+
64
+ Sparkline.prototype.type = 'sparkline'
65
+
66
+ module.exports = Sparkline
@@ -0,0 +1,141 @@
1
+ 'use strict'
2
+ const Box = require('../../../blessed/lib/widgets/box'),
3
+ List = require('../../../blessed/lib/widgets/list'),
4
+ Node = require('../../../blessed/lib/widgets/node'),
5
+ stripAnsi = require('strip-ansi')
6
+
7
+ function Table(options) {
8
+ const self = this
9
+
10
+ if (!(this instanceof Node)) {
11
+ return new Table(options)
12
+ }
13
+
14
+ if (Array.isArray(options.columnSpacing)) {
15
+ throw (
16
+ 'Error: columnSpacing cannot be an array.\r\n' +
17
+ 'Note: From release 2.0.0 use property columnWidth instead of columnSpacing.\r\n' +
18
+ 'Please refere to the README or to https://github.com/yaronn/blessed-contrib/issues/39'
19
+ )
20
+ }
21
+
22
+ if (!options.columnWidth) {
23
+ throw 'Error: A table must get columnWidth as a property. Please refer to the README.'
24
+ }
25
+
26
+ options = options || {}
27
+ options.columnSpacing =
28
+ options.columnSpacing == null ? 10 : options.columnSpacing
29
+ options.bold = true
30
+ options.selectedFg = options.selectedFg || 'white'
31
+ options.selectedBg = options.selectedBg || 'blue'
32
+ options.fg = options.fg || 'green'
33
+ options.bg = options.bg || ''
34
+ options.interactive =
35
+ typeof options.interactive === 'undefined' ? true : options.interactive
36
+ this.options = options
37
+ Box.call(this, options)
38
+
39
+ this.rows = new List({
40
+ //height: 0,
41
+ top: 2,
42
+ width: 0,
43
+ left: 1,
44
+ style: {
45
+ selected: {
46
+ fg: options.selectedFg,
47
+ bg: options.selectedBg
48
+ },
49
+ item: {
50
+ fg: options.fg,
51
+ bg: options.bg
52
+ }
53
+ },
54
+ keys: options.keys,
55
+ vi: options.vi,
56
+ mouse: options.mouse,
57
+ tags: true,
58
+ interactive: options.interactive,
59
+ screen: this.screen
60
+ })
61
+
62
+ this.append(this.rows)
63
+
64
+ this.on('attach', function () {
65
+ if (self.options.data) {
66
+ self.setData(self.options.data)
67
+ }
68
+ })
69
+ }
70
+
71
+ Table.prototype = Object.create(Box.prototype)
72
+
73
+ Table.prototype.focus = function () {
74
+ this.rows.focus()
75
+ }
76
+
77
+ Table.prototype.render = function () {
78
+ if (this.screen.focused == this.rows) {
79
+ this.rows.focus()
80
+ }
81
+
82
+ this.rows.width = this.width - 3
83
+ this.rows.height = this.height - 4
84
+ Box.prototype.render.call(this)
85
+ }
86
+
87
+ Table.prototype.setData = function (table) {
88
+ const self = this
89
+
90
+ const dataToString = function (d) {
91
+ let str = ''
92
+ d.forEach(function (r, i) {
93
+ let colsize = self.options.columnWidth[i],
94
+ strip = stripAnsi(r.toString()),
95
+ ansiLen = r.toString().length - strip.length,
96
+ spaceLength = colsize - strip.length + self.options.columnSpacing
97
+ r = r.toString().substring(0, colsize + ansiLen) //compensate for ansi len
98
+ if (spaceLength < 0) {
99
+ spaceLength = 0
100
+ }
101
+ const spaces = new Array(spaceLength).join(' ')
102
+ str += r + spaces
103
+ })
104
+ return str
105
+ }
106
+
107
+ const formatted = []
108
+
109
+ table.data.forEach(function (d) {
110
+ const str = dataToString(d)
111
+ formatted.push(str)
112
+ })
113
+ this.setContent(dataToString(table.headers))
114
+ this.rows.setItems(formatted)
115
+ }
116
+
117
+ Table.prototype.getOptionsPrototype = function () {
118
+ return {
119
+ keys: true,
120
+ fg: 'white',
121
+ interactive: false,
122
+ label: 'Active Processes',
123
+ width: '30%',
124
+ height: '30%',
125
+ border: { type: 'line', fg: 'cyan' },
126
+ columnSpacing: 10,
127
+ columnWidth: [16, 12],
128
+ data: {
129
+ headers: ['col1', 'col2'],
130
+ data: [
131
+ ['a', 'b'],
132
+ ['5', 'u'],
133
+ ['x', '16.1']
134
+ ]
135
+ }
136
+ }
137
+ }
138
+
139
+ Table.prototype.type = 'table'
140
+
141
+ module.exports = Table
@@ -0,0 +1,179 @@
1
+ 'use strict'
2
+ const Box = require('../../../blessed/lib/widgets/box'),
3
+ List = require('../../../blessed/lib/widgets/list'),
4
+ Node = require('../../../blessed/lib/widgets/node')
5
+
6
+ function Tree(options) {
7
+ if (!(this instanceof Node)) {
8
+ return new Tree(options)
9
+ }
10
+
11
+ const self = this
12
+ options = options || {}
13
+ options.bold = true
14
+ this.options = options
15
+ this.data = {}
16
+ this.nodeLines = []
17
+ this.lineNbr = 0
18
+ Box.call(this, options)
19
+
20
+ options.extended = options.extended || false
21
+ options.keys = options.keys || ['+', 'space', 'enter']
22
+
23
+ options.template = options.template || {}
24
+ options.template.extend = options.template.extend || ' [+]'
25
+ options.template.retract = options.template.retract || ' [-]'
26
+ options.template.lines = options.template.lines || false
27
+
28
+ // Do not set height, since this create a bug where the first line is not always displayed
29
+ this.rows = new List({
30
+ top: 1,
31
+ width: 0,
32
+ left: 1,
33
+ style: options.style,
34
+ padding: options.padding,
35
+ keys: true,
36
+ tags: options.tags,
37
+ input: options.input,
38
+ vi: options.vi,
39
+ ignoreKeys: options.ignoreKeys,
40
+ scrollable: options.scrollable,
41
+ mouse: options.mouse,
42
+ selectedBg: options.selectedBg || 'blue',
43
+ selectedFg: options.selectedFg || 'black'
44
+ })
45
+
46
+ this.append(this.rows)
47
+
48
+ this.rows.key(options.keys, function () {
49
+ const selectedNode = self.nodeLines[this.getItemIndex(this.selected)]
50
+ if (selectedNode.children) {
51
+ selectedNode.extended = !selectedNode.extended
52
+ self.setData(self.data)
53
+ self.screen.render()
54
+ }
55
+
56
+ self.emit('select', selectedNode, this.getItemIndex(this.selected))
57
+ })
58
+ }
59
+
60
+ Tree.prototype = Object.create(Box.prototype)
61
+
62
+ Tree.prototype.walk = function (node, treeDepth) {
63
+ let lines = []
64
+
65
+ if (!node.parent) {
66
+ // root level
67
+ this.lineNbr = 0
68
+ this.nodeLines.length = 0
69
+ node.parent = null
70
+ }
71
+
72
+ if (treeDepth === '' && node.name) {
73
+ this.lineNbr = 0
74
+ this.nodeLines[this.lineNbr++] = node
75
+ lines.push(node.name)
76
+ treeDepth = ' '
77
+ }
78
+
79
+ node.depth = treeDepth.length - 1
80
+
81
+ if (node.children && node.extended) {
82
+ let i = 0
83
+
84
+ if (typeof node.children === 'function') {
85
+ node.childrenContent = node.children(node)
86
+ }
87
+
88
+ if (!node.childrenContent) {
89
+ node.childrenContent = node.children
90
+ }
91
+
92
+ for (let child in node.childrenContent) {
93
+ if (!node.childrenContent[child].name) {
94
+ node.childrenContent[child].name = child
95
+ }
96
+
97
+ child = node.childrenContent[child]
98
+ child.parent = node
99
+ child.position = i++
100
+
101
+ if (typeof child.extended === 'undefined') {
102
+ child.extended = this.options.extended
103
+ }
104
+
105
+ if (typeof child.children === 'function') {
106
+ child.childrenContent = child.children(child)
107
+ } else {
108
+ child.childrenContent = child.children
109
+ }
110
+
111
+ const isLastChild =
112
+ child.position === Object.keys(child.parent.childrenContent).length - 1
113
+ let treePrefix
114
+ let suffix = ''
115
+ if (isLastChild) {
116
+ treePrefix = '└'
117
+ } else {
118
+ treePrefix = '├'
119
+ }
120
+
121
+ if (
122
+ !child.childrenContent ||
123
+ Object.keys(child.childrenContent).length === 0
124
+ ) {
125
+ treePrefix += '─'
126
+ } else if (child.extended) {
127
+ treePrefix += '┬'
128
+ suffix = this.options.template.retract
129
+ } else {
130
+ treePrefix += '─'
131
+ suffix = this.options.template.extend
132
+ }
133
+
134
+ if (!this.options.template.lines) {
135
+ treePrefix = '|-'
136
+ }
137
+ if (this.options.template.spaces) {
138
+ treePrefix = ' '
139
+ }
140
+
141
+ lines.push(treeDepth + treePrefix + child.name + suffix)
142
+
143
+ this.nodeLines[this.lineNbr++] = child
144
+
145
+ let parentTree
146
+ if (isLastChild || !this.options.template.lines) {
147
+ parentTree = treeDepth + ' '
148
+ } else {
149
+ parentTree = treeDepth + '│'
150
+ }
151
+
152
+ lines = lines.concat(this.walk(child, parentTree))
153
+ }
154
+ }
155
+ return lines
156
+ }
157
+
158
+ Tree.prototype.focus = function () {
159
+ this.rows.focus()
160
+ }
161
+
162
+ Tree.prototype.render = function () {
163
+ if (this.screen.focused === this.rows) {
164
+ this.rows.focus()
165
+ }
166
+
167
+ this.rows.width = this.width - 3
168
+ this.rows.height = this.height - 3
169
+ Box.prototype.render.call(this)
170
+ }
171
+
172
+ Tree.prototype.setData = function (nodes) {
173
+ this.data = nodes
174
+ this.rows.setItems(this.walk(nodes, ''))
175
+ }
176
+
177
+ Tree.prototype.type = 'tree'
178
+
179
+ module.exports = Tree
@@ -0,0 +1,6 @@
1
+
2
+ 'use strict'
3
+ ;
4
+ module.exports = function () {
5
+ return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
6
+ };
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
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
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "ansi-regex",
3
+ "version": "2.1.1",
4
+ "description": "Regular expression for matching ANSI escape codes",
5
+ "license": "MIT",
6
+ "repository": "chalk/ansi-regex",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "maintainers": [
13
+ "Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
14
+ "Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)",
15
+ "JD Ballard <i.am.qix@gmail.com> (github.com/qix-)"
16
+ ],
17
+ "engines": {
18
+ "node": ">=0.10.0"
19
+ },
20
+ "scripts": {
21
+ "test": "xo && ava --verbose",
22
+ "view-supported": "node fixtures/view-codes.js"
23
+ },
24
+ "files": [
25
+ "index.js"
26
+ ],
27
+ "keywords": [
28
+ "ansi",
29
+ "styles",
30
+ "color",
31
+ "colour",
32
+ "colors",
33
+ "terminal",
34
+ "console",
35
+ "cli",
36
+ "string",
37
+ "tty",
38
+ "escape",
39
+ "formatting",
40
+ "rgb",
41
+ "256",
42
+ "shell",
43
+ "xterm",
44
+ "command-line",
45
+ "text",
46
+ "regex",
47
+ "regexp",
48
+ "re",
49
+ "match",
50
+ "test",
51
+ "find",
52
+ "pattern"
53
+ ],
54
+ "devDependencies": {
55
+ "ava": "0.17.0",
56
+ "xo": "0.16.0"
57
+ },
58
+ "xo": {
59
+ "rules": {
60
+ "guard-for-in": 0,
61
+ "no-loop-func": 0
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,39 @@
1
+ # ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
2
+
3
+ > Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
4
+
5
+
6
+ ## Install
7
+
8
+ ```
9
+ $ npm install --save ansi-regex
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ const ansiRegex = require('ansi-regex');
17
+
18
+ ansiRegex().test('\u001b[4mcake\u001b[0m');
19
+ //=> true
20
+
21
+ ansiRegex().test('cake');
22
+ //=> false
23
+
24
+ '\u001b[4mcake\u001b[0m'.match(ansiRegex());
25
+ //=> ['\u001b[4m', '\u001b[0m']
26
+ ```
27
+
28
+ ## FAQ
29
+
30
+ ### Why do you test for codes not in the ECMA 48 standard?
31
+
32
+ Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
33
+
34
+ On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
35
+
36
+
37
+ ## License
38
+
39
+ MIT © [Sindre Sorhus](http://sindresorhus.com)
@@ -0,0 +1,67 @@
1
+
2
+ 'use strict'
3
+ ;
4
+
5
+ function assembleStyles () {
6
+ var styles = {
7
+ modifiers: {
8
+ reset: [0, 0],
9
+ bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
10
+ dim: [2, 22],
11
+ italic: [3, 23],
12
+ underline: [4, 24],
13
+ inverse: [7, 27],
14
+ hidden: [8, 28],
15
+ strikethrough: [9, 29]
16
+ },
17
+ colors: {
18
+ black: [30, 39],
19
+ red: [31, 39],
20
+ green: [32, 39],
21
+ yellow: [33, 39],
22
+ blue: [34, 39],
23
+ magenta: [35, 39],
24
+ cyan: [36, 39],
25
+ white: [37, 39],
26
+ gray: [90, 39]
27
+ },
28
+ bgColors: {
29
+ bgBlack: [40, 49],
30
+ bgRed: [41, 49],
31
+ bgGreen: [42, 49],
32
+ bgYellow: [43, 49],
33
+ bgBlue: [44, 49],
34
+ bgMagenta: [45, 49],
35
+ bgCyan: [46, 49],
36
+ bgWhite: [47, 49]
37
+ }
38
+ };
39
+
40
+ // fix humans
41
+ styles.colors.grey = styles.colors.gray;
42
+
43
+ Object.keys(styles).forEach(function (groupName) {
44
+ var group = styles[groupName];
45
+
46
+ Object.keys(group).forEach(function (styleName) {
47
+ var style = group[styleName];
48
+
49
+ styles[styleName] = group[styleName] = {
50
+ open: '\u001b[' + style[0] + 'm',
51
+ close: '\u001b[' + style[1] + 'm'
52
+ };
53
+ });
54
+
55
+ Object.defineProperty(styles, groupName, {
56
+ value: group,
57
+ enumerable: false
58
+ });
59
+ });
60
+
61
+ return styles;
62
+ }
63
+
64
+ Object.defineProperty(module, 'exports', {
65
+ enumerable: true,
66
+ get: assembleStyles
67
+ });
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
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
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.