UNPKG

1.63 kBMarkdownView Raw
1<div align="center">
2 <img src="logo.png" alt="tsm" width="200" />
3</div>
4
5<div align="center">
6 <a href="https://npmjs.org/package/tsm">
7 <img src="https://badgen.net/npm/v/tsm" alt="version" />
8 </a>
9 <a href="https://github.com/lukeed/tsm/actions">
10 <img src="https://github.com/lukeed/tsm/workflows/CI/badge.svg" alt="CI" />
11 </a>
12 <a href="https://npmjs.org/package/tsm">
13 <img src="https://badgen.net/npm/dm/tsm" alt="downloads" />
14 </a>
15 <a href="https://packagephobia.now.sh/result?p=tsm">
16 <img src="https://badgen.net/packagephobia/publish/tsm" alt="publish size" />
17 </a>
18</div>
19
20<div align="center">TypeScript Module Loader</div>
21
22## Features
23
24* Supports `node <file>` usage
25* Supports [ESM `--loader`](https://nodejs.org/api/esm.html#esm_loaders) usage<sup></sup>
26* Supports [`--require` hook](https://nodejs.org/api/cli.html#cli_r_require_module) usage
27* Optional [configuration](/docs/configuration.md) file for per-extension customization
28
29> <sup>†</sup> The ESM Loader API is still **experimental** and will change in the future.
30
31## Install
32
33```sh
34# install as project dependency
35$ npm install --save-dev tsm
36
37# or install globally
38$ npm install --global tsm
39```
40
41## Usage
42
43> **Note:** Refer to [`/docs/usage.md`](/docs/usage.md) for more information.
44
45```sh
46# use as `node` replacement
47$ tsm server.ts
48
49# forwards any `node` ENV or flags
50$ NO_COLOR=1 tsm server.ts --trace-warnings
51
52# use as `--require` hook
53$ node --require tsm server.tsx
54$ node -r tsm server.tsx
55
56# use as `--loader` hook
57$ node --loader tsm main.jsx
58```
59
60## License
61
62MIT © [Luke Edwards](https://lukeed.com)