@emailens/engine 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +162 -7
  2. package/dist/{chunk-ZQF2XUIJ.js → chunk-2NMEKWO5.js} +2 -13
  3. package/dist/{chunk-3NDQOTPM.js → chunk-E4QE4WXE.js} +2 -2
  4. package/dist/{chunk-URZ4XPST.js → chunk-HBKZMR7V.js} +2 -2
  5. package/dist/{chunk-OY3DGZVU.js → chunk-PW6EUG2G.js} +2 -2
  6. package/dist/chunk-Z22AD2IU.js +14 -0
  7. package/dist/{chunk-ZQF2XUIJ.js.map → chunk-Z22AD2IU.js.map} +1 -1
  8. package/dist/compile/index.d.cts +2 -2
  9. package/dist/compile/index.d.ts +2 -2
  10. package/dist/compile/index.js +8 -7
  11. package/dist/compile/index.js.map +1 -1
  12. package/dist/index.cjs +3685 -507
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +80 -6
  15. package/dist/index.d.ts +80 -6
  16. package/dist/index.js +3678 -507
  17. package/dist/index.js.map +1 -1
  18. package/dist/maizzle-KKJF7XY7.js +9 -0
  19. package/dist/mjml-C46UWTTK.js +9 -0
  20. package/dist/react-email-C-p8ZL37.d.cts +58 -0
  21. package/dist/react-email-DcseUoOu.d.ts +58 -0
  22. package/dist/react-email-QKHRTEJW.js +9 -0
  23. package/dist/react-email-QKHRTEJW.js.map +1 -0
  24. package/dist/server.cjs +368 -0
  25. package/dist/server.cjs.map +1 -0
  26. package/dist/server.d.cts +80 -0
  27. package/dist/server.d.ts +80 -0
  28. package/dist/server.js +342 -0
  29. package/dist/server.js.map +1 -0
  30. package/dist/{react-email-BQljgXbo.d.cts → types-4P9AtKm_.d.cts} +65 -54
  31. package/dist/{react-email-BQljgXbo.d.ts → types-4P9AtKm_.d.ts} +65 -54
  32. package/package.json +13 -6
  33. package/dist/maizzle-Y2CLJ7GB.js +0 -8
  34. package/dist/mjml-D7IOYXXK.js +0 -8
  35. package/dist/react-email-4TW6IDAA.js +0 -8
  36. /package/dist/{maizzle-Y2CLJ7GB.js.map → chunk-2NMEKWO5.js.map} +0 -0
  37. /package/dist/{chunk-3NDQOTPM.js.map → chunk-E4QE4WXE.js.map} +0 -0
  38. /package/dist/{chunk-URZ4XPST.js.map → chunk-HBKZMR7V.js.map} +0 -0
  39. /package/dist/{chunk-OY3DGZVU.js.map → chunk-PW6EUG2G.js.map} +0 -0
  40. /package/dist/{mjml-D7IOYXXK.js.map → maizzle-KKJF7XY7.js.map} +0 -0
  41. /package/dist/{react-email-4TW6IDAA.js.map → mjml-C46UWTTK.js.map} +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @emailens/engine
2
2
 
3
- Email compatibility engine that transforms CSS per email client, analyzes compatibility, scores results, simulates dark mode, provides framework-aware fix snippets, and runs spam, accessibility, link, and image quality analysis.
3
+ Email compatibility engine that transforms CSS per email client, analyzes compatibility across **250+ CSS properties**, scores results, simulates dark mode, provides framework-aware fix snippets, checks DNS deliverability (SPF, DKIM, DMARC, MX, BIMI), and runs content hygiene, accessibility, link, image, inbox preview, size, and template variable analysis.
4
4
 
5
5
  Supports **12 email clients**: Gmail (Web, Android, iOS), Outlook (365, Windows), Apple Mail (macOS, iOS), Yahoo Mail, Samsung Mail, Thunderbird, HEY Mail, and Superhuman.
6
6
 
@@ -49,13 +49,22 @@ console.log(report.links.totalLinks);
49
49
 
50
50
  console.log(report.images.total);
51
51
  // 0
52
+
53
+ console.log(report.inboxPreview.subject);
54
+ // "Newsletter"
55
+
56
+ console.log(report.size.clipped);
57
+ // false
58
+
59
+ console.log(report.templateVariables.unresolvedCount);
60
+ // 0
52
61
  ```
53
62
 
54
63
  ## API Reference
55
64
 
56
65
  ### `auditEmail(html: string, options?: AuditOptions): AuditReport`
57
66
 
58
- **Unified API** — runs all email analysis checks in a single call. Returns compatibility warnings + scores, spam analysis, link validation, accessibility audit, and image analysis.
67
+ **Unified API** — runs all 8 email analysis checks in a single call. Returns compatibility warnings + scores, spam analysis, link validation, accessibility audit, image analysis, inbox preview extraction, size checking, and template variable detection.
59
68
 
60
69
  Internally parses the HTML once and shares the DOM across all analyzers.
61
70
 
@@ -74,12 +83,15 @@ const report = auditEmail(html, {
74
83
  // report.links — LinkReport
75
84
  // report.accessibility — AccessibilityReport
76
85
  // report.images — ImageReport
86
+ // report.inboxPreview — InboxPreview
87
+ // report.size — SizeReport
88
+ // report.templateVariables — TemplateReport
77
89
  ```
78
90
 
79
91
  **`AuditOptions`:**
80
92
  - `framework?: "jsx" | "mjml" | "maizzle"` — attach framework-specific fix snippets
81
93
  - `spam?: SpamAnalysisOptions` — options for spam analysis
82
- - `skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility">` — skip specific checks
94
+ - `skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables">` — skip specific checks
83
95
 
84
96
  ---
85
97
 
@@ -99,6 +111,9 @@ const spam = session.analyzeSpam();
99
111
  const links = session.validateLinks();
100
112
  const a11y = session.checkAccessibility();
101
113
  const images = session.analyzeImages();
114
+ const preview = session.extractInboxPreview();
115
+ const size = session.checkSize();
116
+ const templates = session.checkTemplateVariables();
102
117
 
103
118
  // Or run everything at once:
104
119
  const report = session.audit();
@@ -122,6 +137,10 @@ const darkMode = session.simulateDarkMode("gmail-web");
122
137
  | `validateLinks()` | Yes | Link validation |
123
138
  | `checkAccessibility()` | Yes | Accessibility audit |
124
139
  | `analyzeImages()` | Yes | Image analysis |
140
+ | `extractInboxPreview()` | Yes | Subject line and preheader extraction |
141
+ | `checkSize()` | Yes | Gmail clipping size check |
142
+ | `checkTemplateVariables()` | Yes | Unresolved template variable detection |
143
+ | `checkDeliverability(domain)` | — | DNS deliverability check (async, SPF/DKIM/DMARC/MX/BIMI) |
125
144
  | `transformForClient(clientId)` | No | Transform for one client |
126
145
  | `transformForAllClients()` | No | Transform for all 12 clients |
127
146
  | `simulateDarkMode(clientId)` | No | Dark mode simulation |
@@ -166,7 +185,9 @@ Get only warnings that require HTML restructuring (`fixType: "structural"`).
166
185
 
167
186
  ### `analyzeSpam(html: string, options?: SpamAnalysisOptions): SpamReport`
168
187
 
169
- Analyzes an HTML email for spam indicators. Returns a 0–100 score (100 = clean) and an array of issues. Uses heuristic rules modeled after SpamAssassin, CAN-SPAM, and GDPR.
188
+ Analyzes an HTML email for content hygiene issues. Returns a 0–100 score (100 = clean) and an array of issues. Uses heuristic rules modeled after SpamAssassin, CAN-SPAM, and GDPR.
189
+
190
+ > **Note:** Content hygiene heuristics — not a real spam filter. This checks for common anti-patterns that trigger spam filters but cannot predict actual inbox placement. For real spam testing, use the `checkSpamAssassin()` integration or a dedicated service.
170
191
 
171
192
  ```typescript
172
193
  import { analyzeSpam } from "@emailens/engine";
@@ -219,6 +240,90 @@ const report = analyzeImages(html);
219
240
 
220
241
  **Checks:** missing dimensions, oversized data URIs, missing alt, WebP/SVG format, missing `display:block`, tracking pixels, high image count.
221
242
 
243
+ ### `extractInboxPreview(html: string): InboxPreview`
244
+
245
+ Extracts subject line (from `<title>`) and preheader text from the email HTML. Returns per-client truncation data showing how subject and preheader will appear across 8 email clients.
246
+
247
+ ```typescript
248
+ import { extractInboxPreview } from "@emailens/engine";
249
+
250
+ const preview = extractInboxPreview(html);
251
+ // { subject: "Newsletter", preheader: "This week's highlights...",
252
+ // subjectLength: 10, preheaderLength: 28,
253
+ // truncation: [...], issues: [...] }
254
+ ```
255
+
256
+ **Checks:** missing `<title>`, subject too long, missing preheader, preheader too short/long, `&zwnj;&nbsp;` padding hack, emoji in subject.
257
+
258
+ ### `checkSize(html: string): SizeReport`
259
+
260
+ Checks email HTML byte size for Gmail clipping issues. Gmail clips messages larger than ~102KB, hiding content behind a "View entire message" link.
261
+
262
+ ```typescript
263
+ import { checkSize } from "@emailens/engine";
264
+
265
+ const report = checkSize(html);
266
+ // { htmlBytes: 45230, humanSize: "44.2 KB", clipped: false, issues: [] }
267
+ ```
268
+
269
+ **Checks:** Gmail clipping threshold (102KB), approaching clip threshold warning (90KB).
270
+
271
+ ### `checkTemplateVariables(html: string): TemplateReport`
272
+
273
+ Scans email HTML for unresolved template/merge variables in text content and key attributes (`href`, `src`, `alt`).
274
+
275
+ ```typescript
276
+ import { checkTemplateVariables } from "@emailens/engine";
277
+
278
+ const report = checkTemplateVariables(html);
279
+ // { unresolvedCount: 0, issues: [] }
280
+ ```
281
+
282
+ **Detects:** `{{var}}` (Handlebars/Mustache), `${var}` (ES template literals), `<%= %>` (ERB/EJS), `*|TAG|*` (Mailchimp), `%%tag%%` (Salesforce), `{merge_field}` (single-brace).
283
+
284
+ ---
285
+
286
+ ### `checkDeliverability(domain, options?): Promise<DeliverabilityReport>`
287
+
288
+ Validates email deliverability for a domain by checking MX, SPF, DKIM, DMARC, and BIMI DNS records. All DNS queries have a 5-second timeout. No external dependencies — uses `node:dns/promises`.
289
+
290
+ ```typescript
291
+ import { checkDeliverability } from "@emailens/engine";
292
+
293
+ const report = await checkDeliverability("example.com");
294
+ console.log(report.score); // 0-100
295
+ console.log(report.checks); // individual check results
296
+ console.log(report.issues); // actionable issues
297
+ ```
298
+
299
+ **Checks:**
300
+ - **MX** — domain can receive email
301
+ - **SPF** — authorized senders (`v=spf1`), flags dangerous `+all`
302
+ - **DKIM** — probes 15 common selectors (`google`, `selector1`, `default`, `dkim`, etc.)
303
+ - **DMARC** — policy enforcement (`v=DMARC1`), warns on `p=none`
304
+ - **BIMI** — brand indicator (optional, nice-to-have)
305
+
306
+ Also available as a session method: `session.checkDeliverability("example.com")`.
307
+
308
+ > **Note:** This is standalone async — not wired into the synchronous `auditEmail()` pipeline.
309
+
310
+ ### `checkSpamAssassin(input, options?): Promise<SpamAssassinResult | null>`
311
+
312
+ Opt-in integration with a local SpamAssassin installation. Shells out to `spamc` (daemon) or `spamassassin` (standalone) via `execFile`. Returns `null` if SpamAssassin is not installed.
313
+
314
+ ```typescript
315
+ import { checkSpamAssassin } from "@emailens/engine";
316
+
317
+ const result = await checkSpamAssassin(rawRfc2822Message);
318
+ if (result) {
319
+ console.log(result.score); // e.g. 3.2
320
+ console.log(result.isSpam); // true if score >= threshold
321
+ console.log(result.rules); // matched SpamAssassin rules
322
+ }
323
+ ```
324
+
325
+ > **Note:** Requires a full RFC 2822 message (headers + body), not just HTML.
326
+
222
327
  ---
223
328
 
224
329
  ### `transformForClient(html, clientId, framework?): TransformResult`
@@ -329,7 +434,7 @@ try {
329
434
 
330
435
  The engine internally parses HTML using [Cheerio](https://cheerio.js.org/). For a typical 50–100KB email, each `cheerio.load()` call takes 5–15ms. Without optimization, calling multiple analysis functions on the same HTML would parse it repeatedly.
331
436
 
332
- **`auditEmail()`** parses the HTML once and shares the DOM across all 5 analyzers (compatibility, spam, links, accessibility, images). Previously each analyzer parsed independently — this eliminates ~80% of parsing overhead in the audit path.
437
+ **`auditEmail()`** parses the HTML once and shares the DOM across all 8 analyzers (compatibility, spam, links, accessibility, images, inbox preview, size, template variables). Previously each analyzer parsed independently — this eliminates ~80% of parsing overhead in the audit path.
333
438
 
334
439
  **`createSession()`** extends this optimization to any combination of calls. When you need to call `analyzeEmail()` + `analyzeSpam()` + `validateLinks()` + other checks on the same HTML, a session shares a single parse across all of them.
335
440
 
@@ -337,7 +442,7 @@ The engine internally parses HTML using [Cheerio](https://cheerio.js.org/). For
337
442
 
338
443
  | Operation | Complexity | Notes |
339
444
  |---|---|---|
340
- | `auditEmail()` | 1 parse + 5 analyses | Shared DOM, most efficient for full reports |
445
+ | `auditEmail()` | 1 parse + 8 analyses | Shared DOM, most efficient for full reports |
341
446
  | `createSession()` | 1 parse upfront | Amortized across all subsequent analysis calls |
342
447
  | `analyzeEmail()` | 1 parse + CSS property scan | Scans `<style>` blocks + inline styles × 12 clients |
343
448
  | `transformForAllClients()` | 12 parses (1 per client) | Each client mutates its own DOM copy |
@@ -471,6 +576,9 @@ interface AuditReport {
471
576
  links: LinkReport;
472
577
  accessibility: AccessibilityReport;
473
578
  images: ImageReport;
579
+ inboxPreview: InboxPreview;
580
+ size: SizeReport;
581
+ templateVariables: TemplateReport;
474
582
  }
475
583
 
476
584
  interface EmailSession {
@@ -483,11 +591,35 @@ interface EmailSession {
483
591
  validateLinks(): LinkReport;
484
592
  checkAccessibility(): AccessibilityReport;
485
593
  analyzeImages(): ImageReport;
594
+ extractInboxPreview(): InboxPreview;
595
+ checkSize(): SizeReport;
596
+ checkTemplateVariables(): TemplateReport;
486
597
  transformForClient(clientId): TransformResult;
487
598
  transformForAllClients(): TransformResult[];
488
599
  simulateDarkMode(clientId): { html; warnings };
489
600
  }
490
601
 
602
+ interface InboxPreview {
603
+ subject: string | null;
604
+ preheader: string | null;
605
+ subjectLength: number;
606
+ preheaderLength: number;
607
+ truncation: ClientTruncation[];
608
+ issues: InboxPreviewIssue[];
609
+ }
610
+
611
+ interface SizeReport {
612
+ htmlBytes: number;
613
+ humanSize: string;
614
+ clipped: boolean;
615
+ issues: SizeIssue[];
616
+ }
617
+
618
+ interface TemplateReport {
619
+ unresolvedCount: number;
620
+ issues: TemplateIssue[];
621
+ }
622
+
491
623
  interface SpamReport {
492
624
  score: number; // 0–100 (100 = clean)
493
625
  level: "low" | "medium" | "high";
@@ -511,6 +643,29 @@ interface ImageReport {
511
643
  issues: ImageIssue[];
512
644
  images: ImageInfo[];
513
645
  }
646
+
647
+ interface DeliverabilityReport {
648
+ domain: string;
649
+ checks: DeliverabilityCheck[];
650
+ score: number; // 0-100
651
+ issues: DeliverabilityIssue[];
652
+ }
653
+
654
+ interface DeliverabilityCheck {
655
+ name: "spf" | "dkim" | "dmarc" | "mx" | "bimi";
656
+ status: "pass" | "fail" | "warn" | "skip";
657
+ message: string;
658
+ detail?: string;
659
+ record?: string;
660
+ }
661
+
662
+ interface SpamAssassinResult {
663
+ score: number;
664
+ threshold: number;
665
+ isSpam: boolean;
666
+ rules: Array<{ name: string; score: number; description: string }>;
667
+ rawOutput: string;
668
+ }
514
669
  ```
