Skip to content

Commit 2d9225f

Browse files
committed
feat: expose enableDebug
1 parent f268ce7 commit 2d9225f

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

dts.snapshot.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
]
2222
},
2323
"index.d.mts": {
24+
"enableDebug": "declare function enableDebug(_: boolean | Arrayable<string>): void",
2425
"#exports": [
2526
"AttwOptions",
2627
"BuildContext",
@@ -65,6 +66,7 @@
6566
"build",
6667
"buildWithConfigs",
6768
"defineConfig",
69+
"enableDebug",
6870
"globalLogger",
6971
"mergeConfig"
7072
]

src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ cli
8484
globalLogger.info(
8585
`tsdown ${dim`v${pkg.version}`} powered by rolldown ${dim`v${rolldownVersion}`}`,
8686
)
87-
const { build } = await import('./index.ts')
87+
const { build } = await import('./build.ts')
8888
if (input.length > 0) flags.entry = input
8989
await build(flags)
9090
})
@@ -128,7 +128,7 @@ cli
128128
export async function runCLI(): Promise<void> {
129129
cli.parse(process.argv, { run: false })
130130

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

133133
try {
134134
await cli.runMatchedCommand()

src/features/debug.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { createDebug, enable, namespaces } from 'obug'
22
import { resolveComma, toArray } from '../utils/general.ts'
3+
import type { Arrayable } from '../utils/types.ts'
34

45
const debugLog = createDebug('tsdown:debug')
56

6-
export function enableDebug(cliOptions: Record<string, any>): void {
7-
const { debug } = cliOptions
7+
export function enableDebug(debug?: boolean | Arrayable<string>): void {
88
if (!debug) return
99

1010
let namespace: string

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export const shimFile: string = path.resolve(pkgRoot, 'esm-shims.js')
1010
export { build, buildWithConfigs } from './build.ts'
1111
export { defineConfig, mergeConfig } from './config.ts'
1212
export * from './config/types.ts'
13+
export { enableDebug } from './features/debug.ts'
1314
export { globalLogger, type Logger } from './utils/logger.ts'
1415
export * as Rolldown from 'rolldown'

0 commit comments

Comments
 (0)