Files
foliate-js/package.json
john-okeefe 3242b6f7aa build: configure Rollup to automate ML/CV library vendoring
Set up build system to automatically download and copy ML/CV libraries
during npm run build, eliminating manual file management.

Changes to package.json:
- Add devDependencies:
  * @techstark/opencv-js: OpenCV.js for edge detection
  * @tensorflow-models/coco-ssd: ML model for panel detection
  * @rollup/plugin-terser: Minification plugin (already used)

Changes to rollup.config.js:
- Add custom downloadTensorFlow plugin:
  * Downloads TensorFlow UMD build from unpkg.com during build
  * Saves to vendor/tfjs/tf.min.js (1.5MB)
  * Only runs during build, not in watch mode

- Add copy plugins for ML/CV libraries:
  * Copy OpenCV.js from node_modules to vendor/opencv/opencv.js
  * Copy COCO-SSD from node_modules to vendor/coco-ssd/coco-ssd.min.js

This automated approach ensures:
1. All vendored libraries are updated when npm install is run
2. No manual file downloads or copy operations needed
3. Reproducible builds across different environments
4. Version tracking via package.json

Build workflow: npm install → npm run build → all ML/CV libraries ready
2026-04-13 19:14:59 -04:00

50 lines
1.1 KiB
JSON

{
"name": "foliate-js",
"version": "0.0.0",
"description": "Render e-books in the browser",
"repository": {
"type": "git",
"url": "git+https://github.com/johnfactotum/foliate-js.git"
},
"bugs": {
"url": "https://github.com/johnfactotum/foliate-js/issues"
},
"homepage": "https://github.com/johnfactotum/foliate-js#readme",
"author": "John Factotum",
"license": "MIT",
"type": "module",
"exports": {
"./*.js": "./*.js"
},
"devDependencies": {
"@eslint/js": "^9.9.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^1.0.0",
"@zip.js/zip.js": "^2.7.52",
"fflate": "^0.8.2",
"fs-extra": "^11.2.0",
"globals": "^15.9.0",
"pdfjs-dist": "^5.5.207",
"@techstark/opencv-js": "4.12.0-release.1",
"@tensorflow-models/coco-ssd": "^2.2.3",
"rollup": "^4.22.4"
},
"scripts": {
"build": "npx rollup -c"
},
"keywords": [
"ebook",
"reader",
"epub",
"cfi",
"mobi",
"azw",
"azw3",
"fb2",
"cbz",
"dictd",
"stardict",
"opds"
]
}