@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
@@ -174,6 +174,8 @@ interface SpamReport {
174
174
  interface SpamAnalysisOptions {
175
175
  /** Value of the List-Unsubscribe header, if present */
176
176
  listUnsubscribeHeader?: string;
177
+ /** Value of the List-Unsubscribe-Post header (RFC 8058 one-click unsubscribe) */
178
+ listUnsubscribePostHeader?: string;
177
179
  /** Type of email — transactional emails are exempt from unsubscribe requirements */
178
180
  emailType?: "marketing" | "transactional";
179
181
  }
@@ -230,60 +232,69 @@ interface ImageReport {
230
232
  issues: ImageIssue[];
231
233
  images: ImageInfo[];
232
234
  }
233
-
234
- /**
235
- * Unified error class for all email compilation failures.
236
- *
237
- * Replaces the per-format error classes (ReactEmailCompileError,
238
- * MjmlCompileError, MaizzleCompileError) with a single class that
239
- * carries the source format and failure phase.
240
- */
241
- declare class CompileError extends Error {
242
- name: string;
243
- readonly format: Exclude<InputFormat, "html">;
244
- readonly phase: "validation" | "transpile" | "execution" | "render" | "compile";
245
- constructor(message: string, format: CompileError["format"], phase: CompileError["phase"]);
235
+ interface InboxPreviewIssue {
236
+ rule: string;
237
+ severity: "error" | "warning" | "info";
238
+ message: string;
246
239
  }
247
-
248
- /**
249
- * Sandbox strategy for JSX execution.
250
- *
251
- * - `"vm"` — `node:vm` with hardened globals. Fast, zero-dependency,
252
- * but NOT a true security boundary (prototype-chain escapes are possible).
253
- * Suitable for CLI / local use where users run their own code.
254
- *
255
- * - `"isolated-vm"` (default) — Separate V8 isolate via the `isolated-vm`
256
- * npm package. True heap isolation; escapes require a V8 engine bug.
257
- * Requires `isolated-vm` to be installed (native addon).
258
- *
259
- * - `"quickjs"` — Validates code structure in a QuickJS WASM sandbox, then
260
- * executes in `node:vm` for React rendering. Security is equivalent to
261
- * `node:vm` — the QuickJS phase validates import restrictions only.
262
- * No native addons needed, but only supports ES2020 and is slower.
263
- * For true isolation on servers, use `isolated-vm`.
264
- */
265
- type SandboxStrategy = "vm" | "isolated-vm" | "quickjs";
266
- interface CompileReactEmailOptions {
267
- /**
268
- * Sandbox strategy to use for executing user JSX code.
269
- * @default "isolated-vm"
270
- */
271
- sandbox?: SandboxStrategy;
240
+ interface ClientTruncation {
241
+ client: string;
242
+ subjectLimit: number;
243
+ preheaderLimit: number;
244
+ truncatedSubject: string | null;
245
+ truncatedPreheader: string | null;
246
+ subjectTruncated: boolean;
247
+ preheaderTruncated: boolean;
248
+ }
249
+ interface InboxPreview {
250
+ subject: string | null;
251
+ preheader: string | null;
252
+ subjectLength: number;
253
+ preheaderLength: number;
254
+ truncation: ClientTruncation[];
255
+ issues: InboxPreviewIssue[];
256
+ }
257
+ interface SizeIssue {
258
+ rule: string;
259
+ severity: "error" | "warning" | "info";
260
+ message: string;
261
+ detail?: string;
262
+ }
263
+ interface SizeReport {
264
+ htmlBytes: number;
265
+ humanSize: string;
266
+ clipped: boolean;
267
+ issues: SizeIssue[];
268
+ }
269
+ interface TemplateIssue {
270
+ rule: string;
271
+ severity: "error" | "warning" | "info";
272
+ message: string;
273
+ variable: string;
274
+ location: "text" | "attribute";
275
+ }
276
+ interface TemplateReport {
277
+ unresolvedCount: number;
278
+ issues: TemplateIssue[];
279
+ }
280
+ interface DeliverabilityCheck {
281
+ name: "spf" | "dkim" | "dmarc" | "mx" | "bimi";
282
+ status: "pass" | "fail" | "warn" | "skip";
283
+ message: string;
284
+ detail?: string;
285
+ record?: string;
286
+ }
287
+ interface DeliverabilityReport {
288
+ domain: string;
289
+ checks: DeliverabilityCheck[];
290
+ score: number;
291
+ issues: DeliverabilityIssue[];
292
+ }
293
+ interface DeliverabilityIssue {
294
+ rule: string;
295
+ severity: "error" | "warning" | "info";
296
+ message: string;
297
+ detail?: string;
272
298
  }
273
- /**
274
- * Compile a React Email JSX/TSX source string into an HTML email string.
275
- *
276
- * Pipeline:
277
- * 1. Validate input (size, basic checks)
278
- * 2. Transpile JSX/TSX → CommonJS JS using sucrase
279
- * 3. Execute inside a sandbox (configurable strategy)
280
- * 4. Render the exported component to a full HTML email string
281
- *
282
- * Requires peer dependencies: sucrase, react, @react-email/components,
283
- * @react-email/render. Additionally:
284
- * - sandbox "isolated-vm" requires `isolated-vm`
285
- * - sandbox "quickjs" requires `quickjs-emscripten`
286
- */
287
- declare function compileReactEmail(source: string, options?: CompileReactEmailOptions): Promise<string>;
288
299
 
289
- export { type AiProvider as A, type CSSWarning as C, type DiffResult as D, type EmailClient as E, type Framework as F, type ImageReport as I, type LinkReport as L, type PreviewResult as P, type SpamAnalysisOptions as S, type TransformResult as T, type CodeFix as a, type ExportPromptOptions as b, type AiFixResult as c, type SpamReport as d, type AccessibilityReport as e, type AccessibilityIssue as f, CompileError as g, type CompileReactEmailOptions as h, type EstimateOptions as i, type ExportScope as j, type FixType as k, type ImageInfo as l, type ImageIssue as m, type InputFormat as n, type LinkIssue as o, type SandboxStrategy as p, type SpamIssue as q, type SupportLevel as r, type TokenEstimate as s, type TokenEstimateWithWarnings as t, estimateAiFixTokens as u, generateFixPrompt as v, heuristicTokenCount as w, compileReactEmail as x };
300
+ export { type AiProvider as A, type TokenEstimateWithWarnings as B, type CSSWarning as C, type DiffResult as D, type EmailClient as E, type Framework as F, estimateAiFixTokens as G, generateFixPrompt as H, type ImageReport as I, heuristicTokenCount as J, type LinkReport as L, type PreviewResult as P, type SupportLevel as S, type TransformResult as T, type CodeFix as a, type ExportPromptOptions as b, type AiFixResult as c, type SpamAnalysisOptions as d, type SpamReport as e, type AccessibilityReport as f, type InboxPreview as g, type SizeReport as h, type TemplateReport as i, type DeliverabilityReport as j, type AccessibilityIssue as k, type ClientTruncation as l, type DeliverabilityCheck as m, type DeliverabilityIssue as n, type EstimateOptions as o, type ExportScope as p, type FixType as q, type ImageInfo as r, type ImageIssue as s, type InboxPreviewIssue as t, type InputFormat as u, type LinkIssue as v, type SizeIssue as w, type SpamIssue as x, type TemplateIssue as y, type TokenEstimate as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emailens/engine",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Email compatibility engine — transforms CSS per email client, scores compatibility, simulates dark mode, suggests fixes, and runs spam, accessibility, link, and image quality analysis.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,6 +13,11 @@
13
13
  "types": "./dist/compile/index.d.ts",
14
14
  "import": "./dist/compile/index.js",
15
15
  "require": "./dist/compile/index.cjs"
16
+ },
17
+ "./server": {
18
+ "types": "./dist/server.d.ts",
19
+ "import": "./dist/server.js",
20
+ "require": "./dist/server.cjs"
16
21
  }
17
22
  },
18
23
  "types": "./dist/index.d.ts",
@@ -28,6 +33,7 @@
28
33
  "build": "tsup",
29
34
  "dev": "tsup --watch",
30
35
  "typecheck": "tsc --noEmit",
36
+ "sync:caniemail": "bun run scripts/sync-caniemail.ts",
31
37
  "test": "bun test",
32
38
  "prepublishOnly": "bun run build"
33
39
  },
@@ -36,14 +42,14 @@
36
42
  "css-tree": "^3.1.0"
37
43
  },
