Skip to content

Commit e570252

Browse files
authored
feat: support debug in dev process (#1051)
'* + Enter' to log the keys of AppContext, while 'key + Enter' is to log the value of corresponding field in AppContext
1 parent d8db81c commit e570252

File tree

1 file changed

+11
-0
lines changed
  • packages/@vuepress/core/lib

1 file changed

+11
-0
lines changed

packages/@vuepress/core/lib/dev.js

+11
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
7979
const port = await resolvePort(cliOptions.port || ctx.siteConfig.port)
8080
const { host, displayHost } = await resolveHost(cliOptions.host || ctx.siteConfig.host)
8181

82+
// debug in a running dev process.
83+
process.stdout.on('data', chunk => {
84+
const parsed = chunk.toString('utf-8').trim()
85+
if (parsed === '*') {
86+
console.log(Object.keys(ctx))
87+
}
88+
if (ctx[parsed]) {
89+
console.log(ctx[parsed])
90+
}
91+
})
92+
8293
config
8394
.plugin('vuepress-log')
8495
.use(DevLogPlugin, [{

0 commit comments

Comments
 (0)