[Feat] PaddleOCR.js#17861
Merged
Bobholamovic merged 78 commits intoApr 20, 2026
Merged
Conversation
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
|
Thanks for your contribution! |
Made-with: Cursor
Made-with: Cursor
Set up the TypeScript migration foundation: - Add TypeScript, vite-plugin-dts, and type definitions as devDependencies - Create tsconfig.json files (core, test, root project references) - Configure Vite library build with ES/CJS/UMD outputs and .d.ts generation - Update package.json entry points from src/ to dist/ with proper exports map - Replace plain JS ESLint config with typescript-eslint strict type-checked rules - Update Vitest coverage to target .ts files - Add typecheck script, engines, keywords across workspace packages Made-with: Cursor
…exports types-first Made-with: Cursor
…-lib and opencv Minimal .d.ts files covering only the APIs actually used by the project. Made-with: Cursor
Converts utils/common, worker/protocol, pipelines/ocr/default-config, pipelines/ocr/runtime-params, runtime/opencv, runtime/ort, runtime/index, and models/common from .js to .ts with full type annotations. Made-with: Cursor
Converts models/det, models/rec, models/index, resources/tar, resources/cache, resources/registry, resources/standard-model, resources/index, platform/browser, and platform/worker from .js to .ts with interfaces for all model configs, results, and platform types. Made-with: Cursor
Converts worker/client, worker/entry, pipelines/ocr/config, pipelines/ocr/shared, pipelines/ocr/core, pipelines/ocr/worker-backed, and pipelines/ocr/worker-entry from .js to .ts with full type annotations for pipeline options, results, and initialization state. Made-with: Cursor
… types/index.ts Converts pipelines/ocr/index, pipelines/index, and src/index from .js to .ts. Creates src/types/index.ts re-exporting all public-facing types. Fixes all TypeScript errors (strict mode + verbatimModuleSyntax clean). Made-with: Cursor
- Renamed all 29 test files from .js to .ts - Added type annotations to test helpers and mocks - Fixed barrel import in core.ts to maintain mock interceptability - Restored createWorker: null in resolveWorkerOptions for API contract - Updated public-api test to import from source directly All 154 tests pass. Made-with: Cursor
- Add worker.format: 'es' to core vite config (fixes UMD build conflict) - Add resolve alias in demo vite config to resolve paddleocr-js to source Made-with: Cursor
- Remove unnecessary optional chains, type assertions, and type conversions - Remove unused type imports - Fix floating promises, non-Error throws, and catch variable types - Widen SourceToMatFn to accept sync or async returns - Update tests to match sync dispose() and sourcePayloadToMat() 96 lint errors -> 0. All 154 tests pass. Made-with: Cursor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eline } Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cuicheng01
reviewed
Apr 20, 2026
| @@ -0,0 +1,80 @@ | |||
| # Architecture | |||
Collaborator
There was a problem hiding this comment.
这三个文档建议还是补充一个中文文档吧?另外总文档看是否要链一下这三个文档?
Member
Author
There was a problem hiding this comment.
done,这三个文档和项目代码结构强相关,放在mkdocs里会有些抽象,且mkdocs文档用户通常主要关心用法而不是子项目结构设计/二次开发,考虑作为子项目内部文档,在子项目的readme里保留链接。
| @@ -0,0 +1,255 @@ | |||
| import yaml from "js-yaml"; | |||
Collaborator
There was a problem hiding this comment.
.ts建议整体加一下版权信息?避免一些后续可能引发的问题
| }); | ||
| ``` | ||
|
|
||
| **自定义模型** — 资源描述: |
Collaborator
There was a problem hiding this comment.
自定义模型应满足的格式说明下?这里是否需要提供一个什么check机制,check通过后才可以使用。
Member
Author
There was a problem hiding this comment.
补充了说明,包括格式要求、内置check机制的反馈、以及得到标准模型格式的推荐办法(通过paddle2onnx)。
|
|
||
| # 浏览器端部署 | ||
|
|
||
| PaddleOCR 提供浏览器端推理 SDK PaddleOCR.js。开发者可以将 OCR 功能嵌入到浏览器中,实现离线推理。详情请参考 [PaddleOCR.js](https://github.com/PaddlePaddle/PaddleOCR/blob/main/paddleocr-js)。 |
Collaborator
There was a problem hiding this comment.
paddleocr-js/以及paddleocr-js/packages/core/中的README还是建议可以直接在站点文档中显示,要不然可能会比较割裂。
Member
Author
There was a problem hiding this comment.
done,提供了一份适合在mkdocs站点阅读的文档
cuicheng01
approved these changes
Apr 20, 2026
scyyh11
added a commit
to scyyh11/PaddleOCR
that referenced
this pull request
Apr 21, 2026
dorny/paths-filter defaults to the "some" predicate-quantifier, so docs_only became true whenever any single file matched the patterns, causing test-pr to be skipped on PRs that touched both a doc-like file (any .yml/.md/.txt or an ignored subdir) and real code (e.g. pyproject.toml). Switch to predicate-quantifier: every so the filter only matches when all changed files are skippable, aligning with the bash logic PaddlePaddle#17861 introduced for test_gpu.yml. Signed-off-by: Bvicii <yizhanhuang2002@gmail.com>
scyyh11
added a commit
to scyyh11/PaddleOCR
that referenced
this pull request
Apr 21, 2026
dorny/paths-filter defaults to the "some" predicate-quantifier, so docs_only became true whenever any single file matched the patterns, causing test-pr to be skipped on PRs that touched both a doc-like file (any .yml/.md/.txt or an ignored subdir) and real code (e.g. pyproject.toml). Switch to predicate-quantifier: every so the filter only matches when all changed files are skippable, aligning with the bash logic PaddlePaddle#17861 introduced for test_gpu.yml. Signed-off-by: Bvicii <yizhanhuang2002@gmail.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.