Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/ocr-runtime-hardening.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@happyvertical/pdf': patch
---

Improve Node OCR runtime handling for scanned PDFs by auto-detecting Tesseract
`tessdata`, surfacing actionable OCR dependency errors, routing explicit
external OCR providers like `onnx` through the `unpdf` pipeline, and rendering
OCR pages directly with `pdfjs-dist` to avoid worker-version mismatches.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ pnpm-debug.log*
.env
.env.local
.env.*.local

# OCR runtime cache
.kreuzberg/
18 changes: 15 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"include": [
"src/**/*.{js,ts,tsx,jsx}",
"test/**/*.{js,ts,tsx,jsx}",
"*.{js,ts,tsx,jsx}"
"src/**/*.js",
"src/**/*.jsx",
"src/**/*.ts",
"src/**/*.tsx",
"test/**/*.js",
"test/**/*.jsx",
"test/**/*.ts",
"test/**/*.tsx",
"scripts/**/*.js",
"scripts/**/*.ts",
"*.js",
"*.jsx",
"*.ts",
"*.tsx",
"*.json"
],
"ignoreUnknown": true
},
Expand Down
34 changes: 15 additions & 19 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ export default {
2,
'always',
[
'feat', // New feature
'fix', // Bug fix
'docs', // Documentation changes
'style', // Code style changes (formatting, missing semicolons, etc.)
'refactor', // Code refactoring (neither fixes a bug nor adds a feature)
'perf', // Performance improvements
'test', // Adding or updating tests
'build', // Changes to build system or dependencies
'ci', // Changes to CI configuration files and scripts
'chore', // Other changes that don't modify src or test files
'revert', // Reverts a previous commit
'feat', // New feature
'fix', // Bug fix
'docs', // Documentation changes
'style', // Code style changes (formatting, missing semicolons, etc.)
'refactor', // Code refactoring (neither fixes a bug nor adds a feature)
'perf', // Performance improvements
'test', // Adding or updating tests
'build', // Changes to build system or dependencies
'ci', // Changes to CI configuration files and scripts
'chore', // Other changes that don't modify src or test files
'revert', // Reverts a previous commit
],
],

Expand All @@ -35,17 +35,13 @@ export default {
'pdf',
'ocr',
'unpdf',
'deps', // Dependency updates
'release', // Release-related changes
'deps', // Dependency updates
'release', // Release-related changes
],
],

// Subject case - allow sentence-case, lowercase, kebab-case, etc.
'subject-case': [
2,
'never',
['upper-case', 'pascal-case', 'start-case'],
],
'subject-case': [2, 'never', ['upper-case', 'pascal-case', 'start-case']],

// Subject full stop - no period at the end
'subject-full-stop': [2, 'never', '.'],
Expand Down Expand Up @@ -73,5 +69,5 @@ export default {

// Body max line length - disable for semantic-release commits
'body-max-line-length': [0],
],
},
};
2 changes: 1 addition & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pre-commit:
commands:
format:
glob: "*.{js,jsx,ts,tsx}"
glob: "**/*.{js,jsx,ts,tsx}"
run: pnpm biome check --write {staged_files}
stage_fixed: true

Expand Down
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
"pdfjs-dist": "5.4.296"
}
},
"files": [
"dist",
"README.md",
"LICENSE"
],
"files": ["dist", "README.md", "LICENSE"],
"publishConfig": {
"registry": "https://npm.pkg.github.com",
"access": "public"
Expand All @@ -45,7 +41,7 @@
"build": "vite build",
"build:watch": "vite build --watch",
"typecheck": "tsc --noEmit",
"lint": "biome check",
"lint": "biome check .",
"format": "biome format --write src/",
"clean": "rm -rf dist *.tsbuildinfo",
"dev": "npm run build:watch & npm run test:watch",
Expand All @@ -56,9 +52,10 @@
"prepare": "lefthook install"
},
"dependencies": {
"@happyvertical/ocr": "^0.60.4",
"@happyvertical/utils": "^0.71.0",
"pdf-to-png-converter": "^3.10.0",
"@happyvertical/ocr": "^0.60.33",
"@happyvertical/utils": "^0.71.20",
"@napi-rs/canvas": "0.1.97",
"pdfjs-dist": "5.4.296",
"unpdf": "^1.4.0"
},
"optionalDependencies": {
Expand Down
Loading
Loading