Drop unused MDX deps and inline use-scramble#74
Merged
Conversation
First-principles audit of the runtime dep list. Four packages removed: - react-markdown: zero imports anywhere in the codebase. Velite/MDX is the actual blog pipeline; this was dead weight. - @next/mdx: not wired into next.config.mjs (no withMDX() wrapper) and no .mdx routes under app/. Velite compiles MDX to JSX code that MDXRenderer.tsx evaluates against react/jsx-runtime. - @mdx-js/react: zero direct imports. Typically a peer of @next/mdx's React provider system, which isn't used here. velite depends on @mdx-js/mdx (the compiler), not @mdx-js/react (the runtime). - use-scramble: used in exactly one component (custom Link wrapper). Inlined as a ~50-line rAF loop with an in-flight guard and a callback ref. Behavior parity preserved: left-to-right reveal, 4-char scramble window, fires on hover/touch, whitespace passes through unscrambled. Switched from onMouseOver to onMouseEnter because mouseOver re-fires every time textContent mutates (browsers emit it on child-node changes), which would restart the animation in an infinite loop. The mdast-util-to-hast override stays — its two remaining transitive paths (shiki/rehype-pretty-code and velite/@mdx-js/mdx) still resolve to a pre-fix version without the override. CLAUDE.md updated to drop the now-removed react-markdown path from the rationale. bun audit, lint, typecheck, build, verify (17/17), and Playwright (18/18 including a new footer-scramble regression test that guards against the mouseover-textContent-refire loop) all pass. Signed-off-by: Will Manning <will@willmanning.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔦 Lighthouse audit
Run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First-principles audit of the runtime dependency list. Four packages dropped, one decorative hook inlined.
react-markdownMDXRenderer.tsx, which evaluates compiled JSX.react-markdownplays no role.@next/mdxnext.config.mjs(nowithMDX()wrapper). No.mdxfiles underapp/for Next to route. Velite handles MDX compilation entirely.@mdx-js/react@next/mdx's React provider system, which isn't used here.velitedepends on@mdx-js/mdx(the compiler), not@mdx-js/react(the runtime).use-scramblesrc/components/link/index.tsx). Replaced with a ~50-linerequestAnimationFrameloop. Behavior parity preserved: left-to-right reveal, 4-char scramble window, fires on hover/touch, whitespace passes through unscrambled.Peer-dependency verification: nothing else in the tree requires these four as peers.
veliteinstalls cleanly.One non-obvious gotcha in the scramble inlining
The original
use-scramblesetup bound the animation toonMouseOver. That doesn't survive a hand-rolled implementation:mouseoverre-fires every time the element'stextContentmutates (because the new text node is a "different child" under the cursor), which would restart the animation in an infinite loop. Switched toonMouseEnter(single fire per real entry) plus anif (frameRef.current !== null) returnin-flight guard. New regression test intests/smoke.spec.tsasserts the animation actually settles, so the failure mode can't sneak back in.What's not in this PR
mdast-util-to-hastoverride stays. Withreact-markdowngone there are now two transitive paths (shiki/rehype-pretty-code,velite/@mdx-js/mdx) instead of three, but both still resolve to a pre-fix version without the override.CLAUDE.mdrationale updated accordingly.GHSA-w5hq-g745-h8pqaudit-ignore stays. It's blocked by@lhci/cli's transitiveuuid@8.3.2, which this PR doesn't touch.Test plan
bun install—Removed: 4, lockfile clean (-14 lines)bun pm ls --all | grep -E "react-markdown|@mdx-js/react|@next/mdx|use-scramble"returns nothingbun pm ls --all | grep mdast-util-to-hastshows only>=13.2.1(override still effective)bun audit --ignore=GHSA-w5hq-g745-h8pq --ignore=GHSA-52f5-9888-hmc6cleanbun run checkcleanbun run buildsucceeds (all 18 static pages generated)bun run typecheckcleanbun run verify— 17/17 (sitemap, robots, RSS x3, OG, canonicals, theme parity,/api/subscribe, internal links)bun run test:e2e— 18/18 (desktop + mobile), including newfooter › custom Link scramble settles back to original on hoverregression test