@emailens/cli 0.13.19 → 0.14.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.
package/dist/index.js CHANGED
@@ -3,44 +3,47 @@ import { createRequire as __cr } from "node:module";
3
3
  const require = __cr(import.meta.url);
4
4
  import {
5
5
  AI_FIX_SYSTEM_PROMPT,
6
- EMAIL_CLIENTS,
7
6
  EMAIL_DIRS,
8
7
  TARGETING_POLICY_ARG,
9
8
  analyzeEmail,
10
9
  auditEmail,
11
10
  compile,
12
- csstree_esm_exports,
13
11
  defineCommand,
14
- es_exports,
15
12
  estimateAiFixTokens,
16
13
  findEmailsDir,
17
14
  generateAiFix,
18
15
  generateCompatibilityScore,
19
- init_csstree_esm,
20
- init_es,
21
16
  lint_default,
22
17
  parseTargetingPolicy,
23
18
  positionsApply,
24
19
  readInput,
25
- require_boolbase,
26
- require_lib,
27
- require_mime_type,
28
20
  require_picocolors,
29
- require_undici,
30
- require_whatwg_encoding,
31
21
  resolveClients,
32
22
  resolveFormat,
33
23
  runMain,
34
24
  simulateDarkMode,
35
- toFramework,
25
+ toFramework
26
+ } from "./chunk-MCD4OEZU.js";
27
+ import {
28
+ EMAIL_CLIENTS,
29
+ csstree_esm_exports,
30
+ es_exports,
31
+ init_csstree_esm,
32
+ init_es,
33
+ require_boolbase,
34
+ require_lib,
35
+ require_mime_type,
36
+ require_undici,
37
+ require_whatwg_encoding,
36
38
  transformForAllClients
37
- } from "./chunk-J4YQYM4C.js";
38
- import "./chunk-UN26YQF6.js";
39
- import "./chunk-2AP7CT6R.js";
40
- import "./chunk-NXBRJX3V.js";
39
+ } from "./chunk-NGCLN4RF.js";
40
+ import "./chunk-LURVXP3P.js";
41
+ import "./chunk-YE65PQ5Z.js";
42
+ import "./chunk-5MSFYC7W.js";
41
43
  import {
42
44
  CompileError
43
- } from "./chunk-TQGPCAMW.js";
45
+ } from "./chunk-WAXESPJE.js";
46
+ import "./chunk-JKHKS7VL.js";
44
47
  import {
45
48
  __commonJS,
46
49
  __require,
@@ -43703,7 +43706,7 @@ Href: ${href}`
43703
43706
  // package.json
43704
43707
  var package_default = {
43705
43708
  name: "@emailens/cli",
43706
- version: "0.13.19",
43709
+ version: "0.14.0",
43707
43710
  description: "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
43708
43711
  type: "module",
43709
43712
  bin: {
@@ -43735,16 +43738,20 @@ var package_default = {
43735
43738
  },
43736
43739
  dependencies: {},
43737
43740
  peerDependencies: {
43738
- "playwright-core": "^1.62.1"
43741
+ "playwright-core": "^1.62.1",
43742
+ sharp: ">=0.33.0"
43739
43743
  },
43740
43744
  peerDependenciesMeta: {
43741
43745
  "playwright-core": {
43742
43746
  optional: true
43747
+ },
43748
+ sharp: {
43749
+ optional: true
43743
43750
  }
43744
43751
  },
43745
43752
  devDependencies: {
43746
43753
  "@anthropic-ai/sdk": "^0.52.0",
43747
- "@emailens/engine": "^0.18.22",
43754
+ "@emailens/engine": "^0.19.0",
43748
43755
  "@react-email/components": "1.0.12",
43749
43756
  "@types/bun": "^1.4.0",
43750
43757
  "@types/mjml": "^4.7.4",
@@ -46385,6 +46392,90 @@ Watching ${dir} for changes. Ctrl+C to stop.`))
46385
46392
  }
46386
46393
  });
46387
46394
 
