@emailens/cli 0.13.0 → 0.13.2
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.
- package/README.md +188 -186
- package/dist/{chunk-KZ7WXQVF.js → chunk-IM52U7ZV.js} +14 -6
- package/dist/chunk-IM52U7ZV.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/test.js +1 -1
- package/package.json +78 -78
- package/dist/chunk-KZ7WXQVF.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,186 +1,188 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<picture>
|
|
4
|
-
<source media="(prefers-color-scheme: dark)" srcset="./docs/wordmark-dark.svg">
|
|
5
|
-
<img src="./docs/wordmark-light.svg" alt="emailens / cli" width="444">
|
|
6
|
-
</picture>
|
|
7
|
-
|
|
8
|
-
**The email rendering linter for terminal and CI**
|
|
9
|
-
|
|
10
|
-
[](https://github.com/emailens/cli/actions/workflows/ci.yml)
|
|
11
|
-
[" srcset="./docs/wordmark-dark.svg">
|
|
5
|
+
<img src="./docs/wordmark-light.svg" alt="emailens / cli" width="444">
|
|
6
|
+
</picture>
|
|
7
|
+
|
|
8
|
+
**The email rendering linter for terminal and CI**
|
|
9
|
+
|
|
10
|
+
[](https://github.com/emailens/cli/actions/workflows/ci.yml)
|
|
11
|
+
[](https://www.npmjs.com/package/@emailens/cli)
|
|
12
|
+
[](https://github.com/emailens/mcp)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
$ emailens lint emails/welcome.html --fail-on-warning
|
|
18
|
+
emails/welcome.html
|
|
19
|
+
warn 7:10 outlook-windows-legacy display:flex Outlook Classic receives this flex box. The MSO branch needs a table.
|
|
20
|
+
warn 7:25 outlook-windows-legacy,yahoo-mail,yahoo-mail-android+2 gap Outlook Classic does not support "gap".
|
|
21
|
+
warn 8:32 gmail-web,outlook-windows-legacy,yahoo-mail-android+2 box-shadow Gmail does not support "box-shadow".
|
|
22
|
+
warn 14:5 yahoo-mail font-family Yahoo Mail drops an inline font-family that names a quoted font, like 'Courier New': that text shows in Yahoo's own font instead.
|
|
23
|
+
warn inboxPreview preheader-too-short Preheader is only 21 characters, so email clients may backfill with body text (recommended: 30+).
|
|
24
|
+
12 info: safe fallbacks, not problems. --info lists them.
|
|
25
|
+
|
|
26
|
+
1 file | 5 warnings
|
|
27
|
+
|
|
28
|
+
Failed: 5 warnings found (--failOnWarning)
|
|
29
|
+
See it rendered in Gmail, Outlook and Apple Mail, no signup: https://app.emailens.dev/try?utm_source=cli&utm_medium=lint
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
That is a welcome email with a flex row and a card shadow, checked against 21
|
|
33
|
+
email clients. Each finding has its line:column, and the exit code (here 2)
|
|
34
|
+
fails the build. The card's rounded corners are among the 12 info findings:
|
|
35
|
+
Outlook Classic draws them square, a safe fallback rather than a problem. The
|
|
36
|
+
last line appears only when the check fails; `--quiet` drops it, and `--json`
|
|
37
|
+
never has it.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g @emailens/cli
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Run
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
emailens lint 'emails/*.html'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or without installing: `npx @emailens/cli lint email.html`. HTML, React Email
|
|
52
|
+
(`.tsx`/`.jsx`), MJML and Maizzle are detected from the extension and compiled
|
|
53
|
+
first, so the check runs on the HTML that would be sent. No account and no
|
|
54
|
+
network: the analysis runs locally.
|
|
55
|
+
|
|
56
|
+
Exit codes: `0` clean, `1` errors, `2` warnings with `--fail-on-warning`, or
|
|
57
|
+
more than `--max-warnings`.
|
|
58
|
+
|
|
59
|
+
## Why not caniemail, or React Email's own checker?
|
|
60
|
+
|
|
61
|
+
[Can I email](https://www.caniemail.com) is the support table: one feature,
|
|
62
|
+
every client. It does not read your email. This CLI's support data is generated
|
|
63
|
+
from caniemail's (synced 2026-10-27), plus the cells a real-device screenshot
|
|
64
|
+
contradicted, each marked "Observed" with its date. What the CLI adds is the
|
|
65
|
+
reading: it finds the features your file uses, points at the line, scores each
|
|
66
|
+
client, and exits non-zero.
|
|
67
|
+
|
|
68
|
+
[React Email 4](https://resend.com/blog/react-email-4) added a compatibility
|
|
69
|
+
checker, also powered by Can I email, to its preview. Its CLI (`email dev`,
|
|
70
|
+
`build`, `start`, `export`) has no check command and no exit code for CI, per
|
|
71
|
+
[its docs](https://react.email/docs/cli). This CLI reads React Email files as
|
|
72
|
+
well as MJML, Maizzle and plain HTML, and fails the build.
|
|
73
|
+
|
|
74
|
+
Beyond CSS support, `lint` checks what neither covers: spam signals, links,
|
|
75
|
+
accessibility, images, the inbox preview text, size, template variables,
|
|
76
|
+
overflow, dark-mode and mobile contrast, Outlook VML, styles a client drops, and
|
|
77
|
+
client-targeting hacks.
|
|
78
|
+
|
|
79
|
+
## Extras
|
|
80
|
+
|
|
81
|
+
### `lint` options
|
|
82
|
+
|
|
83
|
+
| Flag | Alias | Description |
|
|
84
|
+
|------|-------|-------------|
|
|
85
|
+
| `--format` | `-f` | Input format: `html`, `jsx`, `mjml`, `maizzle`. `.vue` is `maizzle`. A pasted Vue file with no flag is detected. |
|
|
86
|
+
| `--json` | | Output as JSON, one line, every finding including info |
|
|
87
|
+
| `--info` | | List info findings too. By default they are counted, not listed: they are safe fallbacks, not problems |
|
|
88
|
+
| `--fail-on-warning` | | Exit 2 if warnings found |
|
|
89
|
+
| `--max-warnings` | | Fail if more than n warnings |
|
|
90
|
+
| `--reporter github` | | Also print GitHub Actions annotations, so each finding shows on its line in the pull request. Not with `--json` |
|
|
91
|
+
| `--quiet` | `-q` | No line about the hosted preview after a failure |
|
|
92
|
+
| `--skip` | | Comma-separated checks to skip: `spam,links,accessibility,images,compatibility,inboxPreview,size,templateVariables,overflow,visual,darkContrast,mobileContrast,design,vml,styleSurvival,targeting` |
|
|
93
|
+
| `--targeting-policy` | | `progressive` (default), `strict`, or `lenient` |
|
|
94
|
+
|
|
95
|
+
A `.emailensrc` in the project, the file the VS Code extension reads, can set
|
|
96
|
+
rule severities and skips; `--skip` on the command line wins.
|
|
97
|
+
|
|
98
|
+
Maizzle HTML needs `@maizzle/framework@5` installed beside the CLI. A `.vue`
|
|
99
|
+
file needs `@maizzle/framework@6`. One install is one major.
|
|
100
|
+
|
|
101
|
+
### Other commands
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
emailens analyze email.html # score per client, findings by client
|
|
105
|
+
emailens analyze email.html --clients gmail-web,outlook-windows --json
|
|
106
|
+
emailens audit email.html # compatibility plus every other check
|
|
107
|
+
emailens preview email.html --dark-mode # transforms, analysis, dark mode simulation
|
|
108
|
+
emailens preview email.html --screenshots --out ./shots # needs BROWSERLESS_URL and playwright-core
|
|
109
|
+
emailens export email.html -o ./report # self-contained HTML report (--json for JSON)
|
|
110
|
+
emailens fix email.html -o fixed.html # AI fix, needs ANTHROPIC_API_KEY (--estimate: tokens only)
|
|
111
|
+
emailens clients # the 21 clients
|
|
112
|
+
cat email.html | emailens analyze - # stdin
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `emailens inbox wait`
|
|
116
|
+
|
|
117
|
+
The CI step for what your app actually sends. Make your app send a real email
|
|
118
|
+
(sign-up, reset, receipt) to your Emailens test inbox, then wait for it. It
|
|
119
|
+
fails when the email is no longer the one you checked in Emailens, or changed
|
|
120
|
+
since it last arrived: a link moved to staging, an emptied variable, a new
|
|
121
|
+
line, an image gone, a size jump, signing that stopped passing. Codes, tokens
|
|
122
|
+
and tracking ids differ on every send and do not count. It needs an API key.
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
export EMAILENS_API_KEY=... # app.emailens.dev/dashboard/api
|
|
126
|
+
SINCE=$(date +%s000) # before the send
|
|
127
|
+
npm run send-signup-email # your app sends it
|
|
128
|
+
emailens inbox wait --subject "Welcome" --since "$SINCE"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Options: `--subject`, `--sender`, `--inbox <id>`, `--since` (ISO time, epoch
|
|
132
|
+
ms, or a duration such as `5m`; default 2 minutes back), `--timeout` (seconds,
|
|
133
|
+
default 60, at most 600), `--fail-on all|check|drift|none` (default `all`),
|
|
134
|
+
`--json`. Exit codes: `0` pass, `1` changed, `2` nothing arrived or Emailens
|
|
135
|
+
could not be reached.
|
|
136
|
+
|
|
137
|
+
### In your tests
|
|
138
|
+
|
|
139
|
+
The same check as `lint`, as an assertion. It throws with every failing
|
|
140
|
+
finding and its line, reads your `.emailensrc`, and works in Vitest, Jest and
|
|
141
|
+
bun:test.
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import { render } from "@react-email/render";
|
|
145
|
+
import { expectEmailToPass } from "@emailens/cli/test";
|
|
146
|
+
|
|
147
|
+
test("welcome email passes", async () => {
|
|
148
|
+
expectEmailToPass(await render(<Welcome name="Ada" />));
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Options: `failOnWarning`, `skip` (the `--skip` names), `framework`.
|
|
153
|
+
|
|
154
|
+
### In GitHub Actions
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
- uses: actions/setup-node@v4
|
|
158
|
+
with:
|
|
159
|
+
node-version: 22
|
|
160
|
+
- run: npx -y @emailens/cli lint 'emails/*.html' --fail-on-warning --reporter github
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`--reporter github` puts each finding on its line in the pull request's
|
|
164
|
+
changed files.
|
|
165
|
+
|
|
166
|
+
`**` globs are not supported: use a single-level wildcard or list the files.
|
|
167
|
+
For scores per client in a pull request comment, use the
|
|
168
|
+
[Action](https://github.com/emailens/action).
|
|
169
|
+
|
|
170
|
+
### Hosted
|
|
171
|
+
|
|
172
|
+
[app.emailens.dev/try](https://app.emailens.dev/try?utm_source=cli&utm_medium=readme)
|
|
173
|
+
renders the email per client: five clients with no account, all 21 with a free
|
|
174
|
+
one. The + Real plans add real-device screenshots: Outlook on Windows and Mac,
|
|
175
|
+
Apple Mail on Mac and iPad, and Gmail, Yahoo and Proton on the web.
|
|
176
|
+
|
|
177
|
+
## Ecosystem
|
|
178
|
+
|
|
179
|
+
| Project | What it is |
|
|
180
|
+
|---|---|
|
|
181
|
+
| [@emailens/engine](https://github.com/emailens/engine) | The analysis engine this CLI runs, as a library |
|
|
182
|
+
| [@emailens/mcp](https://github.com/emailens/mcp) | The same checks for coding agents: `claude mcp add emailens -- npx -y @emailens/mcp` |
|
|
183
|
+
| [emailens/action](https://github.com/emailens/action) | GitHub Action: fails the build, and can comment the scores per client on the pull request |
|
|
184
|
+
| [emailens/vscode](https://github.com/emailens/vscode) | VS Code extension: findings and preview in the editor |
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
MIT
|
|
@@ -416,15 +416,22 @@ function mergeLocs(into, from) {
|
|
|
416
416
|
into.sort((a, b) => a.offset - b.offset);
|
|
417
417
|
return truncated;
|
|
418
418
|
}
|
|
419
|
+
function whereNoLine(message, issue) {
|
|
420
|
+
return !issue.loc && issue.element ? `${message}: ${issue.element}` : message;
|
|
421
|
+
}
|
|
419
422
|
function flattenToLintIssues(report, skip) {
|
|
420
423
|
const issues = [];
|
|
421
424
|
if (!skip.includes("compatibility")) {
|
|
422
425
|
const seenProps = /* @__PURE__ */ new Map();
|
|
426
|
+
const ownCheck = new Set(
|
|
427
|
+
["styleSurvival", "size", "vml"].filter((check) => !skip.includes(check)).flatMap((check) => report[check].issues.map((i) => i.rule))
|
|
428
|
+
);
|
|
423
429
|
for (const w of report.compatibility.warnings) {
|
|
430
|
+
if (ownCheck.has(w.property)) continue;
|
|
424
431
|
const key = `${w.property}\0${w.severity}`;
|
|
425
432
|
const existing = seenProps.get(key);
|
|
426
433
|
if (existing) {
|
|
427
|
-
existing.clients.push(w.client);
|
|
434
|
+
if (!existing.clients.includes(w.client)) existing.clients.push(w.client);
|
|
428
435
|
existing.loc ??= w.loc;
|
|
429
436
|
if (mergeLocs(existing.locs, w.locs)) existing.locsTruncated = true;
|
|
430
437
|
if (w.locsTruncated) existing.locsTruncated = true;
|
|
@@ -481,7 +488,7 @@ function flattenToLintIssues(report, skip) {
|
|
|
481
488
|
severity: issue.severity,
|
|
482
489
|
category: "accessibility",
|
|
483
490
|
rule: issue.rule,
|
|
484
|
-
message: issue.message,
|
|
491
|
+
message: whereNoLine(issue.message, issue),
|
|
485
492
|
...issue.loc ? { loc: issue.loc } : {}
|
|
486
493
|
});
|
|
487
494
|
}
|
|
@@ -558,7 +565,7 @@ function flattenToLintIssues(report, skip) {
|
|
|
558
565
|
severity: issue.severity,
|
|
559
566
|
category: "darkContrast",
|
|
560
567
|
rule: issue.rule,
|
|
561
|
-
message: issue.message.replace(/^Dark mode: /, ""),
|
|
568
|
+
message: whereNoLine(issue.message.replace(/^Dark mode: /, ""), issue),
|
|
562
569
|
...issue.loc ? { loc: issue.loc } : {}
|
|
563
570
|
});
|
|
564
571
|
}
|
|
@@ -569,7 +576,7 @@ function flattenToLintIssues(report, skip) {
|
|
|
569
576
|
severity: issue.severity,
|
|
570
577
|
category: "mobileContrast",
|
|
571
578
|
rule: issue.rule,
|
|
572
|
-
message: issue.message.replace(/^At mobile width: /, ""),
|
|
579
|
+
message: whereNoLine(issue.message.replace(/^At mobile width: /, ""), issue),
|
|
573
580
|
...issue.loc ? { loc: issue.loc } : {}
|
|
574
581
|
});
|
|
575
582
|
}
|
|
@@ -625,7 +632,8 @@ function flattenToLintIssues(report, skip) {
|
|
|
625
632
|
}
|
|
626
633
|
}
|
|
627
634
|
const order = { error: 0, warning: 1, info: 2 };
|
|
628
|
-
|
|
635
|
+
const at = (i) => i.loc?.offset ?? Number.MAX_SAFE_INTEGER;
|
|
636
|
+
issues.sort((a, b) => order[a.severity] - order[b.severity] || at(a) - at(b));
|
|
629
637
|
return issues;
|
|
630
638
|
}
|
|
631
639
|
|
|
@@ -642,4 +650,4 @@ export {
|
|
|
642
650
|
lint_default,
|
|
643
651
|
flattenToLintIssues
|
|
644
652
|
};
|
|
645
|
-
//# sourceMappingURL=chunk-
|
|
653
|
+
//# sourceMappingURL=chunk-IM52U7ZV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/project-config.ts","../src/commands/lint.ts","../src/utils.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\r\nimport { dirname, join, parse } from \"node:path\";\r\n\r\n/**\r\n * `.emailensrc`, shared with the editor extension.\r\n *\r\n * A severity policy is a team decision, and a team decision that lives in one\r\n * person's editor settings is one CI disagrees with. The extension has read\r\n * this file since it shipped; the CLI reading the same keys is what makes the\r\n * two agree: a rule demoted in the editor and still failing the build is the\r\n * worst of both.\r\n *\r\n * Precedence here is the other way round from the editor's, deliberately. A\r\n * command-line flag is an explicit choice for one invocation and wins; an\r\n * editor setting is ambient, so the repo's file wins there.\r\n */\r\n\r\n/** What a rule may be turned into. `off` means not reported at all. */\r\nexport type RuleSeverity = \"error\" | \"warning\" | \"info\" | \"off\";\r\nexport type RuleSeverities = Record<string, RuleSeverity>;\r\n\r\nconst SEVERITIES: readonly string[] = [\"error\", \"warning\", \"info\", \"off\"];\r\n\r\nexport interface ProjectConfig {\r\n skip?: string[];\r\n rules?: RuleSeverities;\r\n /** Where it was read from, for error messages. */\r\n source?: string;\r\n /** Entries that were not usable, named rather than dropped in silence. */\r\n invalid: string[];\r\n}\r\n\r\n/**\r\n * Read a `rules` map, keeping what is usable and naming what is not.\r\n *\r\n * A misspelled severity is silently nothing otherwise, and a rule someone\r\n * believes is switched off but is not is worse than no setting at all.\r\n */\r\nexport function parseRules(value: unknown): { rules: RuleSeverities; invalid: string[] } {\r\n const rules: RuleSeverities = {};\r\n const invalid: string[] = [];\r\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { rules, invalid };\r\n\r\n for (const [rule, severity] of Object.entries(value as Record<string, unknown>)) {\r\n if (typeof severity === \"string\" && SEVERITIES.includes(severity)) {\r\n rules[rule] = severity as RuleSeverity;\r\n } else {\r\n invalid.push(`${rule}: ${JSON.stringify(severity)}`);\r\n }\r\n }\r\n return { rules, invalid };\r\n}\r\n\r\n/** Parse a config body that has already been read off disk. */\r\nexport function parseProjectConfig(\r\n source: string,\r\n from: \"emailensrc\" | \"package.json\",\r\n): ProjectConfig | undefined {\r\n let parsed: unknown;\r\n try {\r\n parsed = JSON.parse(source);\r\n } catch {\r\n // A malformed file is a reason to lint without it, not a reason to stop.\r\n return undefined;\r\n }\r\n if (!parsed || typeof parsed !== \"object\") return undefined;\r\n\r\n const body = from === \"package.json\" ? (parsed as Record<string, unknown>).emailens : parsed;\r\n if (!body || typeof body !== \"object\") return undefined;\r\n\r\n const config: ProjectConfig = { invalid: [] };\r\n const skip = (body as Record<string, unknown>).skip;\r\n if (Array.isArray(skip) && skip.every((s) => typeof s === \"string\")) config.skip = skip;\r\n\r\n const { rules, invalid } = parseRules((body as Record<string, unknown>).rules);\r\n if (Object.keys(rules).length) config.rules = rules;\r\n config.invalid = invalid;\r\n\r\n return config.skip || config.rules || invalid.length ? config : undefined;\r\n}\r\n\r\n/**\r\n * Find and read the nearest config, walking up from `from`.\r\n *\r\n * Upward, because `emailens lint emails/*.html` is usually run from the repo\r\n * root while the file being linted is not, and the config belongs to the\r\n * project rather than to the directory the shell happens to be in.\r\n */\r\nexport function loadProjectConfig(from: string = process.cwd()): ProjectConfig | undefined {\r\n const root = parse(from).root;\r\n for (let dir = from; ; dir = dirname(dir)) {\r\n for (const [name, kind] of [\r\n [\".emailensrc\", \"emailensrc\"],\r\n [\"package.json\", \"package.json\"],\r\n ] as const) {\r\n const path = join(dir, name);\r\n if (!existsSync(path)) continue;\r\n let body: string;\r\n try {\r\n body = readFileSync(path, \"utf-8\");\r\n } catch {\r\n continue;\r\n }\r\n const config = parseProjectConfig(body, kind);\r\n if (config) return { ...config, source: path };\r\n }\r\n if (dir === root) return undefined;\r\n }\r\n}\r\n\r\n/** Apply per-rule severities. `off` drops the issue entirely. */\r\nexport function applySeverities<T extends { rule: string; severity: \"error\" | \"warning\" | \"info\" }>(\r\n issues: T[],\r\n rules?: RuleSeverities,\r\n): T[] {\r\n if (!rules || !Object.keys(rules).length) return issues;\r\n const out: T[] = [];\r\n for (const issue of issues) {\r\n const severity = rules[issue.rule];\r\n if (severity === \"off\") continue;\r\n out.push(severity ? { ...issue, severity } : issue);\r\n }\r\n return out;\r\n}\r\n","import { defineCommand } from \"citty\";\r\nimport pc from \"picocolors\";\r\nimport { parseTargetingPolicy, positionsApply, readInput, resolveFormat, TARGETING_POLICY_ARG, toFramework } from \"../utils.js\";\r\nimport { compile } from \"@emailens/engine/compile\";\r\nimport {\r\n auditEmail,\r\n CompileError,\r\n MAX_WARNING_LOCATIONS,\r\n type AuditReport,\r\n type SourceLocation,\r\n} from \"@emailens/engine\";\r\nimport { applySeverities, loadProjectConfig } from \"../project-config.js\";\r\nimport { readdir } from \"node:fs/promises\";\r\nimport { resolve, relative } from \"node:path\";\r\n\r\nexport interface LintIssue {\r\n severity: \"error\" | \"warning\" | \"info\";\r\n category: string;\r\n rule: string;\r\n message: string;\r\n detail?: string;\r\n /** Where in the file the issue is. HTML sources only, see `positionsApply`. */\r\n loc?: SourceLocation;\r\n /** Every place a CSS property breaks, in document order. */\r\n locs?: SourceLocation[];\r\n /** `locs` is capped and does not list every occurrence. */\r\n locsTruncated?: boolean;\r\n}\r\n\r\nexport interface LintFileResult {\r\n file: string;\r\n issues: LintIssue[];\r\n errors: number;\r\n warnings: number;\r\n}\r\n\r\nconst VALID_SKIPS = new Set([\r\n \"spam\", \"links\", \"accessibility\", \"images\",\r\n \"compatibility\", \"inboxPreview\", \"size\", \"templateVariables\", \"overflow\", \"visual\",\r\n \"darkContrast\", \"mobileContrast\", \"design\", \"vml\", \"styleSurvival\", \"targeting\",\r\n]);\r\n\r\nexport default defineCommand({\r\n meta: {\r\n name: \"lint\",\r\n description: \"Lint HTML emails for compatibility, spam, accessibility, and more. CI/CD-friendly with structured exit codes.\",\r\n },\r\n args: {\r\n input: {\r\n type: \"positional\",\r\n description: \"HTML file path or glob pattern\",\r\n required: true,\r\n },\r\n format: {\r\n type: \"string\",\r\n alias: \"f\",\r\n description: \"Input format: html, jsx, mjml, maizzle\",\r\n },\r\n json: {\r\n type: \"boolean\",\r\n description: \"Output as JSON\",\r\n },\r\n info: {\r\n type: \"boolean\",\r\n description: \"List info findings too: safe fallbacks, not problems (counted, not listed, by default)\",\r\n },\r\n failOnWarning: {\r\n type: \"boolean\",\r\n description: \"Exit 2 if warnings found\",\r\n },\r\n skip: {\r\n type: \"string\",\r\n description: \"Comma-separated checks to skip: spam,links,accessibility,images,compatibility,inboxPreview,size,templateVariables,overflow,visual,vml,styleSurvival,targeting\",\r\n },\r\n targetingPolicy: TARGETING_POLICY_ARG,\r\n maxWarnings: {\r\n type: \"string\",\r\n description: \"Fail if more than n warnings\",\r\n },\r\n reporter: {\r\n type: \"string\",\r\n description: \"Also print findings as GitHub Actions annotations, on the lines of the pull request: github\",\r\n },\r\n quiet: {\r\n type: \"boolean\",\r\n alias: \"q\",\r\n description: \"Suppress decorations: no hosted-preview line after a failure\",\r\n },\r\n },\r\n async run({ args }) {\r\n try {\r\n if (args.format) resolveFormat(args.format);\r\n if (args.reporter !== undefined && args.reporter !== \"github\") {\r\n throw new Error(`Unknown reporter \"${args.reporter}\". Valid: github`);\r\n }\r\n // Workflow commands share stdout with the JSON, which must stay one parseable line.\r\n if (args.reporter && args.json) throw new Error(\"--reporter github cannot be combined with --json\");\r\n // `.emailensrc`, the same file the editor extension reads. Without this\r\n // a rule demoted in the editor still fails the build, which is the worst\r\n // of both: the panel says it does not matter and CI says it does.\r\n const project = loadProjectConfig();\r\n if (project?.invalid.length && !args.json) {\r\n console.error(\r\n pc.yellow(\r\n `${project.source}: ignoring ${project.invalid.join(\", \")}, ` +\r\n `a severity must be \"error\", \"warning\", \"info\" or \"off\".`,\r\n ),\r\n );\r\n }\r\n\r\n // Parse --skip. A flag is an explicit choice for this invocation and\r\n // wins over the file; in the editor it is the other way round, because\r\n // an editor setting is ambient and the repo's file is the team's.\r\n const skip: Array<string> = [];\r\n if (!args.skip) {\r\n for (const s of project?.skip ?? []) {\r\n // Named rather than dropped: a team that believes spam checking is\r\n // off and finds it is not has been misled by their own config.\r\n if (VALID_SKIPS.has(s)) skip.push(s);\r\n else if (!args.json) {\r\n console.error(pc.yellow(`${project?.source}: unknown skip value \"${s}\", ignoring.`));\r\n }\r\n }\r\n }\r\n if (args.skip) {\r\n for (const s of args.skip.split(\",\").map((s) => s.trim()).filter(Boolean)) {\r\n if (!VALID_SKIPS.has(s)) {\r\n throw new Error(`Unknown skip value \"${s}\". Valid: ${Array.from(VALID_SKIPS).join(\", \")}`);\r\n }\r\n skip.push(s);\r\n }\r\n }\r\n\r\n const maxWarningsRaw = args.maxWarnings !== undefined ? parseInt(args.maxWarnings, 10) : undefined;\r\n if (maxWarningsRaw !== undefined && isNaN(maxWarningsRaw)) {\r\n throw new Error(`--maxWarnings must be a number, got: ${args.maxWarnings}`);\r\n }\r\n const maxWarnings = maxWarningsRaw ?? Infinity;\r\n const files = await resolveGlob(args.input);\r\n\r\n if (files.length === 0) {\r\n if (args.json) {\r\n console.log(JSON.stringify({ files: [], totalErrors: 0, totalWarnings: 0 }));\r\n } else {\r\n console.error(pc.red(`No files found matching: ${args.input}`));\r\n }\r\n process.exit(1);\r\n }\r\n\r\n const results: LintFileResult[] = [];\r\n let totalErrors = 0;\r\n let totalWarnings = 0;\r\n\r\n for (const file of files) {\r\n const source = await readInput(file);\r\n const format = resolveFormat(args.format, file, source);\r\n const html = await compile(source, format);\r\n const framework = toFramework(format);\r\n\r\n // Positions describe the HTML that was analyzed. For jsx/mjml/maizzle\r\n // that is compiled output whose lines have nothing to do with the file\r\n // the user wrote, so we only ask for, and only report, positions when\r\n // the source IS the analyzed HTML.\r\n const positions = positionsApply(format);\r\n\r\n const targetingPolicy = parseTargetingPolicy(args.targetingPolicy);\r\n const report = auditEmail(html, {\r\n framework,\r\n skip: skip as AuditSkipType[],\r\n positions,\r\n targetingPolicy,\r\n });\r\n\r\n const issues = applySeverities(flattenToLintIssues(report, skip), project?.rules);\r\n const errors = issues.filter((i) => i.severity === \"error\").length;\r\n const warnings = issues.filter((i) => i.severity === \"warning\").length;\r\n\r\n results.push({ file: relative(process.cwd(), file), issues, errors, warnings });\r\n totalErrors += errors;\r\n totalWarnings += warnings;\r\n }\r\n\r\n if (args.reporter === \"github\") {\r\n for (const line of githubAnnotations(results, { info: args.info })) console.log(line);\r\n }\r\n\r\n // Output\r\n if (args.json) {\r\n // Compact: the usual reader is a program or an agent paying per token.\r\n console.log(JSON.stringify({ files: results, totalErrors, totalWarnings }));\r\n } else {\r\n for (const result of results) {\r\n console.log(pc.underline(result.file));\r\n // Info is a safe fallback, not a problem. Listed, it was most of the\r\n // output and buried the warnings: agents in the coding-agent\r\n // benchmark stopped with real warnings left among dozens of infos.\r\n const shown = args.info ? result.issues : result.issues.filter((i) => i.severity !== \"info\");\r\n const hidden = result.issues.length - shown.length;\r\n if (shown.length === 0) {\r\n console.log(` ${pc.green(\"pass\")} No issues found`);\r\n } else {\r\n // Only reserve the position column when this file has positions to\r\n // show; compiled sources never do.\r\n const width = shown.reduce(\r\n (w, i) => (i.loc ? Math.max(w, `${i.loc.line}:${i.loc.column}`.length) : w),\r\n 0,\r\n );\r\n for (const issue of shown) {\r\n const sev = issue.severity === \"error\"\r\n ? pc.red(\"error\")\r\n : issue.severity === \"warning\"\r\n ? pc.yellow(\"warn \")\r\n : pc.blue(\"info \");\r\n const pos = width > 0\r\n ? `${pc.dim((issue.loc ? `${issue.loc.line}:${issue.loc.column}` : \"\").padStart(width))} `\r\n : \"\";\r\n console.log(` ${sev} ${pos}${pc.dim(issue.category.padEnd(18))} ${pc.bold(issue.rule.padEnd(22))} ${issue.message}`);\r\n }\r\n }\r\n if (hidden > 0) {\r\n console.log(pc.dim(` ${hidden} info: safe fallbacks, not problems. --info lists them.`));\r\n }\r\n console.log();\r\n }\r\n\r\n const summary = [\r\n `${files.length} file${files.length === 1 ? \"\" : \"s\"}`,\r\n totalErrors > 0 ? pc.red(`${totalErrors} error${totalErrors === 1 ? \"\" : \"s\"}`) : null,\r\n totalWarnings > 0 ? pc.yellow(`${totalWarnings} warning${totalWarnings === 1 ? \"\" : \"s\"}`) : null,\r\n totalErrors === 0 && totalWarnings === 0 ? pc.green(\"all clean\") : null,\r\n ].filter(Boolean).join(\" | \");\r\n\r\n console.log(summary);\r\n }\r\n\r\n // The exit code, decided once so the human output can follow it.\r\n let exitCode = 0;\r\n let reason: string | null = null;\r\n if (totalErrors > 0) {\r\n exitCode = 1;\r\n } else if (args.failOnWarning && totalWarnings > 0) {\r\n exitCode = 2;\r\n reason = pc.yellow(`\\nFailed: ${totalWarnings} warning${totalWarnings === 1 ? \"\" : \"s\"} found (--failOnWarning)`);\r\n } else if (Number.isFinite(maxWarnings) && totalWarnings > maxWarnings) {\r\n exitCode = 2;\r\n reason = pc.red(`\\nExceeded max warnings: ${totalWarnings} > ${maxWarnings}`);\r\n }\r\n\r\n if (!args.json) {\r\n if (reason) console.error(reason);\r\n const hint = failureHint(exitCode, { quiet: args.quiet });\r\n if (hint) console.log(pc.dim(hint));\r\n }\r\n\r\n if (exitCode !== 0) process.exit(exitCode);\r\n } catch (err) {\r\n if (err instanceof CompileError) {\r\n console.error(pc.red(`Compilation failed (${err.phase}): ${err.message}`));\r\n } else {\r\n console.error(pc.red((err as Error).message));\r\n }\r\n process.exit(1);\r\n }\r\n },\r\n});\r\n\r\n/**\r\n * The one line from a failed local lint to the hosted product: the same email\r\n * rendered per client, which a list of findings cannot show. /try needs no\r\n * account. Failures only (a clean run is not an occasion to sell), never in\r\n * --json, and --quiet drops it. Exported for the tests.\r\n */\r\nexport const HOSTED_HINT =\r\n \"See it rendered in Gmail, Outlook and Apple Mail, no signup: https://app.emailens.dev/try?utm_source=cli&utm_medium=lint\";\r\n\r\nexport function failureHint(exitCode: number, options: { quiet?: boolean } = {}): string | null {\r\n if (exitCode === 0 || options.quiet) return null;\r\n return HOSTED_HINT;\r\n}\r\n\r\n/**\r\n * GitHub Actions workflow commands, one per finding, so each lands on its line\r\n * in the pull request diff. Paths are relative to the checkout, which is what\r\n * GitHub matches against; compiled sources have no position and annotate the\r\n * file. Info is a safe fallback and stays out unless --info. Exported for the tests.\r\n */\r\nexport function githubAnnotations(\r\n results: LintFileResult[],\r\n options: { info?: boolean; root?: string } = {},\r\n): string[] {\r\n const root = options.root ?? process.env.GITHUB_WORKSPACE ?? process.cwd();\r\n const level = { error: \"error\", warning: \"warning\", info: \"notice\" } as const;\r\n // https://docs.github.com/actions/reference/workflow-commands-for-github-actions\r\n const data = (s: string) => s.replace(/%/g, \"%25\").replace(/\\r/g, \"%0D\").replace(/\\n/g, \"%0A\");\r\n const prop = (s: string) => data(s).replace(/:/g, \"%3A\").replace(/,/g, \"%2C\");\r\n const lines: string[] = [];\r\n for (const result of results) {\r\n const file = relative(root, resolve(result.file)).split(\"\\\\\").join(\"/\");\r\n for (const issue of result.issues) {\r\n if (issue.severity === \"info\" && !options.info) continue;\r\n const loc = issue.loc ?? issue.locs?.[0];\r\n const props = [`file=${prop(file)}`];\r\n if (loc) props.push(`line=${loc.line}`, `col=${loc.column}`);\r\n props.push(`title=${prop(`emailens ${issue.category}: ${issue.rule}`)}`);\r\n lines.push(`::${level[issue.severity]} ${props.join(\",\")}::${data(issue.message)}`);\r\n }\r\n }\r\n return lines;\r\n}\r\n\r\ntype AuditSkipType = \"spam\" | \"links\" | \"accessibility\" | \"images\" | \"compatibility\" | \"inboxPreview\" | \"size\" | \"templateVariables\" | \"overflow\" | \"visual\" | \"darkContrast\" | \"mobileContrast\" | \"design\" | \"vml\" | \"styleSurvival\" | \"targeting\";\r\n\r\n\r\n/**\r\n * Resolve a file path or simple glob pattern to an array of files.\r\n * Supports basic * glob in the last path segment.\r\n */\r\nasync function resolveGlob(pattern: string): Promise<string[]> {\r\n // If it's a direct file, just return it\r\n if (!pattern.includes(\"*\")) {\r\n return [resolve(pattern)];\r\n }\r\n\r\n // Recursive glob is not supported: provide clear error\r\n if (pattern.includes(\"**\")) {\r\n throw new Error(\"Recursive glob (**) is not supported. Use a single-level wildcard (e.g., src/*.html) or list files explicitly.\");\r\n }\r\n\r\n // Simple glob: split into dir + glob pattern\r\n const lastSep = Math.max(pattern.lastIndexOf(\"/\"), pattern.lastIndexOf(\"\\\\\"));\r\n const dir = lastSep >= 0 ? pattern.slice(0, lastSep) : \".\";\r\n const glob = lastSep >= 0 ? pattern.slice(lastSep + 1) : pattern;\r\n\r\n // Convert glob to regex (only support * wildcard)\r\n const regex = new RegExp(\"^\" + glob.replace(/\\*/g, \".*\") + \"$\");\r\n\r\n const entries = await readdir(resolve(dir), { withFileTypes: true });\r\n return entries\r\n .filter((e) => e.isFile() && regex.test(e.name))\r\n .map((e) => resolve(dir, e.name))\r\n .sort();\r\n}\r\n\r\n/**\r\n * Add occurrences we haven't already recorded, keeping document order.\r\n *\r\n * Grouping unions several engine warnings, each already capped, so the cap has\r\n * to be applied again here or a document with many selector shapes produces an\r\n * unbounded list. Returns true when it bit, so the issue can say so.\r\n */\r\nfunction mergeLocs(into: SourceLocation[], from: SourceLocation[] | undefined): boolean {\r\n if (!from) return false;\r\n let truncated = false;\r\n for (const loc of from) {\r\n if (into.some((l) => l.offset === loc.offset)) continue;\r\n if (into.length >= MAX_WARNING_LOCATIONS) {\r\n truncated = true;\r\n break;\r\n }\r\n into.push(loc);\r\n }\r\n into.sort((a, b) => a.offset - b.offset);\r\n return truncated;\r\n}\r\n\r\n/**\r\n * Name the element when there is no line to point at: compiled sources (React\r\n * Email, MJML) never have one, and \"Low contrast ratio 2.1:1\" alone cannot be\r\n * acted on. The engine already says which element; it was being dropped.\r\n */\r\nfunction whereNoLine(message: string, issue: { loc?: SourceLocation; element?: string }): string {\r\n return !issue.loc && issue.element ? `${message}: ${issue.element}` : message;\r\n}\r\n\r\n/**\r\n * Flatten an AuditReport into a unified LintIssue array.\r\n */\r\nexport function flattenToLintIssues(report: AuditReport, skip: string[]): LintIssue[] {\r\n const issues: LintIssue[] = [];\r\n\r\n // CSS compatibility warnings → group by property (deduplicate across clients)\r\n if (!skip.includes(\"compatibility\")) {\r\n const seenProps = new Map<string, {\r\n severity: \"error\" | \"warning\" | \"info\";\r\n clients: string[];\r\n message: string;\r\n loc?: SourceLocation;\r\n locs: SourceLocation[];\r\n locsTruncated?: boolean;\r\n }>();\r\n\r\n // The engine copies style-survival, size and VML findings into the\r\n // per-client warnings so they count in each client's score. They are\r\n // reported below by their own check, with a line, so not again here.\r\n const ownCheck = new Set(\r\n ([\"styleSurvival\", \"size\", \"vml\"] as const)\r\n .filter((check) => !skip.includes(check))\r\n .flatMap((check) => report[check].issues.map((i) => i.rule)),\r\n );\r\n\r\n for (const w of report.compatibility.warnings) {\r\n if (ownCheck.has(w.property)) continue;\r\n const key = `${w.property}\\0${w.severity}`;\r\n const existing = seenProps.get(key);\r\n if (existing) {\r\n // One client breaks a property once per selector group (`div`, `td`),\r\n // so it comes back here more than once.\r\n if (!existing.clients.includes(w.client)) existing.clients.push(w.client);\r\n // Clients repeat the same finding, but selector groups don't: `div` and\r\n // `span` breaking one property are separate warnings, so union their\r\n // occurrences to get every place it actually breaks.\r\n existing.loc ??= w.loc;\r\n if (mergeLocs(existing.locs, w.locs)) existing.locsTruncated = true;\r\n if (w.locsTruncated) existing.locsTruncated = true;\r\n } else {\r\n seenProps.set(key, {\r\n severity: w.severity,\r\n clients: [w.client],\r\n message: w.message,\r\n loc: w.loc,\r\n locs: (w.locs ?? []).slice(0, MAX_WARNING_LOCATIONS),\r\n ...(w.locsTruncated ? { locsTruncated: true } : {}),\r\n });\r\n }\r\n }\r\n\r\n for (const [key, val] of seenProps) {\r\n const property = key.split(\"\\0\")[0];\r\n issues.push({\r\n severity: val.severity,\r\n category: val.clients.slice(0, 3).join(\",\") + (val.clients.length > 3 ? `+${val.clients.length - 3}` : \"\"),\r\n rule: property,\r\n message: val.message,\r\n ...(val.loc ? { loc: val.loc } : {}),\r\n ...(val.locs.length ? { locs: val.locs } : {}),\r\n ...(val.locsTruncated ? { locsTruncated: true } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"spam\")) {\r\n for (const issue of report.spam.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"spam\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n detail: issue.detail,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"links\")) {\r\n for (const issue of report.links.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"links\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"accessibility\")) {\r\n for (const issue of report.accessibility.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"accessibility\",\r\n rule: issue.rule,\r\n message: whereNoLine(issue.message, issue),\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"images\")) {\r\n for (const issue of report.images.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"images\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"inboxPreview\")) {\r\n for (const issue of report.inboxPreview.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"inboxPreview\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"size\")) {\r\n for (const issue of report.size.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"size\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"templateVariables\")) {\r\n for (const issue of report.templateVariables.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"templateVars\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"overflow\")) {\r\n for (const issue of report.overflow.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"overflow\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"visual\")) {\r\n for (const issue of report.visual.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"visual\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n // Contrast in the two renders a desktop light preview never shows. These are\r\n // flat arrays rather than a report with `.issues`, and their messages arrive\r\n // prefixed (\"Dark mode: …\"), which the category column already says.\r\n if (!skip.includes(\"darkContrast\")) {\r\n for (const issue of report.darkContrast) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"darkContrast\",\r\n rule: issue.rule,\r\n message: whereNoLine(issue.message.replace(/^Dark mode: /, \"\"), issue),\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"mobileContrast\")) {\r\n for (const issue of report.mobileContrast) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"mobileContrast\",\r\n rule: issue.rule,\r\n message: whereNoLine(issue.message.replace(/^At mobile width: /, \"\"), issue),\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"vml\")) {\r\n for (const issue of report.vml.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"vml\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n detail: issue.detail,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"styleSurvival\")) {\r\n for (const issue of report.styleSurvival.issues) {\r\n // The clients are the finding here: \"Gmail drops this block\" is the\r\n // whole point, and the message alone does not carry it in lint output.\r\n const clients = issue.clients.length ? ` (${issue.clients.join(\", \")})` : \"\";\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"styleSurvival\",\r\n rule: issue.rule,\r\n message: `${issue.message}${clients}`,\r\n detail: issue.frameworkNote ?? issue.detail,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"targeting\")) {\r\n for (const issue of report.targeting.warnings) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"targeting\",\r\n rule: issue.property,\r\n message: issue.message,\r\n detail: issue.suggestion,\r\n ...(issue.loc ? { loc: issue.loc } : {}),\r\n ...(issue.locs?.length ? { locs: issue.locs } : {}),\r\n ...(issue.locsTruncated ? { locsTruncated: true } : {}),\r\n });\r\n }\r\n }\r\n\r\n if (!skip.includes(\"design\")) {\r\n for (const issue of report.design.issues) {\r\n issues.push({\r\n severity: issue.severity,\r\n category: \"design\",\r\n rule: issue.rule,\r\n message: issue.message,\r\n detail: issue.detail,\r\n });\r\n }\r\n }\r\n\r\n // Errors first, then warnings, then info; within each, in document order,\r\n // and findings with no line (the whole email, or a compiled source) last.\r\n const order = { error: 0, warning: 1, info: 2 };\r\n const at = (i: LintIssue) => i.loc?.offset ?? Number.MAX_SAFE_INTEGER;\r\n issues.sort((a, b) => order[a.severity] - order[b.severity] || at(a) - at(b));\r\n\r\n return issues;\r\n}\r\n","import { readFileSync } from \"node:fs\";\r\nimport { EMAIL_CLIENTS, type Framework, type InputFormat, type TargetingPolicy } from \"@emailens/engine\";\r\nimport { detectFormat } from \"@emailens/engine/compile\";\r\n\r\nconst VALID_FORMATS = new Set([\"html\", \"jsx\", \"mjml\", \"maizzle\"]);\r\n\r\n/**\r\n * Read HTML input from a file path or stdin (`-`).\r\n * Always returns a Promise for consistent caller ergonomics.\r\n */\r\nexport async function readInput(pathOrStdin: string): Promise<string> {\r\n if (pathOrStdin === \"-\") {\r\n // Try /dev/stdin first (works on Unix and Git Bash on Windows)\r\n try {\r\n return readFileSync(\"/dev/stdin\", \"utf-8\");\r\n } catch {\r\n // Fall through to async approach\r\n }\r\n\r\n // Async stdin reading for Windows compatibility\r\n return new Promise<string>((resolve, reject) => {\r\n const chunks: Buffer[] = [];\r\n process.stdin.resume();\r\n process.stdin.on(\"data\", (chunk) => chunks.push(Buffer.from(chunk)));\r\n process.stdin.on(\"end\", () => {\r\n const data = Buffer.concat(chunks).toString(\"utf-8\");\r\n if (!data.trim()) {\r\n reject(new Error(\"No input received from stdin. Pipe HTML or provide a file path.\"));\r\n } else {\r\n resolve(data);\r\n }\r\n });\r\n process.stdin.on(\"error\", () => {\r\n reject(new Error(\"No input received from stdin. Pipe HTML or provide a file path.\"));\r\n });\r\n });\r\n }\r\n\r\n try {\r\n return readFileSync(pathOrStdin, \"utf-8\");\r\n } catch (err) {\r\n const message = err instanceof Error ? err.message : String(err);\r\n throw new Error(`Failed to read file \"${pathOrStdin}\": ${message}`);\r\n }\r\n}\r\n\r\n/**\r\n * Validate and resolve client IDs. Returns all clients if none specified.\r\n */\r\nexport function resolveClients(ids?: string): string[] {\r\n const validIds = new Set(EMAIL_CLIENTS.map((c) => c.id));\r\n\r\n if (!ids) {\r\n return EMAIL_CLIENTS.map((c) => c.id);\r\n }\r\n\r\n const requested = ids.split(\",\").map((s) => s.trim()).filter(Boolean);\r\n const invalid = requested.filter((id) => !validIds.has(id));\r\n\r\n if (invalid.length > 0) {\r\n throw new Error(\r\n `Unknown client ID(s): ${invalid.join(\", \")}.\\n` +\r\n `Valid IDs: ${Array.from(validIds).join(\", \")}`\r\n );\r\n }\r\n\r\n return requested;\r\n}\r\n\r\n/**\r\n * Resolve the input format from explicit flag, file extension, or default.\r\n * Validates the --format flag and errors on unknown values.\r\n * Auto-detects from file extension when no flag is given.\r\n */\r\nfunction isVueSfc(source: string): boolean {\r\n return /<template[\\s>]/i.test(source) && /<\\/template>/i.test(source);\r\n}\r\n\r\nexport function resolveFormat(formatFlag?: string, filePath?: string, source?: string): InputFormat {\r\n if (formatFlag) {\r\n if (!VALID_FORMATS.has(formatFlag)) {\r\n throw new Error(\r\n `Unknown format \"${formatFlag}\". Valid formats: ${Array.from(VALID_FORMATS).join(\", \")}`\r\n );\r\n }\r\n return formatFlag as InputFormat;\r\n }\r\n\r\n // Auto-detect from file extension. `.vue` is maizzle.\r\n if (filePath && filePath !== \"-\") {\r\n return detectFormat(filePath);\r\n }\r\n\r\n // Stdin has no extension. A Vue SFC graded as HTML looks clean.\r\n if (source && isVueSfc(source)) return \"maizzle\";\r\n\r\n return \"html\";\r\n}\r\n\r\n/**\r\n * Convert a format string to the engine's Framework type.\r\n */\r\nexport function toFramework(format: InputFormat): Framework | undefined {\r\n if (format === \"jsx\" || format === \"mjml\" || format === \"maizzle\") return format;\r\n return undefined;\r\n}\r\n\r\n/**\r\n * Do source positions refer to the file the user wrote?\r\n *\r\n * Only for plain HTML. JSX, MJML and Maizzle are compiled before analysis, so\r\n * a position would point into generated output: worse than no position at all,\r\n * because it looks authoritative.\r\n */\r\nexport function positionsApply(format: string): boolean {\r\n return format === \"html\";\r\n}\r\n\r\n/** citty arg shared by analyze / audit / lint / preview / export / fix. */\r\nexport const TARGETING_POLICY_ARG = {\r\n type: \"string\" as const,\r\n description: \"Client-targeting policy: progressive (default), strict, or lenient\",\r\n};\r\n\r\nexport function parseTargetingPolicy(raw?: string): TargetingPolicy | undefined {\r\n if (raw == null || raw === \"\") return undefined;\r\n if (raw === \"progressive\" || raw === \"strict\" || raw === \"lenient\") return raw;\r\n throw new Error(`Unknown targeting policy \"${raw}\". Valid: progressive, strict, lenient`);\r\n}\r\n"],"mappings":";;;AAAA,SAAS,YAAY,oBAAoB;AACzC,SAAS,SAAS,MAA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 +8,7 @@ import {
|
|
|
8
8
|
resolveClients,
|
|
9
9
|
resolveFormat,
|
|
10
10
|
toFramework
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IM52U7ZV.js";
|
|
12
12
|
import {
|
|
13
13
|
__require
|
|
14
14
|
} from "./chunk-7OCVIDC7.js";
|
|
@@ -22,7 +22,7 @@ import { EMAIL_CLIENTS } from "@emailens/engine";
|
|
|
22
22
|
// package.json
|
|
23
23
|
var package_default = {
|
|
24
24
|
name: "@emailens/cli",
|
|
25
|
-
version: "0.13.
|
|
25
|
+
version: "0.13.2",
|
|
26
26
|
description: "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
|
|
27
27
|
type: "module",
|
|
28
28
|
bin: {
|
|
@@ -53,7 +53,7 @@ var package_default = {
|
|
|
53
53
|
prepublishOnly: "bun run build"
|
|
54
54
|
},
|
|
55
55
|
dependencies: {
|
|
56
|
-
"@emailens/engine": "^0.18.
|
|
56
|
+
"@emailens/engine": "^0.18.4",
|
|
57
57
|
citty: "^0.1.6",
|
|
58
58
|
"cli-table3": "^0.6.5",
|
|
59
59
|
ora: "^8.2.0",
|