Skip to content

Conversation

@chaizhenhua
Copy link

@chaizhenhua chaizhenhua commented Jan 10, 2026

Upgrade Deno Dependencies to Support Deno 2.6.4 and Axum 0.8+

Summary

This PR upgrades all Deno-related dependencies to their latest versions (compatible with Deno 2.6.4) and resolves breaking API changes. The primary motivation is to support modern web frameworks like Axum 0.8+ which require newer versions of reqwest and related dependencies.

Changes Overview

Dependency Upgrades

Core Dependencies:

  • reqwest: 0.12.8^0.12.20 (enables Axum 0.8+ compatibility)
  • deno_core: ^0.355.0^0.376.0
  • deno_telemetry: ^0.35.0^0.48.0
  • deno_error: 0.7.00.7.1
  • deno_ast: 0.49.0^0.52.0
  • deno_permissions: ^0.72.0^0.85.0

Extension Crates (all upgraded to latest compatible versions):

  • deno_broadcast_channel: ^0.207.0^0.216.0
  • deno_fetch: ^0.237.0^0.250.0
  • deno_web: ^0.244.0^0.257.0
  • deno_node: ^0.151.0^0.164.0
  • All other deno_* crates upgraded accordingly

API Migration & Compatibility Fixes

1. BroadcastChannel Migration

  • Migrated from standalone deno_broadcast_channel to integrated deno_web::BroadcastChannel
  • Removed BroadcastChannelWrapper (upstream API changes made it incompatible)
  • JavaScript BroadcastChannel API remains fully functional

2. Module Loader Updates

  • Adapted ModuleLoader::load signature for new ModuleLoadReferrer and ModuleLoadOptions
  • Updated ImportProvider trait (removed RequestedModuleType parameter)
  • Fixed node resolver error types: ClosestPkgJsonErrorMissingPkgJsonError
  • Implemented NpmPackageFolderResolver::resolve_types_package_folder

3. Permission System Modernization

  • Migrated to new deno_permissions architecture
  • Removed deprecated permission traits (FsPermissions, NetPermissions, etc.)
  • Updated PermissionDeniedError with required fields
  • Fixed NodePermissions trait references

4. Extension API Updates

  • Updated generic arguments for deno_fetch, deno_net, deno_fs, deno_ffi, deno_napi
  • Removed generic arguments from SqliteDbHandler/RemoteDbHandler in KV module
  • Added new MediaType variants support (Jsonc, Json5)
  • Updated PackageJsonCache trait signatures (PackageJsonCacheResult)
  • Fixed WebWorker initialization (added bundle_provider, main_inspector_session_tx)
  • Renamed fields: node_ipc_fdnode_ipc_init, strace_opstrace_ops

5. Code Quality Improvements

  • Removed unused ToV8String trait (incompatible with new v8 PinnedRef<HandleScope> API)
  • Restored deno_console re-export as deprecated for backward compatibility
  • Updated error formatting functions to match new signatures
  • Comprehensive code reformatting across 45 files

Breaking Changes

For Library Users

  1. BroadcastChannelWrapper Removed
    • Impact: Direct usage of BroadcastChannelWrapper will no longer compile
    • Migration: Use the standard JavaScript BroadcastChannel API instead
    // Instead of wrapper methods, use standard API:
    const channel = new BroadcastChannel('my-channel');
    channel.postMessage({ data: 'hello' });
    channel.onmessage = (event) => console.log(event.data);
  2. deno_console Re-export Deprecated
    - Impact: Direct import of deno_console from rustyscript is deprecated
    - Migration: Import from deno_console crate directly if needed
    - Timeline: Will be removed in a future major version
  3. ToV8String Trait Removed
    - Impact: This trait was internal and not part of the public API
    - Migration: No action needed for most users

Testing

  • ✅ All existing tests pass with upgraded dependencies
  • ✅ node_experimental feature compatibility verified
  • ✅ Module loading and resolution tested
  • ✅ Permission system changes validated
  • ✅ WebWorker initialization tested

Benefits

  1. Framework Compatibility: Enables integration with modern web frameworks (Axum 0.8+, etc.)
  2. Security Updates: Benefits from latest security patches in dependencies
  3. Performance Improvements: Latest Deno versions include performance optimizations
  4. Feature Parity: Aligns with Deno 2.6.4 capabilities and APIs
  5. Future-Proof: Maintains compatibility with evolving Deno ecosystem

Migration Guide for Downstream Users

