singularity-forge/native/crates/engine/Cargo.toml
Lex Christopherson 4c97d59536 feat: add native Rust diff engine for edit tool
Move the edit tool's hot-path diffing operations from JS to native Rust:
- `normalizeForFuzzyMatch`: single-pass Unicode normalization (smart quotes,
  dashes, special spaces, trailing whitespace)
- `fuzzyFindText`: exact-then-fuzzy substring search with UTF-16 index
  conversion for JS compatibility
- `generateDiff`: unified diff generation using the `similar` crate
  (Myers' algorithm with optimizations)

The Rust module at `native/crates/engine/src/diff.rs` exposes three napi
functions. The TypeScript wrapper at `packages/native/src/diff/` follows
the existing module pattern. `edit-diff.ts` now delegates to native
implementations while keeping line-ending handling and file I/O in JS.

18 tests covering normalization, fuzzy matching (including UTF-16 index
correctness with emoji/surrogate pairs), and diff generation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:11:40 -06:00

40 lines
959 B
TOML

[package]
name = "gsd-engine"
version.workspace = true
edition.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true
description = "N-API native addon for GSD — exposes high-performance Rust modules to Node.js"
[lib]
crate-type = ["cdylib"]
[dependencies]
gsd-ast = { path = "../ast" }
gsd-grep = { path = "../grep" }
arboard = "3"
dashmap = "6"
globset = "0.4"
html-to-markdown-rs = { version = "2", default-features = false }
ignore = "0.4"
image = { version = "0.25", default-features = false, features = [
"png",
"jpeg",
"gif",
"webp",
] }
napi = { version = "2", features = ["napi8"] }
napi-derive = "2"
regex = "1"
similar = "2"
smallvec = "1"
syntect = { version = "5", default-features = false, features = ["default-syntaxes", "default-themes", "regex-fancy"] }
unicode-segmentation = "1"
unicode-width = "0.2"
[build-dependencies]
napi-build = "2"
[target.'cfg(unix)'.dependencies]
libc = "0.2"