Skip to content

Commit d0307f4

Browse files
prepare
1 parent 7af7d30 commit d0307f4

File tree

21 files changed

+64
-33
lines changed

21 files changed

+64
-33
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ file.buildSplitDiffLines();
119119
-**Extend Data** - Attach and render custom data per line
120120
-**Web Worker Support** - Offload processing for better performance
121121
-**SSR & RSC** - Full server-side rendering support for React and Vue
122-
-**Diff Match Patch** - Enhanced line-level diff with FastDiff template (experimental)
122+
-**Diff Match Patch** - Enhanced line-level diff with FastDiff template
123123
-**Multiple Platforms** - React, Vue, Solid, Svelte, and CLI
124124

125125
## ⚡ Advanced Features
126126

127-
### FastDiff Template (Experimental)
127+
### FastDiff Template
128128

129129
Enhanced line-by-line diff visualization for better readability.
130130

packages/cli/.eslintrc.cjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
extends: [require.resolve("project-tool/baseLint"), require.resolve("project-tool/reactLint")],
3+
env: {
4+
browser: true,
5+
es2021: true,
6+
},
7+
parserOptions: {
8+
ecmaFeatures: {
9+
jsx: true,
10+
},
11+
sourceType: "module",
12+
tsconfigRootDir: __dirname,
13+
project: "./tsconfig.json",
14+
},
15+
rules: {
16+
"@typescript-eslint/no-unused-vars": [
17+
"error",
18+
{
19+
argsIgnorePattern: "^_",
20+
varsIgnorePattern: "React",
21+
},
22+
],
23+
},
24+
};

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "@git-diff-view/cli",
44
"author": "MrWangJustToDo",
55
"license": "MIT",
6-
"version": "0.1.2",
6+
"version": "0.1.3",
77
"main": "index.mjs",
88
"type": "module",
99
"types": "index.d.ts",
@@ -51,7 +51,7 @@
5151
"cli diff component"
5252
],
5353
"dependencies": {
54-
"@git-diff-view/core": "^0.1.2",
54+
"@git-diff-view/core": "^0.1.3",
5555
"@types/hast": "^3.0.0",
5656
"chalk": "^5.6.2",
5757
"highlight.js": "^11.11.0",

packages/cli/src/components/CodeContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ const CodeSyntax = React.memo(
167167
}
168168

169169
return buildAnsiStringWithLineBreaks(chars, width);
170-
}, [bg, width, theme, rawLine, syntaxLine, enableTabSpace, tabWidth]);
170+
}, [bg, width, theme, syntaxLine, enableTabSpace, tabWidth]);
171171

172172
// Fallback to CodeString if no syntax line
173173
if (!syntaxLine) {

packages/cli/src/components/CodeView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ CodeLine.displayName = "CodeLine";
115115
/**
116116
* CodeViewContent - renders all code lines using terminal size from context
117117
*/
118-
const CodeViewContent = memo(({ file, theme, width }: { file: File; theme: "light" | "dark", width?: number }) => {
118+
const CodeViewContent = memo(({ file, theme, width }: { file: File; theme: "light" | "dark"; width?: number }) => {
119119
const { useCodeContext } = useCodeViewContext();
120120

121121
const enableHighlight = useCodeContext((s) => s.enableHighlight);
@@ -180,9 +180,10 @@ const InternalCodeView = <T,>(
180180
codeViewTheme,
181181
} = props;
182182

183-
const fileId = useMemo(() => file.fileName || "code-file", [file.fileName]);
183+
const fileId = file.getId();
184184

185185
// Performance optimization using store
186+
// eslint-disable-next-line react-hooks/exhaustive-deps
186187
const useCodeContext = useMemo(() => createCodeConfigStore(props, fileId), []);
187188

188189
useEffect(() => {
@@ -238,6 +239,8 @@ const InternalCodeView = <T,>(
238239
renderExtendLine,
239240
codeViewTabSpace,
240241
codeViewTabWidth,
242+
props.extendData,
243+
props.renderExtendLine,
241244
]);
242245

243246
useEffect(() => {

packages/cli/src/components/DiffContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ const DiffSyntax = React.memo(
348348

349349
// Use width - 2 because the operator column takes 1 character and end padding takes 1 character
350350
return buildAnsiStringWithLineBreaks(chars, width - 2);
351-
}, [bg, width, theme, rawLine, diffLine, operator, syntaxLine, enableTabSpace, tabWidth]);
351+
}, [bg, width, theme, diffLine, operator, syntaxLine, enableTabSpace, tabWidth]);
352352

353353
// Fallback to DiffString if no syntax line
354354
if (!syntaxLine) {

packages/cli/src/components/DiffView.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const InternalDiffView = <T extends unknown>(
8989
const diffFileId = useMemo(() => diffFile.getId(), [diffFile]);
9090

9191
// performance optimization
92+
// eslint-disable-next-line react-hooks/exhaustive-deps
9293
const useDiffContext = useMemo(() => createDiffConfigStore(props, diffFileId), []);
9394

9495
useEffect(() => {
@@ -158,6 +159,8 @@ const InternalDiffView = <T extends unknown>(
158159
diffViewTabSpace,
159160
diffViewTabWidth,
160161
diffViewHideOperator,
162+
props.extendData,
163+
props.renderExtendLine,
161164
]);
162165

163166
useEffect(() => {

packages/cli/src/hooks/useCodeTerminalSize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function useCodeTerminalSize(): { columns: number } {
4444
return () => {
4545
process.stdout.off("resize", debounceUpdate);
4646
};
47-
}, [wrapper]);
47+
}, [hasWidth, wrapper]);
4848

4949
return { columns: size };
5050
}

packages/cli/src/hooks/useUnmount.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export const useUnmount = (cb: () => void, deps: any[]) => {
55

66
ref.current = cb;
77

8+
// eslint-disable-next-line react-hooks/exhaustive-deps
89
useEffect(() => ref.current, deps);
910
};

packages/cli/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"moduleResolution": "Bundler",
77
"jsx": "react"
88
},
9-
"include": ["./src"],
9+
"include": ["./src", ".eslintrc.cjs"],
1010
"exclude": ["node_modules"]
1111
}

0 commit comments

Comments
 (0)