Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@git-diff-view/core

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@git-diff-view/core - npm Package Compare versions

Comparing version
0.0.28
to
0.0.29
+6
-0
index.d.ts

@@ -29,2 +29,3 @@ // Generated by dts-bundle-generator v9.5.1

maxLineNumber: number;
enableTemplate: boolean;
static createInstance(data: File$1): File$1;

@@ -92,2 +93,5 @@ constructor(row: string, lang: DiffHighlighterLang, fileName?: string);

init(): void;
enableTemplate(): void;
disableTemplate(): void;
getIsEnableTemplate(): boolean;
buildSplitDiffLines(): void;

@@ -171,2 +175,3 @@ buildUnifiedDiffLines(): void;

theme: "light" | "dark";
enableTemplate: boolean;
isFullMerge: boolean;

@@ -229,2 +234,3 @@ };

theme: "light" | "dark";
enableTemplate: boolean;
};

@@ -231,0 +237,0 @@ _mergeFullBundle: (data: ReturnType<DiffFile["_getFullBundle"]>, notifyUpdate?: boolean) => void;

+2
-2

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "0.0.28",
"version": "0.0.29",
"main": "index.js",

@@ -54,3 +54,3 @@ "types": "index.d.ts",

"dependencies": {
"@git-diff-view/lowlight": "^0.0.28",
"@git-diff-view/lowlight": "^0.0.29",
"highlight.js": "^11.11.0",

@@ -57,0 +57,0 @@ "lowlight": "^3.3.0",

@@ -148,2 +148,4 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

#enableTemplate: boolean = true;
#composeByFullMerge: boolean = false;

@@ -298,2 +300,3 @@

);
this.#oldFileResult.enableTemplate = this.#enableTemplate;
}

@@ -309,2 +312,3 @@

);
this.#newFileResult.enableTemplate = this.#enableTemplate;
}

@@ -380,2 +384,3 @@ }

);
this.#oldFileResult.enableTemplate = this.#enableTemplate;
this.#newFileResult = getFile(

@@ -388,2 +393,3 @@ this._newFileContent,

);
this.#newFileResult.enableTemplate = this.#enableTemplate;
this.#oldFilePlaceholderLines = oldFilePlaceholderLines;

@@ -423,2 +429,3 @@ this.#newFilePlaceholderLines = newFilePlaceholderLines;

);
this.#newFileResult.enableTemplate = this.#enableTemplate;
} else if (this.#newFileResult) {

@@ -454,2 +461,3 @@ let oldLineNumber = 1;

);
this.#oldFileResult.enableTemplate = this.#enableTemplate;
}

@@ -716,2 +724,14 @@

enableTemplate() {
this.#enableTemplate = true;
}
disableTemplate() {
this.#enableTemplate = false;
}
getIsEnableTemplate() {
return this.#enableTemplate;
}
buildSplitDiffLines() {

@@ -1402,2 +1422,3 @@ if (this.#hasBuildSplit) return;

// TODO improve
subscribe = (listener: (() => void) & { isSyncExternal?: boolean }) => {

@@ -1407,3 +1428,3 @@ this.#listeners.push(listener);

return () => {
this.#listeners.filter((i) => i !== listener);
this.#listeners = this.#listeners.filter((i) => i !== listener);
};

@@ -1471,2 +1492,3 @@ };

const theme = this.#theme;
const enableTemplate = this.#enableTemplate;

@@ -1510,2 +1532,4 @@ return {

enableTemplate,
isFullMerge: false,

@@ -1552,2 +1576,4 @@ };

this.#enableTemplate = data.enableTemplate;
// mark this instance as a merged instance

@@ -1569,3 +1595,3 @@ this.#composeByMerge = true;

_getHighlighterName = () => this.#highlighterName;
_getHighlighterName = () => this.#highlighterName || "";

@@ -1572,0 +1598,0 @@ _getIsPureDiffRender = () => this.#composeByDiff;

@@ -57,2 +57,4 @@ import { highlighter } from "@git-diff-view/lowlight";

enableTemplate: boolean = true;
static createInstance(data: File) {

@@ -83,2 +85,4 @@ const file = new File(data?.raw, data?.lang, data?.fileName);

file.enableTemplate = data?.enableTemplate ?? true;
return file;

@@ -142,6 +146,8 @@ }

// get syntax template
Object.values(syntaxFileObject).forEach((line: SyntaxLineWithTemplate) => {
line.template = getSyntaxLineTemplate(line);
});
if (this.enableTemplate) {
// get syntax template
Object.values(syntaxFileObject).forEach((line: SyntaxLineWithTemplate) => {
line.template = getSyntaxLineTemplate(line);
});
}

@@ -180,6 +186,8 @@ this.syntaxFile = syntaxFileObject;

this.rawFile[i + 1] = i < rawArray.length - 1 ? rawArray[i] + "\n" : rawArray[i];
this.plainFile[i + 1] = {
value: this.rawFile[i + 1],
template: getPlainLineTemplate(this.rawFile[i + 1]),
};
if (this.enableTemplate) {
this.plainFile[i + 1] = {
value: this.rawFile[i + 1],
template: getPlainLineTemplate(this.rawFile[i + 1]),
};
}
}

@@ -186,0 +194,0 @@

@@ -96,3 +96,3 @@ import { NewLineSymbol } from "@git-diff-view/utils";

if (aSymbol === bSymbol) {
if (aSymbol === bSymbol && !hasNewLineChanged) {
return { addSymbol: undefined, addString: stringA, delSymbol: undefined, delString: stringB };

@@ -99,0 +99,0 @@ }

@@ -11,2 +11,4 @@ import { addContentHighlightBGName, delContentHighlightBGName, getSymbol } from "@git-diff-view/utils";

const defaultTransform = (content: string) => escapeHtml(content).replace(/\n/g, "").replace(/\r/g, "");
export const getPlainDiffTemplate = ({

@@ -27,3 +29,3 @@ diffLine,

const transform = isTransformEnabled() ? processTransformTemplateContent : escapeHtml;
const transform = isTransformEnabled() ? processTransformTemplateContent : defaultTransform;

@@ -64,3 +66,3 @@ const range = changes.range;

const transform = isTransformEnabled() ? processTransformTemplateContent : escapeHtml;
const transform = isTransformEnabled() ? processTransformTemplateContent : defaultTransform;

@@ -106,3 +108,3 @@ const range = changes.range;

const transform = isTransformEnabled() ? processTransformTemplateContent : escapeHtml;
const transform = isTransformEnabled() ? processTransformTemplateContent : defaultTransform;

@@ -121,3 +123,3 @@ line?.nodeList?.forEach(({ node, wrapper }) => {

const transform = isTransformEnabled() ? processTransformTemplateContent : escapeHtml;
const transform = isTransformEnabled() ? processTransformTemplateContent : defaultTransform;

@@ -124,0 +126,0 @@ const template = transform(line);

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