Skip to content

privatenumber/ts-runtime-comparison

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