Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
enter(path, asset) {
traverse.cache.clearScope();
path.scope.crawl();
asset.cacheData.imports = asset.cacheData.imports || Object.create(null);
asset.cacheData.exports = asset.cacheData.exports || Object.create(null);
asset.cacheData.wildcards = asset.cacheData.wildcards || [];
asset.cacheData.sideEffects = asset._package && hasSideEffects(asset);
let shouldWrap = false;
path.traverse({
CallExpression(path) {
// If we see an `eval` call, wrap the module in a function.
// Otherwise, local variables accessed inside the eval won't work.
let callee = path.node.callee;
if (
t.isIdentifier(callee) &&
callee.name === 'eval' &&
addComment(
data,
comment.value,
comment.loc,
path,
path.node.loc,
includeContext
)
);
}
(path.node[type] || []).filter(isJSDocComment).forEach(parseComment);
}
});
traverse.cache.clear();
return newResults;
}