Socket
Socket
Sign inDemoInstall

tsx

Package Overview
Dependencies
4
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.12.10 to 3.13.0

dist/cjs/index.cjs

21

package.json
{
"name": "tsx",
"version": "3.12.10",
"version": "3.13.0",
"description": "TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files",

@@ -26,17 +26,20 @@ "keywords": [

"./package.json": "./package.json",
".": "./dist/loader.js",
"./cli": "./dist/cli.js",
".": "./dist/loader.mjs",
"./cjs": "./dist/cjs/index.cjs",
"./esm": "./dist/esm/index.mjs",
"./cli": "./dist/cli.mjs",
"./source-map": "./dist/source-map.cjs",
"./suppress-warnings": "./dist/suppress-warnings.cjs",
"./preflight": "./dist/preflight.cjs",
"./repl": "./dist/repl.js"
"./repl": "./dist/repl.mjs"
},
"bin": "./dist/cli.js",
"bin": "./dist/cli.mjs",
"dependencies": {
"@esbuild-kit/cjs-loader": "^2.4.2",
"@esbuild-kit/core-utils": "^3.3.0",
"@esbuild-kit/esm-loader": "^2.6.3"
"esbuild": "~0.18.20",
"get-tsconfig": "^4.7.2",
"source-map-support": "^0.5.21"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
"fsevents": "~2.3.3"
}
}
# tsx <a href="https://npm.im/tsx"><img src="https://badgen.net/npm/v/tsx"></a> <a href="https://npm.im/tsx"><img src="https://badgen.net/npm/dm/tsx"></a> <a href="https://packagephobia.now.sh/result?p=tsx"><img src="https://packagephobia.now.sh/badge?p=tsx"></a>
> _TypeScript Execute (`tsx`)_: Node.js enhanced with [esbuild](https://esbuild.github.io/) to run TypeScript & ESM files
> _TypeScript Execute (`tsx`)_: Node.js enhanced to run TypeScript & ESM files

@@ -13,3 +13,3 @@ ### Features

- Resolves `tsconfig.json` [`paths`](https://www.typescriptlang.org/tsconfig#paths)
- Tested on Linux & Windows with Node.js v12~18
- Tested on Linux & Windows with Node.js v12~20

@@ -45,2 +45,7 @@ > **💡 Protip: Looking to bundle your TypeScript project?**

### Mission
tsx strives to:
1. Enhance Node.js with TypeScript compatibility
2. Improve ESM <-> CJS interoperability
3. Support the latest major version of Node.js v12 and up _(likely to change in the future)_

@@ -153,19 +158,30 @@ ## Install

To use `tsx` as a Node.js loader, simply pass it in to the [`--loader`](https://nodejs.org/api/esm.html#loaders) flag.
To use `tsx` as a Node.js loader, pass it in to the [`--loader`](https://nodejs.org/api/esm.html#loaders) flag. This will add TypeScript & ESM support for both ESM and CommonJS contexts.
> Note: The loader is limited to adding support for loading TypeScript/ESM files. CLI features such as _watch mode_ or suppressing "experimental feature" warnings will not be available.
```sh
# As a CLI flag
node --loader tsx ./file.ts
```
# As an environment variable
Or as an environment variable:
```sh
NODE_OPTIONS='--loader tsx' node ./file.ts
```
> 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()` (not `import`).
> **Note:** The loader is limited to adding support for loading TypeScript/ESM files. CLI features such as _watch mode_ or suppressing "experimental feature" warnings will not be available.
#### ESM only loader
If you only need to add TypeScript support in a Module context, you can use the ESM loader:
```sh
node --loader tsx/esm ./file.ts
```
#### CommonJS only loader
If you only need to add TypeScript & ESM support in a CommonJS context, you can use the CJS loader:
```sh
node --require tsx/cjs ./file.ts
```
### Hashbang

@@ -195,10 +211,2 @@

## Dependencies
#### [@esbuild-kit/esm-loader](https://github.com/esbuild-kit/esm-loader)
Node.js Loader to transform TypeScript to ESM.
#### [@esbuild-kit/cjs-loader](https://github.com/esbuild-kit/cjs-loader)
Node.js `require()` hook to transform TypeScript & ESM to CommonJS.
<br>

@@ -291,6 +299,2 @@

[**Holocron**](https://holocron.so#github-privatenumber)
[![Holocron](https://holocron.so/banners/github.png)](https://holocron.so#github-privatenumber)
<p align="center">

@@ -297,0 +301,0 @@ <a href="https://privatenumber-sponsors.vercel.app/api/sponsor?tier=silver1">

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc