Convert Deno client to universal Node.js/Deno/Bun compatibility #180
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR converts the Deno-specific webview client to be universally compatible with Deno, Node.js, and Bun runtimes. The changes enable cross-platform usage while maintaining backward compatibility with existing Deno workflows.
• Configuration Migration: Replaced
deno.jsonwithpackage.jsonfor npm ecosystem compatibility• API Conversion: Converted all Deno-specific APIs to Node.js built-ins using
node:prefix• Import System: Implemented TypeScript configuration for extensionless imports with post-build processing
• Cross-Runtime Support: Added platform detection and fallback handling for unknown runtimes
• Binary Management: Enhanced binary downloading with cross-platform cache directory resolution
• Examples Update: Updated all examples to use new import paths and work with compiled JavaScript
Key Technical Changes
Runtime API Conversion
Deno.Command→node:child_process.spawnDeno.env→process.envDeno.writeFile→node:fs/promises.writeFileDeno.readTextFile→node:fs/promises.readFileDeno.mkdir→node:fs/promises.mkdirBuild System
fix-imports.jsscript to convert extensionless imports to.jsextensionsDependency Management
@bcheidemann/tracing→ custom console logger@gabriel/ts-pattern→ts-patternTest Plan
cd src/clients/deno && npm installnpm run buildnode examples/simple.jsdeno run --allow-all examples/simple.tsRuntime Compatibility
Breaking Changes
None for existing Deno users - the package maintains full backward compatibility while adding Node.js/Bun support.