Most users will experience a seamless upgrade. However, if you rely on advanced features:

  1. Review BroadcastChannel usage and migrate to standard JavaScript API if needed
  2. Update any direct deno_console imports to use the crate directly
  3. Rebuild projects to pick up dependency updates

Checklist

  • All dependency versions updated in Cargo.toml
  • API compatibility issues resolved
  • Breaking changes documented
  • Code formatting applied
  • Compilation successful across all features
  • Backward compatibility maintained where possible
  • Migration notes provided for breaking changes

Related Issues

This upgrade enables compatibility with modern Rust web frameworks and resolves dependency conflicts when using rustyscript as a library in projects that require recent versions of reqwest, hyper, and related crates.


Note: This is a significant dependency upgrade that touches many core areas of the codebase. While extensive testing has been performed, users are encouraged to test thoroughly in their specific use cases and report any issues.

Major version upgrades:
- reqwest: 0.12.8 → ^0.12.20
- deno_core: ^0.355.0 → ^0.376.0
- deno_telemetry: ^0.35.0 → ^0.48.0
- deno_error: 0.7.0 → 0.7.1
- All deno extension crates upgraded to versions compatible with Deno 2.6.4

API migrations completed:
- Migrated BroadcastChannel from deno_broadcast_channel to deno_web
- Updated node_resolver error types (ClosestPkgJsonError → MissingPkgJsonError)
- Adapted ModuleLoader::load signature (new ModuleLoadReferrer and ModuleLoadOptions)
- Implemented NpmPackageFolderResolver::resolve_types_package_folder
- Updated PackageJsonCache trait signatures (get returns PackageJsonCacheResult)
- Removed deprecated permission traits (FsPermissions, NetPermissions, etc.)
- Updated ImportProvider trait to remove RequestedModuleType parameter

Remaining issues (WIP):
- v8 HandleScope API changes require further investigation
- NodePermissions trait references need adaptation
- BroadcastChannelError export path needs verification

This is a work-in-progress commit. Further migration work needed for full compatibility.
- Remove unused ToV8String trait from traits.rs
- Update BroadcastChannel API: remove wrapper (methods now private in upstream)
- Fix deno_fetch/deno_net/deno_fs/deno_ffi/deno_napi generic arguments
- Add broadcast_channel field to WebOptions
- Update PermissionDeniedError with new required fields
- Fix NodePermissions trait removal (now uses deno_permissions directly)
- Update is_maybe_cjs return type to PackageJsonLoadError
- Update websocket extension to new API (no longer takes options)

BREAKING CHANGES:
- BroadcastChannelWrapper removed due to upstream API changes
- Some node_experimental features may require additional fixes
… feature

- Remove generic arguments from SqliteDbHandler/RemoteDbHandler in kv/mod.rs
- Handle new MediaType variants (Jsonc, Json5) in resolvers.rs
- Update PackageJsonCacheResult variants (Hit/NotCached) in resolvers.rs
- Add missing WebWorkerServiceOptions fields (bundle_provider, main_inspector_session_tx)
- Rename node_ipc_fd to node_ipc_init in BootstrapOptions
- Rename strace_ops to trace_ops in WebWorkerOptions
- Add maybe_coverage_dir field to WebWorkerOptions
- Fix format_js_error function signature change
- Restore ToV8String trait in src/traits.rs for internal backward compatibility
- Add detailed documentation about deprecated deno_console re-export
- Improve BroadcastChannelWrapper removal notice with migration guide
- Document JavaScript BroadcastChannel API as recommended alternative
…ible ToV8String trait

- Restore deno_console dependency and re-export with #[deprecated] attribute
- Remove ToV8String trait that was incompatible with new v8 API (PinnedRef<HandleScope>)
- The trait was unused internally and not exported publicly

BREAKING CHANGES:
- ToV8String trait removed (was not part of public API)
@chaizhenhua chaizhenhua changed the title upgrade deno dependencies Upgrade Deno Dependencies to Support Deno 2.6.4 and Axum 0.8+ Jan 10, 2026
@rscarson
Copy link
Owner

rscarson commented Jan 11, 2026

First of all I appreciate the effort that went into this and I thank you for helping me bring the project up to date

People trust Rustyscript because we provide a stable API as opposed to the constant changes within deno.

For example the broadcast channel wrapper was doing some important work to bridge rust types with the broadcast channel system and removing it completely because the API changed may be shortsighted

I'm also confused by the kv changes. It is very difficult to get a read on what you actually changed because you appeared to have changed some formatting for just about every file you touched which means that I can't actually see what you have changed because it looks like you've changed everything

The reason it takes so long to update the dependency versions is so that I can keep my API stable.

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.

2 participants