twing
Version:
First-class Twig engine for Node.js
25 lines (24 loc) • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.executeTemplateNodeSynchronously = exports.executeTemplateNode = void 0;
const executeTemplateNode = (node, executionContext) => {
const { template, nodeExecutor: execute, outputBuffer, sourceMapRuntime } = executionContext;
const { securityCheck, body } = node.children;
return execute(securityCheck, executionContext)
.then(() => {
sourceMapRuntime === null || sourceMapRuntime === void 0 ? void 0 : sourceMapRuntime.enterSourceMapBlock(node.line, node.column, node.type, template.source, outputBuffer);
return execute(body, executionContext).then(() => {
sourceMapRuntime === null || sourceMapRuntime === void 0 ? void 0 : sourceMapRuntime.leaveSourceMapBlock(outputBuffer);
});
});
};
exports.executeTemplateNode = executeTemplateNode;
const executeTemplateNodeSynchronously = (node, executionContext) => {
const { template, nodeExecutor: execute, outputBuffer, sourceMapRuntime } = executionContext;
const { securityCheck, body } = node.children;
execute(securityCheck, executionContext);
sourceMapRuntime === null || sourceMapRuntime === void 0 ? void 0 : sourceMapRuntime.enterSourceMapBlock(node.line, node.column, node.type, template.source, outputBuffer);
execute(body, executionContext);
sourceMapRuntime === null || sourceMapRuntime === void 0 ? void 0 : sourceMapRuntime.leaveSourceMapBlock(outputBuffer);
};
exports.executeTemplateNodeSynchronously = executeTemplateNodeSynchronously;