38
44
  "peerDependencies": {
39
- "sucrase": "^3.35.0",
40
- "react": "^18.0.0 || ^19.0.0",
45
+ "@maizzle/framework": ">=5.0.0",
41
46
  "@react-email/components": ">=0.0.36",
42
47
  "@react-email/render": ">=1.0.0",
43
- "mjml": ">=4.0.0",
44
- "@maizzle/framework": ">=5.0.0",
45
48
  "isolated-vm": ">=5.0.0",
46
- "quickjs-emscripten": ">=0.29.0"
49
+ "mjml": ">=4.0.0",
50
+ "quickjs-emscripten": ">=0.29.0",
51
+ "react": "^18.0.0 || ^19.0.0",
52
+ "sucrase": "^3.35.0"
47
53
  },
48
54
  "peerDependenciesMeta": {
49
55
  "sucrase": {
@@ -75,6 +81,7 @@
75
81
  "@maizzle/framework": "^5.0.0",
76
82
  "@react-email/components": "^0.0.36",
77
83
  "@react-email/render": "^1.0.6",
84
+ "@types/bun": "^1.3.9",
78
85
  "@types/css-tree": "^2.3.11",
79
86
  "@types/mjml": "^4.7.4",
80
87
  "@types/node": "^25.3.0",
@@ -1,8 +0,0 @@
1
- import {
2
- compileMaizzle
3
- } from "./chunk-OY3DGZVU.js";
4
- import "./chunk-ZQF2XUIJ.js";
5
- export {
6
- compileMaizzle
7
- };
8
- //# sourceMappingURL=maizzle-Y2CLJ7GB.js.map
@@ -1,8 +0,0 @@
1
- import {
2
- compileMjml
3
- } from "./chunk-3NDQOTPM.js";
4
- import "./chunk-ZQF2XUIJ.js";
5
- export {
6
- compileMjml
7
- };
8
- //# sourceMappingURL=mjml-D7IOYXXK.js.map
@@ -1,8 +0,0 @@
1
- import {
2
- compileReactEmail
3
- } from "./chunk-URZ4XPST.js";
4
- import "./chunk-ZQF2XUIJ.js";
5
- export {
6
- compileReactEmail
7
- };
8
- //# sourceMappingURL=react-email-4TW6IDAA.js.map