46395
+ // src/commands/design.ts
46396
+ var import_picocolors7 = __toESM(require_picocolors(), 1);
46397
+ var MARK = { kept: import_picocolors7.default.green("\u2713"), changed: import_picocolors7.default.yellow("~"), broken: import_picocolors7.default.red("\u2717") };
46398
+ function designExitCode(results, strict = false) {
46399
+ const failing = results.some(
46400
+ (r) => r.verdict === "broken" || strict && r.verdict === "changed"
46401
+ );
46402
+ return failing ? 1 : 0;
46403
+ }
46404
+ var design_default = defineCommand({
46405
+ meta: {
46406
+ name: "design",
46407
+ description: "Check the email still looks like its design in each client's live preview (needs a browser)"
46408
+ },
46409
+ args: {
46410
+ input: {
46411
+ type: "positional",
46412
+ description: "HTML, JSX, MJML or Maizzle file path, or - for stdin",
46413
+ required: true
46414
+ },
46415
+ format: {
46416
+ type: "string",
46417
+ alias: "f",
46418
+ description: "Input format: html, jsx, mjml, maizzle"
46419
+ },
46420
+ clients: {
46421
+ type: "string",
46422
+ alias: "c",
46423
+ description: "Comma-separated client IDs (default: all)"
46424
+ },
46425
+ strict: {
46426
+ type: "boolean",
46427
+ description: "Fail on Needs work too, not only on Broken"
46428
+ },
46429
+ json: {
46430
+ type: "boolean",
46431
+ description: "Output as JSON"
46432
+ },
46433
+ quiet: {
46434
+ type: "boolean",
46435
+ alias: "q",
46436
+ description: "Suppress spinners and decorations"
46437
+ }
46438
+ },
46439
+ async run({ args }) {
46440
+ const spinner = args.quiet || args.json ? null : ora();
46441
+ try {
46442
+ if (args.format) resolveFormat(args.format);
46443
+ const source = await readInput(args.input);
46444
+ const format = resolveFormat(args.format, args.input, source);
46445
+ const html = await compile(source, format);
46446
+ const clientIds = resolveClients(args.clients);
46447
+ const { checkDesignAcross } = await import("./design-3W7LDIBV.js");
46448
+ spinner?.start(process.env.BROWSERLESS_URL ? "Connecting to Browserless..." : "Starting Chromium...");
46449
+ const results = await checkDesignAcross(html, clientIds, {
46450
+ framework: toFramework(format),
46451
+ onProgress: (done, total) => {
46452
+ if (spinner) spinner.text = `Checking the design (${done}/${total})...`;
46453
+ }
46454
+ });
46455
+ spinner?.stop();
46456
+ if (!results.length && !args.json) {
46457
+ console.log("No design to compare: the input is not a rendered email.");
46458
+ } else if (args.json) {
46459
+ console.log(JSON.stringify({ design: results }, null, 2));
46460
+ } else {
46461
+ for (const r of results) {
46462
+ console.log(`${MARK[r.verdict]} ${import_picocolors7.default.bold(r.name.padEnd(26))} ${r.label}`);
46463
+ if (r.verdict === "kept") continue;
46464
+ console.log(import_picocolors7.default.dim(` ${r.sentence}`));
46465
+ for (const reason of r.reasons) console.log(` - ${reason}`);
46466
+ if (r.more) console.log(import_picocolors7.default.dim(` and ${r.more} more`));
46467
+ }
46468
+ }
46469
+ const code = designExitCode(results, args.strict);
46470
+ if (code) process.exit(code);
46471
+ } catch (err) {
46472
+ spinner?.fail("Design check failed");
46473
+ console.error(err.message);
46474
+ process.exit(1);
46475
+ }
46476
+ }
46477
+ });
46478
+
46388
46479
  // src/index.ts
