UNPKG

@visulima/email

Version:

A comprehensive email library with multi-provider support, crypto utilities, and template engines

2 lines (1 loc) 1.24 kB
var i=Object.defineProperty;var d=(a,r)=>i(a,"name",{value:r,configurable:!0});import t from"handlebars";import s from"../packem_shared/EmailError-zm2ffVav.js";var o=Object.defineProperty,l=d((a,r)=>o(a,"name",{value:r,configurable:!0}),"s");const p=l((a,r,e)=>{try{if(typeof a!="string")throw new TypeError("Handlebars template must be a string");return t.compile(a,e)(r||{})}catch(n){throw n instanceof Error&&n.message.includes("Cannot find module")?new s("handlebars","Handlebars is not installed. Please install it: pnpm add handlebars",{cause:n}):new s("handlebars",`Failed to render Handlebars template: ${n.message}`,{cause:n})}},"renderHandlebars"),u=l((a,r)=>{try{t.registerHelper(a,r)}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new s("handlebars","Handlebars is not installed. Please install it: pnpm add handlebars",{cause:e}):e}},"registerHandlebarsHelper"),h=l((a,r)=>{try{t.registerPartial(a,r)}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new s("handlebars","Handlebars is not installed. Please install it: pnpm add handlebars",{cause:e}):e}},"registerHandlebarsPartial");export{u as registerHandlebarsHelper,h as registerHandlebarsPartial,p as renderHandlebars};