Skip to content

Comparison of Node.js TypeScript runtimes

Notifications You must be signed in to change notification settings

privatenumber/ts-runtime-comparison

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TypeScript runtime comparisons

Comparison of Node.js TypeScript runtimes.

Disclaimer: This comparison is by the author & maintainer of tsx

Compared runtimes

Methodology

  • Tested on Node.js v12.20.0 because they all support it, and the node: prefix is not supported in require()

  • Tested in both package types commonjs & module when applicable

Symbols

Symbol Description
βœ… Pass (Sometimes clickable)
❌ Fail
⛔️ Error (Hover to see error message)

Project stats

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
npm downloads
Install size
GitHub stars
Issues open
Issues closed
Last commit

Transformation

Supported transformation features and code tranformation correctness.

Package type: CommonJS

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
TypeScript syntax βœ… βœ… βœ… βœ… βœ… βœ… βœ…
ESM β†’ CJS: import/export syntax βœ… ❌ βœ… βœ… βœ… βœ… ❌
ESM β†’ CJS: import.meta.url shim βœ… ❌ ❌ βœ… ❌ ❌ ❌
CJS scope in .js file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
CJS scope in .ts file βœ… βœ… βœ… βœ… βœ… βœ… ❌
CJS scope in .cjs file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
CJS scope in .cts file βœ… βœ… βœ… βœ… βœ… βœ… ❌
No CJS scope in .mjs file βœ… βœ… βœ… ❌ βœ… βœ… βœ…
No CJS scope in .mts file βœ… ❌ ❌ ❌ ❌ βœ… βœ…
Source maps βœ… βœ… βœ… ❌ ❌ βœ… βœ…

Package type: Module

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
TypeScript syntax βœ… ⛔️ ⛔️ βœ… ⛔️ βœ… βœ…
CJS scope in .cjs file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
CJS scope in .cts file βœ… ⛔️ ⛔️ βœ… ⛔️ βœ… ❌
No CJS scope in .js file βœ… βœ… βœ… ❌ βœ… βœ… βœ…
No CJS scope in .ts file βœ… ⛔️ ⛔️ ❌ ⛔️ βœ… βœ…
No CJS scope in .mjs file βœ… βœ… βœ… ❌ βœ… βœ… βœ…
No CJS scope in .mts file βœ… ⛔️ ⛔️ ❌ ⛔️ βœ… βœ…
Source maps βœ… ⛔️ ⛔️ ❌ ⛔️ βœ… βœ…

* CommonJS scope (CJS scope) refers to having the following variables available in the module scope: module, exports, require, __filename, __dirname.

Resolution

Whether require()/import() can resolve a given specifier.

require()

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
.ts file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
.ts file via .js βœ… ❌ ❌ ❌ ❌ βœ… ❌
.ts file without extension βœ… βœ… βœ… βœ… βœ… βœ… ❌
index.ts file via directory βœ… βœ… βœ… βœ… βœ… βœ… ❌
.cts file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
.cts file via .cjs βœ… ❌ ❌ ❌ ❌ βœ… ❌
.mts file βœ… βœ… βœ… βœ… βœ… ❌ βœ…
.mts file via .mjs βœ… ❌ ❌ ❌ ❌ ❌ ❌
node: prefix βœ… ❌ ❌ βœ… ❌ ❌ βœ…
tsconfig.json paths βœ… ❌ ❌ ❌ ❌ ❌ ❌

import()

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
.ts file βœ… ❌ ❌ ❌ βœ… βœ… βœ…
.ts file via .js βœ… ❌ ❌ ❌ ❌ βœ… βœ…
.ts file without extension βœ… ❌ ❌ ❌ βœ… ❌ βœ…
index.ts file via directory βœ… ❌ ❌ ❌ βœ… ❌ ❌
.cts file βœ… ❌ ❌ ❌ βœ… βœ… βœ…
.cts file via .cjs βœ… ❌ ❌ ❌ ❌ βœ… βœ…
.mts file βœ… ❌ ❌ ❌ βœ… βœ… βœ…
.mts file via .mjs βœ… ❌ ❌ ❌ ❌ βœ… βœ…
tsconfig.json paths βœ… ❌ ❌ ❌ ❌ ❌ ❌

Interoperability

Whether it can correctly load a file for interoperability.

Package type: CommonJS

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
require() .js file (ESM export) βœ… ⛔️ βœ… βœ… βœ… βœ… ⛔️
require() .ts file (ESM export) βœ… ⛔️ βœ… βœ… βœ… βœ… ⛔️
require() .cjs file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
require() .cts file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
require() .mjs file βœ… ⛔️ βœ… βœ… ⛔️ ⛔️ ⛔️
require() .mts file βœ… ⛔️ ⛔️ βœ… ⛔️ ⛔️ ⛔️
import() .js file (ESM export) βœ… ⛔️ ❌ ⛔️ βœ… ❌ ⛔️
import() .ts file (ESM export) βœ… ⛔️ ⛔️ ⛔️ βœ… ❌ βœ…
import() .cjs file βœ… βœ… βœ… βœ… ❌ βœ… βœ…
import() .cts file βœ… ⛔️ ⛔️ ⛔️ ❌ βœ… βœ…
import() .mjs file βœ… βœ… βœ… βœ… ⛔️ βœ… βœ…
import() .mts file βœ… ⛔️ ⛔️ ⛔️ ⛔️ βœ… βœ…

Package type: Module

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
require() .js file (ESM export) βœ… ⛔️ ⛔️ ⛔️ ⛔️ ⛔️ ⛔️
require() .ts file (ESM export) βœ… ⛔️ βœ… ⛔️ βœ… ⛔️ ⛔️
require() .cjs file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
require() .cts file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
require() .mjs file βœ… ⛔️ βœ… ⛔️ ⛔️ ⛔️ ⛔️
require() .mts file βœ… ⛔️ ⛔️ ⛔️ ⛔️ ⛔️ ⛔️
import() .js file (ESM export) βœ… βœ… βœ… βœ… βœ… βœ… βœ…
import() .ts file (ESM export) βœ… ⛔️ ⛔️ βœ… ⛔️ βœ… βœ…
import() .cjs file βœ… βœ… βœ… ❌ βœ… βœ… βœ…
import() .cts file βœ… ⛔️ ⛔️ ❌ ⛔️ βœ… βœ…
import() .mjs file βœ… βœ… βœ… βœ… βœ… βœ… βœ…
import() .mts file βœ… ⛔️ ⛔️ βœ… ⛔️ βœ… βœ…

Performance features

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
Compiler esbuild SWC esbuild Babel Sucrase (Babel fork) TypeScript / SWC esbuild
Disk cache βœ… ? ❌ βœ… ? βœ… ? ❌ ❌ ? ❌

DX features

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
TypeScript REPL βœ… ? ❌ ❌ ❌ ❌ βœ… ? ❌
Watch mode βœ… ? ❌ ❌ ❌ ❌ ❌ ❌
Type checking ❌ ❌ ❌ ❌ ❌ βœ… ❌
Hides experimental feature warnings βœ… - - - - βœ… ? ❌
Binaries tsx swc-node esr jiti sucrase-node ts-node, ts-node-esm, +4 tsm

Testing

tsx @swc/register esbuild-runner jiti sucrase ts-node tsm
Operating systems Linux & Windows Linux No tests Linux & Windows Linux Linux & Windows Linux & Windows
Node.js versions 12.20 ~ 18 Latest LTS No tests 16 14 & 16 12 ~ 18 + Nightly 12.22.10 ~ 16.14

About

Comparison of Node.js TypeScript runtimes

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •