Skip to content

add the openvector-wasm npm package - #56

Merged
Microck merged 1 commit into
mainfrom
feat/wasm-npm
Dec 2, 2026
Merged

Microck merged 1 commit into
mainfrom
feat/wasm-npm

Conversation

@Microck

@Microck Microck commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Script Console can load libraries from a module worker, but the OpenVector npm package is native and Penpot doesn't provide cross-origin isolation.

this adds openvector-wasm as a separate AGPLv3 package. it takes PNG, JPEG, BMP, GIF, or TIFF bytes and returns an SVG, with the CLI's SVG layout and thin stroke options. the tarball includes the source and build instructions. a caller can cancel by terminating the worker.

Refs #55

Proof Chromium produced the same SVG bytes as OpenVector 0.1.8 for all five formats and the custom layout case in a module worker with crossOriginIsolated === false. the source archive rebuilt offline.

Reviewed with sol-loop: 2 rounds with GPT-6.2 Sol on medium. Sol verdict: approved.

Implemented and tested with Codex (GPT-6.2 Sol) on behalf of Microck.

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capy found no issues.

View 4 other findings in Capy.

Open in Capy

@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Adds AGPL-3.0-only npm package openvector-wasm 0.1.0, which converts PNG, JPEG, BMP, GIF, or TIFF bytes to SVG in a module worker without cross-origin isolation.

  • createTracer() returns convert(imageBytes, options); options layout and thinStroke match the CLI.
  • build.sh npm builds the package offline; trace.rs adds the Emscripten export convert_image.
  • Reviewer action: SVG parity with OpenVector 0.1.8 and the offline rebuild are author-reported. No smoke test results (npm-wasm/smoke.py) were supplied; confirm them.

Walkthrough

This change adds the openvector-wasm package for converting image bytes to SVG in a browser. The tracer accepts layout and stroke options and reports conversion errors. The build scripts compile and package the Emscripten engine and create source and npm archives. The smoke test checks browser conversions, error handling, reuse, and worker execution. The README documents package use, worker cancellation, and build steps.

Sequence Diagram(s)

sequenceDiagram
  participant BrowserWorker
  participant createTracer
  participant convert_image
  participant EmscriptenFilesystem
  BrowserWorker->>createTracer: initialize the tracer
  BrowserWorker->>createTracer: call convert with image bytes and options
  createTracer->>EmscriptenFilesystem: write input and options.json
  createTracer->>convert_image: run conversion
  convert_image->>EmscriptenFilesystem: read input and options.json
  convert_image->>EmscriptenFilesystem: write output.svg or error.txt
  createTracer->>EmscriptenFilesystem: read output.svg or error.txt
  createTracer-->>BrowserWorker: return SVG or throw an error
Loading
Merge Risk: Minimal · up to fe2cc

This adds a new, separate WASM npm package without changing existing behavior beyond a small refactor of the Rust open helper. No concrete merge-blocking risk was identified.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 2e1f90fc-3759-4984-8ffd-c2898d5f1914
Commits

Reviewing files that changed from the base of the PR and between c87347c and fe2ccd5.

Files selected for processing: 10

  • npm-wasm/README.md
  • npm-wasm/compile.sh
  • npm-wasm/index.d.ts
  • npm-wasm/index.mjs
  • npm-wasm/package.json
  • npm-wasm/smoke.py
  • scripts/wasm-prototype/build.sh
  • scripts/wasm-prototype/editor.rs
  • scripts/wasm-prototype/trace.rs
  • tools/check-source.sh

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@Microck
Microck merged commit 36fefd1 into main Dec 2, 2026
8 checks passed
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.

1 participant