@socketsecurity/lib 3.2.8 → 3.3.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.
- package/CHANGELOG.md +22 -0
- package/README.md +19 -240
- package/dist/agent.js +10 -10
- package/dist/bin.js +4 -4
- package/dist/colors.d.ts +37 -0
- package/dist/colors.js +58 -0
- package/dist/constants/node.js +1 -1
- package/dist/constants/packages.js +9 -9
- package/dist/constants/process.js +1 -1
- package/dist/constants/socket.d.ts +1 -0
- package/dist/constants/socket.js +3 -0
- package/dist/debug.js +3 -3
- package/dist/dlx-binary.js +4 -4
- package/dist/effects/text-shimmer.js +1 -1
- package/dist/env/ci.js +2 -2
- package/dist/env/debug.js +1 -1
- package/dist/env/github.js +1 -1
- package/dist/env/home.js +1 -1
- package/dist/env/locale.js +1 -1
- package/dist/env/node-auth-token.js +1 -1
- package/dist/env/node-env.js +1 -1
- package/dist/env/npm.js +1 -1
- package/dist/env/package-manager.js +1 -1
- package/dist/env/path.js +1 -1
- package/dist/env/pre-commit.js +2 -2
- package/dist/env/rewire.d.ts +5 -5
- package/dist/env/rewire.js +22 -14
- package/dist/env/shell.js +1 -1
- package/dist/env/socket-cli-shadow.js +2 -2
- package/dist/env/socket-cli.js +2 -2
- package/dist/env/socket.js +2 -2
- package/dist/env/temp-dir.js +1 -1
- package/dist/env/term.js +1 -1
- package/dist/env/test.js +3 -3
- package/dist/env/windows.js +1 -1
- package/dist/env/xdg.js +1 -1
- package/dist/external/@inquirer/checkbox.js +3361 -3
- package/dist/external/@inquirer/confirm.js +1 -0
- package/dist/external/@inquirer/input.js +1 -0
- package/dist/external/@inquirer/password.js +1 -0
- package/dist/external/@inquirer/search.js +1 -0
- package/dist/external/@inquirer/select.js +1 -0
- package/dist/fs.js +4 -6
- package/dist/git.js +1 -1
- package/dist/github.js +2 -2
- package/dist/globs.js +3 -4
- package/dist/lifecycle-script-names.d.ts +8 -2
- package/dist/lifecycle-script-names.js +9 -4
- package/dist/logger.d.ts +106 -81
- package/dist/logger.js +234 -205
- package/dist/maintained-node-versions.d.ts +2 -2
- package/dist/maintained-node-versions.js +9 -4
- package/dist/objects.js +1 -1
- package/dist/package-default-node-range.d.ts +2 -2
- package/dist/package-default-node-range.js +10 -5
- package/dist/package-default-socket-categories.d.ts +6 -2
- package/dist/package-default-socket-categories.js +9 -4
- package/dist/package-extensions.d.ts +2 -2
- package/dist/package-extensions.js +9 -4
- package/dist/packages/exports.js +1 -1
- package/dist/packages/isolation.js +2 -2
- package/dist/packages/licenses.js +2 -2
- package/dist/packages/manifest.js +3 -3
- package/dist/packages/normalize.js +1 -1
- package/dist/packages/operations.js +5 -5
- package/dist/packages/provenance.js +1 -1
- package/dist/path.d.ts +11 -0
- package/dist/path.js +1 -1
- package/dist/paths.js +14 -14
- package/dist/promises.js +2 -2
- package/dist/spawn.js +1 -1
- package/dist/spinner.d.ts +29 -51
- package/dist/spinner.js +155 -149
- package/dist/stdio/prompts.d.ts +17 -0
- package/dist/stdio/prompts.js +11 -12
- package/dist/temporary-executor.js +1 -1
- package/dist/themes/types.d.ts +2 -1
- package/dist/themes/utils.d.ts +1 -1
- package/dist/utils/get-ipc.d.ts +0 -1
- package/dist/utils/get-ipc.js +4 -4
- package/dist/versions.d.ts +1 -1
- package/package.json +15 -11
- package/dist/external/@inquirer/core.js +0 -4
- package/dist/external/@inquirer/prompts.js +0 -4
package/dist/logger.js
CHANGED
|
@@ -88,6 +88,9 @@ const LOG_SYMBOLS = /* @__PURE__ */ (() => {
|
|
|
88
88
|
const stepColor = theme.colors.step;
|
|
89
89
|
target.fail = /* @__PURE__ */ applyColor(supported ? "\u2716" : "\xD7", errorColor, colors);
|
|
90
90
|
target.info = /* @__PURE__ */ applyColor(supported ? "\u2139" : "i", infoColor, colors);
|
|
91
|
+
target.reason = colors.dim(
|
|
92
|
+
/* @__PURE__ */ applyColor(supported ? "\u2234" : ":.", warningColor, colors)
|
|
93
|
+
);
|
|
91
94
|
target.step = /* @__PURE__ */ applyColor(supported ? "\u2192" : ">", stepColor, colors);
|
|
92
95
|
target.success = /* @__PURE__ */ applyColor(supported ? "\u2714" : "\u221A", successColor, colors);
|
|
93
96
|
target.warn = /* @__PURE__ */ applyColor(supported ? "\u26A0" : "\u203C", warningColor, colors);
|
|
@@ -239,6 +242,26 @@ class Logger {
|
|
|
239
242
|
this.#options = { __proto__: null };
|
|
240
243
|
}
|
|
241
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Apply a console method with indentation.
|
|
247
|
+
* @private
|
|
248
|
+
*/
|
|
249
|
+
#apply(methodName, args, stream) {
|
|
250
|
+
const con = this.#getConsole();
|
|
251
|
+
const text = args.at(0);
|
|
252
|
+
const hasText = typeof text === "string";
|
|
253
|
+
const targetStream = stream || (methodName === "log" ? "stdout" : "stderr");
|
|
254
|
+
const indent = this.#getIndent(targetStream);
|
|
255
|
+
const logArgs = hasText ? [(0, import_strings.applyLinePrefix)(text, { prefix: indent }), ...args.slice(1)] : args;
|
|
256
|
+
ReflectApply(
|
|
257
|
+
con[methodName],
|
|
258
|
+
con,
|
|
259
|
+
logArgs
|
|
260
|
+
);
|
|
261
|
+
this[lastWasBlankSymbol](hasText && (0, import_strings.isBlankString)(logArgs[0]), targetStream);
|
|
262
|
+
this[incLogCallCountSymbol]();
|
|
263
|
+
return this;
|
|
264
|
+
}
|
|
242
265
|
/**
|
|
243
266
|
* Get the Console instance for this logger, creating it lazily on first access.
|
|
244
267
|
*
|
|
@@ -270,70 +293,20 @@ class Logger {
|
|
|
270
293
|
return con;
|
|
271
294
|
}
|
|
272
295
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* All logging operations on this instance will write to stderr only.
|
|
276
|
-
* Indentation is tracked separately from stdout. The instance is
|
|
277
|
-
* cached and reused on subsequent accesses.
|
|
278
|
-
*
|
|
279
|
-
* @returns A logger instance bound to stderr
|
|
280
|
-
*
|
|
281
|
-
* @example
|
|
282
|
-
* ```typescript
|
|
283
|
-
* // Write errors to stderr
|
|
284
|
-
* logger.stderr.error('Configuration invalid')
|
|
285
|
-
* logger.stderr.warn('Using fallback settings')
|
|
286
|
-
*
|
|
287
|
-
* // Indent only affects stderr
|
|
288
|
-
* logger.stderr.indent()
|
|
289
|
-
* logger.stderr.error('Nested error details')
|
|
290
|
-
* logger.stderr.dedent()
|
|
291
|
-
* ```
|
|
296
|
+
* Get indentation for a specific stream.
|
|
297
|
+
* @private
|
|
292
298
|
*/
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
const instance = new Logger(...ctorArgs);
|
|
297
|
-
instance.#parent = this;
|
|
298
|
-
instance.#boundStream = "stderr";
|
|
299
|
-
instance.#options = { __proto__: null, ...this.#options };
|
|
300
|
-
instance.#theme = this.#theme;
|
|
301
|
-
this.#stderrLogger = instance;
|
|
302
|
-
}
|
|
303
|
-
return this.#stderrLogger;
|
|
299
|
+
#getIndent(stream) {
|
|
300
|
+
const root = this.#getRoot();
|
|
301
|
+
return stream === "stderr" ? root.#stderrIndention : root.#stdoutIndention;
|
|
304
302
|
}
|
|
305
303
|
/**
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
* All logging operations on this instance will write to stdout only.
|
|
309
|
-
* Indentation is tracked separately from stderr. The instance is
|
|
310
|
-
* cached and reused on subsequent accesses.
|
|
311
|
-
*
|
|
312
|
-
* @returns A logger instance bound to stdout
|
|
313
|
-
*
|
|
314
|
-
* @example
|
|
315
|
-
* ```typescript
|
|
316
|
-
* // Write normal output to stdout
|
|
317
|
-
* logger.stdout.log('Processing started')
|
|
318
|
-
* logger.stdout.log('Items processed: 42')
|
|
319
|
-
*
|
|
320
|
-
* // Indent only affects stdout
|
|
321
|
-
* logger.stdout.indent()
|
|
322
|
-
* logger.stdout.log('Detailed output')
|
|
323
|
-
* logger.stdout.dedent()
|
|
324
|
-
* ```
|
|
304
|
+
* Get lastWasBlank state for a specific stream.
|
|
305
|
+
* @private
|
|
325
306
|
*/
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const instance = new Logger(...ctorArgs);
|
|
330
|
-
instance.#parent = this;
|
|
331
|
-
instance.#boundStream = "stdout";
|
|
332
|
-
instance.#options = { __proto__: null, ...this.#options };
|
|
333
|
-
instance.#theme = this.#theme;
|
|
334
|
-
this.#stdoutLogger = instance;
|
|
335
|
-
}
|
|
336
|
-
return this.#stdoutLogger;
|
|
307
|
+
#getLastWasBlank(stream) {
|
|
308
|
+
const root = this.#getRoot();
|
|
309
|
+
return stream === "stderr" ? root.#stderrLastWasBlank : root.#stdoutLastWasBlank;
|
|
337
310
|
}
|
|
338
311
|
/**
|
|
339
312
|
* Get the root logger (for accessing shared indentation state).
|
|
@@ -342,14 +315,6 @@ class Logger {
|
|
|
342
315
|
#getRoot() {
|
|
343
316
|
return this.#parent || this;
|
|
344
317
|
}
|
|
345
|
-
/**
|
|
346
|
-
* Get the resolved theme for this logger instance.
|
|
347
|
-
* Returns instance theme if set, otherwise falls back to context theme.
|
|
348
|
-
* @private
|
|
349
|
-
*/
|
|
350
|
-
#getTheme() {
|
|
351
|
-
return this.#theme ?? (0, import_context.getTheme)();
|
|
352
|
-
}
|
|
353
318
|
/**
|
|
354
319
|
* Get logger-specific symbols using the resolved theme.
|
|
355
320
|
* @private
|
|
@@ -362,18 +327,28 @@ class Logger {
|
|
|
362
327
|
__proto__: null,
|
|
363
328
|
fail: /* @__PURE__ */ applyColor(supported ? "\u2716" : "\xD7", theme.colors.error, colors),
|
|
364
329
|
info: /* @__PURE__ */ applyColor(supported ? "\u2139" : "i", theme.colors.info, colors),
|
|
330
|
+
reason: colors.dim(
|
|
331
|
+
/* @__PURE__ */ applyColor(supported ? "\u2234" : ":.", theme.colors.warning, colors)
|
|
332
|
+
),
|
|
365
333
|
step: /* @__PURE__ */ applyColor(supported ? "\u2192" : ">", theme.colors.step, colors),
|
|
366
334
|
success: /* @__PURE__ */ applyColor(supported ? "\u2714" : "\u221A", theme.colors.success, colors),
|
|
367
335
|
warn: /* @__PURE__ */ applyColor(supported ? "\u26A0" : "\u203C", theme.colors.warning, colors)
|
|
368
336
|
};
|
|
369
337
|
}
|
|
370
338
|
/**
|
|
371
|
-
* Get
|
|
339
|
+
* Get the target stream for this logger instance.
|
|
372
340
|
* @private
|
|
373
341
|
*/
|
|
374
|
-
#
|
|
375
|
-
|
|
376
|
-
|
|
342
|
+
#getTargetStream() {
|
|
343
|
+
return this.#boundStream || "stderr";
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Get the resolved theme for this logger instance.
|
|
347
|
+
* Returns instance theme if set, otherwise falls back to context theme.
|
|
348
|
+
* @private
|
|
349
|
+
*/
|
|
350
|
+
#getTheme() {
|
|
351
|
+
return this.#theme ?? (0, import_context.getTheme)();
|
|
377
352
|
}
|
|
378
353
|
/**
|
|
379
354
|
* Set indentation for a specific stream.
|
|
@@ -387,14 +362,6 @@ class Logger {
|
|
|
387
362
|
root.#stdoutIndention = value;
|
|
388
363
|
}
|
|
389
364
|
}
|
|
390
|
-
/**
|
|
391
|
-
* Get lastWasBlank state for a specific stream.
|
|
392
|
-
* @private
|
|
393
|
-
*/
|
|
394
|
-
#getLastWasBlank(stream) {
|
|
395
|
-
const root = this.#getRoot();
|
|
396
|
-
return stream === "stderr" ? root.#stderrLastWasBlank : root.#stdoutLastWasBlank;
|
|
397
|
-
}
|
|
398
365
|
/**
|
|
399
366
|
* Set lastWasBlank state for a specific stream.
|
|
400
367
|
* @private
|
|
@@ -407,39 +374,12 @@ class Logger {
|
|
|
407
374
|
root.#stdoutLastWasBlank = value;
|
|
408
375
|
}
|
|
409
376
|
}
|
|
410
|
-
/**
|
|
411
|
-
* Get the target stream for this logger instance.
|
|
412
|
-
* @private
|
|
413
|
-
*/
|
|
414
|
-
#getTargetStream() {
|
|
415
|
-
return this.#boundStream || "stderr";
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Apply a console method with indentation.
|
|
419
|
-
* @private
|
|
420
|
-
*/
|
|
421
|
-
#apply(methodName, args, stream) {
|
|
422
|
-
const con = this.#getConsole();
|
|
423
|
-
const text = args.at(0);
|
|
424
|
-
const hasText = typeof text === "string";
|
|
425
|
-
const targetStream = stream || (methodName === "log" ? "stdout" : "stderr");
|
|
426
|
-
const indent = this.#getIndent(targetStream);
|
|
427
|
-
const logArgs = hasText ? [(0, import_strings.applyLinePrefix)(text, { prefix: indent }), ...args.slice(1)] : args;
|
|
428
|
-
ReflectApply(
|
|
429
|
-
con[methodName],
|
|
430
|
-
con,
|
|
431
|
-
logArgs
|
|
432
|
-
);
|
|
433
|
-
this[lastWasBlankSymbol](hasText && (0, import_strings.isBlankString)(logArgs[0]), targetStream);
|
|
434
|
-
this[incLogCallCountSymbol]();
|
|
435
|
-
return this;
|
|
436
|
-
}
|
|
437
377
|
/**
|
|
438
378
|
* Strip log symbols from the start of text.
|
|
439
379
|
* @private
|
|
440
380
|
*/
|
|
441
381
|
#stripSymbols(text) {
|
|
442
|
-
return text.replace(/^[
|
|
382
|
+
return text.replace(/^(?:[✖✗×⚠‼✔✓√ℹ→∴]|:.)[\uFE0F\s]*/u, "");
|
|
443
383
|
}
|
|
444
384
|
/**
|
|
445
385
|
* Apply a method with a symbol prefix.
|
|
@@ -468,6 +408,72 @@ class Logger {
|
|
|
468
408
|
this[incLogCallCountSymbol]();
|
|
469
409
|
return this;
|
|
470
410
|
}
|
|
411
|
+
/**
|
|
412
|
+
* Gets a logger instance bound exclusively to stderr.
|
|
413
|
+
*
|
|
414
|
+
* All logging operations on this instance will write to stderr only.
|
|
415
|
+
* Indentation is tracked separately from stdout. The instance is
|
|
416
|
+
* cached and reused on subsequent accesses.
|
|
417
|
+
*
|
|
418
|
+
* @returns A logger instance bound to stderr
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```typescript
|
|
422
|
+
* // Write errors to stderr
|
|
423
|
+
* logger.stderr.error('Configuration invalid')
|
|
424
|
+
* logger.stderr.warn('Using fallback settings')
|
|
425
|
+
*
|
|
426
|
+
* // Indent only affects stderr
|
|
427
|
+
* logger.stderr.indent()
|
|
428
|
+
* logger.stderr.error('Nested error details')
|
|
429
|
+
* logger.stderr.dedent()
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
get stderr() {
|
|
433
|
+
if (!this.#stderrLogger) {
|
|
434
|
+
const ctorArgs = privateConstructorArgs.get(this) ?? [];
|
|
435
|
+
const instance = new Logger(...ctorArgs);
|
|
436
|
+
instance.#parent = this;
|
|
437
|
+
instance.#boundStream = "stderr";
|
|
438
|
+
instance.#options = { __proto__: null, ...this.#options };
|
|
439
|
+
instance.#theme = this.#theme;
|
|
440
|
+
this.#stderrLogger = instance;
|
|
441
|
+
}
|
|
442
|
+
return this.#stderrLogger;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Gets a logger instance bound exclusively to stdout.
|
|
446
|
+
*
|
|
447
|
+
* All logging operations on this instance will write to stdout only.
|
|
448
|
+
* Indentation is tracked separately from stderr. The instance is
|
|
449
|
+
* cached and reused on subsequent accesses.
|
|
450
|
+
*
|
|
451
|
+
* @returns A logger instance bound to stdout
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```typescript
|
|
455
|
+
* // Write normal output to stdout
|
|
456
|
+
* logger.stdout.log('Processing started')
|
|
457
|
+
* logger.stdout.log('Items processed: 42')
|
|
458
|
+
*
|
|
459
|
+
* // Indent only affects stdout
|
|
460
|
+
* logger.stdout.indent()
|
|
461
|
+
* logger.stdout.log('Detailed output')
|
|
462
|
+
* logger.stdout.dedent()
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
get stdout() {
|
|
466
|
+
if (!this.#stdoutLogger) {
|
|
467
|
+
const ctorArgs = privateConstructorArgs.get(this) ?? [];
|
|
468
|
+
const instance = new Logger(...ctorArgs);
|
|
469
|
+
instance.#parent = this;
|
|
470
|
+
instance.#boundStream = "stdout";
|
|
471
|
+
instance.#options = { __proto__: null, ...this.#options };
|
|
472
|
+
instance.#theme = this.#theme;
|
|
473
|
+
this.#stdoutLogger = instance;
|
|
474
|
+
}
|
|
475
|
+
return this.#stdoutLogger;
|
|
476
|
+
}
|
|
471
477
|
/**
|
|
472
478
|
* Gets the total number of log calls made on this logger instance.
|
|
473
479
|
*
|
|
@@ -545,6 +551,46 @@ class Logger {
|
|
|
545
551
|
this[lastWasBlankSymbol](false);
|
|
546
552
|
return value ? this : this[incLogCallCountSymbol]();
|
|
547
553
|
}
|
|
554
|
+
/**
|
|
555
|
+
* Clears the current line in the terminal.
|
|
556
|
+
*
|
|
557
|
+
* Moves the cursor to the beginning of the line and clears all content.
|
|
558
|
+
* Works in both TTY and non-TTY environments. Useful for clearing
|
|
559
|
+
* progress indicators created with `progress()`.
|
|
560
|
+
*
|
|
561
|
+
* The stream to clear (stderr or stdout) depends on whether the logger
|
|
562
|
+
* is stream-bound.
|
|
563
|
+
*
|
|
564
|
+
* @returns The logger instance for chaining
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```typescript
|
|
568
|
+
* logger.progress('Loading...')
|
|
569
|
+
* // ... do work ...
|
|
570
|
+
* logger.clearLine()
|
|
571
|
+
* logger.success('Loaded')
|
|
572
|
+
*
|
|
573
|
+
* // Clear multiple progress updates
|
|
574
|
+
* for (const file of files) {
|
|
575
|
+
* logger.progress(`Processing ${file}`)
|
|
576
|
+
* processFile(file)
|
|
577
|
+
* logger.clearLine()
|
|
578
|
+
* }
|
|
579
|
+
* logger.success('All files processed')
|
|
580
|
+
* ```
|
|
581
|
+
*/
|
|
582
|
+
clearLine() {
|
|
583
|
+
const con = this.#getConsole();
|
|
584
|
+
const stream = this.#getTargetStream();
|
|
585
|
+
const streamObj = stream === "stderr" ? con._stderr : con._stdout;
|
|
586
|
+
if (streamObj.isTTY) {
|
|
587
|
+
streamObj.cursorTo(0);
|
|
588
|
+
streamObj.clearLine(0);
|
|
589
|
+
} else {
|
|
590
|
+
streamObj.write("\r\x1B[K");
|
|
591
|
+
}
|
|
592
|
+
return this;
|
|
593
|
+
}
|
|
548
594
|
/**
|
|
549
595
|
* Clears the visible terminal screen.
|
|
550
596
|
*
|
|
@@ -719,6 +765,30 @@ class Logger {
|
|
|
719
765
|
this[lastWasBlankSymbol](false);
|
|
720
766
|
return this[incLogCallCountSymbol]();
|
|
721
767
|
}
|
|
768
|
+
/**
|
|
769
|
+
* Logs a completion message with a success symbol (alias for `success()`).
|
|
770
|
+
*
|
|
771
|
+
* Provides semantic clarity when marking something as "done". Does NOT
|
|
772
|
+
* automatically clear the current line - call `clearLine()` first if
|
|
773
|
+
* needed after using `progress()`.
|
|
774
|
+
*
|
|
775
|
+
* @param args - Message and additional arguments to log
|
|
776
|
+
* @returns The logger instance for chaining
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* ```typescript
|
|
780
|
+
* logger.done('Task completed')
|
|
781
|
+
*
|
|
782
|
+
* // After progress indicator
|
|
783
|
+
* logger.progress('Processing...')
|
|
784
|
+
* // ... do work ...
|
|
785
|
+
* logger.clearLine()
|
|
786
|
+
* logger.done('Processing complete')
|
|
787
|
+
* ```
|
|
788
|
+
*/
|
|
789
|
+
done(...args) {
|
|
790
|
+
return this.#symbolApply("success", args);
|
|
791
|
+
}
|
|
722
792
|
/**
|
|
723
793
|
* Logs an error message to stderr.
|
|
724
794
|
*
|
|
@@ -961,6 +1031,62 @@ class Logger {
|
|
|
961
1031
|
logNewline() {
|
|
962
1032
|
return this.#getLastWasBlank("stdout") ? this : this.log("");
|
|
963
1033
|
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Shows a progress indicator that can be cleared with `clearLine()`.
|
|
1036
|
+
*
|
|
1037
|
+
* Displays a simple status message with a '∴' prefix. Does not include
|
|
1038
|
+
* animation or spinner. Intended to be cleared once the operation completes.
|
|
1039
|
+
* The output stream (stderr or stdout) depends on whether the logger is
|
|
1040
|
+
* stream-bound.
|
|
1041
|
+
*
|
|
1042
|
+
* @param text - The progress message to display
|
|
1043
|
+
* @returns The logger instance for chaining
|
|
1044
|
+
*
|
|
1045
|
+
* @example
|
|
1046
|
+
* ```typescript
|
|
1047
|
+
* logger.progress('Processing files...')
|
|
1048
|
+
* // ... do work ...
|
|
1049
|
+
* logger.clearLine()
|
|
1050
|
+
* logger.success('Files processed')
|
|
1051
|
+
*
|
|
1052
|
+
* // Stream-specific progress
|
|
1053
|
+
* logger.stdout.progress('Loading...')
|
|
1054
|
+
* // ... do work ...
|
|
1055
|
+
* logger.stdout.clearLine()
|
|
1056
|
+
* logger.stdout.log('Done')
|
|
1057
|
+
* ```
|
|
1058
|
+
*/
|
|
1059
|
+
progress(text) {
|
|
1060
|
+
const con = this.#getConsole();
|
|
1061
|
+
const stream = this.#getTargetStream();
|
|
1062
|
+
const streamObj = stream === "stderr" ? con._stderr : con._stdout;
|
|
1063
|
+
streamObj.write(`\u2234 ${text}`);
|
|
1064
|
+
this[lastWasBlankSymbol](false);
|
|
1065
|
+
return this;
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Logs a reasoning/working message with a dimmed yellow therefore symbol.
|
|
1069
|
+
*
|
|
1070
|
+
* Automatically prefixes the message with `LOG_SYMBOLS.reason` (dimmed yellow ∴).
|
|
1071
|
+
* Useful for showing intermediate reasoning, logic steps, or "working" output
|
|
1072
|
+
* that leads to a conclusion. Always outputs to stderr. If the message starts
|
|
1073
|
+
* with an existing symbol, it will be stripped and replaced.
|
|
1074
|
+
*
|
|
1075
|
+
* @param args - Message and additional arguments to log
|
|
1076
|
+
* @returns The logger instance for chaining
|
|
1077
|
+
*
|
|
1078
|
+
* @example
|
|
1079
|
+
* ```typescript
|
|
1080
|
+
* logger.step('Analyzing package security')
|
|
1081
|
+
* logger.reason('Found 3 direct dependencies')
|
|
1082
|
+
* logger.reason('Checking 47 transitive dependencies')
|
|
1083
|
+
* logger.reason('Risk score: 8.5/10')
|
|
1084
|
+
* logger.fail('Package blocked due to high risk')
|
|
1085
|
+
* ```
|
|
1086
|
+
*/
|
|
1087
|
+
reason(...args) {
|
|
1088
|
+
return this.#symbolApply("reason", args);
|
|
1089
|
+
}
|
|
964
1090
|
/**
|
|
965
1091
|
* Resets all indentation to zero.
|
|
966
1092
|
*
|
|
@@ -1083,30 +1209,6 @@ class Logger {
|
|
|
1083
1209
|
success(...args) {
|
|
1084
1210
|
return this.#symbolApply("success", args);
|
|
1085
1211
|
}
|
|
1086
|
-
/**
|
|
1087
|
-
* Logs a completion message with a success symbol (alias for `success()`).
|
|
1088
|
-
*
|
|
1089
|
-
* Provides semantic clarity when marking something as "done". Does NOT
|
|
1090
|
-
* automatically clear the current line - call `clearLine()` first if
|
|
1091
|
-
* needed after using `progress()`.
|
|
1092
|
-
*
|
|
1093
|
-
* @param args - Message and additional arguments to log
|
|
1094
|
-
* @returns The logger instance for chaining
|
|
1095
|
-
*
|
|
1096
|
-
* @example
|
|
1097
|
-
* ```typescript
|
|
1098
|
-
* logger.done('Task completed')
|
|
1099
|
-
*
|
|
1100
|
-
* // After progress indicator
|
|
1101
|
-
* logger.progress('Processing...')
|
|
1102
|
-
* // ... do work ...
|
|
1103
|
-
* logger.clearLine()
|
|
1104
|
-
* logger.done('Processing complete')
|
|
1105
|
-
* ```
|
|
1106
|
-
*/
|
|
1107
|
-
done(...args) {
|
|
1108
|
-
return this.#symbolApply("success", args);
|
|
1109
|
-
}
|
|
1110
1212
|
/**
|
|
1111
1213
|
* Displays data in a table format.
|
|
1112
1214
|
*
|
|
@@ -1305,79 +1407,6 @@ class Logger {
|
|
|
1305
1407
|
this[lastWasBlankSymbol](false);
|
|
1306
1408
|
return this;
|
|
1307
1409
|
}
|
|
1308
|
-
/**
|
|
1309
|
-
* Shows a progress indicator that can be cleared with `clearLine()`.
|
|
1310
|
-
*
|
|
1311
|
-
* Displays a simple status message with a '∴' prefix. Does not include
|
|
1312
|
-
* animation or spinner. Intended to be cleared once the operation completes.
|
|
1313
|
-
* The output stream (stderr or stdout) depends on whether the logger is
|
|
1314
|
-
* stream-bound.
|
|
1315
|
-
*
|
|
1316
|
-
* @param text - The progress message to display
|
|
1317
|
-
* @returns The logger instance for chaining
|
|
1318
|
-
*
|
|
1319
|
-
* @example
|
|
1320
|
-
* ```typescript
|
|
1321
|
-
* logger.progress('Processing files...')
|
|
1322
|
-
* // ... do work ...
|
|
1323
|
-
* logger.clearLine()
|
|
1324
|
-
* logger.success('Files processed')
|
|
1325
|
-
*
|
|
1326
|
-
* // Stream-specific progress
|
|
1327
|
-
* logger.stdout.progress('Loading...')
|
|
1328
|
-
* // ... do work ...
|
|
1329
|
-
* logger.stdout.clearLine()
|
|
1330
|
-
* logger.stdout.log('Done')
|
|
1331
|
-
* ```
|
|
1332
|
-
*/
|
|
1333
|
-
progress(text) {
|
|
1334
|
-
const con = this.#getConsole();
|
|
1335
|
-
const stream = this.#getTargetStream();
|
|
1336
|
-
const streamObj = stream === "stderr" ? con._stderr : con._stdout;
|
|
1337
|
-
streamObj.write(`\u2234 ${text}`);
|
|
1338
|
-
this[lastWasBlankSymbol](false);
|
|
1339
|
-
return this;
|
|
1340
|
-
}
|
|
1341
|
-
/**
|
|
1342
|
-
* Clears the current line in the terminal.
|
|
1343
|
-
*
|
|
1344
|
-
* Moves the cursor to the beginning of the line and clears all content.
|
|
1345
|
-
* Works in both TTY and non-TTY environments. Useful for clearing
|
|
1346
|
-
* progress indicators created with `progress()`.
|
|
1347
|
-
*
|
|
1348
|
-
* The stream to clear (stderr or stdout) depends on whether the logger
|
|
1349
|
-
* is stream-bound.
|
|
1350
|
-
*
|
|
1351
|
-
* @returns The logger instance for chaining
|
|
1352
|
-
*
|
|
1353
|
-
* @example
|
|
1354
|
-
* ```typescript
|
|
1355
|
-
* logger.progress('Loading...')
|
|
1356
|
-
* // ... do work ...
|
|
1357
|
-
* logger.clearLine()
|
|
1358
|
-
* logger.success('Loaded')
|
|
1359
|
-
*
|
|
1360
|
-
* // Clear multiple progress updates
|
|
1361
|
-
* for (const file of files) {
|
|
1362
|
-
* logger.progress(`Processing ${file}`)
|
|
1363
|
-
* processFile(file)
|
|
1364
|
-
* logger.clearLine()
|
|
1365
|
-
* }
|
|
1366
|
-
* logger.success('All files processed')
|
|
1367
|
-
* ```
|
|
1368
|
-
*/
|
|
1369
|
-
clearLine() {
|
|
1370
|
-
const con = this.#getConsole();
|
|
1371
|
-
const stream = this.#getTargetStream();
|
|
1372
|
-
const streamObj = stream === "stderr" ? con._stderr : con._stdout;
|
|
1373
|
-
if (streamObj.isTTY) {
|
|
1374
|
-
streamObj.cursorTo(0);
|
|
1375
|
-
streamObj.clearLine(0);
|
|
1376
|
-
} else {
|
|
1377
|
-
streamObj.write("\r\x1B[K");
|
|
1378
|
-
}
|
|
1379
|
-
return this;
|
|
1380
|
-
}
|
|
1381
1410
|
}
|
|
1382
1411
|
let _prototypeInitialized = false;
|
|
1383
1412
|
function ensurePrototypeInitialized() {
|
|
@@ -18,13 +18,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var maintained_node_versions_exports = {};
|
|
21
|
-
|
|
21
|
+
__export(maintained_node_versions_exports, {
|
|
22
|
+
maintainedNodeVersions: () => maintainedNodeVersions
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(maintained_node_versions_exports);
|
|
22
25
|
const ObjectFreeze = Object.freeze;
|
|
23
26
|
const next = "25.0.0";
|
|
24
27
|
const current = "22.20.0";
|
|
25
28
|
const previous = "20.19.5";
|
|
26
29
|
const last = "18.20.8";
|
|
27
|
-
|
|
30
|
+
const maintainedNodeVersions = ObjectFreeze(
|
|
28
31
|
Object.assign([last, previous, current, next], {
|
|
29
32
|
current,
|
|
30
33
|
last,
|
|
@@ -32,5 +35,7 @@ var maintained_node_versions_default = ObjectFreeze(
|
|
|
32
35
|
previous
|
|
33
36
|
})
|
|
34
37
|
);
|
|
35
|
-
|
|
36
|
-
module.exports =
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
maintainedNodeVersions
|
|
41
|
+
});
|
package/dist/objects.js
CHANGED
|
@@ -40,7 +40,7 @@ __export(objects_exports, {
|
|
|
40
40
|
toSortedObjectFromEntries: () => toSortedObjectFromEntries
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(objects_exports);
|
|
43
|
-
var import_core = require("
|
|
43
|
+
var import_core = require("#constants/core");
|
|
44
44
|
var import_arrays = require("./arrays");
|
|
45
45
|
var import_sorts = require("./sorts");
|
|
46
46
|
const ObjectDefineProperties = Object.defineProperties;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export
|
|
1
|
+
declare const packageDefaultNodeRange: string;
|
|
2
|
+
export { packageDefaultNodeRange };
|
|
@@ -18,9 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var package_default_node_range_exports = {};
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
__export(package_default_node_range_exports, {
|
|
22
|
+
packageDefaultNodeRange: () => packageDefaultNodeRange
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(package_default_node_range_exports);
|
|
25
|
+
const { maintainedNodeVersions } = require("#lib/maintained-node-versions");
|
|
23
26
|
const semver = require("./external/semver");
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
module.exports =
|
|
27
|
+
const packageDefaultNodeRange = `>=${semver.parse(maintainedNodeVersions.last).major}`;
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
packageDefaultNodeRange
|
|
31
|
+
});
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Default Socket security categories for packages.
|
|
3
|
+
*/
|
|
4
|
+
// Default category for new packages
|
|
5
|
+
declare const packageDefaultSocketCategories: readonly string[];
|
|
6
|
+
export { packageDefaultSocketCategories };
|
|
@@ -18,7 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var package_default_socket_categories_exports = {};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
module.exports =
|
|
21
|
+
__export(package_default_socket_categories_exports, {
|
|
22
|
+
packageDefaultSocketCategories: () => packageDefaultSocketCategories
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(package_default_socket_categories_exports);
|
|
25
|
+
const packageDefaultSocketCategories = Object.freeze(["cleanup"]);
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
packageDefaultSocketCategories
|
|
29
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export
|
|
1
|
+
declare const packageExtensions: readonly any[];
|
|
2
|
+
export { packageExtensions };
|
|
@@ -18,10 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var package_extensions_exports = {};
|
|
21
|
-
|
|
21
|
+
__export(package_extensions_exports, {
|
|
22
|
+
packageExtensions: () => packageExtensions
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(package_extensions_exports);
|
|
22
25
|
const { freeze: ObjectFreeze } = Object;
|
|
23
26
|
const yarnPkgExtensions = require("./external/@yarnpkg/extensions");
|
|
24
|
-
|
|
27
|
+
const packageExtensions = ObjectFreeze(
|
|
25
28
|
[
|
|
26
29
|
yarnPkgExtensions.packageExtensions,
|
|
27
30
|
[
|
|
@@ -61,5 +64,7 @@ var package_extensions_default = ObjectFreeze(
|
|
|
61
64
|
return 0;
|
|
62
65
|
})
|
|
63
66
|
);
|
|
64
|
-
|
|
65
|
-
module.exports =
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
packageExtensions
|
|
70
|
+
});
|
package/dist/packages/exports.js
CHANGED
|
@@ -27,7 +27,7 @@ __export(exports_exports, {
|
|
|
27
27
|
resolvePackageJsonEntryExports: () => resolvePackageJsonEntryExports
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(exports_exports);
|
|
30
|
-
var import_core = require("
|
|
30
|
+
var import_core = require("#constants/core");
|
|
31
31
|
var import_arrays = require("../arrays");
|
|
32
32
|
var import_objects = require("../objects");
|
|
33
33
|
// @__NO_SIDE_EFFECTS__
|