Skip to content

Dev#170

Merged
jorgedanisc merged 3 commits into
mainfrom
dev
Dec 16, 2025
Merged

Dev#170
jorgedanisc merged 3 commits into
mainfrom
dev

Conversation

@jorgedanisc

Copy link
Copy Markdown
Contributor

No description provided.

@jorgedanisc jorgedanisc self-assigned this Dec 16, 2025
Copilot AI review requested due to automatic review settings December 16, 2025 18:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a major refactoring of the ducsvg package, replacing the C# .NET-based pdf-into-svg library with a custom Rust/WASM implementation using the hayro and hayro-svg libraries. The change provides a more native, self-contained PDF-to-SVG conversion solution while maintaining the existing two-step conversion approach (DUC → PDF → SVG).

Key Changes:

  • Replaced pdf-into-svg dependency with a custom Rust WASM module using hayro-svg
  • Added new Rust crate pdf2svg within the ducsvg package for PDF-to-SVG conversion
  • Updated infrastructure configuration to use dynamic region variable and enable Cloudflare proxy
  • Added background_color field to all ducpdf test cases for comprehensive testing
  • Renamed sst:wrap to sst:shell across package scripts for clearer naming

Reviewed changes

Copilot reviewed 15 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sst.config.ts Changed region from hardcoded string to variable reference; enabled Cloudflare DNS proxy for both web and docs domains
packages/ducsvg/vite.config.mts Removed pdf-into-svg from external dependencies and build globals; added emptyOutDir: false to preserve WASM artifacts
packages/ducsvg/tsconfig.json Added pkg and src/pdf2svg/src to exclude list for TypeScript compilation
packages/ducsvg/src/wasm.ts New file re-exporting WASM bindings from dist directory
packages/ducsvg/src/pdf2svg/src/lib.rs New Rust implementation using hayro for PDF parsing and hayro-svg for SVG conversion
packages/ducsvg/src/pdf2svg/index.ts TypeScript wrapper for initializing and calling the WASM module
packages/ducsvg/src/pdf2svg/Cargo.toml Cargo configuration for the new pdf2svg Rust crate
packages/ducsvg/src/ducToSvg.ts Updated to use new local pdf2svg module instead of pdf-into-svg package
packages/ducsvg/package.json Removed pdf-into-svg dependency; added build scripts for WASM compilation; added ./pkg export
packages/ducsvg/README.md Updated documentation to reflect use of hayro and hayro_svg instead of pdf-into-svg
packages/ducpdf/src/duc2pdf/tests/test_integration.rs Added background_color field to all test cases; added new block_ids and instance_id fields to test helper
packages/ducpdf/src/duc2pdf/src/lib.rs Code formatting improvements for error handling calls
packages/ducpdf/src/duc2pdf/index.ts Removed trailing whitespace
package.json Renamed sst:wrap script to sst:shell across all SST-related commands
bun.lock Removed pdf-into-svg dependency from lock file
Cargo.toml Added packages/ducsvg/src/pdf2svg to workspace members
Cargo.lock Added dependencies for hayro, hayro-svg, and related crates
.vscode/settings.json Added pdf2svg Cargo.toml to Rust analyzer linked projects

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +3
// Re-export WASM bindings from dist for bundled distribution
export * from '../dist/pdf2svg';
export { default } from '../dist/pdf2svg'; No newline at end of file

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

This file re-exports from ../dist/pdf2svg, but the dist directory is generated during the build process and won't exist in the source tree. This creates a circular dependency where TypeScript compilation requires the WASM build output to already exist. Consider importing directly from ../pkg/pdf2svg instead, or restructuring the build to ensure the WASM build happens before TypeScript compilation attempts to resolve this import.

Suggested change
// Re-export WASM bindings from dist for bundled distribution
export * from '../dist/pdf2svg';
export { default } from '../dist/pdf2svg';
// Re-export WASM bindings from pkg for development and build
export * from '../pkg/pdf2svg';
export { default } from '../pkg/pdf2svg';

Copilot uses AI. Check for mistakes.
is_deleted: false,
group_ids: vec![],
region_ids: vec![],

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

This line contains only whitespace and should be removed to maintain code cleanliness.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +16 to 20
"./pkg": {
"types": "./pkg/pdf2svg.d.ts",
"import": "./pkg/pdf2svg.js",
"default": "./pkg/pdf2svg.js"
}

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The ./pkg export points to the pkg directory, but this directory is not included in the files array (lines 47-50). This means when the package is published to npm, the pkg directory won't be included, making the ./pkg export unusable. Either add pkg to the files array or remove this export if the WASM files are meant to be consumed only from the dist directory (which is included in files).

Copilot uses AI. Check for mistakes.
Comment on lines +37 to +39
export interface SvgPage {
svg: string;
}

Copilot AI Dec 16, 2025

Copy link

Choose a reason for hiding this comment

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

The SvgPage interface is missing a pageIndex property that is referenced in the test file at tests/duc-to-svg.unit.test.ts:37. The test tries to access page.pageIndex to generate unique filenames, but this property doesn't exist on the interface. Either add a pageIndex?: number property to the interface and populate it in the Rust code, or update the test to use array indices instead.

Copilot uses AI. Check for mistakes.
@jorgedanisc jorgedanisc merged commit 0fb1e67 into main Dec 16, 2025
12 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.2.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

jorgedanisc added a commit that referenced this pull request Jun 2, 2026
jorgedanisc added a commit that referenced this pull request Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants