bun-debug
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/bun:debug
/bun:debug
Launch a script with Bun's debugger enabled for interactive debugging.
启动启用Bun调试器的脚本以进行交互式调试。
Parameters
参数
- (required): Script file to debug
file - : Break at first line (for fast-exiting scripts)
--brk - : Wait for debugger to attach before running
--wait - : Use specific port (default: auto-assigned)
--port=<port>
- (必填):要调试的脚本文件
file - :在第一行断点(适用于快速退出的脚本)
--brk - :运行前等待调试器连接
--wait - :使用指定端口(默认:自动分配)
--port=<port>
Execution
执行
Standard debug (opens debug URL):
bash
bun --inspect $FILEBreak at first line:
bash
bun --inspect-brk $FILEWait for debugger attachment:
bash
bun --inspect-wait $FILECustom port:
bash
bun --inspect=$PORT $FILEDebug tests:
bash
bun --inspect-brk test $PATTERN标准调试(打开调试URL):
bash
bun --inspect $FILE在第一行断点:
bash
bun --inspect-brk $FILE等待调试器连接:
bash
bun --inspect-wait $FILE自定义端口:
bash
bun --inspect=$PORT $FILE调试测试:
bash
bun --inspect-brk test $PATTERNOutput
输出
The command outputs a debug URL:
------------------- Bun Inspector -------------------
Listening: ws://localhost:6499/
Open: debug.bun.sh/#localhost:6499
-----------------------------------------------------命令会输出一个调试URL:
------------------- Bun Inspector -------------------
Listening: ws://localhost:6499/
Open: debug.bun.sh/#localhost:6499
-----------------------------------------------------Post-launch
启动后
- Report the debug URL to user
- Explain how to connect:
- Open in browser
debug.bun.sh/#localhost:<port> - Or use VSCode with Bun extension attached to the WebSocket URL
- Open
- Remind about breakpoint controls (F8 continue, F10 step over, F11 step into)
- 向用户报告调试URL
- 说明连接方式:
- 在浏览器中打开
debug.bun.sh/#localhost:<port> - 或者使用VSCode并通过WebSocket URL连接Bun扩展
- 在浏览器中打开
- 提醒断点控制(F8继续,F10单步跳过,F11单步进入)
VSCode Integration
VSCode集成
For VSCode debugging, suggest adding to :
.vscode/launch.jsonjson
{
"type": "bun",
"request": "launch",
"name": "Debug",
"program": "${file}",
"stopOnEntry": true
}对于VSCode调试,建议添加到 :
.vscode/launch.jsonjson
{
"type": "bun",
"request": "launch",
"name": "Debug",
"program": "${file}",
"stopOnEntry": true
}