Skip to content

Fix installed CLI and data-inline mangling, release 4.0.1 - #34

Merged
sabind merged 1 commit into
masterfrom
fix-cli-bin-and-data-inline
Oct 20, 2026
Merged

sabind merged 1 commit into
masterfrom
fix-cli-bin-and-data-inline

Conversation

@sabind

@sabind sabind commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Why

There is no ticket: these defects were discovered via testing and while writing the newcomer docs. We ran tests and found issues, and we're simply patching them here based on our findings.

What

The installed inline-email command runs again, and turning on juice.webResources resource inlining no longer breaks the responsive stylesheet or users' own attributes that start with data-inline. Released as 4.0.1.

Changes

  • The installed CLI runs again. src/cli.ts ran main only when the module's URL equalled process.argv[1], but npm starts the command through a symlinked bin entry while Node resolves the module to the real file, so npx inline-email exited 0 doing nothing in every release since 3.0.0. The guard now compares against realpathSync(process.argv[1]). A new test in test/esm-package.test.ts runs the built CLI through a symlink. We ran tests and found issues; we're patching them based on our findings.
  • The responsive stylesheet survives resource inlining. web-resource-inliner deletes data-inline as a prefix anywhere in the document, which turned the layout's <style data-inline-email-preserve-style> into <style-email-preserve-style>, an element email clients ignore, whenever image or link inlining was on in 4.0.0. The marker is now data-ie-preserve-style in src/layout.ts; test/layout.test.ts follows the rename and a new test in test/compile.test.ts checks the stylesheet survives. We ran tests and found issues; we're patching them based on our findings.
  • Users' own data-inline… attributes survive resource inlining. The same prefix match turned <p data-inline-note="x"> into <p-note="x">. src/compile.ts renames such attributes to a placeholder before the inliner runs and restores them afterwards, leaving its own data-inline and data-inline-ignore for it to read. A new test in test/compile.test.ts covers both. We ran tests and found issues; we're patching them based on our findings.
  • Version 4.0.1. package.json and the lockfile.

Testing

We ran tests:

  • Each of the three new regression tests failed before its fix and passes after.
  • npm audit --audit-level=high --omit=dev, npm run build, npm test (7 files, 289 tests), npm run examples, npm run test:visual (5 of 5 snapshots unchanged) and npm pack --dry-run: all pass on Node 24. Node 20 and 22 run in CI.
  • The packed 4.0.1 tarball installed into a scratch app: npx inline-email in.html --data data.json --inlineImages rendered the data, kept <style data-ie-preserve-style> with its @media rules, and kept <p data-inline-note="keep"> intact.

Risk and rollout

Patch release: ship this and tag v4.0.1 once it merges. The responsive stylesheet's marker attribute changes from data-inline-email-preserve-style to data-ie-preserve-style, which only matters to anyone matching raw HTML output.

🤖 Generated with Claude Code

The CLI guard compared import.meta.url with the symlinked bin path, so
the installed command never ran. web-resource-inliner strips any
attribute text starting with data-inline, which broke the responsive
stylesheet marker and users' own data-inline-* attributes whenever
resource inlining was on. Found through testing and the newcomer docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sabind
sabind merged commit e9bd694 into master Oct 20, 2026
4 checks passed
@sabind
sabind deleted the fix-cli-bin-and-data-inline branch October 20, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants