@socketsecurity/cli-with-sentry 0.15.59 → 0.15.61

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.
@@ -196,18 +196,19 @@ function requireYoctoSpinner() {
196
196
  return _stripVTControlCharacters(string)
197
197
  }
198
198
  class YoctoSpinner {
199
- #frames
200
- #interval
201
- #currentFrame = -1
202
- #timer
203
- #text
204
- #stream
205
199
  #color
206
- #lines = 0
200
+ #currentFrame = -1
207
201
  #exitHandlerBound
202
+ #frames
203
+ #indention = ''
204
+ #interval
208
205
  #isInteractive
209
- #lastSpinnerFrameTime = 0
210
206
  #isSpinning = false
207
+ #lastSpinnerFrameTime = 0
208
+ #lines = 0
209
+ #stream
210
+ #text
211
+ #timer
211
212
  constructor(options = {}) {
212
213
  const opts = {
213
214
  __proto__: null,
@@ -223,58 +224,87 @@ function requireYoctoSpinner() {
223
224
  this.#isInteractive = !!stream.isTTY && isProcessInteractive()
224
225
  this.#exitHandlerBound = this.#exitHandler.bind(this)
225
226
  }
226
- start(text) {
227
- if (text) {
228
- this.#text = text
229
- }
227
+ #exitHandler(signal) {
230
228
  if (this.isSpinning) {
231
- return this
229
+ this.stop()
232
230
  }
233
- this.#isSpinning = true
234
- this.#hideCursor()
235
- this.#render()
236
- this.#subscribeToProcessEvents()
237
231
 
238
- // Only start the timer in interactive mode
232
+ // SIGINT: 128 + 2
233
+ // SIGTERM: 128 + 15
234
+ const exitCode =
235
+ signal === 'SIGINT' ? 130 : signal === 'SIGTERM' ? 143 : 1
236
+ // eslint-disable-next-line n/no-process-exit
237
+ process.exit(exitCode)
238
+ }
239
+ #hideCursor() {
239
240
  if (this.#isInteractive) {
240
- this.#timer = setInterval(() => {
241
- this.#render()
242
- }, this.#interval)
241
+ this.#write('\u001B[?25l')
243
242
  }
244
- return this
245
243
  }
246
- stop(finalText) {
247
- if (!this.isSpinning) {
248
- return this
244
+ #lineCount(text) {
245
+ const width = this.#stream.columns ?? defaultTtyColumns
246
+ const lines = stripVTControlCharacters(text).split('\n')
247
+ let lineCount = 0
248
+ for (const line of lines) {
249
+ lineCount += Math.max(1, Math.ceil(line.length / width))
249
250
  }
250
- this.#isSpinning = false
251
- if (this.#timer) {
252
- clearInterval(this.#timer)
253
- this.#timer = undefined
251
+ return lineCount
252
+ }
253
+ #render() {
254
+ // Ensure we only update the spinner frame at the wanted interval,
255
+ // even if the frame method is called more often.
256
+ const now = Date.now()
257
+ if (
258
+ this.#currentFrame === -1 ||
259
+ now - this.#lastSpinnerFrameTime >= this.#interval
260
+ ) {
261
+ this.#currentFrame = ++this.#currentFrame % this.#frames.length
262
+ this.#lastSpinnerFrameTime = now
263
+ }
264
+ const colors = getYoctocolors()
265
+ const applyColor = colors[this.#color] ?? colors.cyan
266
+ const frame = this.#frames[this.#currentFrame]
267
+ let string = `${applyColor(frame)} ${this.#text}`
268
+ if (string) {
269
+ if (this.#indention.length) {
270
+ string = `${this.#indention}${string}`
271
+ }
272
+ if (!this.#isInteractive) {
273
+ string += '\n'
274
+ }
254
275
  }
255
- this.#showCursor()
256
276
  this.clear()
257
- this.#unsubscribeFromProcessEvents()
258
- if (finalText) {
259
- this.#stream.write(`${finalText}\n`)
277
+ this.#write(string)
278
+ if (this.#isInteractive) {
279
+ this.#lines = this.#lineCount(string)
260
280
  }
261
- return this
281
+ }
282
+ #showCursor() {
283
+ if (this.#isInteractive) {
284
+ this.#write('\u001B[?25h')
285
+ }
286
+ }
287
+ #subscribeToProcessEvents() {
288
+ process.once('SIGINT', this.#exitHandlerBound)
289
+ process.once('SIGTERM', this.#exitHandlerBound)
262
290
  }
263
291
  #symbolStop(symbolType, text) {
264
292
  const symbols = getLogSymbols()
265
293
  return this.stop(`${symbols[symbolType]} ${text ?? this.#text}`)
266
294
  }
267
- success(text) {
268
- return this.#symbolStop('success', text)
295
+ #write(text) {
296
+ this.#stream.write(text)
269
297
  }
270
- error(text) {
271
- return this.#symbolStop('error', text)
298
+ #unsubscribeFromProcessEvents() {
299
+ process.off('SIGINT', this.#exitHandlerBound)
300
+ process.off('SIGTERM', this.#exitHandlerBound)
272
301
  }
273
- warning(text) {
274
- return this.#symbolStop('warning', text)
302
+ get color() {
303
+ return this.#color
275
304
  }
276
- info(text) {
277
- return this.#symbolStop('info', text)
305
+ set color(value) {
306
+ this.#color = value
307
+ this.#render()
278
308
  }
279
309
  get isSpinning() {
280
310
  return this.#isSpinning
@@ -286,13 +316,6 @@ function requireYoctoSpinner() {
286
316
  this.#text = value ?? ''
287
317
  this.#render()
288
318
  }
289
- get color() {
290
- return this.#color
291
- }
292
- set color(value) {
293
- this.#color = value
294
- this.#render()
295
- }
296
319
  clear() {
297
320
  if (!this.#isInteractive) {
298
321
  return this
@@ -307,71 +330,66 @@ function requireYoctoSpinner() {
307
330
  this.#lines = 0
308
331
  return this
309
332
  }
310
- #render() {
311
- // Ensure we only update the spinner frame at the wanted interval,
312
- // even if the frame method is called more often.
313
- const now = Date.now()
314
- if (
315
- this.#currentFrame === -1 ||
316
- now - this.#lastSpinnerFrameTime >= this.#interval
317
- ) {
318
- this.#currentFrame = ++this.#currentFrame % this.#frames.length
319
- this.#lastSpinnerFrameTime = now
333
+ dedent(spaces = 2) {
334
+ this.#indention = this.#indention.slice(0, -spaces)
335
+ return this
336
+ }
337
+ error(text) {
338
+ return this.#symbolStop('error', text)
339
+ }
340
+ indent(spaces = 2) {
341
+ this.#indention += ' '.repeat(spaces)
342
+ return this
343
+ }
344
+ info(text) {
345
+ return this.#symbolStop('info', text)
346
+ }
347
+ resetIndent() {
348
+ this.#indention = ''
349
+ return this
350
+ }
351
+ start(text) {
352
+ if (text) {
353
+ this.#text = text
320
354
  }
321
- const colors = getYoctocolors()
322
- const applyColor = colors[this.#color] ?? colors.cyan
323
- const frame = this.#frames[this.#currentFrame]
324
- let string = `${applyColor(frame)} ${this.#text}`
325
- if (!this.#isInteractive) {
326
- string += '\n'
355
+ if (this.isSpinning) {
356
+ return this
327
357
  }
328
- this.clear()
329
- this.#write(string)
358
+ this.#isSpinning = true
359
+ this.#hideCursor()
360
+ this.#render()
361
+ this.#subscribeToProcessEvents()
362
+
363
+ // Only start the timer in interactive mode
330
364
  if (this.#isInteractive) {
331
- this.#lines = this.#lineCount(string)
365
+ this.#timer = setInterval(() => {
366
+ this.#render()
367
+ }, this.#interval)
332
368
  }
369
+ return this
333
370
  }
334
- #write(text) {
335
- this.#stream.write(text)
336
- }
337
- #lineCount(text) {
338
- const width = this.#stream.columns ?? defaultTtyColumns
339
- const lines = stripVTControlCharacters(text).split('\n')
340
- let lineCount = 0
341
- for (const line of lines) {
342
- lineCount += Math.max(1, Math.ceil(line.length / width))
371
+ stop(finalText) {
372
+ if (!this.isSpinning) {
373
+ return this
343
374
  }
344
- return lineCount
345
- }
346
- #hideCursor() {
347
- if (this.#isInteractive) {
348
- this.#write('\u001B[?25l')
375
+ this.#isSpinning = false
376
+ if (this.#timer) {
377
+ clearInterval(this.#timer)
378
+ this.#timer = undefined
349
379
  }
350
- }
351
- #showCursor() {
352
- if (this.#isInteractive) {
353
- this.#write('\u001B[?25h')
380
+ this.#showCursor()
381
+ this.clear()
382
+ this.#unsubscribeFromProcessEvents()
383
+ if (finalText) {
384
+ this.#write(`${this.#indention}${finalText}\n`)
354
385
  }
386
+ return this
355
387
  }
356
- #subscribeToProcessEvents() {
357
- process.once('SIGINT', this.#exitHandlerBound)
358
- process.once('SIGTERM', this.#exitHandlerBound)
359
- }
360
- #unsubscribeFromProcessEvents() {
361
- process.off('SIGINT', this.#exitHandlerBound)
362
- process.off('SIGTERM', this.#exitHandlerBound)
388
+ success(text) {
389
+ return this.#symbolStop('success', text)
363
390
  }
364
- #exitHandler(signal) {
365
- if (this.isSpinning) {
366
- this.stop()
367
- }
368
-
369
- // SIGINT: 128 + 2
370
- // SIGTERM: 128 + 15
371
- const exitCode =
372
- signal === 'SIGINT' ? 130 : signal === 'SIGTERM' ? 143 : 1
373
- // eslint-disable-next-line n/no-process-exit
374
- process.exit(exitCode)
391
+ warning(text) {
392
+ return this.#symbolStop('warning', text)
375
393
  }
376
394
  }
377
395
  yoctoSpinner = function yoctoSpinner(options) {
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
3
  const maintainedNodeVersions = /*@__PURE__*/ require('./maintained-node-versions')
4
+ const semver = /*@__PURE__*/ require('../../external/semver')
4
5
 
5
- module.exports = `>=${maintainedNodeVersions.last}`
6
+ module.exports = `>=${semver.parse(maintainedNodeVersions.last).major}`