Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const extractAttrs = argv.attrs
const xgettextArgs = argv.xgettextArgs
// clean up
shell.rm('-f', outputFile)
let finalAttrs = extractAttrs
? extractAttrs.concat(ExtractorDefaultAttrs)
: ExtractorDefaultAttrs
// support v-translate directive
if (finalAttrs.indexOf('v-translate') === -1) {
finalAttrs.push('v-translate')
}
const extractor = new Extractor({
lineNumbers: true,
attributes: finalAttrs
})
const vueFiles = glob.sync(`${srcFolder}/**/*.vue`)
// extract from templates
let renderPromises = vueFiles.map((file) => {
let content = fs.readFileSync(file, 'utf8')
let filename = path.basename(file)
let output = parseVue(content, filename, false)
let templateLang = output.template ? output.template.lang : null
let renderFn = templateLang && consolidate[templateLang] && consolidate[templateLang].render
let renderOpts = templateLang && require(`./extract-opts/${templateLang}`)
// must be in html so that they can match when the app runs