Skip to content

Commit bb4e74c

Browse files
committed
feat!: rename debugLogs to debug
1 parent 63e6f4f commit bb4e74c

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

docs/reference/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ When loading environment variables from a file via `--env-file`, only include va
203203
tsdown --env-file .env --env-prefix APP_ --env-prefix TSDOWN_
204204
```
205205

206-
## `--debug-logs [feat]`
206+
## `--debug [feat]`
207207

208208
Show debug logs.
209209

docs/zh-CN/reference/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ tsdown --env-file .env.production
203203
tsdown --env-file .env --env-prefix APP_ --env-prefix TSDOWN_
204204
```
205205

206-
## `--debug-logs [feat]`
206+
## `--debug [feat]`
207207

208208
显示调试日志。
209209

src/cli.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { cac } from 'cac'
44
import { VERSION as rolldownVersion } from 'rolldown'
55
import { x } from 'tinyexec'
66
import pkg from '../package.json' with { type: 'json' }
7-
import { enableDebugLog } from './features/debug.ts'
7+
import { enableDebug } from './features/debug.ts'
88
import { globalLogger } from './utils/logger.ts'
99
import type { UserConfig } from './config.ts'
1010

@@ -30,7 +30,7 @@ cli
3030
.option('--external <module>', 'Mark dependencies as external')
3131
.option('--minify', 'Minify output')
3232
.option('--devtools', 'Enable devtools integration')
33-
.option('--debug-logs [feat]', 'Show debug logs')
33+
.option('--debug [feat]', 'Show debug logs')
3434
.option('--target <target>', 'Bundle target, e.g "es2015", "esnext"')
3535
.option('-l, --logLevel <level>', 'Set log level: info, warn, error, silent')
3636
.option('--fail-on-warn', 'Fail on warnings', { default: true })
@@ -128,7 +128,7 @@ cli
128128
export async function runCLI(): Promise<void> {
129129
cli.parse(process.argv, { run: false })
130130

131-
enableDebugLog(cli.options)
131+
enableDebug(cli.options)
132132

133133
try {
134134
await cli.runMatchedCommand()

src/config/options.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import type {
3232
WithEnabled,
3333
} from './types.ts'
3434

35-
const debugLog = createDebug('tsdown:config:options')
35+
const debug = createDebug('tsdown:config:options')
3636

3737
export async function resolveUserConfig(
3838
userConfig: UserConfig,
@@ -97,7 +97,7 @@ export async function resolveUserConfig(
9797
const nameLabel = getNameLabel(color, name)
9898

9999
if (!filterConfig(inlineConfig.filter, cwd, name)) {
100-
debugLog('[filter] skipping config %s', cwd)
100+
debug('[filter] skipping config %s', cwd)
101101
return []
102102
}
103103

@@ -194,7 +194,7 @@ export async function resolveUserConfig(
194194
// precedence: process.env < tsdown option
195195
env = { ...envFromProcess, ...env }
196196
}
197-
debugLog(`Environment variables: %O`, env)
197+
debug(`Environment variables: %O`, env)
198198

199199
if (fromVite) {
200200
const viteUserConfig = await loadViteConfig(

src/features/debug.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { createDebug, enable, namespaces } from 'obug'
22
import { resolveComma, toArray } from '../utils/general.ts'
33

4-
const debug = createDebug('tsdown:debug')
4+
const debugLog = createDebug('tsdown:debug')
55

6-
export function enableDebugLog(cliOptions: Record<string, any>): void {
7-
const { debugLogs } = cliOptions
8-
if (!debugLogs) return
6+
export function enableDebug(cliOptions: Record<string, any>): void {
7+
const { debug } = cliOptions
8+
if (!debug) return
99

1010
let namespace: string
11-
if (debugLogs === true) {
11+
if (debug === true) {
1212
namespace = 'tsdown:*'
1313
} else {
1414
// support debugging multiple flags with comma-separated list
15-
namespace = resolveComma(toArray(debugLogs))
15+
namespace = resolveComma(toArray(debug))
1616
.map((v) => `tsdown:${v}`)
1717
.join(',')
1818
}
@@ -21,5 +21,5 @@ export function enableDebugLog(cliOptions: Record<string, any>): void {
2121
if (ns) namespace += `,${ns}`
2222

2323
enable(namespace)
24-
debug('Debugging enabled', namespace)
24+
debugLog('Debugging enabled', namespace)
2525
}

0 commit comments

Comments
 (0)