
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@git-diff-view/core
Advanced tools
Core diff engine for git diff processing with syntax highlighting
npm install @git-diff-view/core
# or
pnpm add @git-diff-view/core
# or
yarn add @git-diff-view/core
import { DiffFile } from "@git-diff-view/core";
// Create diff file instance
const file = new DiffFile(
oldFileName,
oldContent,
newFileName,
newContent,
hunks, // git diff hunks
oldFileLang, // e.g., "typescript"
newFileLang
);
// Initialize theme (optional, default: light)
file.initTheme('dark');
// Initialize diff data
file.init();
// Build view data
file.buildSplitDiffLines(); // For split view
file.buildUnifiedDiffLines(); // For unified view
// For more control over initialization
file.initRaw(); // Parse git diff
file.initSyntax(); // Apply syntax highlighting (optional)
file.buildSplitDiffLines();
file.buildUnifiedDiffLines();
Process diff data in a separate thread or server for better performance:
// Worker/Server side - generate bundle
const file = new DiffFile(/* ... */);
file.initTheme('dark');
file.init();
file.buildSplitDiffLines();
file.buildUnifiedDiffLines();
const bundle = file.getBundle();
// Send bundle to main thread/client
// Main thread/Client side - reconstruct
import { DiffFile } from "@git-diff-view/core";
const mergedFile = DiffFile.createInstance(data, bundle);
// Use with UI components
<DiffView diffFile={mergedFile} />
new DiffFile(
oldFileName: string,
oldContent: string,
newFileName: string,
newContent: string,
hunks: string[],
oldFileLang?: string,
newFileLang?: string
)
| Method | Description |
|---|---|
initTheme(theme) | Set theme ('light' or 'dark') |
init() | Initialize diff data (calls initRaw + initSyntax) |
initRaw() | Parse git diff without syntax highlighting |
initSyntax() | Apply syntax highlighting |
buildSplitDiffLines() | Generate split view data |
buildUnifiedDiffLines() | Generate unified view data |
getBundle() | Export data for transfer |
| Method | Description |
|---|---|
createInstance(data, bundle) | Reconstruct DiffFile from bundle |
MIT © MrWangJustToDo
FAQs
@git-diff-view/core
The npm package @git-diff-view/core receives a total of 75,013 weekly downloads. As such, @git-diff-view/core popularity was classified as popular.
We found that @git-diff-view/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.