Comparing version 3.4.0 to 3.4.1
@@ -1,1 +0,1 @@ | ||
import{r}from"./pkgroll_create-require-1839faef.js";export*from"@esbuild-kit/esm-loader";import"module";r("@esbuild-kit/cjs-loader"); | ||
import{r}from"./pkgroll_create-require-97f6f9e8.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-2effcb46.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-fb1d7b77.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.0", | ||
"description": "Node.js runtime enhanced with esbuild for loading TypeScript & ESM", | ||
"version": "3.4.1", | ||
"description": "TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files", | ||
"keywords": [ | ||
@@ -38,5 +38,5 @@ "esbuild", | ||
"dependencies": { | ||
"@esbuild-kit/cjs-loader": "^2.0.0", | ||
"@esbuild-kit/core-utils": "^1.1.1", | ||
"@esbuild-kit/esm-loader": "^2.1.0" | ||
"@esbuild-kit/cjs-loader": "^2.0.1", | ||
"@esbuild-kit/core-utils": "^1.2.0", | ||
"@esbuild-kit/esm-loader": "^2.1.2" | ||
}, | ||
@@ -43,0 +43,0 @@ "optionalDependencies": { |
# tsx | ||
Node.js enhanced with [esbuild](https://esbuild.github.io/) to run TypeScript & ESM | ||
_TypeScript Execute (tsx)_: Node.js enhanced with [esbuild](https://esbuild.github.io/) to run TypeScript & ESM files | ||
@@ -15,2 +15,5 @@ ### Features | ||
## Install | ||
### Local installation | ||
If you're using it in an npm project, install it as a development dependency: | ||
```sh | ||
@@ -20,12 +23,33 @@ npm install --save-dev tsx | ||
### Install globally | ||
Install it globally to use it anywhere, outside of your npm project, without [npx](https://docs.npmjs.com/cli/v8/commands/npx). | ||
You can reference it directly in the `package.json#scripts` object: | ||
```json5 | ||
{ | ||
"scripts": { | ||
"dev": "tsx ..." | ||
} | ||
} | ||
``` | ||
To use the binary, you can call it with [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) while in the project directory: | ||
```sh | ||
npx tsx ... | ||
``` | ||
### Global installation | ||
If you want to use it in any arbitrary project without [npx](https://docs.npmjs.com/cli/v8/commands/npx), install it globally: | ||
```sh | ||
npm install --global tsx | ||
``` | ||
You can call `tsx` directly: | ||
```sh | ||
tsx ... | ||
``` | ||
## Usage | ||
> Note: Commands are prefixed with [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) to execute the `tsx` binary, but it's not necessary if globally installed or when using it in the `script` object in `package.json` | ||
### Run TypeScript / ESM / CJS module | ||
@@ -36,3 +60,3 @@ | ||
```sh | ||
npx tsx ./file.ts | ||
tsx ./file.ts | ||
``` | ||
@@ -49,10 +73,10 @@ | ||
```sh | ||
npx tsx watch ./file.ts | ||
tsx watch ./file.ts | ||
``` | ||
### REPL | ||
Start a TypeScript REPL by running `tsx` with no arguments. | ||
Start a TypeScript REPL by running with no arguments. | ||
```sh | ||
npx tsx | ||
tsx | ||
``` | ||
@@ -66,3 +90,3 @@ | ||
```sh | ||
npx tsx --no-cache ./file.ts | ||
tsx --no-cache ./file.ts | ||
``` | ||
@@ -72,3 +96,3 @@ | ||
tsx is a standalone binary used in-place of Node.js, but sometimes you'll want to use `node` directly. For example, when adding TypeScript & ESM support to Node.js 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. | ||
@@ -87,3 +111,5 @@ To use tsx with Node.js, pass it into the [`--loader`](https://nodejs.org/api/esm.html#loaders) flag. | ||
If you're looking to use 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 not_ be applied to dynamic `import()`s. | ||
> Tip: In rare circumstances, you might be limited to use 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()`. | ||
@@ -90,0 +116,0 @@ ## Dependencies |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121217
134