Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
var ast = babylon.parse(code, { sourceFilename: file, sourceType: 'unambiguous' });
const hub = new Hub();
hub.buildError = function (node, message, Error) {
const loc = node && node.loc;
const err = new Error(message);
if (loc) {
err.loc = loc.start;
}
return err;
};
const path = NodePath.get({
hub: hub,
parent: ast,
container: ast,
key: 'program'
}).setContext();
traverse(ast, {
enter: function(path) {
if (types.isAssignmentExpression(path.node) && isBaseControllerExportExpression(path.node.left)) {
// what's equivalent of print_to_string()? I replaced with simple value property assuming it's a string literal
baseController = '\'' + path.node.right.value + '\'';
}
},
ImportDeclaration: function(path) {
moduleCodes += generate(path.node, GENCODE_OPTIONS).code;
path.remove();
constructor(options: {}, { code, ast, inputMap }: NormalizedFile) {
this.opts = options;
this.code = code;
this.ast = ast;
this.inputMap = inputMap;
this.path = NodePath.get({
hub: this.hub,
parentPath: null,
parent: this.ast,
container: this.ast,
key: "program",
}).setContext();
this.scope = this.path.scope;
}