Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 2.28 KB

IMPLEMENTATION_PROGRESS.md

File metadata and controls

59 lines (45 loc) · 2.28 KB

Deno API Migration Implementation Progress

Current Task: Migrate javascript.rs to Deno 0.371/0.229 APIs

Changes Required (Priority Order)

Phase 1: Core Worker Initialization (HIGH PRIORITY - IN PROGRESS)

Goal: Get basic worker creation working with new Deno APIs

Files to modify:

  • crates/js/src/javascript.rs (main implementation file)

Specific changes:

  1. Remove program_state: Option<Arc<deno::program_state::ProgramState>> field (line 103)

  2. Remove set_program_state() and get_program_state() methods (lines 219-225)

  3. Update worker initialization in js_initialize() function (around line 1740-1753):

    • Remove: let program_fut = futures::executor::block_on(deno::program_state::ProgramState::build(flags));
    • Remove: let mut worker = deno::create_main_worker(&program, main_module.clone(), permissions);
    • Add: Direct MainWorker::bootstrap_from_options() call with WorkerOptions
  4. Update imports at top of file:

    • Remove any use deno::* imports (none currently - good!)
    • Already have deno_runtime::worker::MainWorker imported ✓
    • Add: use deno_runtime::permissions::PermissionsContainer;
    • Add: use deno_core::ModuleSpecifier;
    • Add: use std::rc::Rc;

Phase 2: Subcommands (MEDIUM PRIORITY - DEFERRED)

Goal: Update all subcommand implementations

Comment out for now, implement later:

  • get_subcommand() function (line 1965+)
  • All subcommand handling in js_cli() function

Phase 3: Module Loading (MEDIUM PRIORITY - DEFERRED

Goal: Implement custom ModuleLoader for file caching

  • Create custom EmacsModuleLoader struct implementing deno_core::ModuleLoader trait
  • Replace old file_fetcher pattern (lines 1781-1787)

Phase 4: Testing (FINAL)

  • Test eval-js with simple JavaScript
  • Test eval-ts with TypeScript smoke test
  • Verify object passing through FFI

Status

  • Analysis complete
  • Build system resolved (globals.h generated)
  • Phase 1: Worker initialization (IN PROGRESS)
  • Phase 2: Subcommands (deferred)
  • Phase 3: Module loading (deferred)
  • Phase 4: Testing

Next Immediate Steps

  1. Comment out subcommand code to reduce compile errors
  2. Update worker initialization to use new API
  3. Test basic eval-js functionality
  4. Incrementally add features back