mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-19 10:41:10 -05:00
feat: improve inspect output
This commit is contained in:
@@ -25,7 +25,18 @@ module.exports = (api, options) => {
|
||||
res = config
|
||||
}
|
||||
|
||||
// TODO improve stringification for loaders, plugins etc.
|
||||
console.log(stringify(res, null, 2))
|
||||
const pluginRE = /(?:function|class) (\w+Plugin)/
|
||||
console.log(stringify(res, (value, indent, stringify) => {
|
||||
if (typeof value === 'function' && value.toString().length > 100) {
|
||||
return `function () { /* omitted long function */ }`
|
||||
}
|
||||
if (value && typeof value.constructor === 'function') {
|
||||
const match = value.constructor.toString().match(pluginRE)
|
||||
if (match) {
|
||||
return `/* ${match[1]} */ ` + stringify(value)
|
||||
}
|
||||
}
|
||||
return stringify(value)
|
||||
}, 2))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user