Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
await this.engine.emitAsync(`parse::start::css`, { resource });
const result = await postcss().process(code, { from: resource, parser: safe });
const ast = result.root!; // always defined even for '' (typings error?)
await this.engine.emitAsync(`parse::end::css`, {
ast,
code,
element,
resource
});
} catch (err) /* istanbul ignore next */ {
logger.error(`Error parsing CSS code: ${code} - ${err}`);
}
}
const vulnerabilities: Vulnerability[] = snykInfo.reduce((vulns, vuln) => {
const version = removeTagsFromVersion(lib.version) /* istanbul ignore next */ || '';
try {
vuln.semver.vulnerable.forEach((vulnVersion: string) => {
if (semver.satisfies(version, vulnVersion)) {
vulns.push(vuln);
}
});
} catch (e) {
logger.error(getMessage('versionNotCompliant', context.language, [version, lib.name]));
}
return vulns;
}, [] as Vulnerability[]);