import (.*) from '(assert|assert/strict|async_hooks|buffer|child_process|cluster|console|constants|crypto|dgram|diagnostics_channel|dns|dns/promises|domain|events|fs|fs/promises|http|http2|https|inspector|inspector/promises|module|net|os|path|path/posix|path/win32|perf_hooks|process|querystring|readline|readline/promises|repl|stream|stream/consumers|stream/promises|stream/web|string_decoder|timers|timers/promises|tls|trace_events|tty|url|util|util/types|v8|vm|wasi|worker_threads|zlib)('|/)import $1 from 'node:$2$3
git ls-files '*.ts' | xargs sed -i '' -E 's#import (.*) from '(assert|assert/strict|async_hooks|buffer|child_process|cluster|console|constants|crypto|dgram|diagnostics_channel|dns|dns/promises|domain|events|fs|fs/promises|http|http2|https|inspector|inspector/promises|module|net|os|path|path/posix|path/win32|perf_hooks|process|querystring|readline|readline/promises|repl|stream|stream/consumers|stream/promises|stream/web|string_decoder|timers|timers/promises|tls|trace_events|tty|url|util|util/types|v8|vm|wasi|worker_threads|zlib)('|/)#import $1 from 'node:$2$3#g'Note: Using # as delimiter to avoid conflicts with / in the regex.
This uses git ls-files to find all TypeScript files in the repository and pipes them to sed via xargs.