@ackplus/nest-dynamic-templates
Version:
A powerful and flexible dynamic template rendering library for NestJS applications with support for Nunjucks, Handlebars, EJS, Pug, MJML, Markdown, and more.
21 lines • 598 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadPeer = loadPeer;
const template_errors_1 = require("../errors/template.errors");
async function loadPeer(pkg, engine, kind) {
try {
if (typeof require === 'function') {
return require(pkg);
}
return (await import(pkg));
}
catch {
throw new template_errors_1.TemplateEngineUnavailableError({
engine,
kind,
reason: 'not-installed',
peerPackage: pkg,
});
}
}
//# sourceMappingURL=load-peer.js.map