Git Product home page Git Product logo

swc-node's Introduction

swc-node

๐Ÿš€ Help me to become a full-time open-source developer by sponsoring me on Github

Fast TypeScript/JavaScript transformer without node-gyp and postinstall script.

Build Status Downloads License

Usage

Run TypeScript with node, without compilation or typechecking:

npm i -D @swc-node/register
node -r @swc-node/register script.ts

Support matrix

node10 node12 node14 node16
Windows x64 โœ“ โœ“ โœ“ โœ“
Windows x32 โœ“ โœ“ โœ“ โœ“
Windows arm64 โœ“ โœ“ โœ“ โœ“
macOS x64 โœ“ โœ“ โœ“ โœ“
macOS arm64 โœ“ โœ“ โœ“ โœ“
Linux x64 gnu โœ“ โœ“ โœ“ โœ“
Linux x64 musl โœ“ โœ“ โœ“ โœ“
Linux arm gnueabihf โœ“ โœ“ โœ“ โœ“
Linux arm64 gnu โœ“ โœ“ โœ“ โœ“
Linux arm64 musl โœ“ โœ“ โœ“ โœ“
Android arm64 โœ“ โœ“ โœ“ โœ“
FreeBSD x64 โœ“ โœ“ โœ“ โœ“

@swc-node/core

Fastest TypeScript transformer.

Detail: @swc-node/core

Benchmark

transform RxJS AjaxObservable.ts to ES2015 & CommonJS JavaScript. Benchmark code: bench

Hardware info:

Model Name: MacBook Pro
Model Identifier: MacBookPro15,1
Processor Name: 6-Core Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 12 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB

transformSync

esbuild x 510 ops/sec ยฑ1.28% (88 runs sampled)
@swc-node/core x 438 ops/sec ยฑ1.00% (88 runs sampled)
typescript x 28.83 ops/sec ยฑ10.20% (52 runs sampled)
babel x 24.21 ops/sec ยฑ10.66% (46 runs sampled)
Transform rxjs/AjaxObservable.ts benchmark bench suite: Fastest is esbuild

transform parallel

UV_THREADPOOL_SIZE=11 yarn bench

@swc-node/core x 1,253 ops/sec ยฑ0.90% (75 runs sampled)
esbuild x 914 ops/sec ยฑ1.31% (77 runs sampled)
Transform rxjs/AjaxObservable.ts parallel benchmark bench suite: Fastest is @swc-node/core

yarn bench

@swc-node/core x 1,123 ops/sec ยฑ0.95% (77 runs sampled)
esbuild x 847 ops/sec ยฑ3.74% (71 runs sampled)
Transform rxjs/AjaxObservable.ts parallel benchmark bench suite: Fastest is @swc-node/core

@swc-node/jest

Fastest jest TypeScript transformer.

Detail: @swc-node/jest

Performance glance

Testing in pure TypeScript project, compile target is ES2018. Running with npx jest --no-cache, ts-jest was configured with isolatedModules: true

ts-jest

Test Suites: 49 passed, 49 total
Tests:       254 passed, 254 total
Snapshots:   53 passed, 53 total
Time:        54.631 s
Ran all test suites.
โœจ  Done in 62.71s.

@swc-node/jest

Test Suites: 49 passed, 49 total
Tests:       254 passed, 254 total
Snapshots:   53 passed, 53 total
Time:        10.511 s
Ran all test suites.
โœจ  Done in 14.34s.

@swc-node/register

Faster ts-node/register/transpile-only alternative.

Detail: @swc-node/register

Development

Install dependencies

  • pnpm latest

Build and test

  • pnpm install
  • pnpm test

Sponsors

sponsors

swc-node's People

Contributors

dependabot[bot] avatar brooooooklyn avatar h-a-n-a avatar gyz0072004 avatar sod avatar huozhi avatar maschwenk avatar natemoo-re avatar kdy1 avatar tbvjaos510 avatar kagawagao avatar vonovak avatar darky avatar moltar avatar itsoli avatar jameshfisher avatar herringtondarkholme avatar devongovett avatar dmregister avatar craga89 avatar arwid avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.