@vizzly-testing/honeydiff 0.4.0 → 0.4.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,92 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.4.2] - 2025-12-01
9
+
10
+ ## What's Changed
11
+
12
+ ### Fixed
13
+ - **ESM exports now work correctly in published package** - Fixed critical bug where ESM imports were broken in consuming projects (e.g., `import { compare } from '@vizzly-testing/honeydiff'` threw `SyntaxError: The requested module does not provide an export named 'compare'`). The package loader now auto-detects whether to use platform-specific binaries (published package) or the local development build. (#14)
14
+
15
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.4.1...v0.4.2
16
+
17
+ ## [0.4.1] - 2025-11-30
18
+
19
+ ## What's Changed
20
+
21
+ ### Changed
22
+ - CHANGELOG.md is now included in the npm package, providing version history for offline reference
23
+
24
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.4.0...v0.4.1
25
+
26
+ ## [0.4.0] - 2025-11-30
27
+
28
+ ### Breaking Changes
29
+ - **ESM-only package**: Switched from CommonJS (`module.exports`) to native ES modules (`export`). If you're using CommonJS, you'll need to use dynamic `import()` or update your project to ESM.
30
+
31
+ ### Added
32
+ - Color blindness simulation API for accessibility testing:
33
+ - `simulateColorBlindness` / `simulateColorBlindnessSync` - Simulate how images appear to users with color vision deficiencies
34
+ - `saveColorBlindnessSimulation` / `saveColorBlindnessSimulationSync` - Save simulated images to disk
35
+ - `saveAllColorBlindnessSimulations` / `saveAllColorBlindnessSimulationsSync` - Generate all CVD type simulations at once
36
+ - `analyzeWcagForCvd` / `analyzeWcagForCvdSync` - Analyze WCAG contrast for a specific color blindness type
37
+ - `analyzeWcagAllCvd` / `analyzeWcagAllCvdSync` - Analyze WCAG contrast across all color blindness types
38
+ - `getColorBlindnessTypes` - Get list of supported color blindness types (protanopia, deuteranopia, tritanopia, achromatopsia)
39
+
40
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.3.1...v0.4.0
41
+
42
+ ## [0.3.1] - 2025-11-15
43
+
44
+ ### Fixed
45
+ - Fixed release workflow to properly export WCAG functions (`analyzeWcagContrast`, `analyzeWcagContrastSync`, `saveWcagOverlay`, `saveWcagOverlaySync`)
46
+
47
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.3.0...v0.3.1
48
+
49
+ ## [0.3.0] - 2025-11-15
50
+
51
+ ### Added
52
+ - WCAG accessibility testing API for analyzing color contrast compliance
53
+ - `analyzeWcagContrast` / `analyzeWcagContrastSync` - Analyze images for WCAG color contrast violations
54
+ - `saveWcagOverlay` / `saveWcagOverlaySync` - Generate visual overlays highlighting contrast issues
55
+
56
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.2.1...v0.3.0
57
+
58
+ ## [0.2.1] - 2025-11-11
59
+
60
+ ### Changed
61
+ - Improved README documentation for better user experience
62
+
63
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.2.0...v0.2.1
64
+
65
+ ## [0.2.0] - 2025-11-10
66
+
67
+ ### Added
68
+ - Node.js bindings for accessibility features (ignore colors mode, anti-aliasing detection settings)
69
+ - Comprehensive accessibility features for visual regression testing
70
+
71
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.1.1...v0.2.0
72
+
73
+ ## [0.1.1] - 2025-10-25
74
+
75
+ ### Added
76
+ - `getDimensions` / `getDimensionsSync` API to retrieve image dimensions without loading full image into memory
77
+
78
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.1.0...v0.1.1
79
+
80
+ ## [0.1.0] - 2025-10-21
81
+
82
+ ### Added
83
+ - Initial release of `@vizzly-testing/honeydiff` Node.js bindings
84
+ - Native Rust bindings via Neon for high-performance image diffing
85
+ - `compare` / `compareSync` - Full image comparison with all options
86
+ - `quickCompare` / `quickCompareSync` - Fast comparison returning only diff count and match status
87
+ - Support for macOS ARM64, Linux x64/ARM64, and Windows x64
88
+ - Async and sync variants of all APIs
89
+ - TypeScript definitions included
90
+ - 1.1B pixels/sec throughput for Full HD images
91
+
92
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/releases/tag/v0.1.0
package/index.js CHANGED
@@ -2,31 +2,61 @@
2
2
  * @vizzly-testing/honeydiff - Native Node.js bindings for Honeydiff
3
3
  */
4
4
 
5
+ import { existsSync } from 'node:fs';
6
+ import { createRequire } from 'node:module';
7
+ import { dirname, join } from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+
10
+ const require = createRequire(import.meta.url);
11
+ const __dirname = dirname(fileURLToPath(import.meta.url));
12
+
5
13
  let addon;
6
14
 
7
- try {
8
- // Load the platform-specific native addon
9
- addon = require('./load-platform.js');
10
- } catch (e) {
11
- throw new Error(
12
- '@vizzly-testing/honeydiff failed to load native binary.\n' +
13
- 'Platform: ' + process.platform + ' ' + process.arch + '\n' +
14
- 'Original error: ' + e.message
15
- );
15
+ // Try to load the native addon:
16
+ // 1. First try load-platform.js (exists in published npm package with multi-platform binaries)
17
+ // 2. Fall back to index.node (exists in local development builds)
18
+ const platformLoaderPath = join(__dirname, 'load-platform.js');
19
+
20
+ if (existsSync(platformLoaderPath)) {
21
+ // Published package: use platform-specific loader
22
+ addon = require(platformLoaderPath);
23
+ } else {
24
+ // Local development: use directly built index.node
25
+ try {
26
+ addon = require('./index.node');
27
+ } catch (e) {
28
+ throw new Error(
29
+ '@vizzly-testing/honeydiff: Failed to load native binary.\n' +
30
+ 'If developing locally, run "cargo build --release" first.\n' +
31
+ 'Original error: ' +
32
+ e.message
33
+ );
34
+ }
16
35
  }
17
36
 
18
- // Export all functions from the native addon
19
- module.exports = {
20
- compare: addon.compare,
21
- quickCompare: addon.quickCompare,
22
- compareSync: addon.compareSync,
23
- quickCompareSync: addon.quickCompareSync,
24
- getDimensions: addon.getDimensions,
25
- getDimensionsSync: addon.getDimensionsSync,
26
-
27
- // WCAG Accessibility API
28
- analyzeWcagContrast: addon.analyzeWcagContrast,
29
- analyzeWcagContrastSync: addon.analyzeWcagContrastSync,
30
- saveWcagOverlay: addon.saveWcagOverlay,
31
- saveWcagOverlaySync: addon.saveWcagOverlaySync,
32
- };
37
+ // Core comparison API
38
+ export const compare = addon.compare;
39
+ export const quickCompare = addon.quickCompare;
40
+ export const compareSync = addon.compareSync;
41
+ export const quickCompareSync = addon.quickCompareSync;
42
+ export const getDimensions = addon.getDimensions;
43
+ export const getDimensionsSync = addon.getDimensionsSync;
44
+
45
+ // WCAG Accessibility API
46
+ export const analyzeWcagContrast = addon.analyzeWcagContrast;
47
+ export const analyzeWcagContrastSync = addon.analyzeWcagContrastSync;
48
+ export const saveWcagOverlay = addon.saveWcagOverlay;
49
+ export const saveWcagOverlaySync = addon.saveWcagOverlaySync;
50
+
51
+ // Color Vision Deficiency (CVD) Simulation API
52
+ export const simulateColorBlindness = addon.simulateColorBlindness;
53
+ export const simulateColorBlindnessSync = addon.simulateColorBlindnessSync;
54
+ export const saveColorBlindnessSimulation = addon.saveColorBlindnessSimulation;
55
+ export const saveColorBlindnessSimulationSync = addon.saveColorBlindnessSimulationSync;
56
+ export const saveAllColorBlindnessSimulations = addon.saveAllColorBlindnessSimulations;
57
+ export const saveAllColorBlindnessSimulationsSync = addon.saveAllColorBlindnessSimulationsSync;
58
+ export const analyzeWcagForCvd = addon.analyzeWcagForCvd;
59
+ export const analyzeWcagForCvdSync = addon.analyzeWcagForCvdSync;
60
+ export const analyzeWcagAllCvd = addon.analyzeWcagAllCvd;
61
+ export const analyzeWcagAllCvdSync = addon.analyzeWcagAllCvdSync;
62
+ export const getColorBlindnessTypes = addon.getColorBlindnessTypes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizzly-testing/honeydiff",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "High-performance image diffing for Node.js - Native bindings to Honeydiff Rust library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -51,11 +51,13 @@
51
51
  "load-platform.js",
52
52
  "platforms/*.node",
53
53
  "README.md",
54
+ "CHANGELOG.md",
54
55
  "index.js",
55
56
  "index.d.ts",
56
57
  "load-platform.js",
57
58
  "platforms/*.node",
58
- "README.md"
59
+ "README.md",
60
+ "CHANGELOG.md"
59
61
  ],
60
62
  "engines": {
61
63
  "node": ">=22.0.0"