-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
Target branch
All PRs must branch from next/v3 and target base next/v3 (not main).
Context
In the reconciliation report for #379, next/v3 is missing the post-merge-base main work that fixed Conditional comment correctness and Raw nesting/duplication. Today next/v3’s Conditional renders conditional comments directly (and uses the old <![endif]--> closer), while main has a more robust marker + rehype-plugin approach with <![endif]/--> and explicit no-dup tests.
Scope (files/areas)
packages/jsx-email/src/components/conditional.tsxpackages/jsx-email/src/components/head.tsxpackages/jsx-email/src/renderer/render.tspackages/jsx-email/src/renderer/raw.ts- (add)
packages/jsx-email/src/renderer/conditional.ts - (tests)
packages/jsx-email/test/**conditional*(+ snapshots under.snapshots/)
Tasks
- Port
main’s Conditional “marker element” approach intonext/v3:- Render a
jsx-email-condcustom element withdata-mso/data-expression/data-headmarkers. - Remove the Suspense +
dangerouslySetInnerHTMLconditional-comment string generation.
- Render a
- Port
main’s conditional rehype plugin intonext/v3(new filepackages/jsx-email/src/renderer/conditional.ts). - Update the render pipeline to ensure:
- Raw hoisting happens before conditional processing.
- Conditional comments always close with
<![endif]/-->.
- Update
Headto matchmain’s current behavior:- Use
<Conditional head mso>with<Raw content="<xml>…</xml>" />inside.
- Use
- Port the targeted correctness tests from
mainintonext/v3:packages/jsx-email/test/conditional-endif-closer.test.tsxpackages/jsx-email/test/conditional-raw-nodup.test.tsxpackages/jsx-email/test/conditional-raw.test.tsx- Keep snapshot updates minimal (only intentional markup changes).
Acceptance criteria (done when)
- Conditional output in
next/v3matchesmain’s closer semantics (<![endif]/-->) for bothmsoandexpressionpaths. - Nesting
<Raw>inside<Conditional>does not duplicate the raw payload or emit it outside the conditional block. jsx-emailunit tests pass onnext/v3withFORCE_COLOR=1.
Verification
# Unit tests (match CI color behavior)
$ FORCE_COLOR=1 moon jsx-email:test
# CLI tests (optional but recommended when touching render output)
$ FORCE_COLOR=1 moon test-cli:test.runRefs #379.
Metadata
Metadata
Assignees
Labels
No labels