Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function docsBuild(file, info) {
console.log(`Processing file: ${file}\n`)
const vueObj = vueDocgen.parse(file)
let compDataObj = {
"readme": '',
"examples": '',
"tmplTblData": '',
"version": '',
}
// calculate associated component names and paths
const vueCompName = path.basename(file,'.vue')
const vueCompDir = path.dirname(file)
const vueCompFilePath = vueCompDir + path.sep + vueCompName
const BASE_VERSION = '0.0.0'
let latestMdDoc = null, latestMdVer = BASE_VERSION
// Determine version of current raw vue component based on its associated package.json file
files.forEach((file) => {
console.log(`Processing file: ${file}\n`)
const vueObj = vueDocgen.parse(file)
// Determine version of current raw vue component
const currentVer = `${vueObj["tags"] && vueObj["tags"]["version"] ? vueObj["tags"]["version"][0]["description"] : ''}`
if (!semver.valid(currentVer))
throw new Error(`Vue component at ${file} doesn't have a valid semver @version tag`)
const mdTemplate = createMarkdownTemplate(file, vueObj)
const vueCompName = path.basename(file,'.vue')
const vueCompDir = path.dirname(file)
let latestMdDoc = null, latestMdVer = '0.0.0'
// pull in the markdown documentation files and their NPM versions
glob(`${vueCompDir}/${vueCompName}*.md`, (mdFileErr, mdFiles) => {
module.exports = async path => {
const file = fileContent();
try {
const data = await vueDocs.parse(path);
file.addline(`# ${data.displayName}\n${data.description}\n`);
// Tags
file.addline(generateTags(data));
file.addline('## Table of contents\n[[toc]]\n');
// Props
if (data.props) {
const props = data.props;
let propsContent = '## Props\n\n';
props.forEach(prop => {
propsContent += `### ${prop.name} (\`${prop.type.name}\`)\n`;
const defaultParser = file => vueDocs.parse(file, { alias, modules });
const propsParser = config.propsParser || defaultParser;
const defaultParser = async (file: string) =>
await parse(file, {
alias,
modules,
jsx: config.jsxInComponents,
validExtends: config.validExtends
})
const propsParser = config.propsParser || defaultParser
function getComponentInfoFromVue(pathVueFile) {
const fullPathVueFile = pathInsideComponentsRoot(pathVueFile);
const componentDoc = vueDocs.parse(fullPathVueFile);
const props = extractPropsFromComponentDoc(componentDoc);
const slots = extractSlotsFromComponentDoc(componentDoc);
const events = extractEventsFromComponentDoc(componentDoc);
return {
props: generateComponentDetailsInfo(props),
slots: generateComponentDetailsInfo(slots),
events: generateComponentDetailsInfo(events)
};
}
var parseVue = function (filePath, doclet) {
const docGen = vueDocs.parse(filePath)
doclet.name = doclet.longname = docGen.displayName
return {
displayName: docGen.displayName,
filePath: filePath,
props: Object.values(docGen.props || {}).map(prop => ({
name: prop.name,
description: prop.description,
type: prop.type.name,
required: typeof prop.required === 'boolean' && prop.required,
defaultValue: prop.defaultValue
? (prop.defaultValue.func ? 'function()' : prop.defaultValue.value)
: undefined
})),
slots: Object.keys(docGen.slots || {}).map(key => ({
name: key,
description: docGen.slots[key].description,
module.exports = async (documentationRootDir) => {
const file = path.resolve(
documentationRootDir,
'../src/components/Select.vue',
);
const documentation = await docs.parse(file, {
jsx: false,
addScriptHandlers: [
/**
* @param {Documentation} docs
* @param {NodePath} path
* @param {bt.File} astPath
* @param {ParseOptions} options
* @return {Promise}
*/
function (docs, path, astPath, options) {
},
],
addTemplateHandlers: [
/**
* @param {Documentation} docs