@visulima/email
Version:
A comprehensive email library with multi-provider support, crypto utilities, and template engines
2 lines (1 loc) • 900 B
JavaScript
var i=Object.defineProperty;var a=(t,o)=>i(t,"name",{value:o,configurable:!0});import l from"mjml";import r from"../packem_shared/EmailError-zm2ffVav.js";var f=Object.defineProperty,d=a((t,o)=>f(t,"name",{value:o,configurable:!0}),"o");const v=d((t,o,n)=>{try{if(typeof t!="string")throw new TypeError("MJML template must be a string");const e=l(t,{beautify:n?.beautify??!1,fonts:n?.fonts,keepComments:n?.keepComments??!0,minify:n?.minify??!1,validationLevel:n?.validationLevel??"soft"});if(e.errors&&e.errors.length>0){const s=e.errors.map(m=>m.message).join("; ");throw new r("mjml",`MJML validation errors: ${s}`)}return e.html}catch(e){throw e instanceof Error&&e.message.includes("Cannot find module")?new r("mjml","MJML is not installed. Please install it: pnpm add mjml",{cause:e}):e instanceof r?e:new r("mjml",`Failed to render MJML: ${e.message}`,{cause:e})}},"mjml");export{v as default};