515
670
 
516
671
  ## Testing
@@ -519,7 +674,7 @@ interface ImageReport {
519
674
  bun test
520
675
  ```
521
676
 
522
- 467 tests covering analysis, transformation, dark mode simulation, framework-aware fixes, AI fix generation, token estimation, spam scoring, link validation, accessibility checking, image analysis, session API, security hardening, integration pipelines, and accuracy benchmarks.
677
+ 574 tests covering analysis (250+ CSS properties), transformation, dark mode simulation, framework-aware fixes, AI fix generation, token estimation, content hygiene scoring, link validation, accessibility checking, image analysis, inbox preview extraction, size checking, template variable detection, DNS deliverability checking, session API, security hardening, integration pipelines, accuracy benchmarks, and battle tests.
523
678
 
524
679
  ## License
525
680
 
@@ -30,20 +30,9 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
 
33
- // src/compile/errors.ts
34
- var CompileError = class extends Error {
35
- constructor(message, format, phase) {
36
- super(message);
37
- this.name = "CompileError";
38
- this.format = format;
39
- this.phase = phase;
40
- }
41
- };
42
-
43
33
  export {
44
34
  __spreadValues,
45
35
  __spreadProps,
46
- __objRest,
47
- CompileError
36
+ __objRest
48
37
  };
49
- //# sourceMappingURL=chunk-ZQF2XUIJ.js.map
38
+ //# sourceMappingURL=chunk-2NMEKWO5.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CompileError
3
- } from "./chunk-ZQF2XUIJ.js";
3
+ } from "./chunk-Z22AD2IU.js";
4
4
 
5
5
  // src/compile/mjml.ts
6
6
  var MAX_SOURCE_SIZE = 512e3;
@@ -61,4 +61,4 @@ async function compileMjml(source) {
61
61
  export {
62
62
  compileMjml
63
63
  };
64
- //# sourceMappingURL=chunk-3NDQOTPM.js.map
64
+ //# sourceMappingURL=chunk-E4QE4WXE.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CompileError
3
- } from "./chunk-ZQF2XUIJ.js";
3
+ } from "./chunk-Z22AD2IU.js";
4
4
 
5
5
  // src/compile/react-email.ts
6
6
  var MAX_SOURCE_SIZE = 256e3;
@@ -356,4 +356,4 @@ async function executeInQuickJs(code, React, ReactEmailComponents) {
356
356
  export {
357
357
  compileReactEmail
358
358
  };
359
- //# sourceMappingURL=chunk-URZ4XPST.js.map
359
+ //# sourceMappingURL=chunk-HBKZMR7V.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CompileError
3
- } from "./chunk-ZQF2XUIJ.js";
3
+ } from "./chunk-Z22AD2IU.js";
4
4
 
5
5
  // src/compile/maizzle.ts
6
6
  var MAX_SOURCE_SIZE = 512e3;
@@ -75,4 +75,4 @@ async function compileMaizzle(source) {
75
75
  export {
76
76
  compileMaizzle
77
77
  };
78
- //# sourceMappingURL=chunk-OY3DGZVU.js.map
78
+ //# sourceMappingURL=chunk-PW6EUG2G.js.map
@@ -0,0 +1,14 @@
1
+ // src/compile/errors.ts
2
+ var CompileError = class extends Error {
3
+ constructor(message, format, phase) {
4
+ super(message);
5
+ this.name = "CompileError";
6
+ this.format = format;
7
+ this.phase = phase;
8
+ }
9
+ };
10
+
11
+ export {
12
+ CompileError
13
+ };
14
+ //# sourceMappingURL=chunk-Z22AD2IU.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/compile/errors.ts"],"sourcesContent":["import type { InputFormat } from \"../types.js\";\r\n\r\n/**\r\n * Unified error class for all email compilation failures.\r\n *\r\n * Replaces the per-format error classes (ReactEmailCompileError,\r\n * MjmlCompileError, MaizzleCompileError) with a single class that\r\n * carries the source format and failure phase.\r\n */\r\nexport class CompileError extends Error {\r\n override name = \"CompileError\";\r\n readonly format: Exclude<InputFormat, \"html\">;\r\n readonly phase: \"validation\" | \"transpile\" | \"execution\" | \"render\" | \"compile\";\r\n\r\n constructor(\r\n message: string,\r\n format: CompileError[\"format\"],\r\n phase: CompileError[\"phase\"],\r\n ) {\r\n super(message);\r\n this.format = format;\r\n this.phase = phase;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,IAAM,eAAN,cAA2B,MAAM;AAAA,EAKtC,YACE,SACA,QACA,OACA;AACA,UAAM,OAAO;AATf,SAAS,OAAO;AAUd,SAAK,SAAS;AACd,SAAK,QAAQ;AAAA,EACf;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/compile/errors.ts"],"sourcesContent":["import type { InputFormat } from \"../types.js\";\r\n\r\n/**\r\n * Unified error class for all email compilation failures.\r\n *\r\n * Replaces the per-format error classes (ReactEmailCompileError,\r\n * MjmlCompileError, MaizzleCompileError) with a single class that\r\n * carries the source format and failure phase.\r\n */\r\nexport class CompileError extends Error {\r\n override name = \"CompileError\";\r\n readonly format: Exclude<InputFormat, \"html\">;\r\n readonly phase: \"validation\" | \"transpile\" | \"execution\" | \"render\" | \"compile\";\r\n\r\n constructor(\r\n message: string,\r\n format: CompileError[\"format\"],\r\n phase: CompileError[\"phase\"],\r\n ) {\r\n super(message);\r\n this.format = format;\r\n this.phase = phase;\r\n }\r\n}\r\n"],"mappings":";AASO,IAAM,eAAN,cAA2B,MAAM;AAAA,EAKtC,YACE,SACA,QACA,OACA;AACA,UAAM,OAAO;AATf,SAAS,OAAO;AAUd,SAAK,SAAS;AACd,SAAK,QAAQ;AAAA,EACf;AACF;","names":[]}
@@ -1,5 +1,5 @@
1
- import { n as InputFormat } from '../react-email-BQljgXbo.cjs';
2
- export { g as CompileError, h as CompileReactEmailOptions, p as SandboxStrategy, x as compileReactEmail } from '../react-email-BQljgXbo.cjs';
1
+ import { u as InputFormat } from '../types-4P9AtKm_.cjs';
2
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy, c as compileReactEmail } from '../react-email-C-p8ZL37.cjs';
3
3
 
4
4
  /**
5
5
  * Compile an MJML source string into an HTML email string.
@@ -1,5 +1,5 @@
1
- import { n as InputFormat } from '../react-email-BQljgXbo.js';
2
- export { g as CompileError, h as CompileReactEmailOptions, p as SandboxStrategy, x as compileReactEmail } from '../react-email-BQljgXbo.js';
1
+ import { u as InputFormat } from '../types-4P9AtKm_.js';
2
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy, c as compileReactEmail } from '../react-email-DcseUoOu.js';
3
3
 
4
4
  /**
5
5
  * Compile an MJML source string into an HTML email string.
@@ -1,15 +1,16 @@
1
1
  import {
2
2
  compileReactEmail
3
- } from "../chunk-URZ4XPST.js";
3
+ } from "../chunk-HBKZMR7V.js";
4
4
  import {
5
5
  compileMjml
6
- } from "../chunk-3NDQOTPM.js";
6
+ } from "../chunk-E4QE4WXE.js";
7
7
  import {
8
8
  compileMaizzle
9
- } from "../chunk-OY3DGZVU.js";
9
+ } from "../chunk-PW6EUG2G.js";
10
10
  import {
11
11
  CompileError
12
- } from "../chunk-ZQF2XUIJ.js";
12
+ } from "../chunk-Z22AD2IU.js";
13
+ import "../chunk-2NMEKWO5.js";
13
14
 
14
15
  // src/compile/index.ts
15
16
  import { extname } from "path";
@@ -18,15 +19,15 @@ async function compile(source, format, filePath) {
18
19
  case "html":
19
20
  return source;
20
21
  case "jsx": {
21
- const { compileReactEmail: compileReactEmail2 } = await import("../react-email-4TW6IDAA.js");
22
+ const { compileReactEmail: compileReactEmail2 } = await import("../react-email-QKHRTEJW.js");
22
23
  return compileReactEmail2(source);
23
24
  }
24
25
  case "mjml": {
25
- const { compileMjml: compileMjml2 } = await import("../mjml-D7IOYXXK.js");
26
+ const { compileMjml: compileMjml2 } = await import("../mjml-C46UWTTK.js");
26
27
  return compileMjml2(source);
27
28
  }
28
29
  case "maizzle": {
29
- const { compileMaizzle: compileMaizzle2 } = await import("../maizzle-Y2CLJ7GB.js");
30
+ const { compileMaizzle: compileMaizzle2 } = await import("../maizzle-KKJF7XY7.js");
30
31
  return compileMaizzle2(source);
31
32
  }
32
33
  default:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/compile/index.ts"],"sourcesContent":["import { extname } from \"node:path\";\r\nimport type { InputFormat } from \"../types.js\";\r\n\r\nexport { CompileError } from \"./errors.js\";\r\nexport { compileReactEmail } from \"./react-email.js\";\r\nexport type { SandboxStrategy, CompileReactEmailOptions } from \"./react-email.js\";\r\nexport { compileMjml } from \"./mjml.js\";\r\nexport { compileMaizzle } from \"./maizzle.js\";\r\n\r\n/**\r\n * Compile source to HTML based on format.\r\n * Returns the HTML unchanged if format is \"html\".\r\n * Lazily imports per-format compilers to avoid loading unnecessary deps.\r\n */\r\nexport async function compile(\r\n source: string,\r\n format: InputFormat,\r\n filePath?: string,\r\n): Promise<string> {\r\n switch (format) {\r\n case \"html\":\r\n return source;\r\n\r\n case \"jsx\": {\r\n const { compileReactEmail } = await import(\"./react-email.js\");\r\n return compileReactEmail(source);\r\n }\r\n\r\n case \"mjml\": {\r\n const { compileMjml } = await import(\"./mjml.js\");\r\n return compileMjml(source);\r\n }\r\n\r\n case \"maizzle\": {\r\n const { compileMaizzle } = await import(\"./maizzle.js\");\r\n return compileMaizzle(source);\r\n }\r\n\r\n default:\r\n throw new Error(`Unknown format: \"${format}\". Use html, jsx, mjml, or maizzle.`);\r\n }\r\n}\r\n\r\n/**\r\n * Auto-detect input format from file extension.\r\n */\r\nexport function detectFormat(filePath: string): InputFormat {\r\n const ext = extname(filePath).toLowerCase();\r\n\r\n switch (ext) {\r\n case \".tsx\":\r\n case \".jsx\":\r\n return \"jsx\";\r\n case \".mjml\":\r\n return \"mjml\";\r\n case \".html\":\r\n case \".htm\":\r\n return \"html\";\r\n default:\r\n return \"html\";\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,eAAe;AAcxB,eAAsB,QACpB,QACA,QACA,UACiB;AACjB,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO;AAAA,IAET,KAAK,OAAO;AACV,YAAM,EAAE,mBAAAA,mBAAkB,IAAI,MAAM,OAAO,4BAAkB;AAC7D,aAAOA,mBAAkB,MAAM;AAAA,IACjC;AAAA,IAEA,KAAK,QAAQ;AACX,YAAM,EAAE,aAAAC,aAAY,IAAI,MAAM,OAAO,qBAAW;AAChD,aAAOA,aAAY,MAAM;AAAA,IAC3B;AAAA,IAEA,KAAK,WAAW;AACd,YAAM,EAAE,gBAAAC,gBAAe,IAAI,MAAM,OAAO,wBAAc;AACtD,aAAOA,gBAAe,MAAM;AAAA,IAC9B;AAAA,IAEA;AACE,YAAM,IAAI,MAAM,oBAAoB,MAAM,qCAAqC;AAAA,EACnF;AACF;AAKO,SAAS,aAAa,UAA+B;AAC1D,QAAM,MAAM,QAAQ,QAAQ,EAAE,YAAY;AAE1C,UAAQ,KAAK;AAAA,IACX,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":["compileReactEmail","compileMjml","compileMaizzle"]}
