From e570252f0c78868521a8f8c34707270d606149be Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Fri, 30 Nov 2018 00:14:25 +0800 Subject: [PATCH] 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 --- packages/@vuepress/core/lib/dev.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/@vuepress/core/lib/dev.js b/packages/@vuepress/core/lib/dev.js index 2f6e7cddee..2b373cc068 100644 --- a/packages/@vuepress/core/lib/dev.js +++ b/packages/@vuepress/core/lib/dev.js @@ -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, [{