@socketsecurity/cli-with-sentry 0.15.55 → 0.15.57

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 (58) hide show
  1. package/bin/cli.js +2 -2
  2. package/dist/cli.js +82 -55
  3. package/dist/cli.js.map +1 -1
  4. package/dist/constants.js +49 -29
  5. package/dist/constants.js.map +1 -1
  6. package/dist/{shadow-bin.js → shadow-npm-bin.js} +6 -6
  7. package/dist/shadow-npm-bin.js.map +1 -0
  8. package/dist/{shadow-inject.js → shadow-npm-inject.js} +1 -1
  9. package/dist/shadow-npm-inject.js.map +1 -0
  10. package/dist/types/commands/scan/handle-reach-scan.d.mts +1 -1
  11. package/dist/types/commands/scan/handle-reach-scan.d.mts.map +1 -1
  12. package/dist/types/commands/scan/scan-reachability.d.mts +1 -1
  13. package/dist/types/commands/scan/scan-reachability.d.mts.map +1 -1
  14. package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +1 -1
  15. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts +4 -1
  16. package/dist/types/commands/threat-feed/fetch-threat-feed.d.mts.map +1 -1
  17. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts +4 -1
  18. package/dist/types/commands/threat-feed/handle-threat-feed.d.mts.map +1 -1
  19. package/dist/types/constants.d.mts +9 -5
  20. package/dist/types/constants.d.mts.map +1 -1
  21. package/dist/utils.js +5 -5
  22. package/dist/utils.js.map +1 -1
  23. package/dist/vendor.js +21 -21
  24. package/external/@coana-tech/cli/cli.mjs +123 -8
  25. package/external/@socketsecurity/registry/external/@npmcli/package-json/index.js +9 -4
  26. package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +115 -132
  27. package/external/@socketsecurity/registry/external/@yarnpkg/extensions.js +18 -0
  28. package/external/@socketsecurity/registry/external/browserslist.js +662 -658
  29. package/external/@socketsecurity/registry/external/cacache.js +5 -3
  30. package/external/@socketsecurity/registry/external/libnpmpack.js +9 -4
  31. package/external/@socketsecurity/registry/external/make-fetch-happen.js +5 -3
  32. package/external/@socketsecurity/registry/external/npm-package-arg.js +4 -1
  33. package/external/@socketsecurity/registry/external/pacote.js +9 -4
  34. package/external/@socketsecurity/registry/external/validate-npm-package-name.js +4 -1
  35. package/external/@socketsecurity/registry/manifest.json +4 -4
  36. package/external/blessed-contrib/lib/layout/grid.js +400 -32
  37. package/external/blessed-contrib/lib/widget/charts/bar.js +8338 -67
  38. package/external/blessed-contrib/lib/widget/charts/line.js +17861 -196
  39. package/external/blessed-contrib/lib/widget/table.js +140 -121
  40. package/package.json +17 -16
  41. package/dist/shadow-bin.js.map +0 -1
  42. package/dist/shadow-inject.js.map +0 -1
  43. package/external/blessed-contrib/index.js +0 -28
  44. package/external/blessed-contrib/lib/layout/carousel.js +0 -74
  45. package/external/blessed-contrib/lib/server-utils.js +0 -73
  46. package/external/blessed-contrib/lib/utils.js +0 -73
  47. package/external/blessed-contrib/lib/widget/canvas.js +0 -51
  48. package/external/blessed-contrib/lib/widget/charts/stacked-bar.js +0 -218
  49. package/external/blessed-contrib/lib/widget/donut.js +0 -149
  50. package/external/blessed-contrib/lib/widget/gauge-list.js +0 -106
  51. package/external/blessed-contrib/lib/widget/gauge.js +0 -125
  52. package/external/blessed-contrib/lib/widget/lcd.js +0 -451
  53. package/external/blessed-contrib/lib/widget/log.js +0 -33
  54. package/external/blessed-contrib/lib/widget/map.js +0 -86
  55. package/external/blessed-contrib/lib/widget/markdown.js +0 -64
  56. package/external/blessed-contrib/lib/widget/picture.js +0 -66
  57. package/external/blessed-contrib/lib/widget/sparkline.js +0 -58
  58. package/external/blessed-contrib/lib/widget/tree.js +0 -167
