Skip to content

Conversation

@marcodejongh
Copy link
Owner

Summary

This PR refactors the parsing logic to separate browser-compatible code from Node.js-specific code. A new parser-core.ts module contains the core parsing functions that work in both environments, while parser.ts now focuses on Node.js file-based APIs.

Key Changes

  • New parser-core.ts: Contains parseWithProcessor() and deduplicateClimbs() functions that don't depend on Sharp or Node.js-specific modules
  • Updated parser.ts: Now re-exports core functions from parser-core.ts for backward compatibility, while keeping Node.js-specific file APIs (parseScreenshot, parseMultipleScreenshots)
  • Updated browser.ts: Changed imports to use parser-core.ts instead of parser.ts to avoid pulling in Sharp as a dependency in browser builds

Implementation Details

  • The core parsing logic is unchanged; only the module organization has been refactored
  • parser.ts maintains backward compatibility by re-exporting the core functions
  • Browser builds can now import from parser-core.ts directly, eliminating Sharp from the dependency tree for browser consumers
  • The parseScreenshot() function in parser.ts now dynamically imports parseWithProcessor from parser-core.ts

https://claude.ai/code/session_01PJwwsjNro53zsGmLRe3k6K

…rror

The moonboard-ocr browser export was still pulling in sharp during
server-side rendering because parser.ts imported SharpImageProcessor
at the top level. Split browser-safe functions (parseWithProcessor,
deduplicateClimbs) into parser-core.ts and updated browser.ts to
import directly from parser-core.ts.

https://claude.ai/code/session_01PJwwsjNro53zsGmLRe3k6K
@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
boardsesh Building Building Preview, Comment Feb 1, 2026 8:25am

Request Review

@claude
Copy link

claude bot commented Feb 1, 2026

Claude Review

Ready to merge - Minor issue noted below, but nothing blocking.

Issues

  1. Redundant dynamic import (packages/moonboard-ocr/src/parser.ts:22): parseWithProcessor is already statically imported via re-export on line 13, so the dynamic import('./parser-core') is unnecessary and adds overhead. Either remove the re-export on line 13 or use the already-available static import.

Use static import for parseWithProcessor instead of unnecessary
dynamic import since it's already being re-exported.

https://claude.ai/code/session_01PJwwsjNro53zsGmLRe3k6K
@claude
Copy link

claude bot commented Feb 1, 2026

Claude Review

Ready to merge - Clean refactoring that correctly separates browser-safe code from Node.js-specific code.

No significant issues found. The module organization is sound and maintains backward compatibility through re-exports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants