Skip to content

Commit d594ce6

Browse files
committed
chore: plugin usage log
1 parent c6764e2 commit d594ce6

File tree

1 file changed

+7
-8
lines changed
  • packages/@vuepress/core/lib/plugin-api

1 file changed

+7
-8
lines changed

Diff for: packages/@vuepress/core/lib/plugin-api/index.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const { PLUGIN_OPTION_MAP } = require('./constants')
1010
const {
1111
moduleResolver: { getPluginResolver },
1212
datatypes: { assertTypes, isPlainObject },
13-
env: { debug },
1413
logger, chalk
1514
} = require('@vuepress/shared-utils')
1615

@@ -210,13 +209,7 @@ module.exports = class PluginAPI {
210209
alias
211210
}) {
212211
const isInternalPlugin = pluginName.startsWith('@vuepress/internal-')
213-
if (!isInternalPlugin || debug) {
214-
logger.tip(
215-
shortcut
216-
? `Apply plugin ${chalk.magenta(shortcut)} ${chalk.gray(`(i.e. "${pluginName}")`)} ...`
217-
: `Apply plugin ${chalk.magenta(pluginName)} ...`
218-
)
219-
}
212+
logger[isInternalPlugin ? 'debug' : 'tip'](pluginLog(pluginName, shortcut))
220213

221214
this
222215
.registerOption(PLUGIN_OPTION_MAP.READY.key, ready, pluginName)
@@ -238,3 +231,9 @@ module.exports = class PluginAPI {
238231
.registerOption(PLUGIN_OPTION_MAP.ALIAS.key, alias, pluginName)
239232
}
240233
}
234+
235+
function pluginLog (name, shortcut) {
236+
return shortcut
237+
? `Apply plugin ${chalk.magenta(shortcut)} ${chalk.gray(`(i.e. "${name}")`)} ...`
238+
: `Apply plugin ${chalk.magenta(name)} ...`
239+
}

0 commit comments

Comments
 (0)