@@ -11239,7 +11239,9 @@ function requireAst() {
11239
11239
  }
11240
11240
  // XXX abstract out this map method
11241
11241
  let bodyDotAllowed =
11242
- !repeated || allowDot || dot || false ? '' : this.#partsToRegExp(true)
11242
+ !repeated || allowDot || dot || !startNoDot
11243
+ ? ''
11244
+ : this.#partsToRegExp(true)
11243
11245
  if (bodyDotAllowed === body) {
11244
11246
  bodyDotAllowed = ''
11245
11247
  }
@@ -12616,7 +12618,7 @@ function requireCommonjs$1() {
12616
12618
  const IFSOCK = 0b1100
12617
12619
  const IFMT = 0b1111
12618
12620
  // mask to unset low 4 bits
12619
- const IFMT_UNKNOWN = -16
12621
+ const IFMT_UNKNOWN = ~IFMT
12620
12622
  // set after successfully calling readdir() and getting entries.
12621
12623
  const READDIR_CALLED = 0b0000_0001_0000
12622
12624
  // set after a successful lstat()
@@ -12944,7 +12946,7 @@ function requireCommonjs$1() {
12944
12946
  provisional: 0
12945
12947
  })
12946
12948
  this.#children.set(this, children)
12947
- this.#type &= -17
12949
+ this.#type &= ~READDIR_CALLED
12948
12950
  return children
12949
12951
  }
