ngc-webpack
Version:
A wrapper for the @ngtools/webpack with hooks into the compilation process
32 lines • 976 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
// @ignoreDep typescript
var ts = require("typescript");
// Find all nodes from the AST in the subtree of node of SyntaxKind kind.
function collectDeepNodes(node, kind) {
var nodes = [];
var helper = function (child) {
if (child.kind === kind) {
nodes.push(child);
}
ts.forEachChild(child, helper);
};
ts.forEachChild(node, helper);
return nodes;
}
exports.collectDeepNodes = collectDeepNodes;
function getFirstNode(sourceFile) {
if (sourceFile.statements.length > 0) {
return sourceFile.statements[0] || null;
}
return null;
}
exports.getFirstNode = getFirstNode;
function getLastNode(sourceFile) {
if (sourceFile.statements.length > 0) {
return sourceFile.statements[sourceFile.statements.length - 1] || null;
}
return null;
}
exports.getLastNode = getLastNode;
//# sourceMappingURL=ast_helpers.js.map