tsx 3.6.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # tsx
1
+ # 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>
2
2
 
3
3
  > _TypeScript Execute (`tsx`)_: Node.js enhanced with [esbuild](https://esbuild.github.io/) to run TypeScript & ESM files
4
4
 
@@ -9,6 +9,7 @@
9
9
  - Supports `node:` import prefixes
10
10
  - Hides experimental feature warnings
11
11
  - TypeScript REPL
12
+ - Resolves `tsconfig.json` [`paths`](https://www.typescriptlang.org/tsconfig#paths)
12
13
  - Tested on Linux & Windows with Node.js v12~18
13
14
 
14
15
  <sub>Support this project by ⭐️ starring and sharing it. [Follow me](https://github.com/privatenumber) to see what other cool projects I'm working on! ❤️</sub>
@@ -66,6 +67,9 @@ tsx ...
66
67
 
67
68
  ## Usage
68
69
 
70
+ `tsx` is designed to be a drop-in replacement for `node`, so you can use it just the way you would use Node.js. All command-line arguments (with the exception of a few) are propagated to Node.js.
71
+
72
+
69
73
  ### Run TypeScript / ESM / CJS module
70
74
 
71
75
  Pass in a file to run:
@@ -74,6 +78,15 @@ Pass in a file to run:
74
78
  tsx ./file.ts
75
79
  ```
76
80
 
81
+ #### Custom `tsconfig.json` path
82
+ By default, `tsconfig.json` will be detected from the current working directory.
83
+
84
+ To set a custom path, use the `--tsconfig` flag:
85
+
86
+ ```sh
87
+ tsx --tsconfig ./path/to/tsconfig.custom.json ./file.ts
88
+ ```
89
+
77
90
  ### Watch mode
78
91
  Run file and automatically rerun on changes:
79
92
 
@@ -133,6 +146,12 @@ NODE_OPTIONS='--loader tsx' node ./file.ts
133
146
 
134
147
  ## FAQ
135
148
 
149
+ ### Why is it named `tsx`?
150
+
151
+ `tsx` stands for "TypeScript execute", similar to [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) ("Node.js package execute").
152
+
153
+ It has an unfortunate overlap with React's [TSX/JSX](https://www.typescriptlang.org/docs/handbook/jsx.html), which stands for "JavaScript XML". However, we believe the naming is appropriate for what it does.
154
+
136
155
  ### Does it do type-checking?
137
156
 
138
157
  No, [esbuild does not support type checking](https://esbuild.github.io/faq/#:~:text=TypeScript%20type%20checking%20(just%20run%20tsc%20separately)).
@@ -151,3 +170,12 @@ Because esbuild doesn't do type checking, `tsx` is more equivalent to `ts-node -
151
170
  [Here's an exhaustive comparison](https://github.com/privatenumber/ts-runtime-comparison) between `tsx` vs `ts-node` (and other runtimes).
152
171
 
153
172
  If you migrated from `ts-node`, please share your performance gains [here](https://github.com/esbuild-kit/tsx/discussions/10)!
173
+
174
+
175
+ ### Can it use esbuild plugins?
176
+
177
+ No. tsx uses esbuild's [Transform API](https://esbuild.github.io/api/#transform-api), which doesn't support plugins.
178
+
179
+ ### Does it have a configuration file?
180
+
181
+ No. tsx's integration with Node.js is designed to be seamless so there is no configuration.