12950
12952
  /**
@@ -4582,7 +4582,9 @@ function requireAst() {
4582
4582
  }
4583
4583
  // XXX abstract out this map method
4584
4584
  let bodyDotAllowed =
4585
- !repeated || allowDot || dot || false ? '' : this.#partsToRegExp(true)
4585
+ !repeated || allowDot || dot || !startNoDot
4586
+ ? ''
4587
+ : this.#partsToRegExp(true)
4586
4588
  if (bodyDotAllowed === body) {
4587
4589
  bodyDotAllowed = ''
4588
4590
  }
@@ -7099,7 +7101,7 @@ function requireCommonjs$4() {
7099
7101
  const IFSOCK = 0b1100
7100
7102
  const IFMT = 0b1111
7101
7103
  // mask to unset low 4 bits
7102
- const IFMT_UNKNOWN = -16
7104
+ const IFMT_UNKNOWN = ~IFMT
7103
7105
  // set after successfully calling readdir() and getting entries.
7104
7106
  const READDIR_CALLED = 0b0000_0001_0000
7105
7107
  // set after a successful lstat()
@@ -7427,7 +7429,7 @@ function requireCommonjs$4() {
7427
7429
  provisional: 0
7428
7430
  })
7429
7431
  this.#children.set(this, children)
7430
- this.#type &= -17
7432
+ this.#type &= ~READDIR_CALLED
7431
7433
  return children
7432
7434
  }
7433
7435
  /**
@@ -14400,7 +14402,7 @@ function requireLib$I() {
14400
14402
  if (!name.length) {
14401
14403
  errors.push('name length must be greater than zero')
14402
14404
  }
14403
- if (name.match(/^\./)) {
14405
+ if (name.startsWith('.')) {
14404
14406
  errors.push('name cannot start with a period')
14405
14407
  }
14406
14408
  if (name.match(/^_/)) {
@@ -14440,6 +14442,9 @@ function requireLib$I() {
14440
14442
  if (nameMatch) {
14441
14443
  const user = nameMatch[1]
14442
14444
  const pkg = nameMatch[2]
14445
+ if (pkg.startsWith('.')) {
14446
+ errors.push('name cannot start with a period')
14447
+ }
14443
14448
  if (
14444
14449
  encodeURIComponent(user) === user &&
14445
14450
  encodeURIComponent(pkg) === pkg
@@ -25066,7 +25066,9 @@ function requireAst() {
25066
25066
  }
25067
25067
  // XXX abstract out this map method
25068
25068
  let bodyDotAllowed =
25069
- !repeated || allowDot || dot || false ? '' : this.#partsToRegExp(true)
25069
+ !repeated || allowDot || dot || !startNoDot
25070
+ ? ''
25071
+ : this.#partsToRegExp(true)
25070
25072
  if (bodyDotAllowed === body) {
25071
25073
  bodyDotAllowed = ''
25072
25074
  }
@@ -26443,7 +26445,7 @@ function requireCommonjs$1() {
26443
26445
  const IFSOCK = 0b1100
26444
26446
  const IFMT = 0b1111
26445
26447
  // mask to unset low 4 bits
26446
- const IFMT_UNKNOWN = -16
26448
+ const IFMT_UNKNOWN = ~IFMT
26447
26449
  // set after successfully calling readdir() and getting entries.
26448
26450
  const READDIR_CALLED = 0b0000_0001_0000
26449
26451
  // set after a successful lstat()
@@ -26771,7 +26773,7 @@ function requireCommonjs$1() {
26771
26773
  provisional: 0
26772
26774
  })
26773
26775
  this.#children.set(this, children)
26774
- this.#type &= -17
26776
+ this.#type &= ~READDIR_CALLED
26775
26777
  return children
26776
26778
  }
26777
26779
  /**
@@ -4988,7 +4988,7 @@ function requireLib$1() {
4988
4988
  if (!name.length) {
4989
4989
  errors.push('name length must be greater than zero')
4990
4990
  }
4991
- if (name.match(/^\./)) {
4991
+ if (name.startsWith('.')) {
4992
4992
  errors.push('name cannot start with a period')
4993
4993
  }
4994
4994
  if (name.match(/^_/)) {
@@ -5028,6 +5028,9 @@ function requireLib$1() {
5028
5028
  if (nameMatch) {
5029
5029
  const user = nameMatch[1]
5030
5030
  const pkg = nameMatch[2]
5031
+ if (pkg.startsWith('.')) {
5032
+ errors.push('name cannot start with a period')
5033
+ }
5031
5034
  if (
5032
5035
  encodeURIComponent(user) === user &&
5033
5036
  encodeURIComponent(pkg) === pkg
@@ -4580,7 +4580,9 @@ function requireAst() {
4580
4580
  }
4581
4581
  // XXX abstract out this map method
4582
4582
  let bodyDotAllowed =
4583
- !repeated || allowDot || dot || false ? '' : this.#partsToRegExp(true)
4583
+ !repeated || allowDot || dot || !startNoDot
4584
+ ? ''
4585
+ : this.#partsToRegExp(true)
4584
4586
  if (bodyDotAllowed === body) {
4585
4587
  bodyDotAllowed = ''
4586
4588
  }
@@ -7097,7 +7099,7 @@ function requireCommonjs$2() {
7097
7099
  const IFSOCK = 0b1100
7098
7100
  const IFMT = 0b1111
7099
7101
  // mask to unset low 4 bits
7100
- const IFMT_UNKNOWN = -16
7102
+ const IFMT_UNKNOWN = ~IFMT
7101
7103
  // set after successfully calling readdir() and getting entries.
7102
7104
  const READDIR_CALLED = 0b0000_0001_0000
7103
7105
  // set after a successful lstat()
@@ -7425,7 +7427,7 @@ function requireCommonjs$2() {
7425
7427
  provisional: 0
7426
7428
  })
7427
7429
  this.#children.set(this, children)
7428
- this.#type &= -17
7430
+ this.#type &= ~READDIR_CALLED
7429
7431
  return children
7430
7432
  }
7431
7433
  /**
@@ -14398,7 +14400,7 @@ function requireLib$o() {
14398
14400
  if (!name.length) {
14399
14401
  errors.push('name length must be greater than zero')
14400
14402
  }
14401
- if (name.match(/^\./)) {
14403
+ if (name.startsWith('.')) {
14402
14404
  errors.push('name cannot start with a period')
14403
14405
  }
14404
14406
  if (name.match(/^_/)) {
@@ -14438,6 +14440,9 @@ function requireLib$o() {
14438
14440
  if (nameMatch) {
14439
14441
  const user = nameMatch[1]
14440
14442
  const pkg = nameMatch[2]
14443
+ if (pkg.startsWith('.')) {
14444
+ errors.push('name cannot start with a period')
14445
+ }
14441
14446
  if (
14442
14447
  encodeURIComponent(user) === user &&
14443
14448
  encodeURIComponent(pkg) === pkg
@@ -30,7 +30,7 @@ function requireLib() {
30
30
  if (!name.length) {
31
31
  errors.push('name length must be greater than zero')
32
32
  }
33
- if (name.match(/^\./)) {
33
+ if (name.startsWith('.')) {
34
34
  errors.push('name cannot start with a period')
35
35
  }
36
36
  if (name.match(/^_/)) {
@@ -70,6 +70,9 @@ function requireLib() {
70
70
  if (nameMatch) {
71
71
  const user = nameMatch[1]
72
72
  const pkg = nameMatch[2]
73
+ if (pkg.startsWith('.')) {
74
+ errors.push('name cannot start with a period')
75
+ }
73
76
  if (
74
77
  encodeURIComponent(user) === user &&
75
78
  encodeURIComponent(pkg) === pkg
@@ -1843,7 +1843,7 @@
1843
1843
  }
1844
1844
  ],
1845
1845
  [
1846
- "pkg:npm/%40socketregistry/yocto-spinner@1.0.17",
1846
+ "pkg:npm/%40socketregistry/yocto-spinner@1.0.18",
1847
1847
  {
1848
1848
  "categories": ["cleanup"],
1849
1849
  "engines": {
@@ -1853,11 +1853,11 @@
1853
1853
  "license": "MIT",
1854
1854
  "name": "@socketregistry/yocto-spinner",
1855
1855
  "package": "yocto-spinner",
1856
- "version": "1.0.17"
1856
+ "version": "1.0.18"
1857
1857
  }
1858
1858
  ],
1859
1859
  [
1860
- "pkg:npm/shell-quote@1.8.2",
1860
+ "pkg:npm/shell-quote@1.8.3",
1861
1861
  {
1862
1862
  "categories": ["tuneup"],
1863
1863
  "engines": {
@@ -1867,7 +1867,7 @@
1867
1867
  "license": "MIT",
1868
1868
  "name": "shell-quote",
1869
1869
  "package": "shell-quote",
1870
- "version": "1.8.2"
1870
+ "version": "1.8.3"
1871
1871
  }
1872
1872
  ]
1873
1873
  ]
@@ -1,41 +1,409 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('../utils');
3
+ var utils = {};
4
4
 
5
- var widgetSpacing = 0;
5
+ var x256 = {exports: {}};
6
6
 
7
- function Grid(options) {
8
- if (!options.screen) throw 'Error: A screen property must be specified in the grid options.\r\n' +
9
- 'Note: Release 2.0.0 has breaking changes. Please refer to the README or to https://github.com/yaronn/blessed-contrib/issues/39';
10
- this.options = options;
11
- this.options.dashboardMargin = this.options.dashboardMargin || 0;
12
- this.cellWidth = ((100 - this.options.dashboardMargin*2) / this.options.cols);
13
- this.cellHeight = ((100 - this.options.dashboardMargin*2) / this.options.rows);
7
+ var require$$0 = [
8
+ "000000",
9
+ "800000",
10
+ "008000",
11
+ "808000",
12
+ "000080",
13
+ "800080",
14
+ "008080",
15
+ "c0c0c0",
16
+ "808080",
17
+ "ff0000",
18
+ "00ff00",
19
+ "ffff00",
20
+ "0000ff",
21
+ "ff00ff",
22
+ "00ffff",
23
+ "ffffff",
24
+ "000000",
25
+ "00005f",
26
+ "000087",
27
+ "0000af",
28
+ "0000d7",
29
+ "0000ff",
30
+ "005f00",
31
+ "005f5f",
32
+ "005f87",
33
+ "005faf",
34
+ "005fd7",
35
+ "005fff",
36
+ "008700",
37
+ "00875f",
38
+ "008787",
39
+ "0087af",
40
+ "0087d7",
41
+ "0087ff",
42
+ "00af00",
43
+ "00af5f",
44
+ "00af87",
45
+ "00afaf",
46
+ "00afd7",
47
+ "00afff",
48
+ "00d700",
49
+ "00d75f",
50
+ "00d787",
51
+ "00d7af",
52
+ "00d7d7",
53
+ "00d7ff",
54
+ "00ff00",
55
+ "00ff5f",
56
+ "00ff87",
57
+ "00ffaf",
58
+ "00ffd7",
59
+ "00ffff",
60
+ "5f0000",
61
+ "5f005f",
62
+ "5f0087",
63
+ "5f00af",
64
+ "5f00d7",
65
+ "5f00ff",
66
+ "5f5f00",
67
+ "5f5f5f",
68
+ "5f5f87",
69
+ "5f5faf",
70
+ "5f5fd7",
71
+ "5f5fff",
72
+ "5f8700",
73
+ "5f875f",
74
+ "5f8787",
75
+ "5f87af",
76
+ "5f87d7",
77
+ "5f87ff",
78
+ "5faf00",
79
+ "5faf5f",
80
+ "5faf87",
81
+ "5fafaf",
82
+ "5fafd7",
83
+ "5fafff",
84
+ "5fd700",
85
+ "5fd75f",
86
+ "5fd787",
87
+ "5fd7af",
88
+ "5fd7d7",
89
+ "5fd7ff",
90
+ "5fff00",
91
+ "5fff5f",
92
+ "5fff87",
93
+ "5fffaf",
94
+ "5fffd7",
95
+ "5fffff",
96
+ "870000",
97
+ "87005f",
98
+ "870087",
99
+ "8700af",
100
+ "8700d7",
101
+ "8700ff",
102
+ "875f00",
103
+ "875f5f",
104
+ "875f87",
105
+ "875faf",
106
+ "875fd7",
107
+ "875fff",
108
+ "878700",
109
+ "87875f",
110
+ "878787",
111
+ "8787af",
112
+ "8787d7",
113
+ "8787ff",
114
+ "87af00",
115
+ "87af5f",
116
+ "87af87",
117
+ "87afaf",
118
+ "87afd7",
119
+ "87afff",
120
+ "87d700",
121
+ "87d75f",
122
+ "87d787",
123
+ "87d7af",
124
+ "87d7d7",
125
+ "87d7ff",
126
+ "87ff00",
127
+ "87ff5f",
128
+ "87ff87",
129
+ "87ffaf",
130
+ "87ffd7",
131
+ "87ffff",
132
+ "af0000",
133
+ "af005f",
134
+ "af0087",
135
+ "af00af",
136
+ "af00d7",
137
+ "af00ff",
138
+ "af5f00",
139
+ "af5f5f",
140
+ "af5f87",
141
+ "af5faf",
142
+ "af5fd7",
143
+ "af5fff",
144
+ "af8700",
145
+ "af875f",
146
+ "af8787",
147
+ "af87af",
148
+ "af87d7",
149
+ "af87ff",
150
+ "afaf00",
151
+ "afaf5f",
152
+ "afaf87",
153
+ "afafaf",
154
+ "afafd7",
155
+ "afafff",
156
+ "afd700",
157
+ "afd75f",
158
+ "afd787",
159
+ "afd7af",
160
+ "afd7d7",
161
+ "afd7ff",
162
+ "afff00",
163
+ "afff5f",
164
+ "afff87",
165
+ "afffaf",
166
+ "afffd7",
167
+ "afffff",
168
+ "d70000",
169
+ "d7005f",
170
+ "d70087",
171
+ "d700af",
172
+ "d700d7",
173
+ "d700ff",
174
+ "d75f00",
175
+ "d75f5f",
176
+ "d75f87",
177
+ "d75faf",
178
+ "d75fd7",
179
+ "d75fff",
180
+ "d78700",
181
+ "d7875f",
182
+ "d78787",
183
+ "d787af",
184
+ "d787d7",
185
+ "d787ff",
186
+ "d7af00",
187
+ "d7af5f",
188
+ "d7af87",
189
+ "d7afaf",
190
+ "d7afd7",
191
+ "d7afff",
192
+ "d7d700",
193
+ "d7d75f",
194
+ "d7d787",
195
+ "d7d7af",
196
+ "d7d7d7",
197
+ "d7d7ff",
198
+ "d7ff00",
199
+ "d7ff5f",
200
+ "d7ff87",
201
+ "d7ffaf",
202
+ "d7ffd7",
203
+ "d7ffff",
204
+ "ff0000",
205
+ "ff005f",
206
+ "ff0087",
207
+ "ff00af",
208
+ "ff00d7",
209
+ "ff00ff",
210
+ "ff5f00",
211
+ "ff5f5f",
212
+ "ff5f87",
213
+ "ff5faf",
214
+ "ff5fd7",
215
+ "ff5fff",
216
+ "ff8700",
217
+ "ff875f",
218
+ "ff8787",
219
+ "ff87af",
220
+ "ff87d7",
221
+ "ff87ff",
222
+ "ffaf00",
223
+ "ffaf5f",
224
+ "ffaf87",
225
+ "ffafaf",
226
+ "ffafd7",
227
+ "ffafff",
228
+ "ffd700",
229
+ "ffd75f",
230
+ "ffd787",
231
+ "ffd7af",
232
+ "ffd7d7",
233
+ "ffd7ff",
234
+ "ffff00",
235
+ "ffff5f",
236
+ "ffff87",
237
+ "ffffaf",
238
+ "ffffd7",
239
+ "ffffff",
240
+ "080808",
241
+ "121212",
242
+ "1c1c1c",
243
+ "262626",
244
+ "303030",
245
+ "3a3a3a",
246
+ "444444",
247
+ "4e4e4e",
248
+ "585858",
249
+ "606060",
250
+ "666666",
251
+ "767676",
252
+ "808080",
253
+ "8a8a8a",
254
+ "949494",
255
+ "9e9e9e",
256
+ "a8a8a8",
257
+ "b2b2b2",
258
+ "bcbcbc",
259
+ "c6c6c6",
260
+ "d0d0d0",
261
+ "dadada",
262
+ "e4e4e4",
263
+ "eeeeee"
264
+ ];
265
+
266
+ var hasRequiredX256;
267
+ function requireX256() {
268
+ if (hasRequiredX256) return x256.exports;
269
+ hasRequiredX256 = 1;
270
+ // colors scraped from
271
+ // http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
272
+ // %s/ *\d\+ \+#\([^ ]\+\)/\1\r/g
273
+
274
+ var colors = require$$0.map(function (hex) {
275
+ var r = parseInt(hex.slice(0, 2), 16);
276
+ var g = parseInt(hex.slice(2, 4), 16);
277
+ var b = parseInt(hex.slice(4, 6), 16);
278
+ return [r, g, b];
279
+ });
280
+ var x256$1 = x256.exports = function (r, g, b) {
281
+ var c = Array.isArray(r) ? r : [r, g, b];
282
+ var best = null;
283
+ for (var i = 0; i < colors.length; i++) {
284
+ var d = distance(colors[i], c);
285
+ if (!best || d <= best.distance) {
286
+ best = {
287
+ distance: d,
288
+ index: i
289
+ };
290
+ }
291
+ }
292
+ return best.index;
293
+ };
294
+ x256$1.colors = colors;
295
+ function distance(a, b) {
296
+ return Math.sqrt(Math.pow(a[0] - b[0], 2) + Math.pow(a[1] - b[1], 2) + Math.pow(a[2] - b[2], 2));
297
+ }
298
+ return x256.exports;
14
299
  }
15
300
 
16
- Grid.prototype.set = function(row, col, rowSpan, colSpan, obj, opts) {
301
+ var hasRequiredUtils;
302
+ function requireUtils() {
303
+ if (hasRequiredUtils) return utils;
304
+ hasRequiredUtils = 1;
305
+ var x256 = requireX256();
306
+
307
+ /*
308
+ * Recursively merge properties of two objects
309
+ */
310
+ function MergeRecursive(obj1, obj2) {
311
+ if (obj1 == null) {
312
+ return obj2;
313
+ }
314
+ if (obj2 == null) {
315
+ return obj1;
316
+ }
317
+ for (var p in obj2) {
318
+ try {
319
+ // property in destination object set; update its value
320
+ if (obj2[p].constructor == Object) {
321
+ obj1[p] = MergeRecursive(obj1[p], obj2[p]);
322
+ } else {
323
+ obj1[p] = obj2[p];
324
+ }
325
+ } catch (e) {
326
+ // property in destination object not set; create it and set its value
327
+ obj1[p] = obj2[p];
328
+ }
329
+ }
330
+ return obj1;
331
+ }
332
+ function getTypeName(thing) {
333
+ if (thing === null) return '[object Null]'; // special case
334
+ return Object.prototype.toString.call(thing);
335
+ }
336
+ function abbreviateNumber(value) {
337
+ var newValue = value;
338
+ if (value >= 1000) {
339
+ var suffixes = ['', 'k', 'm', 'b', 't'];
340
+ var suffixNum = Math.floor(('' + value).length / 3);
341
+ var shortValue = '';
342
+ for (var precision = 2; precision >= 1; precision--) {
343
+ shortValue = parseFloat((suffixNum != 0 ? value / Math.pow(1000, suffixNum) : value).toPrecision(precision));
344
+ var dotLessShortValue = (shortValue + '').replace(/[^a-zA-Z 0-9]+/g, '');
345
+ if (dotLessShortValue.length <= 2) {
346
+ break;
347
+ }
348
+ }
349
+ newValue = shortValue + suffixes[suffixNum];
350
+ }
351
+ return newValue;
352
+ }
353
+ function getColorCode(color) {
354
+ if (Array.isArray(color) && color.length == 3) {
355
+ return x256(color[0], color[1], color[2]);
356
+ } else {
357
+ return color;
358
+ }
359
+ }
360
+ utils.MergeRecursive = MergeRecursive;
361
+ utils.getTypeName = getTypeName;
362
+ utils.abbreviateNumber = abbreviateNumber;
363
+ utils.getColorCode = getColorCode;
364
+ return utils;
365
+ }
17
366
 
