Registry
L

deno-refactor-resource-ids

No description available

lovelindhoni0 executions

  • Legacy
  • migration
  • Deno
  • resource ID
  • file descriptor
  • TTY
Connect a repo
npx codemod deno-refactor-resource-ids

In Deno v2, resource IDs are being deprecated. Most users do not directly
interact with resource IDs, so we are moving towards a model where resources are
referenced by native JavaScript objects. This codemod automates the process of
updating your code to align with this change.

This codemod turns old Deno method calls that takes resource ID's as a argument
to their new equivalents.

Before

ts
Deno.flock(file1.rid, ...args);
Deno.fsyncSync(file2.rid);
Deno.writeSync(file3.rid, data);
Deno.close(file.rid);

After

ts
file3.lock(...args);
file2.syncSync();
file3.writeSync(data);
file.close();

Method Mappings

The following mappings are applied by the codemod:

  • Deno.flock → lock
  • Deno.flockSync → lockSync
  • Deno.fsync → sync
  • Deno.fsyncSync → syncSync
  • Deno.ftruncate → truncate
  • Deno.ftruncateSync → truncateSync
  • Deno.funlock → unlock
  • Deno.funlockSync → unlockSync
  • Deno.fdatasync → syncData
  • Deno.fdatasyncSync → syncDataSync
  • Deno.futime → utime
  • Deno.futimeSync → utimeSync
  • Deno.fstat → stat
  • Deno.fstateSync → statSync
  • Deno.seek → seek
  • Deno.seekSync → seekSync
  • Deno.read → read
  • Deno.readSync → readSync
  • Deno.write → write
  • Deno.writeSync → writeSync
  • Deno.close → close
  • Deno.shutdown → closeWrite
  • Deno.isatty -> isTerminal,

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.