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.1.4
to
0.1.5
+3
-0
index.d.ts

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

export declare const getCurrentComposeLength: () => number;
export declare const getEnableBuildTemplate: () => boolean;
export declare const getEnableFastDiffTemplate: () => boolean;

@@ -613,2 +614,3 @@ export declare const getLang: (fileName: string) => string;

export declare const resetDefaultComposeLength: () => void;
export declare const resetEnableBuildTemplate: () => void;
export declare const resetEnableFastDiffTemplate: () => void;

@@ -625,2 +627,3 @@ export declare const resetMaxLengthToIgnoreLineDiff: () => void;

export declare const resetTransform: () => void;
export declare const setEnableBuildTemplate: (enable: boolean) => void;
export declare const setEnableFastDiffTemplate: (enable: boolean) => void;

@@ -627,0 +630,0 @@ /**

+2
-2

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

"license": "MIT",
"version": "0.1.4",
"version": "0.1.5",
"main": "index.js",

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

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

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

import { highlighter } from "@git-diff-view/lowlight";
import { Cache } from "./cache";
import { getPlainLineTemplate, getSyntaxLineTemplate, processTransformForFile } from "./parse";
import { getEnableBuildTemplate, getPlainLineTemplate, getSyntaxLineTemplate, processTransformForFile } from "./parse";

@@ -177,6 +177,7 @@ import type { DiffAST, DiffHighlighter, DiffHighlighterLang, SyntaxLine } from "@git-diff-view/lowlight";

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

@@ -213,2 +214,4 @@ this.syntaxFile = syntaxFileObject;

const buildTemplate = getEnableBuildTemplate();
for (let i = 0; i < rawArray.length; i++) {

@@ -218,3 +221,3 @@ this.rawFile[i + 1] = i < rawArray.length - 1 ? rawArray[i] + "\n" : rawArray[i];

value: this.rawFile[i + 1],
template: getPlainLineTemplate(this.rawFile[i + 1]),
template: buildTemplate ? getPlainLineTemplate(this.rawFile[i + 1]) : undefined,
};

@@ -221,0 +224,0 @@ }

@@ -5,2 +5,3 @@ import { diffChanges, relativeChanges } from "./change-range";

import {
getEnableBuildTemplate,
getEnableFastDiffTemplate,

@@ -152,25 +153,28 @@ getPlainDiffTemplate,

}
const buildTemplate = getEnableBuildTemplate();
if (!getEnableFastDiffTemplate()) {
getPlainDiffTemplate({
diffLine: addition,
rawLine: getAdditionRaw(addition.newLineNumber!) || "",
operator: "add",
});
getPlainDiffTemplate({
diffLine: deletion,
rawLine: getDeletionRaw(deletion.oldLineNumber!) || "",
operator: "del",
});
getSyntaxDiffTemplate({
diffFile,
diffLine: addition,
syntaxLine: getAdditionSyntax(addition.newLineNumber!) || null,
operator: "add",
});
getSyntaxDiffTemplate({
diffFile,
diffLine: deletion,
syntaxLine: getDeletionSyntax(deletion.oldLineNumber!) || null,
operator: "del",
});
if (buildTemplate) {
getPlainDiffTemplate({
diffLine: addition,
rawLine: getAdditionRaw(addition.newLineNumber!) || "",
operator: "add",
});
getPlainDiffTemplate({
diffLine: deletion,
rawLine: getDeletionRaw(deletion.oldLineNumber!) || "",
operator: "del",
});
getSyntaxDiffTemplate({
diffFile,
diffLine: addition,
syntaxLine: getAdditionSyntax(addition.newLineNumber!) || null,
operator: "add",
});
getSyntaxDiffTemplate({
diffFile,
diffLine: deletion,
syntaxLine: getDeletionSyntax(deletion.oldLineNumber!) || null,
operator: "del",
});
}
} else {

@@ -190,24 +194,26 @@ const _addition = DiffLine.prototype.clone.call(

deletion._diffChanges = addRange;
getPlainDiffTemplateByFastDiff({
diffLine: addition,
rawLine: getAdditionRaw(addition.newLineNumber!) || "",
operator: "add",
});
getPlainDiffTemplateByFastDiff({
diffLine: deletion,
rawLine: getDeletionRaw(deletion.oldLineNumber!) || "",
operator: "del",
});
getSyntaxDiffTemplateByFastDiff({
diffFile,
diffLine: addition,
syntaxLine: getAdditionSyntax(addition.newLineNumber!) || null,
operator: "add",
});
getSyntaxDiffTemplateByFastDiff({
diffFile,
diffLine: deletion,
syntaxLine: getDeletionSyntax(deletion.oldLineNumber!) || null,
operator: "del",
});
if (buildTemplate) {
getPlainDiffTemplateByFastDiff({
diffLine: addition,
rawLine: getAdditionRaw(addition.newLineNumber!) || "",
operator: "add",
});
getPlainDiffTemplateByFastDiff({
diffLine: deletion,
rawLine: getDeletionRaw(deletion.oldLineNumber!) || "",
operator: "del",
});
getSyntaxDiffTemplateByFastDiff({
diffFile,
diffLine: addition,
syntaxLine: getAdditionSyntax(addition.newLineNumber!) || null,
operator: "add",
});
getSyntaxDiffTemplateByFastDiff({
diffFile,
diffLine: deletion,
syntaxLine: getDeletionSyntax(deletion.oldLineNumber!) || null,
operator: "del",
});
}
}

@@ -214,0 +220,0 @@ }

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

let enableBuildTemplate = true;
export const getEnableBuildTemplate = () => enableBuildTemplate;
export const setEnableBuildTemplate = (enable: boolean) => {
enableBuildTemplate = enable;
};
export const resetEnableBuildTemplate = () => {
enableBuildTemplate = true;
};
export const defaultTransform = (content: string) => escapeHtml(content).replace(/\n/g, "").replace(/\r/g, "");

@@ -25,0 +37,0 @@

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