@emailens/engine 0.9.5 → 0.10.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.
@@ -1,4 +1,4 @@
1
- import { u as InputFormat } from './types-p9e1n-G_.cjs';
1
+ import { u as InputFormat } from './types-DEAn3IiX.cjs';
2
2
 
3
3
  /**
4
4
  * Unified error class for all email compilation failures.
@@ -1,4 +1,4 @@
1
- import { u as InputFormat } from './types-p9e1n-G_.js';
1
+ import { u as InputFormat } from './types-DEAn3IiX.js';
2
2
 
3
3
  /**
4
4
  * Unified error class for all email compilation failures.
package/dist/server.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'node:dns';
2
- import { j as DeliverabilityReport } from './types-p9e1n-G_.cjs';
2
+ import { j as DeliverabilityReport } from './types-DEAn3IiX.cjs';
3
3
 
4
4
  /**
5
5
  * DNS-based email deliverability checker.
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'node:dns';
2
- import { j as DeliverabilityReport } from './types-p9e1n-G_.js';
2
+ import { j as DeliverabilityReport } from './types-DEAn3IiX.js';
3
3
 
4
4
  /**
5
5
  * DNS-based email deliverability checker.
@@ -13,6 +13,10 @@ interface ExportPromptOptions {
13
13
  format?: "html" | "jsx" | "mjml" | "maizzle";
14
14
  /** Optional user goal for the fix (e.g. "keep the gradient header"). */
15
15
  intent?: string;
16
+ /** Content-overflow findings (from checkOverflow) — folded into the fix prompt. */
17
+ overflow?: OverflowIssue[];
18
+ /** Visual-bug findings with fixes (from checkVisual) — folded into the fix prompt. */
19
+ visual?: VisualIssue[];
16
20
  }
17
21
  declare function generateFixPrompt(options: ExportPromptOptions): string;
18
22
 
@@ -106,6 +110,13 @@ interface EmailClient {
106
110
  icon: string;
107
111
  deprecated?: string;
108
112
  }
113
+ type Severity = "error" | "warning" | "info";
114
+ /** Shared shape for every analyzer's issue objects. */
115
+ interface BaseIssue {
116
+ rule: string;
117
+ severity: Severity;
118
+ message: string;
119
+ }
109
120
  interface CodeFix {
110
121
  before: string;
111
122
  after: string;
@@ -114,7 +125,7 @@ interface CodeFix {
114
125
  }
115
126
  type FixType = "css" | "structural";
116
127
  interface CSSWarning {
117
- severity: "error" | "warning" | "info";
128
+ severity: Severity;
118
129
  client: string;
119
130
  property: string;
120
131
  message: string;
@@ -163,10 +174,7 @@ interface DiffResult {
163
174
  introduced: CSSWarning[];
164
175
  unchanged: CSSWarning[];
165
176
  }
166
- interface SpamIssue {
167
- rule: string;
168
- severity: "error" | "warning" | "info";
169
- message: string;
177
+ interface SpamIssue extends BaseIssue {
170
178
  detail?: string;
171
179
  }
172
180
  interface SpamReport {
@@ -182,10 +190,7 @@ interface SpamAnalysisOptions {
182
190
  /** Type of email — transactional emails are exempt from unsubscribe requirements */
183
191
  emailType?: "marketing" | "transactional";
184
192
  }
185
- interface LinkIssue {
186
- severity: "error" | "warning" | "info";
187
- rule: string;
188
- message: string;
193
+ interface LinkIssue extends BaseIssue {
189
194
  href?: string;
190
195
  text?: string;
191
196
  }
@@ -203,10 +208,7 @@ interface LinkReport {
203
208
  other: number;
204
209
  };
205
210
  }
206
- interface AccessibilityIssue {
207
- severity: "error" | "warning" | "info";
208
- rule: string;
209
- message: string;
211
+ interface AccessibilityIssue extends BaseIssue {
210
212
  element?: string;
211
213
  details?: string;
212
214
  }
@@ -214,10 +216,7 @@ interface AccessibilityReport {
214
216
  score: number;
215
217
  issues: AccessibilityIssue[];
216
218
  }
217
- interface ImageIssue {
218
- rule: string;
219
- severity: "error" | "warning" | "info";
220
- message: string;
219
+ interface ImageIssue extends BaseIssue {
221
220
  src?: string;
222
221
  }
223
222
  interface ImageInfo {
@@ -235,10 +234,7 @@ interface ImageReport {
235
234
  issues: ImageIssue[];
236
235
  images: ImageInfo[];
237
236
  }
238
- interface InboxPreviewIssue {
239
- rule: string;
240
- severity: "error" | "warning" | "info";
241
- message: string;
237
+ interface InboxPreviewIssue extends BaseIssue {
242
238
  }
243
239
  interface ClientTruncation {
244
240
  client: string;
@@ -257,10 +253,7 @@ interface InboxPreview {
257
253
  truncation: ClientTruncation[];
258
254
  issues: InboxPreviewIssue[];
259
255
  }
260
- interface SizeIssue {
261
- rule: string;
262
- severity: "error" | "warning" | "info";
263
- message: string;
256
+ interface SizeIssue extends BaseIssue {
264
257
  detail?: string;
265
258
  }
266
259
  interface SizeReport {
@@ -269,10 +262,23 @@ interface SizeReport {
269
262
  clipped: boolean;
270
263
  issues: SizeIssue[];
271
264
  }
272
- interface TemplateIssue {
273
- rule: string;
274
- severity: "error" | "warning" | "info";
275
- message: string;
265
+ interface OverflowIssue extends BaseIssue {
266
+ detail?: string;
267
+ }
268
+ interface OverflowReport {
269
+ /** True when any content is likely to overflow the email frame / viewport. */
270
+ hasOverflow: boolean;
271
+ issues: OverflowIssue[];
272
+ }
273
+ interface VisualIssue extends BaseIssue {
274
+ detail?: string;
275
+ /** Concrete correction to apply (e.g. a background-color / font-family line). */
276
+ fix?: string;
277
+ }
278
+ interface VisualReport {
279
+ issues: VisualIssue[];
280
+ }
281
+ interface TemplateIssue extends BaseIssue {
276
282
  variable: string;
277
283
  location: "text" | "attribute";
278
284
  }
@@ -293,11 +299,8 @@ interface DeliverabilityReport {
293
299
  score: number;
294
300
  issues: DeliverabilityIssue[];
295
301
  }
296
- interface DeliverabilityIssue {
297
- rule: string;
298
- severity: "error" | "warning" | "info";
299
- message: string;
302
+ interface DeliverabilityIssue extends BaseIssue {
300
303
  detail?: string;
301
304
  }
302
305
 
303
- 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 };
306
+ export { type AiProvider as A, type BaseIssue as B, type CSSWarning as C, type DiffResult as D, type EmailClient as E, type Framework as F, type TemplateIssue as G, type TokenEstimate as H, type ImageReport as I, type TokenEstimateWithWarnings as J, type VisualIssue as K, type LinkReport as L, estimateAiFixTokens as M, generateFixPrompt as N, type OverflowReport as O, type PreviewResult as P, heuristicTokenCount as Q, type SupportLevel as S, type TransformResult as T, type VisualReport as V, 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 OverflowIssue as w, type Severity as x, type SizeIssue as y, type SpamIssue as z };
@@ -13,6 +13,10 @@ interface ExportPromptOptions {
13
13
  format?: "html" | "jsx" | "mjml" | "maizzle";
14
14
  /** Optional user goal for the fix (e.g. "keep the gradient header"). */
15
15
  intent?: string;
16
+ /** Content-overflow findings (from checkOverflow) — folded into the fix prompt. */
17
+ overflow?: OverflowIssue[];
18
+ /** Visual-bug findings with fixes (from checkVisual) — folded into the fix prompt. */
19
+ visual?: VisualIssue[];
16
20
  }
17
21
  declare function generateFixPrompt(options: ExportPromptOptions): string;
18
22
 
@@ -106,6 +110,13 @@ interface EmailClient {
106
110
  icon: string;
107
111
  deprecated?: string;
108
112
  }
113
+ type Severity = "error" | "warning" | "info";
114
+ /** Shared shape for every analyzer's issue objects. */
115
+ interface BaseIssue {
116
+ rule: string;
117
+ severity: Severity;
118
+ message: string;
119
+ }
109
120
  interface CodeFix {
110
121
  before: string;
111
122
  after: string;
@@ -114,7 +125,7 @@ interface CodeFix {
114
125
  }
115
126
  type FixType = "css" | "structural";
116
127
  interface CSSWarning {
117
- severity: "error" | "warning" | "info";
128
+ severity: Severity;
118
129
  client: string;
119
130
  property: string;
120
131
  message: string;
@@ -163,10 +174,7 @@ interface DiffResult {
163
174
  introduced: CSSWarning[];
164
175
  unchanged: CSSWarning[];
165
176
  }
166
- interface SpamIssue {
167
- rule: string;
168
- severity: "error" | "warning" | "info";
169
- message: string;
177
+ interface SpamIssue extends BaseIssue {
170
178
  detail?: string;
171
179
  }
172
180
  interface SpamReport {
@@ -182,10 +190,7 @@ interface SpamAnalysisOptions {
182
190
  /** Type of email — transactional emails are exempt from unsubscribe requirements */
183
191
  emailType?: "marketing" | "transactional";
184
192
  }
185
- interface LinkIssue {
186
- severity: "error" | "warning" | "info";
187
- rule: string;
188
- message: string;
193
+ interface LinkIssue extends BaseIssue {
189
194
  href?: string;
190
195
  text?: string;
191
196
  }
@@ -203,10 +208,7 @@ interface LinkReport {
203
208
  other: number;
204
209
  };
205
210
  }
206
- interface AccessibilityIssue {
207
- severity: "error" | "warning" | "info";
208
- rule: string;
209
- message: string;
211
+ interface AccessibilityIssue extends BaseIssue {
210
212
  element?: string;
211
213
  details?: string;
212
214
  }
@@ -214,10 +216,7 @@ interface AccessibilityReport {
214
216
  score: number;
215
217
  issues: AccessibilityIssue[];
216
218
  }
217
- interface ImageIssue {
218
- rule: string;
219
- severity: "error" | "warning" | "info";
220
- message: string;
219
+ interface ImageIssue extends BaseIssue {
221
220
  src?: string;
222
221
  }
223
222
  interface ImageInfo {
@@ -235,10 +234,7 @@ interface ImageReport {
235
234
  issues: ImageIssue[];
236
235
  images: ImageInfo[];
237
236
  }
238
- interface InboxPreviewIssue {
239
- rule: string;
240
- severity: "error" | "warning" | "info";
241
- message: string;
237
+ interface InboxPreviewIssue extends BaseIssue {
242
238
  }
243
239
  interface ClientTruncation {
244
240
  client: string;
@@ -257,10 +253,7 @@ interface InboxPreview {
257
253
  truncation: ClientTruncation[];
258
254
  issues: InboxPreviewIssue[];
259
255
  }
260
- interface SizeIssue {
261
- rule: string;
262
- severity: "error" | "warning" | "info";
263
- message: string;
256
+ interface SizeIssue extends BaseIssue {
264
257
  detail?: string;
265
258
  }
266
259
  interface SizeReport {
@@ -269,10 +262,23 @@ interface SizeReport {
269
262
  clipped: boolean;
270
263
  issues: SizeIssue[];
271
264
  }
272
- interface TemplateIssue {
273
- rule: string;
274
- severity: "error" | "warning" | "info";
275
- message: string;
265
+ interface OverflowIssue extends BaseIssue {
266
+ detail?: string;
267
+ }
268
+ interface OverflowReport {
269
+ /** True when any content is likely to overflow the email frame / viewport. */
270
+ hasOverflow: boolean;
271
+ issues: OverflowIssue[];
272
+ }
273
+ interface VisualIssue extends BaseIssue {
274
+ detail?: string;
275
+ /** Concrete correction to apply (e.g. a background-color / font-family line). */
276
+ fix?: string;
277
+ }
278
+ interface VisualReport {
279
+ issues: VisualIssue[];
280
+ }
281
+ interface TemplateIssue extends BaseIssue {
276
282
  variable: string;
277
283
  location: "text" | "attribute";
278
284
  }
@@ -293,11 +299,8 @@ interface DeliverabilityReport {
293
299
  score: number;
294
300
  issues: DeliverabilityIssue[];
295
301
  }
296
- interface DeliverabilityIssue {
297
- rule: string;
298
- severity: "error" | "warning" | "info";
299
- message: string;
302
+ interface DeliverabilityIssue extends BaseIssue {
300
303
  detail?: string;
301
304
  }
302
305
 
303
- 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 };
306
+ export { type AiProvider as A, type BaseIssue as B, type CSSWarning as C, type DiffResult as D, type EmailClient as E, type Framework as F, type TemplateIssue as G, type TokenEstimate as H, type ImageReport as I, type TokenEstimateWithWarnings as J, type VisualIssue as K, type LinkReport as L, estimateAiFixTokens as M, generateFixPrompt as N, type OverflowReport as O, type PreviewResult as P, heuristicTokenCount as Q, type SupportLevel as S, type TransformResult as T, type VisualReport as V, 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 OverflowIssue as w, type Severity as x, type SizeIssue as y, type SpamIssue as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emailens/engine",
3
- "version": "0.9.5",
3
+ "version": "0.10.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": {
@@ -36,6 +36,7 @@
36
36
  "sync:caniemail": "bun run scripts/sync-caniemail.ts",
37
37
  "check:freshness": "bun run scripts/check-data-freshness.ts",
38
38
  "test": "bun test",
39
+ "test:render": "RENDER_TESTS=1 bun test src/__tests__/render.e2e.test.ts",
39
40
  "prepublishOnly": "bun run build"
40
41
  },
41
42
  "dependencies": {
@@ -89,6 +90,7 @@
89
90
  "@types/react": "^19.2.14",
90
91
  "bun-types": "^1.3.9",
91
92
  "mjml": "^4.15.0",
93
+ "playwright": "^1.62.0",
92
94
  "react": "^19.0.0",
93
95
  "sucrase": "^3.35.0",
94
96
  "tsup": "^8.4.0",