Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function programVisitor(types, sourceFilePath = 'unknown.js', opts = {}) {
const T = types;
opts = {
...defaults.instrumentVisitor,
...opts
};
const visitState = new VisitState(
types,
sourceFilePath,
opts.inputSourceMap,
opts.ignoreClassMethods
);
return {
enter(path) {
if (shouldIgnoreFile(path.find(p => p.isProgram()))) {
return;
}
if (alreadyInstrumented(path, visitState)) {
return;
}