46389
46480
  var main2 = defineCommand({
46390
46481
  meta,
@@ -46397,7 +46488,8 @@ var main2 = defineCommand({
46397
46488
  audit: audit_default,
46398
46489
  lint: lint_default,
46399
46490
  inbox: inbox_default,
46400
- "react-email": react_email_default
46491
+ "react-email": react_email_default,
46492
+ design: design_default
46401
46493
  }
46402
46494
  });
46403
46495
  runMain(main2);
@@ -3,8 +3,9 @@ const require = __cr(import.meta.url);
3
3
  import {
4
4
  compileMaizzle,
5
5
  isMaizzle6
6
- } from "./chunk-NXBRJX3V.js";
7
- import "./chunk-TQGPCAMW.js";
6
+ } from "./chunk-5MSFYC7W.js";
7
+ import "./chunk-WAXESPJE.js";
8
+ import "./chunk-JKHKS7VL.js";
8
9
  import "./chunk-K6T7YHQE.js";
9
10
  export {
10
11
  compileMaizzle,
@@ -2,8 +2,9 @@ import { createRequire as __cr } from "node:module";
2
2
  const require = __cr(import.meta.url);
3
3
  import {
4
4
  compileMjml
5
- } from "./chunk-2AP7CT6R.js";
6
- import "./chunk-TQGPCAMW.js";
5
+ } from "./chunk-YE65PQ5Z.js";
6
+ import "./chunk-WAXESPJE.js";
7
+ import "./chunk-JKHKS7VL.js";
7
8
  import "./chunk-K6T7YHQE.js";
8
9
  export {
9
10
  compileMjml
@@ -2,8 +2,9 @@ import { createRequire as __cr } from "node:module";
2
2
  const require = __cr(import.meta.url);
3
3
  import {
4
4
  compileReactEmail
5
- } from "./chunk-UN26YQF6.js";
6
- import "./chunk-TQGPCAMW.js";
5
+ } from "./chunk-LURVXP3P.js";
6
+ import "./chunk-WAXESPJE.js";
7
+ import "./chunk-JKHKS7VL.js";
7
8
  import "./chunk-K6T7YHQE.js";
8
9
  export {
9
10
  compileReactEmail
package/dist/test.js CHANGED
@@ -5,11 +5,13 @@ import {
5
5
  auditEmail,
6
6
  flattenToLintIssues,
7
7
  loadProjectConfig
8
- } from "./chunk-J4YQYM4C.js";
9
- import "./chunk-UN26YQF6.js";
10
- import "./chunk-2AP7CT6R.js";
11
- import "./chunk-NXBRJX3V.js";
12
- import "./chunk-TQGPCAMW.js";
8
+ } from "./chunk-MCD4OEZU.js";
9
+ import "./chunk-NGCLN4RF.js";
10
+ import "./chunk-LURVXP3P.js";
11
+ import "./chunk-YE65PQ5Z.js";
12
+ import "./chunk-5MSFYC7W.js";
13
+ import "./chunk-WAXESPJE.js";
14
+ import "./chunk-JKHKS7VL.js";
13
15
  import "./chunk-K6T7YHQE.js";
14
16
 
15
17
  // src/test.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emailens/cli",
3
- "version": "0.13.19",
3
+ "version": "0.14.0",
4
4
  "description": "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,16 +32,20 @@
32
32
  },
33
33
  "dependencies": {},
34
34
  "peerDependencies": {
35
- "playwright-core": "^1.62.1"
35
+ "playwright-core": "^1.62.1",
36
+ "sharp": ">=0.33.0"
36
37
  },
37
38
  "peerDependenciesMeta": {
38
39
  "playwright-core": {
39
40
  "optional": true
41
+ },
42
+ "sharp": {
43
+ "optional": true
40
44
  }
41
45
  },
42
46
  "devDependencies": {
43
47
  "@anthropic-ai/sdk": "^0.52.0",
44
- "@emailens/engine": "^0.18.22",
48
+ "@emailens/engine": "^0.19.0",
45
49
  "@react-email/components": "1.0.12",
46
50
  "@types/bun": "^1.4.0",
47
51
  "@types/mjml": "^4.7.4",