npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cosmicdrift/kumiko-renderer-mail-html

v0.391.0

Published

Renderer-Foundation plugin for branded HTML emails: mail-kind templates (document HTML + subject meta) rendered with isolated Handlebars into an MJML layout, plus plain text via html-to-text. Templates resolved from template-resolver.

Readme

renderer-mail-html

Plugin für renderer-foundation. Rendert RenderRequest { kind: "mail" } zu Betreff + Email-safe HTML + plain-text: Mail-Template (Dokument-HTML + meta.subject) -> isolierter Handlebars -> MJML-Layout -> html-to-text.

Pipeline

RenderRequest { kind: "mail", payload: { slug, locale, variables, unsubscribeUrl? } }
                            ↓
   1. Template laden      resolveTemplate(slug, kind "mail", locale), nur contentFormat html,
                          meta.subject Pflicht
   2. Layout laden        meta.layoutSlug ?? "default", kind "mail-layout";
                          tenant -> system -> in-code DEFAULT_MAIL_LAYOUT_MJML
   3. Body kompilieren    compileDocumentBodyToHandlebars (template-resolver): span[data-variable],
                          Links, Listenzeilen -> Handlebars-Quelle; Autoren-Klammern sind inert
   4. Rendern             Handlebars.create() mit Helfern money/date/link, HTML-Escaping an;
                          Betreff + Preview-Text ohne Escaping, CR/LF entfernt
   5. Layout              Body als Datum (`{{{content}}}`), nie in die Layout-Quelle konkateniert;
                          Layout-Kontext nur: content, subject, previewText, tenantName,
                          signature, imprint, unsubscribeUrl
   6. mjml + html-to-text
                            ↓
   RenderResponse { kind: "mail", subject, html, text, previewText? }

Datum und Zahlen formatiert der Renderer nach payload.locale, der Sprache der Vorlage, im langen Datumsformat („1. Oktober 2026“). ctx.config (optional) liefert die Währung (tenant-settings) und tenantName (Branding-Titel); ohne Config gelten EUR und "".

Mount

import { createRendererMailHtmlFeature } from "@cosmicdrift/kumiko-renderer-mail-html";
import { createTemplateResolverFeature } from "@cosmicdrift/kumiko-bundled-features/template-resolver";
import { createRendererFoundationFeature } from "@cosmicdrift/kumiko-bundled-features/renderer-foundation";

const features = [
  createTemplateResolverFeature(),    // Vorausgesetzt
  createRendererFoundationFeature(),  // Vorausgesetzt
  createRendererMailHtmlFeature(),    // Dieses Plugin
];

Mail-Texte kommen aus r.notification({ variables, template, meta }); applyBootSeeds legt sie als System-Templates an.

Caller-Pattern

const foundation = requireRendererFoundation(ctx, "sendWelcomeMail");
const renderer = foundation.createRendererForTenant({ tenantId, kind: "mail" });

const result = await renderer.render(
  {
    kind: "mail",
    payload: {
      slug: "my-feature:notify:welcome",
      locale: "de",
      variables: { name: user.name, verifyUrl: "https://..." },
    },
  },
  { db: ctx.db, registry: ctx.registry, tenantId, config: ctx.config },
);

await ctx.mailTransport.send({ to: user.email, subject: result.subject, html: result.html, text: result.text });

Tenant-Branding

Ein Tenant legt ein eigenes Layout als Template kind: "mail-layout", contentFormat: "mjml", Slug default (oder den Slug aus meta.layoutSlug) an. Es gewinnt gegen System-Layout und in-code Default. Das Layout sieht nur die oben genannten Variablen; den Body setzt es mit {{{content}}} ein.

Optionales Seeding

import { seedSystemMailLayout } from "@cosmicdrift/kumiko-renderer-mail-html/seeding";

await seedSystemMailLayout(db); // idempotent

Ohne Seeding läuft das Plugin trotzdem und fällt auf DEFAULT_MAIL_LAYOUT_MJML zurück.

Out-of-Scope

  • Visual-Editor für Layouts
  • Inline-Image-Embedding (CID-Attachments)
  • PDF/Image -> andere Plugins (renderer-puppeteer-client)
  • Mail-Versand -> delivery + channel-email + mail-transport-*