Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
const item = await new LIB.Page( page, this.options, this.context ).get_feed_item();
if ( ! _.isEmpty( item ) )
{
this.feed_generator.addItem( item );
out.push( item );
}
}
// -----------------------------------------------------------------------
if ( ! _.isEmpty( out ) )
{
LIB.LOG.success(`added ${CHALK.cyan( out.length + ' page(s)' )} as feed item(s)`);
}
// -----------------------------------------------------------------------
return out;
} catch ( err ) {
LIB.LOG.error( err.message );
}
}
// add_items()
if (hasDefaultExport(content)) {
destPath = await writeEnhancer(
moduleId++,
`export { default } from ${JSON.stringify(enhanceAppFile)}`
)
} else {
destPath = await writeEnhancer(
moduleId++,
`import ${JSON.stringify(enhanceAppFile)}`,
false /* do not contain default export*/
)
}
} else {
logger.developer(
chalk.gray(`[${pluginName}] `) +
`${chalk.cyan(enhanceAppFile)} Not Found.`
)
}
}
if (destPath) {
manifest.push(destPath)
}
}
// 2. write entry file.
await ctx.writeTemp('internal/app-enhancers.js', pathsToModuleCode(manifest))
}
}
const { args, options: commandoptions } = cli
logger.debug('global_options', options)
logger.debug('cli_options', commandoptions)
logger.debug('cli_args', args)
const [commandName] = args
const sourceDir = args[1] ? path.resolve(args[1]) : pwd
const inferredUserDocsDirectory = await inferUserDocsDirectory(pwd)
logger.developer('inferredUserDocsDirectory', inferredUserDocsDirectory)
logger.developer('sourceDir', sourceDir)
if (inferredUserDocsDirectory && sourceDir !== inferredUserDocsDirectory) {
logUnknownCommand(cli)
console.log()
logger.tip(`Did you miss to specify the target docs dir? e.g. ${chalk.cyan(`vuepress ${commandName} [targetDir]`)}.`)
logger.tip(`A custom command registered by a plugin requires VuePress to locate your site configuration like ${chalk.cyan('vuepress dev')} or ${chalk.cyan('vuepress build')}.`)
console.log()
process.exit(1)
}
if (!inferredUserDocsDirectory) {
logUnknownCommand(cli)
process.exit(1)
}
logger.debug('Custom command', chalk.cyan(commandName))
CLI({
async beforeParse (subCli) {
const app = createApp({
sourceDir: sourceDir,
...options,
registerOption (key, value, pluginName) {
const option = PLUGIN_OPTION_MAP[key]
const types = option.types
const { valid, warnMsg } = assertTypes(value, types)
if (valid) {
this.options[option.name].add(pluginName, value)
} else if (value !== undefined) {
logger.warn(
`${chalk.gray(pluginName)} `
+ `Invalid value for "option" ${chalk.cyan(option.name)}: ${warnMsg}`
)
}
return this
}
content += opts.yuqueLinkHtml || `<br><br><a href="${repoUrl}/${slug}" class="yuque-link"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" data-icon="yuque" class="" viewBox="64 64 896 896"><path d="M854.6 370.6c-9.9-39.4 9.9-102.2 73.4-124.4l-67.9-3.6s-25.7-90-143.6-98c-117.8-8.1-194.9-3-195-3 .1 0 87.4 55.6 52.4 154.7-25.6 52.5-65.8 95.6-108.8 144.7-1.3 1.3-2.5 2.6-3.5 3.7C319.4 605 96 860 96 860c245.9 64.4 410.7-6.3 508.2-91.1 20.5-.2 35.9-.3 46.3-.3 135.8 0 250.6-117.6 245.9-248.4-3.2-89.9-31.9-110.2-41.8-149.6zm-204.1 334c-10.6 0-26.2.1-46.8.3l-23.6.2-17.8 15.5c-47.1 41-104.4 71.5-171.4 87.6-52.5 12.6-110 16.2-172.7 9.6 18-20.5 36.5-41.6 55.4-63.1 92-104.6 173.8-197.5 236.9-268.5l1.4-1.4 1.3-1.5c4.1-4.6 20.6-23.3 24.7-28.1 9.7-11.1 17.3-19.9 24.5-28.6 30.7-36.7 52.2-67.8 69-102.2l1.6-3.3 1.2-3.4c13.7-38.8 15.4-76.9 6.2-112.8 22.5.7 46.5 1.9 71.7 3.6 33.3 2.3 55.5 12.9 71.1 29.2 5.8 6 10.2 12.5 13.4 18.7 1 2 1.7 3.6 2.3 5l5 17.7c-15.7 34.5-19.9 73.3-11.4 107.2 3 11.8 6.9 22.4 12.3 34.4 2.1 4.7 9.5 20.1 11 23.3 10.3 22.7 15.4 43 16.7 78.7 3.3 94.6-82.7 181.9-182 181.9z"></path></svg> 使用语雀查看</a>`
}
const permalink = `/${slug}.html`
await ctx.addPage({
content,
frontmatter,
permalink
})
if (!defaultActionLink) {
defaultActionLink = permalink
}
spinner.succeed(`Retrieved ${chalk.cyan(title)} ... `)
}
if (ctx.pages.every(page => page.path !== '/')) {
const { home = {} } = opts
const { actionText, actionLink, heroImage, features, footer } = home
spinner.info(`Apply default homepage`)
await ctx.addPage({
content: '',
permalink: '/',
frontmatter: {
home: true,
heroImage: heroImage || user.large_avatar_url,
actionText: actionText || 'Getting Started →',
actionLink: actionLink || defaultActionLink,
features: features || undefined,