Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.declaration // class declaration
.body.body;
const findOneMethod = classMethodsAst.find(m => m.key.name === 'all');
let nextIndex = classMethodsAst.indexOf(findOneMethod) + 1;
generatePerField(type, generators).forEach((resolverFunctionAst) => {
const classMethodAst = resolverFunctionAst.program.body[0] // class declaration
.body.body[0]; // classMethod
classMethodsAst.splice(nextIndex, 0, classMethodAst);
nextIndex += 1;
});
return print(ast, { trailingComma: true }).code;
}
testGroups.forEach(function(group, idx) {
ast.program.body = group;
// Add the test helpers at the beginning of the batch
ast.program.body.unshift.apply(ast.program.body, testHelperModules);
// Add the test-helper require statement at the end of the batch
ast.program.body.push(requireStatement);
var fileName = 'tests-' + (idx + 1) + '.js';
var filePath = path.resolve(outputPath, 'assets', fileName);
fs.writeFileSync(filePath, recast.print(ast).code);
});
context.evaluate = function(node) {
return vm.runInContext(print(node).code, this);
};
toSource(options) {
if (this._parent) {
return this._parent.toSource(options);
}
if (this.__paths.length === 1) {
return recast.print(this.__paths[0], options).code;
} else {
return this.__paths.map(p => recast.print(p, options).code);
}
}
options.filename = options.filename || 'unknown';
let stylesheets = {};
let ast = parse(source, {
sourceFileName: options.filename
});
transformAST(ast, stylesheets, options);
let printOptions = {};
if (options.sourceMapName) {
printOptions.sourceMapName = options.sourceMapName;
}
const result = print(ast, printOptions);
const { code, map } = result;
const css = buildCSS(stylesheets, options);
return { code, map, css };
}
function compile(source, mapOptions) {
mapOptions = mapOptions || {};
var recastOptions = {
sourceFileName: mapOptions.sourceFileName,
sourceMapName: mapOptions.sourceMapName
};
var ast = recast.parse(source, recastOptions);
return recast.print(transform(ast), recastOptions);
}
continue;
}
if (isMaybeExpression(childNode)) {
if (reproducesBadCase(recast.print(childNode).code)) {
return extractRelevantChild(childNode);
}
} else if (isStatement(childNode)) {
if (reproducesBadCase(recast.print(childNode).code)) {
return extractRelevantChild(childNode);
}
} else {
const childResult = extractRelevantChild(childNode);
if (reproducesBadCase(recast.print(childResult).code)) {
return childResult;
}
}
}
return node;
}
function compile(source, mapOptions) {
mapOptions = mapOptions || {};
var recastOptions = {
sourceFileName: mapOptions.sourceFileName,
sourceMapName: mapOptions.sourceMapName
};
var ast = recast.parse(source, recastOptions);
return recast.print(transform(ast), recastOptions);
}
appName = path.node.left;
}
this.traverse(path);
}
});
if (addDestroyAppImport) {
addDefaultImport(ast, '../helpers/destroy-app', 'destroyApp');
}
if (removeEmberImport && emberImport) {
emberImport.prune();
}
return recast.print(ast, { tabWidth: 2, quote: 'single' }).code;
};