Skip to content

Commit 8e1fee7

Browse files
committed
refactor: remove unused logger and spinner methods and quote utilities
Remove deprecated/unused functionality: - logger.reason() method and LOG_SYMBOLS.reason - spinner.reason() and spinner.reasonAndStop() methods - posixQuote() and win32Quote() functions from argv/quote - Remove argv/quote subpath export from package.json Also removed associated tests and updated documentation. All tests passing after removal.
1 parent ffdc1d7 commit 8e1fee7

8 files changed

Lines changed: 6 additions & 508 deletions

File tree

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@
111111
"types": "./dist/argv/parse.d.ts",
112112
"default": "./dist/argv/parse.js"
113113
},
114-
"./argv/quote": {
115-
"types": "./dist/argv/quote.d.ts",
116-
"default": "./dist/argv/quote.js"
117-
},
118114
"./arrays": {
119115
"types": "./dist/arrays.d.ts",
120116
"default": "./dist/arrays.js"

src/argv/quote.ts

Lines changed: 0 additions & 71 deletions
This file was deleted.

src/logger.ts

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { THEMES } from './themes/themes'
2626
* console.log(`${LOG_SYMBOLS.info} Information message`)
2727
* console.log(`${LOG_SYMBOLS.step} Processing step`)
2828
* console.log(`${LOG_SYMBOLS.progress} Working on task`)
29-
* console.log(`${LOG_SYMBOLS.reason} Working through logic`)
3029
* ```
3130
*/
3231
type LogSymbols = {
@@ -36,8 +35,6 @@ type LogSymbols = {
3635
info: string
3736
/** Cyan colored progress indicator symbol (∴ or :. in ASCII) */
3837
progress: string
39-
/** Dimmed yellow reasoning/working symbol (∴ or :. in ASCII) */
40-
reason: string
4138
/** Cyan colored skip symbol (↻ or @ in ASCII) */
4239
skip: string
4340
/** Cyan colored step symbol (→ or > in ASCII) */
@@ -164,7 +161,6 @@ function applyColor(
164161
* console.log(`${LOG_SYMBOLS.fail} Build failed`) // Theme error color ✖
165162
* console.log(`${LOG_SYMBOLS.info} Starting process`) // Theme info color ℹ
166163
* console.log(`${LOG_SYMBOLS.progress} Working on task`) // Theme step color ∴
167-
* console.log(`${LOG_SYMBOLS.reason} Analyzing dependencies`) // Dimmed yellow ∴
168164
* console.log(`${LOG_SYMBOLS.step} Processing files`) // Theme step color →
169165
* console.log(`${LOG_SYMBOLS.success} Build completed`) // Theme success color ✔
170166
* console.log(`${LOG_SYMBOLS.warn} Deprecated API used`) // Theme warning color ⚠
@@ -602,9 +598,6 @@ export class Logger {
602598
fail: applyColor(supported ? '✖' : '×', theme.colors.error, colors),
603599
info: applyColor(supported ? 'ℹ' : 'i', theme.colors.info, colors),
604600
progress: applyColor(supported ? '∴' : ':.', theme.colors.step, colors),
605-
reason: colors.dim(
606-
applyColor(supported ? '∴' : ':.', theme.colors.warning, colors),
607-
),
608601
skip: applyColor(supported ? '↻' : '@', theme.colors.step, colors),
609602
step: applyColor(supported ? '→' : '>', theme.colors.step, colors),
610603
success: applyColor(supported ? '✔' : '√', theme.colors.success, colors),
@@ -1396,30 +1389,6 @@ export class Logger {
13961389
return this
13971390
}
13981391

1399-
/**
1400-
* Logs a reasoning/working message with a dimmed yellow therefore symbol.
1401-
*
1402-
* Automatically prefixes the message with `LOG_SYMBOLS.reason` (dimmed yellow ∴).
1403-
* Useful for showing intermediate reasoning, logic steps, or "working" output
1404-
* that leads to a conclusion. Always outputs to stderr. If the message starts
1405-
* with an existing symbol, it will be stripped and replaced.
1406-
*
1407-
* @param args - Message and additional arguments to log
1408-
* @returns The logger instance for chaining
1409-
*
1410-
* @example
1411-
* ```typescript
1412-
* logger.step('Analyzing package security')
1413-
* logger.reason('Found 3 direct dependencies')
1414-
* logger.reason('Checking 47 transitive dependencies')
1415-
* logger.reason('Risk score: 8.5/10')
1416-
* logger.fail('Package blocked due to high risk')
1417-
* ```
1418-
*/
1419-
reason(...args: unknown[]): this {
1420-
return this.#symbolApply('reason', args)
1421-
}
1422-
14231392
/**
14241393
* Resets all indentation to zero.
14251394
*

src/spinner.ts

Lines changed: 6 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,9 @@ import { resolveColor } from './themes/utils'
3232

3333
/**
3434
* Symbol types for status messages.
35-
* Maps to log symbols: fail (✗), info (ℹ), reason (∴), skip (↻), success (✓), warn (⚠).
35+
* Maps to log symbols: fail (✗), info (ℹ), skip (↻), success (✓), warn (⚠).
3636
*/
37-
export type SymbolType =
38-
| 'fail'
39-
| 'info'
40-
| 'reason'
41-
| 'skip'
42-
| 'success'
43-
| 'warn'
37+
export type SymbolType = 'fail' | 'info' | 'skip' | 'success' | 'warn'
4438

4539
/**
4640
* Progress tracking information for display in spinner.
@@ -150,11 +144,6 @@ export type Spinner = {
150144
/** Increment progress by specified amount (default: 1) */
151145
progressStep(amount?: number): Spinner
152146

153-
/** Show reasoning (∴) message without stopping the spinner */
154-
reason(text?: string | undefined, ...extras: unknown[]): Spinner
155-
/** Show reasoning (∴) message and stop the spinner, auto-clearing the line */
156-
reasonAndStop(text?: string | undefined, ...extras: unknown[]): Spinner
157-
158147
/** Set complete shimmer configuration */
159148
setShimmer(config: ShimmerConfig): Spinner
160149

@@ -996,45 +985,6 @@ export function Spinner(options?: SpinnerOptions | undefined): Spinner {
996985
return this
997986
}
998987

999-
/**
1000-
* Show a reasoning/working message (∴) without stopping the spinner.
1001-
* Outputs to stderr and continues spinning.
1002-
*
1003-
* @param text - Reasoning message to display
1004-
* @param extras - Additional values to log
1005-
* @returns This spinner for chaining
1006-
*/
1007-
reason(text?: string | undefined, ...extras: unknown[]) {
1008-
return this.#showStatusAndKeepSpinning('reason', [text, ...extras])
1009-
}
1010-
1011-
/**
1012-
* Show a reasoning/working message (∴) and stop the spinner.
1013-
* Auto-clears the spinner line before displaying the message.
1014-
*
1015-
* Implementation note: Unlike other *AndStop methods (successAndStop, failAndStop, etc.),
1016-
* this method cannot use #apply() with a 'reason' method name because yocto-spinner
1017-
* doesn't have a built-in 'reason' method. Instead, we manually stop the spinner then
1018-
* log the message with the reason symbol. This matches the pattern used by methods
1019-
* like debugAndStop() and maintains consistency with normalizeText() usage and empty
1020-
* string handling (see #apply's stop method handling for the pattern).
1021-
*
1022-
* @param text - Reasoning message to display
1023-
* @param extras - Additional values to log
1024-
* @returns This spinner for chaining
1025-
*/
1026-
reasonAndStop(text?: string | undefined, ...extras: unknown[]) {
1027-
// Stop spinner first (can't use #apply('reason') since yocto-spinner has no 'reason' method)
1028-
this.#apply('stop', [])
1029-
// Normalize text (trim leading whitespace) like other methods
1030-
const normalized = normalizeText(text)
1031-
// Only log if we have actual content (consistent with #apply's stop method handling)
1032-
if (normalized) {
1033-
logger.error(`${LOG_SYMBOLS.reason} ${normalized}`, ...extras)
1034-
}
1035-
return this
1036-
}
1037-
1038988
/**
1039989
* Show a skip message (↻) without stopping the spinner.
1040990
* Outputs to stderr and continues spinning.
@@ -1051,9 +1001,10 @@ export function Spinner(options?: SpinnerOptions | undefined): Spinner {
10511001
* Show a skip message (↻) and stop the spinner.
10521002
* Auto-clears the spinner line before displaying the message.
10531003
*
1054-
* Implementation note: Similar to reasonAndStop(), this method cannot use #apply()
1055-
* with a 'skip' method name because yocto-spinner doesn't have a built-in 'skip'
1056-
* method. Instead, we manually stop the spinner then log the message with the skip symbol.
1004+
* Implementation note: Unlike other *AndStop methods (successAndStop, failAndStop, etc.),
1005+
* this method cannot use #apply() with a 'skip' method name because yocto-spinner doesn't
1006+
* have a built-in 'skip' method. Instead, we manually stop the spinner then log the message
1007+
* with the skip symbol.
10571008
*
10581009
* @param text - Skip message to display
10591010
* @param extras - Additional values to log

test/isolated/logger.test.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,36 +1079,6 @@ describe('Logger', () => {
10791079
})
10801080
})
10811081

1082-
describe('reason() method', () => {
1083-
it('should log reason message with symbol', () => {
1084-
testLogger.reason('processing dependencies')
1085-
const output = stderrChunks.join('')
1086-
expect(output).toContain('processing dependencies')
1087-
})
1088-
1089-
it('should support multiple arguments', () => {
1090-
testLogger.reason('Found', 3, 'issues')
1091-
const output = stderrChunks.join('')
1092-
expect(output).toContain('Found')
1093-
})
1094-
1095-
it('should return logger instance for chaining', () => {
1096-
const result = testLogger.reason('analyzing...')
1097-
expect(result).toBe(testLogger)
1098-
})
1099-
1100-
it('should handle empty reason', () => {
1101-
testLogger.reason()
1102-
expect(stderrChunks.length).toBeGreaterThan(0)
1103-
})
1104-
1105-
it('should strip existing symbols', () => {
1106-
testLogger.reason('∴ already has symbol')
1107-
const output = stderrChunks.join('')
1108-
expect(output).toContain('already has symbol')
1109-
})
1110-
})
1111-
11121082
describe('skip() method', () => {
11131083
it('should log skip message with symbol', () => {
11141084
testLogger.skip('Test skipped')

0 commit comments

Comments
 (0)