tsx
Advanced tools
Comparing version 3.12.10 to 3.13.0
{ | ||
"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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 3 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
386855
31
1562
318
35
11
70
5
+ Addedesbuild@~0.18.20
+ Addedget-tsconfig@^4.7.2
+ Addedsource-map-support@^0.5.21
- Removed@esbuild-kit/cjs-loader@^2.4.2
- Removed@esbuild-kit/core-utils@^3.3.0
- Removed@esbuild-kit/esm-loader@^2.6.3
- Removed@esbuild-kit/cjs-loader@2.4.4(transitive)
- Removed@esbuild-kit/core-utils@3.3.2(transitive)
- Removed@esbuild-kit/esm-loader@2.6.5(transitive)