Skip to content

Commit

Permalink
Docs merge for 10.8.1 (#1788)
Browse files Browse the repository at this point in the history
* Update options.md (#1768)

* Update options.md

* Update options.md

* Update configuration.md

* Update performance.md

* Update transpilers.md
  • Loading branch information
cspotcode committed Jun 3, 2022
1 parent 599f28b commit 167a7fe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions website/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ You can use this sample configuration as a starting point:

```json title="tsconfig.json"
{
// This is an alias to @tsconfig/node12: https://github.com/tsconfig/bases
"extends": "ts-node/node12/tsconfig.json",
// This is an alias to @tsconfig/node16: https://github.com/tsconfig/bases
"extends": "ts-node/node16/tsconfig.json",

// Most ts-node options can be specified here using their programmatic names.
"ts-node": {
Expand Down
14 changes: 8 additions & 6 deletions website/docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ ts-node --scope

Scope compiler to files within `scopeDir`. Anything outside this directory is ignored.

*Default: `false` <br/>
*Default:* `false` <br/>
*Environment:* `TS_NODE_SCOPE`

### scopeDir
Expand Down Expand Up @@ -374,10 +374,12 @@ Disable top-level await in REPL. Equivalent to node's [`--no-experimental-repl-

Enable experimental hooks that re-map imports and require calls to support:

* resolves `.js` to `.ts`, so that `import "./foo.js"` will execute `foo.ts`
* resolves `.cjs` to `.cts`
* resolves `.mjs` to `.mts`
* allows including file extensions in CommonJS, for consistency with ESM where this is often mandatory
* remapping extensions, e.g. so that `import "./foo.js"` will execute `foo.ts`. Currently the following extensions will be mapped:
* `.js` to `.ts`, `.tsx`, or `.jsx`
* `.cjs` to `.cts`
* `.mjs` to `.mts`
* `.jsx` to `.tsx`
* including file extensions in CommonJS, for consistency with ESM where this is often mandatory

In the future, this hook will also support:

Expand All @@ -397,7 +399,7 @@ ts-node --experimentalSpecifierResolution node
```

Like node's [`--experimental-specifier-resolution`](https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#customizing-esm-specifier-resolution-algorithm), but can also be set in your `tsconfig.json` for convenience.
Requires `esm` to be enabled.
Requires [`esm`](#esm) to be enabled.

*Default:* `explicit`<br/>

Expand Down
4 changes: 2 additions & 2 deletions website/docs/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ These tricks will make ts-node faster.

It is often better to use `tsc --noEmit` to typecheck as part of your tests or linting. In these cases, ts-node can skip typechecking.

* Enable [swc](./transpilers.md#swc)
* Enable [swc](./swc.md)
* This is by far the fastest option
* Enable [`transpileOnly`](./options.md) to skip typechecking without swc
* Enable [`transpileOnly`](./options.md#transpileonly) to skip typechecking without swc

## With typechecking

Expand Down
4 changes: 2 additions & 2 deletions website/docs/transpilers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ sourcemap support, and global ts-node CLI. Plugins automatically derive an appro
The `transpiler` option allows using third-party transpiler plugins with ts-node. `transpiler` must be given the
name of a module which can be `require()`d. The built-in `swc` plugin is exposed as `ts-node/transpilers/swc`.

For example, to use a hypothetical "speedy-ts-compiler", first install it into your project: `npm install speedy-ts-compiler`
For example, to use a hypothetical "@cspotcode/fast-ts-compiler", first install it into your project: `npm install @cspotcode/fast-ts-compiler`

Then add the following to your tsconfig:

```json title="tsconfig.json"
{
"ts-node": {
"transpileOnly": true,
"transpiler": "speedy-ts-compiler"
"transpiler": "@cspotcode/fast-ts-compiler"
}
}
```
Expand Down

0 comments on commit 167a7fe

Please sign in to comment.