feat: make editor extensions ssr

Draft
DA
4mo ago
+2001-96

Summary by cubic

Make the email serialization pipeline SSR-capable. composeReactEmail can now render stored TipTap JSON with your extensions on any server, no Editor or DOM required, and includes a format option to skip Prettier when not needed.

  • New Features

    • composeReactEmail({ content, extensions }) returns html, text, and unformattedHtml; { editor } still works.
    • format (default true) skips Prettier when false; html === unformattedHtml in that mode.
    • Serializer hooks now receive a ComposeContext ({ doc, schema, extensions }); getEmailTheming accepts either an editor or a context.
    • Extension resolution and schema compilation are cached by extensions-array identity; mutated arrays re-resolve; already-resolved arrays (like editor.extensionManager.extensions) are rejected.
    • Added getGlobalContentFromJSON and exported EmailThemingResult.
    • Docs updated and SSR benchmarks added; output is byte-identical to editor-based exports.
  • Migration

    • Update custom serializer plugins: use context in getNodeStyles and BaseTemplate. Legacy editor-based plugins continue working in { editor } mode; accessing editor internals in { content } mode throws a clear error.
    • When using server-side compose, pass TipTap JSON content and the original extensions list; do not mix editor with content/extensions, and do not pass pre-resolved arrays.
    • Prefer format: false on server send paths to avoid the Prettier cost.