Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function genFile(file, pkgName) {
let modName = last(file.split('/')).slice(0, -3);
let data = await fs.readFile(file, 'utf8');
const env = modData[modName].env;
const isEs5 = contain(env, 'browser') || contain(env, 'miniprogram');
if (isEs5 && pkgName !== 'licia-src') {
data = await transBabel(data);
}
if (pkgName === 'miniprogram-licia') {
if (!contain(env, 'miniprogram')) {
return;
}
}
data = data.replace(/\/\* module[\s\S]*?\*\//m, '');
async function extractInfo() {
const files = await glob('src/*/*.js', {
ignore: ['src/*/*.*.js']
});
const regDependency = /\s*\b_\(\s*['"]([\w\s$]+)['"]\s*\);?/m;
for (const file of files) {
let modName = last(file.split('/')).slice(0, -3);
const data = await fs.readFile(file, 'utf8');
let desc = 'No description.';
let comments = extractBlockCmts(data);
if (comments.length > 0) {
desc = trim(comments[0]).split('\n')[0];
}
let modInfo = extend(
{
description: desc,
dependencies: extractDependencies(data)
},
extractCmts(comments)