From 3374bcd955204401c1cd73b7af0fbfc363b476ca Mon Sep 17 00:00:00 2001 From: ragool Date: Fri, 9 Oct 2026 11:35:43 +0200 Subject: [PATCH] optimize code for performance --- .gitignore | 1 + package-lock.json | 4 +- package.json | 2 +- src/core/tokens.ts | 41 +++++++------ src/htmldiff.ts | 5 ++ src/tables/RowAligner.ts | 95 ++++++++++++++++++++++++------ src/tables/SequenceAligner.spec.ts | 11 ++++ src/tables/SequenceAligner.ts | 23 +++++--- src/tables/TableMerger.ts | 17 ++++-- src/tables/TableVersion.spec.ts | 11 ++++ src/tables/TableVersion.ts | 32 +++++++++- src/tables/helpers.ts | 2 +- src/tables/html.ts | 10 +++- src/tables/similarity.spec.ts | 39 +++++++++++- src/tables/similarity.ts | 33 +++++++++-- test/diff.spec.ts | 5 ++ 16 files changed, 267 insertions(+), 64 deletions(-) diff --git a/.gitignore b/.gitignore index aebae61..b98ca32 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules htmldiff-cli.js js/ .DS_Store +htmldiff-cli.d.ts diff --git a/package-lock.json b/package-lock.json index 625d907..2e600b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@matrixreq/htmldiff", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@matrixreq/htmldiff", - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "bin": { "htmldiff": "htmldiff-cli.js" diff --git a/package.json b/package.json index f63d149..8ed093a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@matrixreq/htmldiff", "description": "Diff and markup HTML with and tags", "companyname": "Matrix Requirements", - "version": "2.0.0", + "version": "2.0.1", "keywords": [ "diff", "html", diff --git a/src/core/tokens.ts b/src/core/tokens.ts index 286499f..3638e6e 100644 --- a/src/core/tokens.ts +++ b/src/core/tokens.ts @@ -154,14 +154,13 @@ function isEndOfHtmlComment(word: string): boolean { } /** - * Inspects the last tag in the given string, its slice from the final '<'. A '>' before the - * slice's end means text follows e.g. "a > b" in a