Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function readLangFiles (src: string): SimpleFile[] {
if (!isValidGlob(src)) {
throw new Error('languageFiles isn\'\t a valid glob pattern.');
}
const targetFiles = glob.sync(src);
if (targetFiles.length === 0) {
throw new Error('languageFiles glob has no files.');
}
return targetFiles.map((f) => {
const langPath = path.resolve(process.cwd(), f);
const langModule = require(langPath);
const { default: defaultImport } = langModule;
const langObj = (defaultImport) ? defaultImport : langModule;
export function readVueFiles (src: string): SimpleFile[] {
if (!isValidGlob(src)) {
throw new Error('vueFiles isn\'\t a valid glob pattern.');
}
const targetFiles = glob.sync(src);
if (targetFiles.length === 0) {
throw new Error('vueFiles glob has no files.');
}
return targetFiles.map((f) => {
const fileName = f.replace(process.cwd(), '');
return { fileName, path: f, content: fs.readFileSync(f, 'utf8') };
});
}