1
+ {"version":3,"sources":["../../src/compile/index.ts"],"sourcesContent":["import { extname } from \"node:path\";\r\nimport type { InputFormat } from \"../types.js\";\r\n\r\nexport { CompileError } from \"./errors.js\";\r\nexport { compileReactEmail } from \"./react-email.js\";\r\nexport type { SandboxStrategy, CompileReactEmailOptions } from \"./react-email.js\";\r\nexport { compileMjml } from \"./mjml.js\";\r\nexport { compileMaizzle } from \"./maizzle.js\";\r\n\r\n/**\r\n * Compile source to HTML based on format.\r\n * Returns the HTML unchanged if format is \"html\".\r\n * Lazily imports per-format compilers to avoid loading unnecessary deps.\r\n */\r\nexport async function compile(\r\n source: string,\r\n format: InputFormat,\r\n filePath?: string,\r\n): Promise<string> {\r\n switch (format) {\r\n case \"html\":\r\n return source;\r\n\r\n case \"jsx\": {\r\n const { compileReactEmail } = await import(\"./react-email.js\");\r\n return compileReactEmail(source);\r\n }\r\n\r\n case \"mjml\": {\r\n const { compileMjml } = await import(\"./mjml.js\");\r\n return compileMjml(source);\r\n }\r\n\r\n case \"maizzle\": {\r\n const { compileMaizzle } = await import(\"./maizzle.js\");\r\n return compileMaizzle(source);\r\n }\r\n\r\n default:\r\n throw new Error(`Unknown format: \"${format}\". Use html, jsx, mjml, or maizzle.`);\r\n }\r\n}\r\n\r\n/**\r\n * Auto-detect input format from file extension.\r\n */\r\nexport function detectFormat(filePath: string): InputFormat {\r\n const ext = extname(filePath).toLowerCase();\r\n\r\n switch (ext) {\r\n case \".tsx\":\r\n case \".jsx\":\r\n return \"jsx\";\r\n case \".mjml\":\r\n return \"mjml\";\r\n case \".html\":\r\n case \".htm\":\r\n return \"html\";\r\n default:\r\n return \"html\";\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AAcxB,eAAsB,QACpB,QACA,QACA,UACiB;AACjB,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO;AAAA,IAET,KAAK,OAAO;AACV,YAAM,EAAE,mBAAAA,mBAAkB,IAAI,MAAM,OAAO,4BAAkB;AAC7D,aAAOA,mBAAkB,MAAM;AAAA,IACjC;AAAA,IAEA,KAAK,QAAQ;AACX,YAAM,EAAE,aAAAC,aAAY,IAAI,MAAM,OAAO,qBAAW;AAChD,aAAOA,aAAY,MAAM;AAAA,IAC3B;AAAA,IAEA,KAAK,WAAW;AACd,YAAM,EAAE,gBAAAC,gBAAe,IAAI,MAAM,OAAO,wBAAc;AACtD,aAAOA,gBAAe,MAAM;AAAA,IAC9B;AAAA,IAEA;AACE,YAAM,IAAI,MAAM,oBAAoB,MAAM,qCAAqC;AAAA,EACnF;AACF;AAKO,SAAS,aAAa,UAA+B;AAC1D,QAAM,MAAM,QAAQ,QAAQ,EAAE,YAAY;AAE1C,UAAQ,KAAK;AAAA,IACX,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":["compileReactEmail","compileMjml","compileMaizzle"]}