diffs Skill

Use when an app uses @pierre/diffs to render or edit code files, diffs, patches, merge conflicts, or CodeView review surfaces, including React, vanilla JavaScript, SSR, workers, annotations, selection, and custom Shiki languages or themes.

Install
npx skills add 'https://github.com/pierrecomputer/pierre/tree/main/skills/diffs'
Download bundle ↓
View on GitHub
← Back to SKILL.md

Recipe: preload a diff on the server

Create props on the server and pass the result to the matching React component:

import { preloadMultiFileDiff } from '@pierre/diffs/ssr';
import { MultiFileDiff } from '@pierre/diffs/react';

const preloaded = await preloadMultiFileDiff({
  oldFile: { name: 'src/value.ts', contents: oldSource },
  newFile: { name: 'src/value.ts', contents: newSource },
  options: { theme: 'pierre-dark', diffStyle: 'split' },
});

<MultiFileDiff {...preloaded} />;

Select the preload function that matches the client component. Use preloadDiffHTML or preloadUnresolvedFileHTML when the host needs an HTML string only.

Referenced from SKILL.md