feat(git): render diffs with @pierre/diffs (diffs.com)#77
Merged
Conversation
Replace the git plugin's line-prefix `<pre>` patch renderer with the Shiki-based diffs.com library, giving syntax-highlighted, per-file diffs in both the working-tree/staged diff panel and the multi-file commit details view. The diff theme tracks the app's light/dark toggle.
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
In commit details, each changed file now sits behind a disclosure header (filename, change icon, +/- counts) that expands to its @pierre/diffs patch, replacing the separate plain-text "N files changed" list. The list is kept only as the static-build fallback, where no patch is baked.
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.
What
Replaces the git plugin's hand-rolled patch renderer — a
<pre>that colored whole lines by prefix (+/-/@@) with no syntax highlighting — with diffs.com (@pierre/diffs), a Shiki-based diff rendering library.Why
The diff surface now gets real syntax highlighting, per-file headers, and a consistent presentation across both places a patch is shown:
Diffs are rendered with the unified layout and classic
+/-indicators, using Shiki'svitesse-light/vitesse-darkthemes to sit alongside the@antfu/designsurfaces. The diff theme follows the app's light/dark toggle.How
DiffPatchViewparses the git patch withparsePatchFilesand renders each file with@pierre/diffs/react'sFileDiff. Its public props are unchanged, so callers and stories needed no edits. The redundant filename bar inDiffPanelViewis dropped sinceFileDiffrenders its own per-file header.useColorScheme()hook observes the.darkclass on<html>so the Shiki theme stays in sync whenever the theme is toggled (in-app or via Storybook).@pierre/diffsadded to thefrontendpnpm catalog and the plugin'sdevDependencies(the SPA is prebuilt intodistat publish time). Its transitive@pierre/theme@1.1.0trips the repo'sno-downgradesupply-chain policy (an earlier version carried provenance, this one doesn't), so it's added to the existingtrustPolicyExcludelist. The library uses Shiki's pure-JS regex engine, so no WASM is bundled.Verification
git diffthroughparsePatchFiles→FileDiff): each file parses, produces syntax-highlighted spans under the vitesse theme, and infers its language. A live browser pass wasn't possible in this ARM64 sandbox (no installable Chromium).This PR was created with the help of an agent.