Skip to content

Development

zzm edited this page Aug 31, 2026 · 2 revisions

Development

Architecture

VS Code command
  → PaperReaderPanel
    → ReaderStorage
    → TranslationService
  ↔ Webview messages
  → React reader UI
    → PDF.js / react-pdf-highlighter-plus
  • The extension host owns file access, clipboard access, local processes, secrets, and remote API calls.
  • The Webview owns PDF rendering and reading interaction.
  • ReaderStorage owns atomic sidecar persistence and recovery.
  • TranslationService provides one boundary for interchangeable providers.

See project_map.md for a file-by-file guide and AGENTS.md for product and engineering constraints.

Local setup

Use Node.js 20.19 or newer, or Node.js 22.12+.

git clone https://github.com/WORMMMMMM/inleaf-reader.git
cd inleaf-reader
npm ci
npm run compile

Press F5 in VS Code to launch an Extension Development Host. Open a normal text PDF and run Inleaf Reader: Open Paper Reader.

Validation

Fast checks while developing:

npm run test:unit
npm run typecheck

Required before committing source changes:

npm test

Webview source changes regenerate assets under media/; those generated assets are committed because the installed extension loads them at runtime. Generated files under out/ are not committed.

Contribution hygiene

Do not commit:

  • .vscode/ or local virtual environments;
  • node_modules/ or out/;
  • PDFs or .inleaf-reader/ runtime data;
  • packaged VSIX files;
  • API keys or credentials.

See CONTRIBUTING.md before opening a pull request.

Clone this wiki locally