Files
jsonPrism/docs/TAURI-NOTES.md
T
poli0981andClaude Opus 4.7 9c6b6d3f65 feat: hygiene, dep upgrades, Tauri, binary formats, reverse conversion (#1)
* feat: hygiene, dep upgrades, Tauri, binary formats, reverse conversion

Đợt sửa lỗi 2 — five phases landed together:

1. Build & type hygiene: fix 8 TS strict errors (override, exactOptional,
   Uint8Array<ArrayBuffer> for Blob), switch `typecheck` to `tsc -b
   --noEmit`, refactor ThemeToggle to click-outside + Escape (replaces
   the racy onBlur close), fix 10 pre-existing test failures.
2. Dep upgrades: jsdom 25→29, vite 6→8 (Rolldown), @vitejs/plugin-react
   4→6, engines.node >=22.11, manualChunks converted to function form.
3. Tauri process hygiene: explicit RunEvent::ExitRequested +
   WindowEvent::CloseRequested cleanup; docs/TAURI-NOTES.md captures
   the WebView2 GDI leak (upstream).
4. Binary converters: BSON, CBOR, MessagePack with base64/hex display
   encoding; OutputPanel decodes back to raw bytes on download.
5. Reverse conversion: Converter.reverse() interface, JSONL/CSV/YAML/
   TOML/RESX → JSON impls, DirectionToggle UI, FormatPicker disables
   non-reversible formats in reverse mode.

175 tests pass (was 137). Build clean. CI scripts now meaningful.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: apply prettier + ignore src-tauri/target in eslint

CI's format:check stage caught 24 files that didn't match the project's
prettier config. Run `npm run format` to normalize. Also widen the
eslint ignore list to skip cargo build output under src-tauri/target so
local Rust builds don't pollute the lint run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(build): switch minifier to oxc for Vite 8 / Rolldown compat

Vite 8 deprecated `transformWithEsbuild`; selecting `minify: 'esbuild'`
now requires esbuild as a separate install. CI didn't have it (we don't
list it as a dep), so the production build failed with
`Cannot find package 'esbuild'`. Switching to oxc — the Rolldown-native
minifier already included with Vite 8 — fixes the build with no new deps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 12:21:23 +07:00

2.5 KiB

Tauri runtime notes

Operational notes for the desktop builds. Aimed at maintainers, not end users.

Process lifecycle

src-tauri/src/lib.rs wires two cleanup hooks that should keep the host process from outliving the main webview:

  • on_window_event — when the main window receives CloseRequested, the app handle's exit(0) is called explicitly. This guards against Windows builds occasionally leaving JSONPrism.exe alive when the webview was the last live reference.
  • RunEvent::ExitRequested — calls app_handle.cleanup_before_exit() so any spawned shell children (none today, but the hook is in place) are signaled before the process exits.

If you ever add long-running spawned commands (e.g. via tauri_plugin_shell), remember to track their handles and kill them in the same hook.

WebView2 GDI leak (Windows, upstream)

Microsoft Edge WebView2 — the runtime Tauri uses on Windows — leaks GDI objects whenever the mouse hovers over the webview surface. Reported and acknowledged by Microsoft:

  • WebView2Feedback #5536 — ~2000 GDI objects leaked per 30 seconds of mouse movement.
  • Toggling visibility (SetIsVisible) compounds the leak (~6000 obj/30s).
  • The per-process GDI cap is 10 000 by default; the app eventually fails to draw and crashes once exhausted.

This is not a JSONPrism bug. The fix has to come from the WebView2 runtime team. Until then:

  • Watch the GDI object count in Task Manager (View → Select Columns) during long sessions. Above ~8000 means a restart is overdue.
  • For QA / release smoke tests, open and close the app five times in succession; verify no zombie JSONPrism.exe remains in Task Manager.

Permissions / capabilities

See src-tauri/capabilities/default.json. Scope is intentionally narrow:

  • Filesystem reads/writes only inside $HOME, $DOCUMENT, $DOWNLOAD, $DESKTOP.
  • Dialog plugin for open/save.
  • Shell plugin restricted to shell:allow-open (URL opening only — no arbitrary command spawn).

Widening the scope requires both a capability edit and a CSP review in tauri.conf.json.

Bundle targets

  • Windows: MSI (via WiX) + NSIS .exe. Tested on Windows 10 22H2 and Windows 11.
  • macOS: DMG + .app, min version 12.0 (Monterey).
  • Linux: AppImage + Debian package.

The release matrix in .github/workflows/release.yml builds all four combinations (Linux, macOS Intel, macOS Apple Silicon, Windows) on a v* tag push.