@git-diff-view/core
Advanced tools
+10
-10
@@ -21,4 +21,4 @@ // Generated by dts-bundle-generator v9.5.1 | ||
| rawLength?: number; | ||
| syntaxFile: Record<number, SyntaxLineWithTemplate>; | ||
| plainFile: Record<number, { | ||
| syntaxFile: Record<number | string, SyntaxLineWithTemplate>; | ||
| plainFile: Record<number | string, { | ||
| value: string; | ||
@@ -168,7 +168,7 @@ template?: string; | ||
| oldFileDiffLines: Record<string, DiffLineItem>; | ||
| oldFilePlainLines: Record<number, { | ||
| oldFilePlainLines: Record<string | number, { | ||
| value: string; | ||
| template?: string; | ||
| }>; | ||
| oldFileSyntaxLines: Record<number, SyntaxLine & { | ||
| oldFileSyntaxLines: Record<string | number, SyntaxLine & { | ||
| template?: string; | ||
@@ -179,7 +179,7 @@ }>; | ||
| newFileDiffLines: Record<string, DiffLineItem>; | ||
| newFilePlainLines: Record<number, { | ||
| newFilePlainLines: Record<string | number, { | ||
| value: string; | ||
| template?: string; | ||
| }>; | ||
| newFileSyntaxLines: Record<number, SyntaxLine & { | ||
| newFileSyntaxLines: Record<string | number, SyntaxLine & { | ||
| template?: string; | ||
@@ -232,7 +232,7 @@ }>; | ||
| oldFileDiffLines: Record<string, DiffLineItem>; | ||
| oldFilePlainLines: Record<number, { | ||
| oldFilePlainLines: Record<string | number, { | ||
| value: string; | ||
| template?: string; | ||
| }>; | ||
| oldFileSyntaxLines: Record<number, SyntaxLine & { | ||
| oldFileSyntaxLines: Record<string | number, SyntaxLine & { | ||
| template?: string; | ||
@@ -243,7 +243,7 @@ }>; | ||
| newFileDiffLines: Record<string, DiffLineItem>; | ||
| newFilePlainLines: Record<number, { | ||
| newFilePlainLines: Record<string | number, { | ||
| value: string; | ||
| template?: string; | ||
| }>; | ||
| newFileSyntaxLines: Record<number, SyntaxLine & { | ||
| newFileSyntaxLines: Record<string | number, SyntaxLine & { | ||
| template?: string; | ||
@@ -250,0 +250,0 @@ }>; |
+2
-2
@@ -6,3 +6,3 @@ { | ||
| "license": "MIT", | ||
| "version": "0.0.34", | ||
| "version": "0.0.35", | ||
| "main": "index.js", | ||
@@ -54,3 +54,3 @@ "types": "index.d.ts", | ||
| "dependencies": { | ||
| "@git-diff-view/lowlight": "^0.0.34", | ||
| "@git-diff-view/lowlight": "^0.0.35", | ||
| "highlight.js": "^11.11.0", | ||
@@ -57,0 +57,0 @@ "lowlight": "^3.3.0", |
+34
-0
@@ -452,4 +452,38 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
| this.#composeRaw(); | ||
| if (__DEV__) { | ||
| this.#checkFile(); | ||
| } | ||
| } | ||
| // check the fileContent is match the diff result or not | ||
| #checkFile() { | ||
| for (const line in this.#oldFileDiffLines || {}) { | ||
| const diffLine = this.#oldFileDiffLines[line]; | ||
| const fileLine = this.#oldFilePlainLines[line]; | ||
| if ( | ||
| (this.#oldFilePlaceholderLines ? !this.#oldFilePlaceholderLines[line] : true) && | ||
| diffLine?.text !== fileLine?.value | ||
| ) { | ||
| console.warn( | ||
| `there are some mismatch from the 'oldFileContent' and 'diff' at line: ${line}, please make sure the 'oldFileContent' is correct` | ||
| ); | ||
| break; | ||
| } | ||
| } | ||
| for (const line in this.#newFileDiffLines || {}) { | ||
| const diffLine = this.#newFileDiffLines[line]; | ||
| const fileLine = this.#newFilePlainLines[line]; | ||
| if ( | ||
| (this.#newFilePlaceholderLines ? !this.#newFilePlaceholderLines[line] : true) && | ||
| diffLine?.text !== fileLine?.value | ||
| ) { | ||
| console.warn( | ||
| `there are some mismatch from the 'newFileContent' and 'diff' at line: ${line}, please make sure the 'newFileContent' is correct` | ||
| ); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| #composeDiff() { | ||
@@ -456,0 +490,0 @@ if (!this.#diffListResults?.length) return; |
+2
-2
@@ -43,5 +43,5 @@ import { highlighter } from "@git-diff-view/lowlight"; | ||
| syntaxFile: Record<number, SyntaxLineWithTemplate> = {}; | ||
| syntaxFile: Record<number | string, SyntaxLineWithTemplate> = {}; | ||
| plainFile: Record<number, { value: string; template?: string }> = {}; | ||
| plainFile: Record<number | string, { value: string; template?: string }> = {}; | ||
@@ -48,0 +48,0 @@ hasDoSyntax: boolean = false; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1134503
0.66%12381
0.62%46
2.22%+ Added
- Removed