From 2a9a11adb363033e61f113ae11867444b8980078 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Mon, 13 Apr 2026 17:00:45 -0400 Subject: [PATCH] Move panel detection dependencies to optionalDependencies Fix npm install errors and make ML/CV libraries truly optional. Changes: - Move dependencies from "dependencies" to "optionalDependencies" - Fix @techstark/opencv-js version from "^4.12.0" to "4.12.0-release.1" - The caret syntax (^) doesn't work with suffix versions like -release.1 - Use exact version match instead Why optionalDependencies: - Installation won't fail if these packages fail to install - Users can opt-out with: npm install foliate-js --omit=optional - Maintains the library's "no hard dependencies" philosophy - Graceful degradation: panel detection falls back to grid-only mode Behavior: - Default: npm attempts to install OpenCV, TensorFlow, COCO-SSD (~4.5MB) - With --omit=optional: skips heavy ML/CV libraries - Either way: library works, panel detection gracefully adapts This resolves npm install errors where "^4.12.0" couldn't be found because the actual version is "4.12.0-release.1". --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b681de4..18a9ba7 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "exports": { "./*.js": "./*.js" }, - "dependencies": { - "@techstark/opencv-js": "^4.12.0", + "optionalDependencies": { + "@techstark/opencv-js": "4.12.0-release.1", "@tensorflow/tfjs": "^4.22.0", "@tensorflow-models/coco-ssd": "^2.2.3" },