18
- if (obj instanceof Grid) {
19
- throw 'Error: A Grid is not allowed to be nested inside another grid.\r\n' +
20
- 'Note: Release 2.0.0 has breaking changes. Please refer to the README or to https://github.com/yaronn/blessed-contrib/issues/39';
367
+ var grid;
368
+ var hasRequiredGrid;
369
+ function requireGrid() {
370
+ if (hasRequiredGrid) return grid;
371
+ hasRequiredGrid = 1;
372
+ var utils = requireUtils();
373
+ var widgetSpacing = 0;
374
+ function Grid(options) {
375
+ if (!options.screen) throw 'Error: A screen property must be specified in the grid options.\r\n' + 'Note: Release 2.0.0 has breaking changes. Please refer to the README or to https://github.com/yaronn/blessed-contrib/issues/39';
376
+ this.options = options;
377
+ this.options.dashboardMargin = this.options.dashboardMargin || 0;
378
+ this.cellWidth = (100 - this.options.dashboardMargin * 2) / this.options.cols;
379
+ this.cellHeight = (100 - this.options.dashboardMargin * 2) / this.options.rows;
21
380
  }
381
+ Grid.prototype.set = function (row, col, rowSpan, colSpan, obj, opts) {
382
+ if (obj instanceof Grid) {
383
+ throw 'Error: A Grid is not allowed to be nested inside another grid.\r\n' + 'Note: Release 2.0.0 has breaking changes. Please refer to the README or to https://github.com/yaronn/blessed-contrib/issues/39';
384
+ }
385
+ var top = row * this.cellHeight + this.options.dashboardMargin;
386
+ var left = col * this.cellWidth + this.options.dashboardMargin;
387
+
388
+ //var options = JSON.parse(JSON.stringify(opts));
389
+ var options = {};
390
+ options = utils.MergeRecursive(options, opts);
391
+ options.top = top + '%';
392
+ options.left = left + '%';
393
+ options.width = this.cellWidth * colSpan - widgetSpacing + '%';
394
+ options.height = this.cellHeight * rowSpan - widgetSpacing + '%';
395
+ if (!this.options.hideBorder) options.border = {
396
+ type: 'line',
397
+ fg: this.options.color || 'cyan'
398
+ };
399
+ var instance = obj(options);
400
+ this.options.screen.append(instance);
401
+ return instance;
402
+ };
403
+ grid = Grid;
404
+ return grid;
405
+ }
406
+
407
+ var gridExports = requireGrid();
22
408
 
23
- var top = row * this.cellHeight + this.options.dashboardMargin;
24
- var left = col * this.cellWidth + this.options.dashboardMargin;
25
-
26
- //var options = JSON.parse(JSON.stringify(opts));
27
- var options = {};
28
- options = utils.MergeRecursive(options, opts);
29
- options.top = top + '%';
30
- options.left = left + '%';
31
- options.width = (this.cellWidth * colSpan - widgetSpacing) + '%';
32
- options.height = (this.cellHeight * rowSpan - widgetSpacing) + '%';
33
- if (!this.options.hideBorder)
34
- options.border = {type: 'line', fg: this.options.color || 'cyan'};
35
-
36
- var instance = obj(options);
37
- this.options.screen.append(instance);
38
- return instance;
39
- };
40
-
41
- module.exports = Grid;
409
+ module.exports = gridExports;