Socket
Socket
Sign inDemoInstall

tsx

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsx - npm Package Compare versions

Comparing version 3.4.2 to 3.4.3

dist/package-81a89caf.js

2

dist/loader.js

@@ -1,1 +0,1 @@

import{r}from"./pkgroll_create-require-91c05cc3.js";export*from"@esbuild-kit/esm-loader";import"module";r("@esbuild-kit/cjs-loader");
import{r}from"./pkgroll_create-require-12c8685c.js";export*from"@esbuild-kit/esm-loader";import"module";r("@esbuild-kit/cjs-loader");

@@ -1,3 +0,3 @@

import c from"repl";import{transform as l}from"@esbuild-kit/core-utils";import{v as m}from"./package-f202b71b.js";console.log(`Welcome to tsx v${m} (Node.js ${process.version}).
import c from"repl";import{transform as l}from"@esbuild-kit/core-utils";import{v as m}from"./package-81a89caf.js";console.log(`Welcome to tsx v${m} (Node.js ${process.version}).
Type ".help" for more information.`);const o=c.start(),{eval:i}=o,f=async function(e,r,t,s){const n=await l(e,".ts").catch(a=>(console.log(a.message),{code:`
`}));return i.call(this,n.code,r,t,s)};o.eval=f;
{
"name": "tsx",
"version": "3.4.2",
"version": "3.4.3",
"description": "TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files",

@@ -39,5 +39,5 @@ "keywords": [

"dependencies": {
"@esbuild-kit/cjs-loader": "^2.0.1",
"@esbuild-kit/core-utils": "^1.2.0",
"@esbuild-kit/esm-loader": "^2.1.3"
"@esbuild-kit/cjs-loader": "^2.1.0",
"@esbuild-kit/core-utils": "^1.3.1",
"@esbuild-kit/esm-loader": "^2.2.0"
},

@@ -48,10 +48,10 @@ "optionalDependencies": {

"devDependencies": {
"@pvtnbr/eslint-config": "^0.22.0",
"@pvtnbr/eslint-config": "^0.23.1",
"@types/cross-spawn": "^6.0.2",
"@types/node": "^17.0.34",
"@types/semver": "^7.3.9",
"@types/node": "^18.0.0",
"@types/semver": "^7.3.10",
"chokidar": "^3.5.3",
"cleye": "^1.2.0",
"cleye": "^1.2.1",
"cross-spawn": "^7.0.3",
"eslint": "^8.15.0",
"eslint": "^8.17.0",
"execa": "^6.1.0",

@@ -62,3 +62,3 @@ "get-node": "^13.0.1",

"semver": "^7.3.7",
"typescript": "^4.6.4"
"typescript": "^4.7.3"
},

@@ -75,2 +75,3 @@ "eslintConfig": {

"allow": [
"test",
"describe",

@@ -77,0 +78,0 @@ "runTestSuite"

# tsx
_TypeScript Execute (tsx)_: Node.js enhanced with [esbuild](https://esbuild.github.io/) to run TypeScript & ESM files
> _TypeScript Execute (`tsx`)_: Node.js enhanced with [esbuild](https://esbuild.github.io/) to run TypeScript & ESM files

@@ -14,2 +14,17 @@ ### Features

## About
`tsx` is a CLI command (alternative to `node`) for seamlessly running TypeScript & ESM, in both `commonjs` & `module` package types.
It's powered by [esbuild](https://esbuild.github.io/) so it's insanely fast.
Want to just run TypeScript code? Try tsx:
```sh
npx tsx ./script.ts
```
How does it compare to [ts-node](https://github.com/TypeStrong/ts-node)? Checkout the [comparison](https://github.com/privatenumber/ts-runtime-comparison).
## Install

@@ -40,3 +55,3 @@

If you want to use it in any arbitrary project without [npx](https://docs.npmjs.com/cli/v8/commands/npx), install it globally:
If you want to use it in any arbitrary project without [`npx`](https://docs.npmjs.com/cli/v8/commands/npx), install it globally:

@@ -47,3 +62,3 @@ ```sh

You can call `tsx` directly:
Then, you can call `tsx` directly:

@@ -65,4 +80,8 @@ ```sh

### Watch mode
Run file and automatically re-run on changes.
Run file and automatically re-run on changes:
```sh
tsx watch ./file.ts
```
All imported files are watched except from the following directories:

@@ -73,8 +92,4 @@ `node_modules`, `bower_components`, `vendor`, `dist`, and `.*` (hidden directories).

```sh
tsx watch ./file.ts
```
### REPL
Start a TypeScript REPL by running with no arguments.
Start a TypeScript REPL by running with no arguments:

@@ -86,3 +101,3 @@ ```sh

### Cache
Modules transformations are cached in the system cache directory ([`TMPDIR`](https://en.wikipedia.org/wiki/TMPDIR)). Transforms are cached by content hash so duplicate dependencies are not re-transformed.
Modules transformations are cached in the system cache directory ([`TMPDIR`](https://en.wikipedia.org/wiki/TMPDIR)). Transforms are cached by content hash, so duplicate dependencies are not re-transformed.

@@ -97,7 +112,7 @@ Set the `--no-cache` flag to disable the cache:

`tsx` is a standalone binary designed to be used in-place of `node`, but sometimes you'll want to use `node` directly. For example, when adding TypeScript & ESM support to npm-installed binaries.
`tsx` is a standalone binary designed to be used in place of `node`, but sometimes you'll want to use `node` directly. For example, when adding TypeScript & ESM support to npm-installed binaries.
To use tsx with Node.js, pass it into the [`--loader`](https://nodejs.org/api/esm.html#loaders) flag.
To use `tsx` with Node.js, pass it to the [`--loader`](https://nodejs.org/api/esm.html#loaders) flag.
> Note: Node.js's experimental feature warnings will not be suppressed when used as a loader
> Note: Node.js's experimental feature warnings will not be suppressed when used as a loader.

@@ -112,5 +127,5 @@ ```sh

> Tip: In rare circumstances, you might be limited to use the [`-r, --require`](https://nodejs.org/api/cli.html#-r---require-module) flag.
> Tip: In rare circumstances, you might be limited to using the [`-r, --require`](https://nodejs.org/api/cli.html#-r---require-module) flag.
>
> You can use [`@esbuild-kit/cjs-loader`](https://github.com/esbuild-kit/cjs-loader) but transformations will only be applied to `require()`.
> You can use [`@esbuild-kit/cjs-loader`](https://github.com/esbuild-kit/cjs-loader), but transformations will only be applied to `require()`.

@@ -121,3 +136,3 @@ ## Dependencies

- [@esbuild-kit/cjs-loader](https://github.com/esbuild-kit/cjs-loader) - Node.js `requie()` hook to transform TypeScript & ESM to CommonJS.
- [@esbuild-kit/cjs-loader](https://github.com/esbuild-kit/cjs-loader) - Node.js `require()` hook to transform TypeScript & ESM to CommonJS.

@@ -138,6 +153,8 @@

The main difference is that `tsx` is powered by [esbuild](https://esbuild.github.io/) for blazing fast TypeScript compilation. Whereas `ts-node` uses the TypeScript compiler, [which is not as fast](https://esbuild.github.io/faq/#:~:text=typescript%20benchmark).
The main difference is that `tsx` is powered by [esbuild](https://esbuild.github.io/) for blazing fast TypeScript compilation, whereas `ts-node` uses the TypeScript compiler, [which is not as fast](https://esbuild.github.io/faq/#:~:text=typescript%20benchmark).
Because esbuild doesn't do type checking, `tsx` is more equivalent to `ts-node --transpileOnly`.
Because esbuild doesn't do type checking, `tsx` is more equivalent to `ts-node --esm --transpileOnly`.
[Here's an exhaustive comparison](https://github.com/privatenumber/ts-runtime-comparison) between `tsx` vs `ts-node` (and other runtimes).
If you migrated from `ts-node`, please share your performance gains [here](https://github.com/esbuild-kit/tsx/discussions/10)!

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc