@createiq/htmldiff 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +51 -0
- package/mise.toml +2 -0
- package/package.json +6 -6
- package/.node-version +0 -1
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Development Commands
|
|
6
|
+
|
|
7
|
+
- **Build**: `npm run build` - Builds ESM and CJS modules using tsup
|
|
8
|
+
- **Test**: `npm test` - Runs tests in watch mode using Vitest
|
|
9
|
+
- **Test CI**: `npm run test:ci` - Runs tests once for CI environments
|
|
10
|
+
- **Test Debug**: `npm run test-debug` - Runs tests with debugging enabled
|
|
11
|
+
- **Lint**: `npm run lint` - Runs Biome linter with error-on-warnings
|
|
12
|
+
- **Lint Fix**: `npm run lint:fix` - Runs linter and auto-fixes issues
|
|
13
|
+
- **Format**: `npm run format` - Checks code formatting with Biome
|
|
14
|
+
- **Format Fix**: `npm run format:fix` - Auto-formats code with Biome
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
This is a TypeScript HTML diff library that compares two HTML snippets and highlights differences. It's a port of the C# HtmlDiff.NET library.
|
|
19
|
+
|
|
20
|
+
### Core Components
|
|
21
|
+
|
|
22
|
+
- **HtmlDiff** (`src/HtmlDiff.ts`): Main class with `execute()` static method and configurable instance options
|
|
23
|
+
- **WordSplitter** (`src/WordSplitter.ts`): Converts HTML to word arrays for comparison
|
|
24
|
+
- **MatchFinder** (`src/MatchFinder.ts`): Finds matching blocks between old and new text
|
|
25
|
+
- **Operation** (`src/Operation.ts`): Represents diff operations (Equal, Insert, Delete, Replace)
|
|
26
|
+
- **Action** (`src/Action.ts`): Enum for operation types
|
|
27
|
+
- **Match** (`src/Match.ts`): Represents matched text blocks
|
|
28
|
+
- **Utils** (`src/Utils.ts`): Utility functions for HTML tag handling
|
|
29
|
+
|
|
30
|
+
### Key Features
|
|
31
|
+
|
|
32
|
+
- Configurable diff accuracy via `repeatingWordsAccuracy` (0-1)
|
|
33
|
+
- Whitespace difference handling via `ignoreWhitespaceDifferences`
|
|
34
|
+
- Orphan match filtering via `orphanMatchThreshold`
|
|
35
|
+
- Block expressions for grouping text (dates, etc.)
|
|
36
|
+
- Special handling for HTML formatting tags
|
|
37
|
+
|
|
38
|
+
### Build System
|
|
39
|
+
|
|
40
|
+
- **tsup**: Builds ESM/CJS modules from `src/HtmlDiff.ts` entry point
|
|
41
|
+
- **Biome**: Handles linting and formatting (replaces ESLint/Prettier)
|
|
42
|
+
- **Vitest**: Test runner with coverage reporting
|
|
43
|
+
- **Husky**: Git hooks with lint-staged for pre-commit checks
|
|
44
|
+
|
|
45
|
+
### Testing
|
|
46
|
+
|
|
47
|
+
Tests are in `/test` directory using Vitest. Run `npm test` for watch mode or `npm run test:ci` for single run. Coverage reports generated with Istanbul provider.
|
|
48
|
+
|
|
49
|
+
### Release Process
|
|
50
|
+
|
|
51
|
+
Releases happen via merge requests to `prod` branch from `main`. Version must be bumped in package.json following semver.
|
package/mise.toml
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@createiq/htmldiff",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "TypeScript port of htmldiff.net",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Mathew Mannion <mathew.mannion@linklaters.com>",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"node": ">=20.0.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@biomejs/biome": "2.
|
|
20
|
-
"@cyclonedx/cyclonedx-npm": "4.0.
|
|
19
|
+
"@biomejs/biome": "2.2.6",
|
|
20
|
+
"@cyclonedx/cyclonedx-npm": "4.0.3",
|
|
21
21
|
"@tsconfig/recommended": "1.0.10",
|
|
22
|
-
"@types/node": "22.
|
|
22
|
+
"@types/node": "22.18.11",
|
|
23
23
|
"@vitest/coverage-istanbul": "3.2.4",
|
|
24
24
|
"@vitest/ui": "3.2.4",
|
|
25
25
|
"husky": "9.1.7",
|
|
26
|
-
"lint-staged": "16.
|
|
26
|
+
"lint-staged": "16.2.4",
|
|
27
27
|
"tsup": "8.5.0",
|
|
28
|
-
"typescript": "5.
|
|
28
|
+
"typescript": "5.9.3",
|
|
29
29
|
"vitest": "3.2.4"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
package/.node-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
22.11.0
|