Skip to content

Commit

Permalink
feat: support debug in dev process (#1051)
Browse files Browse the repository at this point in the history
'* + Enter' to log the keys of AppContext, while 'key + Enter' is to log the value of corresponding
field in AppContext
  • Loading branch information
ulivz authored Nov 29, 2018
1 parent d8db81c commit e570252
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/@vuepress/core/lib/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
const port = await resolvePort(cliOptions.port || ctx.siteConfig.port)
const { host, displayHost } = await resolveHost(cliOptions.host || ctx.siteConfig.host)

// debug in a running dev process.
process.stdout.on('data', chunk => {
const parsed = chunk.toString('utf-8').trim()
if (parsed === '*') {
console.log(Object.keys(ctx))
}
if (ctx[parsed]) {
console.log(ctx[parsed])
}
})

config
.plugin('vuepress-log')
.use(DevLogPlugin, [{
Expand Down

0 comments on commit e570252

Please sign in to comment.