@emailens/cli 0.13.2 → 0.13.4

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/test.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/test.ts"],"sourcesContent":["import { auditEmail, type AuditOptions } from \"@emailens/engine\";\r\nimport { flattenToLintIssues, type LintIssue } from \"./commands/lint.js\";\r\nimport { applySeverities, loadProjectConfig } from \"./project-config.js\";\r\n\r\nexport type { LintIssue };\r\n\r\nexport interface ExpectEmailOptions {\r\n /** Fail on warnings too, like `lint --fail-on-warning`. */\r\n failOnWarning?: boolean;\r\n /** Checks to skip, the same names as `lint --skip`. */\r\n skip?: string[];\r\n framework?: AuditOptions[\"framework\"];\r\n}\r\n\r\n/**\r\n * The `lint` check as a test assertion: throws, listing every finding that\r\n * fails, unless the email passes. Plain throw, so it works in Vitest, Jest and\r\n * bun:test alike. Reads the project's `.emailensrc` like the CLI, so a test and\r\n * the CI step cannot disagree about the same email. Returns the findings.\r\n *\r\n * expectEmailToPass(await render(<Welcome />));\r\n */\r\nexport function expectEmailToPass(html: string, options: ExpectEmailOptions = {}): LintIssue[] {\r\n const project = loadProjectConfig();\r\n const skip = options.skip ?? project?.skip ?? [];\r\n const report = auditEmail(html, {\r\n framework: options.framework,\r\n skip: skip as AuditOptions[\"skip\"],\r\n positions: true,\r\n });\r\n const issues = applySeverities(flattenToLintIssues(report, skip), project?.rules);\r\n const failing = issues.filter(\r\n (i) => i.severity === \"error\" || (options.failOnWarning && i.severity === \"warning\"),\r\n );\r\n if (failing.length > 0) {\r\n const lines = failing.map(\r\n (i) => ` ${i.severity.padEnd(7)} ${i.loc ? `${i.loc.line}:${i.loc.column} ` : \"\"}${i.category} ${i.rule}: ${i.message}`,\r\n );\r\n throw new Error(`Email fails emailens lint (${failing.length}):\\n${lines.join(\"\\n\")}`);\r\n }\r\n return issues;\r\n}\r\n"],"mappings":";;;;;;;;;AAAA,SAAS,kBAAqC;AAsBvC,SAAS,kBAAkB,MAAc,UAA8B,CAAC,GAAgB;AAC7F,QAAM,UAAU,kBAAkB;AAClC,QAAM,OAAO,QAAQ,QAAQ,SAAS,QAAQ,CAAC;AAC/C,QAAM,SAAS,WAAW,MAAM;AAAA,IAC9B,WAAW,QAAQ;AAAA,IACnB;AAAA,IACA,WAAW;AAAA,EACb,CAAC;AACD,QAAM,SAAS,gBAAgB,oBAAoB,QAAQ,IAAI,GAAG,SAAS,KAAK;AAChF,QAAM,UAAU,OAAO;AAAA,IACrB,CAAC,MAAM,EAAE,aAAa,WAAY,QAAQ,iBAAiB,EAAE,aAAa;AAAA,EAC5E;AACA,MAAI,QAAQ,SAAS,GAAG;AACtB,UAAM,QAAQ,QAAQ;AAAA,MACpB,CAAC,MAAM,KAAK,EAAE,SAAS,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,MAAM,MAAM,EAAE,GAAG,EAAE,QAAQ,IAAI,EAAE,IAAI,KAAK,EAAE,OAAO;AAAA,IACxH;AACA,UAAM,IAAI,MAAM,8BAA8B,QAAQ,MAAM;AAAA,EAAO,MAAM,KAAK,IAAI,CAAC,EAAE;AAAA,EACvF;AACA,SAAO;AACT;","names":[]}