Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bin exported without extension, breaks node's native loader picker and ts-node/esm #4645

Closed
FossPrime opened this issue Jun 3, 2021 · 32 comments

Comments

@FossPrime
Copy link

FossPrime commented Jun 3, 2021

Description

custom loaders like ts-node have a really hard time figuring out the mocha "binary"

The binary lacks.js or cjs extensions. Changing the node_modules/.bin/mocha extension isn't enough.

Steps to Reproduce

  1. Sandbox: https://codesandbox.io/s/mocha-ts-node-16-ctt5k?file=/package.json
  2. Open Terminal
  3. Run npm run broken-test-npx or run source env.sh; mocha test/test.js

OR

  1. npm install ts-node typescript @types/mocha mocha on a type: "modules" project.json
  2. Set export NODE_OPTIONS="--loader ts-node/esm/transpile-only"
  3. Run npx mocha test/any-test-at-all.js

Expected behavior:

No errors, tests run.

Actual behavior:

Setting a loader prevents node from running the mocha binary, in any way

$ npm run test # Copies mocha to mocha.js as workaround
3 passing (3ms)
$ npm run test-cjs # Copies mocha to mocha.cjs as workaround
1 passing (2ms)
$ npm run broken-test-npx # Node cant tell what loader to use and errors out
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /sandbox/node_modules/mocha/bin/mocha
$ npm run broken-test-direct # same behavior as before
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /sandbox/node_modules/mocha/bin/mocha

Reproduces how often: 100% of the time

Versions

  • The output of mocha: 8.4.0
  • The output of node --version: 14 (Sandbox) and 16 as well
  • Your operating system
    • name and version: yes
    • architecture (32 or 64-bit): 64
  • Your shell (e.g., bash, zsh, PowerShell, cmd):
  • Your browser and version (if running browser tests):
  • Any third-party Mocha-related modules (and their versions):
  • Any code transpiler being used (and its version): ts-node loader

Additional Information

Transpile only mode does not make a difference. Extension of tests do not make a difference. As long as the loader boots up, when node proceeds to guess which loader to use, node errors out.

@FossPrime FossPrime changed the title Bin exports resolve to extensionless files Bin exports break native loaders and ts-node/esm Jun 3, 2021
@juergba
Copy link
Contributor

juergba commented Jun 3, 2021

This is an working example with Mocha, ESM and ts-node/esm.
Why do you think this issue is a Mocha issue? Not a loader or configuration problem?

@FossPrime
Copy link
Author

FossPrime commented Jun 3, 2021

@juergba The error actually comes from node... internal/modules/esm/get_format.js:71:15

Again, this is just how node works - it'll use the extension loader defined or fallback on the .js loader. We can't make it use ts-node as a result.

TypeStrong/ts-node#116

Most symlinks in node_modules/.bin use extensions... I have the loader set to transpile only... it doesn't have much configuration to do.

lrwxrwxrwx   1 mind ya   21 Jun  2 13:15 mocha.js -> ../mocha/bin/mocha
lrwxrwxrwx   1 mind ya   22 Jun  2 11:45 ts-node -> ../ts-node/dist/bin.js
lrwxrwxrwx   1 mind ya   26 Jun  2 11:45 ts-node-cwd -> ../ts-node/dist/bin-cwd.js
lrwxrwxrwx   1 mind ya   29 Jun  2 11:45 ts-node-script -> ../ts-node/dist/bin-script.js
lrwxrwxrwx   1 mind ya   32 Jun  2 11:45 ts-node-transpile-only -> ../ts-node/dist/bin-transpile.js
lrwxrwxrwx   1 mind ya   40 Jun  2 11:45 ts-script -> ../ts-node/dist/bin-script-deprecated.js
lrwxrwxrwx   1 mind ya   23 May 12 09:45 eslint -> ../eslint/bin/eslint.js
lrwxrwxrwx   1 mind ya   25 May 12 09:45 esparse -> ../esprima/bin/esparse.js
lrwxrwxrwx   1 mind ya   28 May 12 09:45 esvalidate -> ../esprima/bin/esvalidate.js
lrwxrwxrwx   1 mind ya   14 May 12 09:45 flat -> ../flat/cli.js
lrwxrwxrwx   1 mind ya   19 May 12 09:45 json5 -> ../json5/lib/cli.js
lrwxrwxrwx   1 mind ya   25 May 12 09:45 js-yaml -> ../js-yaml/bin/js-yaml.js
lrwxrwxrwx   1 mind ya   15 May 12 09:45 katex -> ../katex/cli.js
lrwxrwxrwx   1 mind ya   33 May 12 09:45 markdown-it -> ../markdown-it/bin/markdown-it.js
lrwxrwxrwx   1 mind ya   14 May 12 09:45 mime -> ../mime/cli.js
lrwxrwxrwx   1 mind ya   20 May 12 09:45 mkdirp -> ../mkdirp/bin/cmd.js
lrwxrwxrwx   1 mind ya   24 May 12 09:45 nanoid -> ../nanoid/bin/nanoid.cjs
lrwxrwxrwx   1 mind ya   29 May 12 09:45 replace-in-file -> ../replace-in-file/bin/cli.js
lrwxrwxrwx   1 mind ya   16 May 12 09:45 rimraf -> ../rimraf/bin.js
lrwxrwxrwx   1 mind ya   23 May 12 09:45 semver -> ../semver/bin/semver.js
lrwxrwxrwx   1 mind ya   19 May 12 09:45 shjs -> ../shelljs/bin/shjs

nandoid goes as far as using cjs

@FossPrime FossPrime changed the title Bin exports break native loaders and ts-node/esm Bin exported without extension, breaks node's native loader picker and ts-node/esm Jun 3, 2021
@juergba
Copy link
Contributor

juergba commented Jun 4, 2021

Again, this is just how node works - it'll use the extension loader defined or fallback on the .js loader. We can't make it use ts-node as a result.

I haven't understood yet, or something is wrong in your argumentation.

  • without extension the above fallback should be triggered. Which would be correct with .js loader. Why isn't this the case?
  • why do you pass Mocha, a CJS module, to your ESM loader? For transpilation?
  • why does my sample mentioned above work? What is the difference to your case?

@juergba
Copy link
Contributor

juergba commented Jun 4, 2021

If you remove --loader ... from NODE_OPTIONS and add it to .mocharc.cjs instead , does it work then?
I guess so, because in this case Mocha starts first, then the loader is called in a subprocess.. The entry point is lib/cli/cli.js.

@juergba
Copy link
Contributor

juergba commented Jun 4, 2021

Yes, above sample does not work anymore, when I remove loader: 'ts-node/esm' from .mocharc.cjs and use NODE_OPTIONS="--loader=ts-node/esm" instead.

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for D:\temp\ts-node-repros\node_modules\mocha\bin\mocha
    at defaultGetFormat (internal/modules/esm/get_format.js:71:15)
    at defer (D:\temp\ts-node-repros\node_modules\ts-node\src\esm.ts:81:7)
    at D:\temp\ts-node-repros\node_modules\ts-node\src\esm.ts:103:12
    at Generator.next (<anonymous>)
    at D:\temp\ts-node-repros\node_modules\ts-node\dist\esm.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (D:\temp\ts-node-repros\node_modules\ts-node\dist\esm.js:4:12)
    at getFormat (D:\temp\ts-node-repros\node_modules\ts-node\dist\esm.js:54:16)
    at Loader.getFormat (internal/modules/esm/loader.js:102:42)
    at Loader.getModuleJob (internal/modules/esm/loader.js:231:31)

@cspotcode can you have a look at this, please?

@cspotcode
Copy link
Contributor

cspotcode commented Jun 4, 2021

This is a confirmed bug in nodejs. Please remind them that they need to fix it! I have cited mocha as one of the libraries being broken by it, but it will help if mocha's users and maintainers also remind them (politely) that they need to fix this!
nodejs/node#33226

To reproduce the bug, use a completely empty --loader. This will prove that node is responsible for the error, not ts-node nor any other loader.

$ node -v
v16.2.0

$ touch empty-loader.mjs
$ touch extensionless-entrypoint
$ node --loader empty-loader.mjs ./extensionless-entrypoint
(node:10077) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/process/esm_loader:74
    internalBinding('errors').triggerUncaughtException(
                              ^

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /c/Users/cspot/extensionless-entrypoint
    at new NodeError (node:internal/errors:363:5)
    at Loader.defaultGetFormat [as _getFormat] (node:internal/modules/esm/get_format:71:15)
    at Loader.getFormat (node:internal/modules/esm/loader:105:42)
    at Loader.getModuleJob (node:internal/modules/esm/loader:243:31)
    at async Loader.import (node:internal/modules/esm/loader:177:17)
    at async Object.loadESM (node:internal/process/esm_loader:68:5) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

EDIT Fixed a typo above; the node --loader invocation was missing the ./extensionless-entrypoint

@juergba
Copy link
Contributor

juergba commented Jun 4, 2021

@cspotcode thank you for your explanation, I will remind nodejs tomorrow.

@rayfoss you have the workaround with .mocharc.cjs. I don't know yet what to do with our extensionless binary.

@cspotcode
Copy link
Contributor

I think if mocha wants to implement a simple fix, they can add a new bin entrypoint file with a file extension (make sure to keep the old one, too, for backwards-compatibility) and then point package.json "bin" field to the new entrypoint with the file extension.

I believe that update can be published as a non-breaking change.

@FossPrime
Copy link
Author

FossPrime commented Jun 4, 2021

I think if mocha wants to implement a simple fix, they can add a new bin entrypoint file with a file extension (make sure to keep the old one, too, for backwards-compatibility) and then point package.json "bin" field to the new entrypoint with the file extension.

I believe that update can be published as a non-breaking change.

... My PR is not a breaking change in any way. mocha/bin/_mocha.js is a new entry point. And NPM makes a symlink called .bin/_mocha. People who use mocha/bin/_mocha directly or via the symlink .bin/_mocha would be unaffected.

There is an argument to be made that it should be mocha/bin/mocha.js, not mocha/bin/_mocha.js, which is then symlinked to .bin/_mocha by NPM, I was just preserving the convention established by mocha/bin/_mocha.

@cspotcode
Copy link
Contributor

You mention a drawback in your PR; is that non-breaking?

We might be talking about the same thing. I'm imagining that mocha ships 4x different files: mocha, mocha.js, _mocha, and _mocha.js. package.json "bin" points to the ones with file extensions.

@FossPrime
Copy link
Author

FossPrime commented Jun 4, 2021

You mention a drawback in your PR; is that non-breaking?

We might be talking about the same thing. I'm imagining that mocha ships 4x different files: mocha, mocha.js, _mocha, and _mocha.js. package.json "bin" points to the ones with file extensions.

My PR only addresses the issue at hand, I couldn't see how you guys output bundled code... So the PR has

  • _mocha (naked vanilla)
  • _mocha.js (clothed vanilla)
  • mocha (naked bundled)

Symbolic Links made by NPM:

  • .bin/_mocha (& to clothed vanilla _mocha.js)
  • .bin/mocha (& to naked bundled mocha)

We can make a mocha/bin/mocha.js that uses the naked bundled mocha/bin/mocha without duplicating the big file by using a funky, but legal, side-effect only, require or import call to the naked bundle.

Update: I corrected the description of the PR to reflect it's contents. I updated the PR code a few hours after publishing to duplicate naked vanilla mocha/bin/_mocha once I stumped on documentation and projects that directly referenced mocha/.bin/_mocha... And remembered Deno and custom package managers exist, and they may not read our package.json for the location of our stable endpoints.

@FossPrime
Copy link
Author

no longer an issue in Mocha 9

@lachrist
Copy link

Hi again @juergba, could it be that the loader mocha option override require? Sorry, I could not find any documentation on the loader option...

@juergba
Copy link
Contributor

juergba commented Aug 14, 2021

@lachrist There is no loader option in Mocha.

Just use 'experimental-loader' : './lib/loader.mjs'. Or with the alias name: loader: './lib/loader.mjs'

Edit: Mocha recognizes Node's option and forwards them to Node by spawning a child-process.

@lachrist
Copy link

Now, it makes more sense! I got confused because node has no documented loader option, hence I assumed it was a mocha option :|

Thanks for the swift answer!

@juergba
Copy link
Contributor

juergba commented Aug 14, 2021

Welcome.
Run node -h, then: --loader, --experimental-loader=... use the specified module as a custom loader

@JakobJingleheimer
Copy link

@juergba @giltayar This issue occurs today. I'm not sure why it was fixed in mocha v9 release but occurs now exactly as OP described for exactly the reason OP described.

I spoke with npm and yarn authors, and both package managers automatically alias a non-naked bin with a naked version (but not the other way around).

There is an on-going discussion within Node.js on how to handle naked bin files, but it has become rather protracted and does not appear to be resolving any time soon.

The quickest solution to get mocha working with loaders is to:

  • add a .js file extension to the currently naked bin file
  • add "type": "commonjs" to mocha's package.json (commonjs is the default, but it saves Node.js having to look further for the info and only eventually fall back to the default value, and is future-proofing for when Node.js switches the default to module)

I'd be happy to do this if you agree.

@juergba
Copy link
Contributor

juergba commented Jan 24, 2022

@JakobJingleheimer no, I'm against this .js solution. We haven't fixed anything in v9 either.

When you set --loader with NODE_OPTIONS then it fails, because Mocha's entry point is extensionless.
When you set --loader via Mocha options (mocha --loader=... or mocha -n loader=...) then Mocha launches a child-process and the entry point lib/cli/cli.js has an extension.

@JakobJingleheimer
Copy link

Ah. Perhaps a documentation update then?

@giltayar
Copy link
Contributor

@juergba why are you against this? (or at least two bin entry points: one without an extension and one with it)

@JakobJingleheimer
Copy link

Also keeping in mind that npm and yarn both handle supplying the naked one automatically.

@juergba
Copy link
Contributor

juergba commented Jan 25, 2022

@giltayar --loader is still experimental and I don't see any reason to adapt Mocha at that floating stage. Furthermore we have this easy work-around.

In aprox. April/May we will publish Mocha v10. If Node still hasn't made up their mind until then about this extensionless binary story, we evtl. could add *.js to our binary as a breaking change.

@lachrist
Copy link

Hi guys I've discussed this issue with the node team. And this will probably never be solved on their end. Checkout nodejs/node#41465. In particular, this is my final take on it:

At the moment, monitoring ECMAScript modules requires --experimental-loader flag. But this flag makes node always use the new esm loader to load the main file. Without this flag, node will sometimes use the old cjs loader. To be clear, the new esm loader is capable of loading commonjs files as well (along with native modules, web assembly modules, ...). So most of the time this change should not be noticeable. The biggest difference I encountered so far is that the cjs loader handles files without extension whereas the esm loader would throw an exception. This is intentional: the cjs loader only has to handle one kind of module (commonjs modules) whereas the esm loader has to handle different kinds of modules and the node team wants to reserve extension-less files for web assembly.

@juergba
Copy link
Contributor

juergba commented Jan 25, 2022

What is the (historic) reason that binaries (or executables?) are extensionless?
The first line #!/usr/bin/env node means, this file is an executable, right? In Linux only? In Windows this line has no purpose.

Also keeping in mind that npm and yarn both handle supplying the naked one automatically.

For which reason does npm/yarn do that?

@JakobJingleheimer
Copy link

JakobJingleheimer commented Jan 25, 2022

Yes, I'm 99% sure the historic reason is days of yore (unix/linux).

Note that adding the .js file extension would NOT be a breaking change as npm and yarn will automatically handle the extension-less part for you.

Also, I'm completely confident that making the two tiny changes I suggested will 100% be compatible now and in future, wherever loaders lands ;)

@lachrist cough I am on the node team 🙂

There is a more recent discussion, but I'm not linking to it at the moment because I need to port it from a PR (that I need to closed) to an actual discussion.

@cspotcode
Copy link
Contributor

The first line #!/usr/bin/env node means, this file is an executable, right? In Linux only?

Technically the execute bit tells Linux it's an executable, and the two-byte sequence #! is a magic number understood by the Linux kernel, used to differentiate different binary formats. That's my understanding at least.

Package managers use https://www.npmjs.com/package/@zkochan/cmd-shim to generate .ps1 and .cmd shims that achieve the same effect on Windows.

@cspotcode
Copy link
Contributor

#4645 (comment)

^^ This is a fully backwards-compatible fix and takes little effort, right? I feel like there's some confusion with talk of this being a breaking change, but it's not. Is there anything we can explain further?

@juergba
Copy link
Contributor

juergba commented Jan 27, 2022

I spoke with npm and yarn authors, and both package managers automatically alias a non-naked bin with a naked version (but not the other way around).

If you mean: bin/mocha.js results in : .bin/mocha then I agree. Otherwise ..?

I can live with adding an additional bin/mocha.js requiring the naked one. The second binary bin/_mocha is on sneaky deprecation, we should leave it as is.

@JakobJingleheimer please go ahead with your PR, if you are still on fire. Otherwise we wait till Mocha@10.

@JakobJingleheimer
Copy link

I spoke with npm and yarn authors, and both package managers automatically alias a non-naked bin with a naked version (but not the other way around).

If you mean: bin/mocha.js results in : .bin/mocha then I agree. Otherwise ..?

Yes, exactly 🙂

I can live with adding an additional bin/mocha.js requiring the naked one. The second binary bin/_mocha is on sneaky deprecation, we should leave it as is.

You don't have to do this: npm and yarn will take care of it automatically.

@JakobJingleheimer please go ahead with your PR, if you are still on fire. Otherwise we wait till Mocha@10.

Not on fire. I've just seen quite a few bugs about it. Whatever you prefer 🙂

I've consolidated the discussions into nodejs/node#41711

@juergba
Copy link
Contributor

juergba commented Jan 27, 2022

You don't have to do this: npm and yarn will take care of it automatically.

This is not true. Take a look at e.g. nanoid after installation with npm, there is a bin/nanoid.cjs but no bin/nanoid.

@cspotcode
Copy link
Contributor

cspotcode commented Jan 27, 2022 via email

@cspotcode
Copy link
Contributor

cspotcode commented Mar 1, 2022

ts-node 10.6.0 implements a workaround that hopefully mimics the bugfix which will eventually be published in node core. This means that, for users of mocha and ts-node, upgrading to the latest ts-node should avoid this issue.

https://github.com/TypeStrong/ts-node/releases/tag/v10.6.0

crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this issue Mar 8, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ts-node](https://typestrong.org/ts-node) ([source](https://github.com/TypeStrong/ts-node)) | devDependencies | minor | [`10.5.0` -> `10.6.0`](https://renovatebot.com/diffs/npm/ts-node/10.5.0/10.6.0) |

---

### Release Notes

<details>
<summary>TypeStrong/ts-node</summary>

### [`v10.6.0`](https://github.com/TypeStrong/ts-node/releases/v10.6.0)

[Compare Source](TypeStrong/ts-node@v10.5.0...v10.6.0)

Questions about this release? Ask in the official discussion thread: [#&#8203;1666](TypeStrong/ts-node#1666)

**Added**

-   Adds workaround for extensionless entrypoints with ESM loader ([#&#8203;1649](TypeStrong/ts-node#1649), [#&#8203;1654](TypeStrong/ts-node#1654))
    -   You can now combine tools such as `mocha` with `--loader ts-node/esm`, where previously node would throw `[ERR_UNKNOWN_FILE_EXTENSION]`
    -   node has a bug where combining `--loader` with an extensionless entrypoint causes this error [nodejs/node#&#8203;33226](nodejs/node#33226)
    -   Some tools, for example `mocha`, have an extensionless entrypoint. ([source](https://github.com/mochajs/mocha/blob/547ffd73535088322579d3d2026432112eae3d4b/package.json#L37), [source](https://github.com/mochajs/mocha/blob/547ffd73535088322579d3d2026432112eae3d4b/bin/mocha))
    -   Combining `NODE_OPTIONS=--loader ts-node/esm` with these tools causes this error.  [mochajs/mocha#&#8203;4645](mochajs/mocha#4645)
    -   node intends to fix this bug in a future release: [nodejs/node#&#8203;41711](nodejs/node#41711)
    -   In the interim, we have implemented a workaround in ts-node.
-   Adds support for target "ES2022" in `moduleTypes` overrides ([#&#8203;1650](TypeStrong/ts-node#1650))

**Fixed**

-   Fixed bug where `--swc` and other third-party transpilers did not respect `moduleTypes` overrides ([#&#8203;1651](TypeStrong/ts-node#1651), [#&#8203;1652](TypeStrong/ts-node#1652), [#&#8203;1660](TypeStrong/ts-node#1660))
-   Fixed bug where node flags were not preserved correctly in `process.execArgv` ([#&#8203;1657](TypeStrong/ts-node#1657), [#&#8203;1658](TypeStrong/ts-node#1658))
    -   This affected `child_process.fork()`, since it uses `process.execArgv` to create a similar child runtime.
    -   With this fix, `child_process.fork()` will preserve both node flags and `ts-node` hooks.
-   Fixed compatibility TypeScript 4.7's API changes ([#&#8203;1647](TypeStrong/ts-node#1647), [#&#8203;1648](TypeStrong/ts-node#1648))

https://github.com/TypeStrong/ts-node/milestone/9

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <[email protected]>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1195
Reviewed-by: Epsilon_02 <[email protected]>
Co-authored-by: Calciumdibromid Bot <[email protected]>
Co-committed-by: Calciumdibromid Bot <[email protected]>
pulumi-renovate bot added a commit to pulumi/examples that referenced this issue Feb 18, 2025
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ts-node](https://typestrong.org/ts-node)
([source](https://redirect.github.com/TypeStrong/ts-node)) |
dependencies | major | [`^8.6.2` ->
`^10.0.0`](https://renovatebot.com/diffs/npm/ts-node/8.10.2/10.9.2) |
| [ts-node](https://typestrong.org/ts-node)
([source](https://redirect.github.com/TypeStrong/ts-node)) |
devDependencies | major | [`8.10.2` ->
`10.9.2`](https://renovatebot.com/diffs/npm/ts-node/8.10.2/10.9.2) |
| [ts-node](https://typestrong.org/ts-node)
([source](https://redirect.github.com/TypeStrong/ts-node)) |
dependencies | major | [`^9.0.0` ->
`^10.0.0`](https://renovatebot.com/diffs/npm/ts-node/9.1.1/10.9.2) |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>TypeStrong/ts-node (ts-node)</summary>

###
[`v10.9.2`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.9.2):
Fix `tsconfig.json` file not found

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.9.1...v10.9.2)

**Fixed**

- Fixed `tsconfig.json` file not found on latest TypeScript version
([https://github.com/TypeStrong/ts-node/pull/2091](https://redirect.github.com/TypeStrong/ts-node/pull/2091))

###
[`v10.9.1`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.9.1)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.9.0...v10.9.1)

**Fixed**

- Workaround nodejs bug introduced in 18.6.0
([#&#8203;1838](https://redirect.github.com/TypeStrong/ts-node/issues/1838))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
    -   Only affects projects on node >=18.6.0 using `--esm`
- Older versions of node and projects without `--esm` are unaffected

https://github.com/TypeStrong/ts-node/milestone/18?closed=1

###
[`v10.9.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.9.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.8.2...v10.9.0)

**Added**

- `--project` accepts path to a directory containing a `tsconfig.json`
([#&#8203;1829](https://redirect.github.com/TypeStrong/ts-node/issues/1829),
[#&#8203;1830](https://redirect.github.com/TypeStrong/ts-node/issues/1830))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
    -   previously it required an explicit filename
- Added helpful error message when swc version is too old to support our
configuration
([#&#8203;1802](https://redirect.github.com/TypeStrong/ts-node/issues/1802))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Added `experimentalTsImportSpecifiers` option which allows using
voluntary `.ts` file extensions in import specifiers (undocumented
except for [API
docs](https://typestrong.org/ts-node/api/interfaces/CreateOptions.html#experimentalTsImportSpecifiers))
([#&#8203;1815](https://redirect.github.com/TypeStrong/ts-node/issues/1815))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)

**Fixed**

- Fixed bug where `child_process.fork()` would erroneously execute the
parent's entrypoint script, not the intended child script
([#&#8203;1812](https://redirect.github.com/TypeStrong/ts-node/issues/1812),
[#&#8203;1814](https://redirect.github.com/TypeStrong/ts-node/issues/1814))
[@&#8203;devversion](https://redirect.github.com/devversion)
- Fixed support for jsx modes `"react-jsx"` and `"react-jsxdev"` in swc
transpiler
([#&#8203;1800](https://redirect.github.com/TypeStrong/ts-node/issues/1800),
[#&#8203;1802](https://redirect.github.com/TypeStrong/ts-node/issues/1802))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Fixed support for import assertions in swc transpiler
([#&#8203;1817](https://redirect.github.com/TypeStrong/ts-node/issues/1817),
[#&#8203;1802](https://redirect.github.com/TypeStrong/ts-node/issues/1802))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Fixed bug where calling `repl.evalCode()` with code not ending in a
newline would not update the typechecker accordingly
([#&#8203;1764](https://redirect.github.com/TypeStrong/ts-node/issues/1764),
[#&#8203;1824](https://redirect.github.com/TypeStrong/ts-node/issues/1824))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)

https://github.com/TypeStrong/ts-node/milestone/16?closed=1

###
[`v10.8.2`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.8.2)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.8.1...v10.8.2)

**Fixed**

- Revert "Use file URL for source map paths"
([#&#8203;1821](https://redirect.github.com/TypeStrong/ts-node/issues/1821))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Fixes
[#&#8203;1790](https://redirect.github.com/TypeStrong/ts-node/issues/1790):
ts-node 10.8.1 regression where `nyc` code coverage reports had
incorrect paths
- Fixes
[#&#8203;1797](https://redirect.github.com/TypeStrong/ts-node/issues/1797):
ts-node 10.8.1 regression where breakpoints did not hit in VSCode
debugging
- Allow JSON imports in node 16.15 and up
([#&#8203;1792](https://redirect.github.com/TypeStrong/ts-node/issues/1792))
[@&#8203;queengooborg](https://redirect.github.com/queengooborg)
    -   JSON imports were already supported in v17.5 and up
    -   this change extends support to >=16.15.0,<17.0.0
- These version ranges match vanilla node's support for JSON imports

https://github.com/TypeStrong/ts-node/milestone/15?closed=1

###
[`v10.8.1`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.8.1)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.8.0...v10.8.1)

**Fixed**

- Fixed
[#&#8203;1769](https://redirect.github.com/TypeStrong/ts-node/issues/1769):
source URLs in source map cache were malformed on Windows, affecting
code coverage reports
([#&#8203;1769](https://redirect.github.com/TypeStrong/ts-node/issues/1769),
[#&#8203;1771](https://redirect.github.com/TypeStrong/ts-node/issues/1771))
[@&#8203;PaperStrike](https://redirect.github.com/PaperStrike)
- Fixed
[#&#8203;1778](https://redirect.github.com/TypeStrong/ts-node/issues/1778):
typechecker was erronously resolving imports from ESM files as if they
were from CJS files
([#&#8203;1778](https://redirect.github.com/TypeStrong/ts-node/issues/1778),
[#&#8203;1782](https://redirect.github.com/TypeStrong/ts-node/issues/1782))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)

https://github.com/TypeStrong/ts-node/milestone/14

###
[`v10.8.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.8.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.7.0...v10.8.0)

Questions about this release? Ask in the official discussion thread:
[#&#8203;1767](https://redirect.github.com/TypeStrong/ts-node/issues/1767)

**Added**

- Added support for `module=NodeNext`, `module=Node16`, `.mts`, `.cts`,
`.mjs`, and `.cjs` file extensions
([#&#8203;1414](https://redirect.github.com/TypeStrong/ts-node/issues/1414),
[#&#8203;1694](https://redirect.github.com/TypeStrong/ts-node/issues/1694),
[#&#8203;1744](https://redirect.github.com/TypeStrong/ts-node/issues/1744),
[#&#8203;1745](https://redirect.github.com/TypeStrong/ts-node/issues/1745),
[#&#8203;1727](https://redirect.github.com/TypeStrong/ts-node/issues/1727),
[#&#8203;1717](https://redirect.github.com/TypeStrong/ts-node/issues/1717),
[#&#8203;1753](https://redirect.github.com/TypeStrong/ts-node/issues/1753),
[#&#8203;1757](https://redirect.github.com/TypeStrong/ts-node/issues/1757))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- For best results, enable `experimentalResolver`
([docs](https://typestrong.org/ts-node/docs/options#experimentalresolver))
- See TypeScript's official documentation:
https://www.typescriptlang.org/docs/handbook/esm-node.html
    -   enables mixed-mode projects with both ESM and CommonJS
    -   enables all supported file extensions in TypeScript 4.7
    -   Obeys package.json "type"
- Added ability to include file extensions in CommonJS imports
([#&#8203;1727](https://redirect.github.com/TypeStrong/ts-node/issues/1727),
[#&#8203;1753](https://redirect.github.com/TypeStrong/ts-node/issues/1753))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Enables consistency with ESM, where file extensions are often
mandatory
- Resolves from emitted to source file extensions
([#&#8203;1727](https://redirect.github.com/TypeStrong/ts-node/issues/1727),
[#&#8203;1753](https://redirect.github.com/TypeStrong/ts-node/issues/1753))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Must enable `experimentalResolver`, will be enabled by default in a
future version
([docs](https://typestrong.org/ts-node/docs/options#experimentalresolver))
- Typechecker requires importing the *emitted* file extension; ts-node
resolves correctly to the *source* file. E.g. `import "./foo.js"` will
execute `foo.ts` See also: [TypeScript issue
#&#8203;37582](https://redirect.github.com/microsoft/TypeScript/issues/37582)
- If typechecking is disabled, you can also use *source* file
extensions. E.g. `import "./foo.ts"`
- Added `experimentalSpecifierResolution`
([#&#8203;1727](https://redirect.github.com/TypeStrong/ts-node/issues/1727),
[#&#8203;1753](https://redirect.github.com/TypeStrong/ts-node/issues/1753))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- the same as Node's `--experimental-specifier-resolution` ([Node
docs](https://nodejs.org/dist/latest-v18.x/docs/api/esm.html#customizing-esm-specifier-resolution-algorithm))
- can also be specified in `tsconfig.json` for convenience, to avoid the
CLI flag
- allows omitting file extensions in ESM imports, plus a few other
CommonJS-style conveniences
- Adds `diagnostics` property to `TSError`, with array of TypeScript
diagnostic objects from the compiler ([API
docs](https://typestrong.org/ts-node/api/classes/TSError.html))
([#&#8203;1705](https://redirect.github.com/TypeStrong/ts-node/issues/1705),
[#&#8203;1706](https://redirect.github.com/TypeStrong/ts-node/issues/1706))
[@&#8203;paulbrimicombe](https://redirect.github.com/paulbrimicombe)

**Changed**

- Renames option `experimentalResolverFeatures` to
`experimentalResolver`
([docs](https://typestrong.org/ts-node/docs/options#experimentalresolver))
([#&#8203;1727](https://redirect.github.com/TypeStrong/ts-node/issues/1727))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Internal change to ESM loader for compatibility with forthcoming node
versions: returns `shortCircuit: true`
([#&#8203;1714](https://redirect.github.com/TypeStrong/ts-node/issues/1714),
[#&#8203;1715](https://redirect.github.com/TypeStrong/ts-node/issues/1715))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Performance: Optimize filesystem stat calls in ESM loader and new
CommonJS resolver
([#&#8203;1758](https://redirect.github.com/TypeStrong/ts-node/issues/1758),
[#&#8203;1759](https://redirect.github.com/TypeStrong/ts-node/issues/1759))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Performance, maintenance: Upgrade source-mapper dependency
"[@&#8203;cspotcode/source-map-support](https://redirect.github.com/cspotcode/source-map-support)"
- Switches to "trace-mapping" for underlying source-map parsing
([#&#8203;1729](https://redirect.github.com/TypeStrong/ts-node/issues/1729))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)

**Fixed**

- Fixed bug where REPL `.type` command was not showing any type
information when using TypeScript nightly builds
([#&#8203;1761](https://redirect.github.com/TypeStrong/ts-node/issues/1761),
[#&#8203;1762](https://redirect.github.com/TypeStrong/ts-node/issues/1762))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Correctly suppress "Custom ESM Loaders" warning on newer node versions
where the warning's prose changed
([#&#8203;1701](https://redirect.github.com/TypeStrong/ts-node/issues/1701))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Fixed REPL bug where function signatures could not be entered across
multiple lines
([#&#8203;1667](https://redirect.github.com/TypeStrong/ts-node/issues/1667),
[#&#8203;1677](https://redirect.github.com/TypeStrong/ts-node/issues/1677))
[@&#8203;d9k](https://redirect.github.com/d9k)
- REPL treats unparenthesized object literals as objects, instead of as
block scopes
([#&#8203;1697](https://redirect.github.com/TypeStrong/ts-node/issues/1697),
[#&#8203;1699](https://redirect.github.com/TypeStrong/ts-node/issues/1699))
[@&#8203;jhmaster2000](https://redirect.github.com/jhmaster2000)
- Fixed bug where `preferTsExts` combined with third-party transpiler
hooks could disrupt `nyc` code coverage
([#&#8203;1755](https://redirect.github.com/TypeStrong/ts-node/issues/1755))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Fixed bug where `file://` URLs in stack traces did not always use
percent-encoding
([#&#8203;1738](https://redirect.github.com/TypeStrong/ts-node/issues/1738),
[#&#8203;1726](https://redirect.github.com/TypeStrong/ts-node/issues/1726),
[#&#8203;1729](https://redirect.github.com/TypeStrong/ts-node/issues/1729))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Fixed bug where v8-compile-cache-lib did not correctly unhook itself
([#&#8203;1717](https://redirect.github.com/TypeStrong/ts-node/issues/1717),
[#&#8203;1718](https://redirect.github.com/TypeStrong/ts-node/issues/1718),
[#&#8203;1719](https://redirect.github.com/TypeStrong/ts-node/issues/1719))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- This internal dependency is used to speed up loading the TypeScript
compiler

**Docs**

- Many docs improvements
([#&#8203;1682](https://redirect.github.com/TypeStrong/ts-node/issues/1682))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Options page: each option its own linkable header w/usage example
([#&#8203;1606](https://redirect.github.com/TypeStrong/ts-node/issues/1606))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Categorize APIs in typedoc, make entrypoints more prominent
([#&#8203;1456](https://redirect.github.com/TypeStrong/ts-node/issues/1456))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)
- Clarify that the shorthand for `--project` is `-P`, not `-p`
([#&#8203;1731](https://redirect.github.com/TypeStrong/ts-node/issues/1731),
[#&#8203;1734](https://redirect.github.com/TypeStrong/ts-node/issues/1734))
[@&#8203;lobsterkatie](https://redirect.github.com/lobsterkatie)
- Add common ESM errors to Troubleshooting page
([#&#8203;1607](https://redirect.github.com/TypeStrong/ts-node/issues/1607))
[@&#8203;cspotcode](https://redirect.github.com/cspotcode)

https://github.com/TypeStrong/ts-node/milestone/12

###
[`v10.7.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.7.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.6.0...v10.7.0)

Questions about this release? Ask in the official discussion thread:
[#&#8203;1680](https://redirect.github.com/TypeStrong/ts-node/issues/1680)

**Added**

- Adds `--esm` flag, option, and `ts-node-esm` binary
([#&#8203;1258](https://redirect.github.com/TypeStrong/ts-node/issues/1258),
[#&#8203;1655](https://redirect.github.com/TypeStrong/ts-node/issues/1655))
- Enables full `esm` support; no need for `--loader` nor `NODE_OPTIONS`
- Use shebang `#!/usr/bin/env ts-node-esm`, run `ts-node --esm`, or add
to your tsconfig.json: `"ts-node": {"esm": true}`

**Changed**

- Unflag ESM json modules on node >=17.5.0
([#&#8203;1661](https://redirect.github.com/TypeStrong/ts-node/issues/1661),
[#&#8203;1665](https://redirect.github.com/TypeStrong/ts-node/issues/1665))
[@&#8203;Jamesernator](https://redirect.github.com/Jamesernator)
    -   no longer requires `--experimental-json-modules`
- Lazy-load dependencies to improve startup responsiveness.
([#&#8203;1676](https://redirect.github.com/TypeStrong/ts-node/issues/1676))

**Fixed**

- Fixed bug where "compiler", "transpiler", and swc backend would not
resolve relative to the tsconfig.json that declared them
([#&#8203;1662](https://redirect.github.com/TypeStrong/ts-node/issues/1662),
[#&#8203;1655](https://redirect.github.com/TypeStrong/ts-node/issues/1655))
- Enables reusable tsconfig.json shared via node module to include
necessary dependencies

https://github.com/TypeStrong/ts-node/milestone/11

###
[`v10.6.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.6.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.5.0...v10.6.0)

Questions about this release? Ask in the official discussion thread:
[#&#8203;1666](https://redirect.github.com/TypeStrong/ts-node/issues/1666)

**Added**

- Adds workaround for extensionless entrypoints with ESM loader
([#&#8203;1649](https://redirect.github.com/TypeStrong/ts-node/issues/1649),
[#&#8203;1654](https://redirect.github.com/TypeStrong/ts-node/issues/1654))
- You can now combine tools such as `mocha` with `--loader ts-node/esm`,
where previously node would throw `[ERR_UNKNOWN_FILE_EXTENSION]`
- node has a bug where combining `--loader` with an extensionless
entrypoint causes this error
[nodejs/node#33226](https://redirect.github.com/nodejs/node/issues/33226)
- Some tools, for example `mocha`, have an extensionless entrypoint.
([source](https://redirect.github.com/mochajs/mocha/blob/547ffd73535088322579d3d2026432112eae3d4b/package.json#L37),
[source](https://redirect.github.com/mochajs/mocha/blob/547ffd73535088322579d3d2026432112eae3d4b/bin/mocha))
- Combining `NODE_OPTIONS=--loader ts-node/esm` with these tools causes
this error.
[mochajs/mocha#4645](https://redirect.github.com/mochajs/mocha/issues/4645)
- node intends to fix this bug in a future release:
[nodejs/node#41711](https://redirect.github.com/nodejs/node/issues/41711)
    -   In the interim, we have implemented a workaround in ts-node.
- Adds support for target "ES2022" in `moduleTypes` overrides
([#&#8203;1650](https://redirect.github.com/TypeStrong/ts-node/issues/1650))

**Fixed**

- Fixed bug where `--swc` and other third-party transpilers did not
respect `moduleTypes` overrides
([#&#8203;1651](https://redirect.github.com/TypeStrong/ts-node/issues/1651),
[#&#8203;1652](https://redirect.github.com/TypeStrong/ts-node/issues/1652),
[#&#8203;1660](https://redirect.github.com/TypeStrong/ts-node/issues/1660))
- Fixed bug where node flags were not preserved correctly in
`process.execArgv`
([#&#8203;1657](https://redirect.github.com/TypeStrong/ts-node/issues/1657),
[#&#8203;1658](https://redirect.github.com/TypeStrong/ts-node/issues/1658))
- This affected `child_process.fork()`, since it uses `process.execArgv`
to create a similar child runtime.
- With this fix, `child_process.fork()` will preserve both node flags
and `ts-node` hooks.
- Fixed compatibility TypeScript 4.7's API changes
([#&#8203;1647](https://redirect.github.com/TypeStrong/ts-node/issues/1647),
[#&#8203;1648](https://redirect.github.com/TypeStrong/ts-node/issues/1648))

https://github.com/TypeStrong/ts-node/milestone/9

###
[`v10.5.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.5.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.4.0...v10.5.0)

<!--
I don't make a discussion thread for every release. Github has a button
to make a discussion thread for a release.
Then I update the discussion thread to remove the release notes and
instead link to the release.
-->

Questions about this release? Ask in the official discussion thread:
[#&#8203;1634](https://redirect.github.com/TypeStrong/ts-node/issues/1634)

**Added**

- Eliminate "Emit Skipped" errors
([#&#8203;693](https://redirect.github.com/TypeStrong/ts-node/issues/693),
[#&#8203;1345](https://redirect.github.com/TypeStrong/ts-node/issues/1345),
[#&#8203;1629](https://redirect.github.com/TypeStrong/ts-node/issues/1629))
- Avoids all "Emit Skipped" errors by performing a fallback
`transpileOnly`-style transformation.
- Does not affect typechecking. Type errors are still detected and
thrown.
- Fallback has the same limitations as `isolatedModules`. This will only
affect rare cases such as using `const enums` with `preserveConstEnums`
disabled.
- Fixes
[#&#8203;693](https://redirect.github.com/TypeStrong/ts-node/issues/693)
- Graduate swc transpiler out of experimental; add `swc: true`
convenience option
([docs](https://typestrong.org/ts-node/docs/transpilers))
([#&#8203;1487](https://redirect.github.com/TypeStrong/ts-node/issues/1487),
[#&#8203;1536](https://redirect.github.com/TypeStrong/ts-node/issues/1536),
[#&#8203;1613](https://redirect.github.com/TypeStrong/ts-node/issues/1613),
[#&#8203;1627](https://redirect.github.com/TypeStrong/ts-node/issues/1627))
    -   `"swc": true` or `--swc` will use swc for faster execution
- This feature is no longer marked "experimental." Thank you to everyone
who filed bugs!
- swc transpiler attempts to load `@swc/core` or `@swc/wasm`
dependencies from your project before falling-back to global
installations
([#&#8203;1613](https://redirect.github.com/TypeStrong/ts-node/issues/1613),
[#&#8203;1627](https://redirect.github.com/TypeStrong/ts-node/issues/1627))
- global fallback only occurs when using a global installation of
ts-node
- Add support for TypeScript's `traceResolution` output
([docs](https://www.typescriptlang.org/tsconfig/#traceResolution))
([#&#8203;1128](https://redirect.github.com/TypeStrong/ts-node/issues/1128),
[#&#8203;1491](https://redirect.github.com/TypeStrong/ts-node/issues/1491))
[@&#8203;TheUnlocked](https://redirect.github.com/TheUnlocked)
- Support import assertions in ESM loader
([docs](https://nodejs.org/dist/latest-v17.x/docs/api/esm.html#import-assertions))
([#&#8203;1557](https://redirect.github.com/TypeStrong/ts-node/issues/1557),
[#&#8203;1558](https://redirect.github.com/TypeStrong/ts-node/issues/1558),
[#&#8203;1559](https://redirect.github.com/TypeStrong/ts-node/issues/1559),
[#&#8203;1573](https://redirect.github.com/TypeStrong/ts-node/issues/1573))
[@&#8203;Pokute](https://redirect.github.com/Pokute),
[@&#8203;geigerzaehler](https://redirect.github.com/geigerzaehler)
- Allows importing JSON files from ESM with the requisite flag
([docs](https://nodejs.org/dist/latest-v17.x/docs/api/esm.html#json-modules))
- `ts-node -vvv` also logs absolute paths to `ts-node` and `typescript`,
to make it more obvious when you're accidentally using
globally-installed versions
([#&#8203;1323](https://redirect.github.com/TypeStrong/ts-node/issues/1323),
[#&#8203;1620](https://redirect.github.com/TypeStrong/ts-node/issues/1620))
- Add swc target "es2022"
([#&#8203;1535](https://redirect.github.com/TypeStrong/ts-node/issues/1535),
[#&#8203;1540](https://redirect.github.com/TypeStrong/ts-node/issues/1540))
- When you have target es2022 in tsconfig, will use swc's es2022 target

**Changed**

- Initialize TypeScript compiler before starting REPL prompt
([#&#8203;1498](https://redirect.github.com/TypeStrong/ts-node/issues/1498))
[@&#8203;TheUnlocked](https://redirect.github.com/TheUnlocked)
    -   Improves responsiveness for first line of REPL input
-   Use `v8-compile-cache-lib` to load typescript
- improves startup time
([#&#8203;1339](https://redirect.github.com/TypeStrong/ts-node/issues/1339),
[#&#8203;1603](https://redirect.github.com/TypeStrong/ts-node/issues/1603))
- Support both `--camelCase` and `--hyphen-case` for all CLI flags;
update documentation to use `--camelCase`
([#&#8203;1598](https://redirect.github.com/TypeStrong/ts-node/issues/1598),
[#&#8203;1599](https://redirect.github.com/TypeStrong/ts-node/issues/1599))
    -   Not a breaking change; CLI continues to accept both forms
- Make `TSError` `diagnosticText` property non-enumerable to prevent it
from being logged below the stack
([#&#8203;1632](https://redirect.github.com/TypeStrong/ts-node/issues/1632))

**Fixed**

- Fix
[#&#8203;1538](https://redirect.github.com/TypeStrong/ts-node/issues/1538):
REPL inputs fail to transpile via swc
([#&#8203;1538](https://redirect.github.com/TypeStrong/ts-node/issues/1538),
[#&#8203;1541](https://redirect.github.com/TypeStrong/ts-node/issues/1541),
[#&#8203;1602](https://redirect.github.com/TypeStrong/ts-node/issues/1602))
- Fix
[#&#8203;1478](https://redirect.github.com/TypeStrong/ts-node/issues/1478):
REPL erroneously logged `undefined` for all inputs after the first when
using swc transpiler
([#&#8203;1478](https://redirect.github.com/TypeStrong/ts-node/issues/1478),
[#&#8203;1580](https://redirect.github.com/TypeStrong/ts-node/issues/1580),
[#&#8203;1602](https://redirect.github.com/TypeStrong/ts-node/issues/1602))
- Fix
[#&#8203;1389](https://redirect.github.com/TypeStrong/ts-node/issues/1389):
In `--showConfig` output, emit accurate `moduleTypes` paths resolved
relative to the `tsconfig.json` which declared them
([#&#8203;1389](https://redirect.github.com/TypeStrong/ts-node/issues/1389),
[#&#8203;1619](https://redirect.github.com/TypeStrong/ts-node/issues/1619))
- Fix: Remove indentation from `ts-node --help` output
([#&#8203;1597](https://redirect.github.com/TypeStrong/ts-node/issues/1597),
[#&#8203;1600](https://redirect.github.com/TypeStrong/ts-node/issues/1600))
- Fix
[#&#8203;1425](https://redirect.github.com/TypeStrong/ts-node/issues/1425):
Merged definitions correctly into `tsconfig.schemastore-schema.json`
([#&#8203;1425](https://redirect.github.com/TypeStrong/ts-node/issues/1425),
[#&#8203;1618](https://redirect.github.com/TypeStrong/ts-node/issues/1618))
- Fix: Allow disabling `"use strict"` emit in SWC transpiler
([#&#8203;1531](https://redirect.github.com/TypeStrong/ts-node/issues/1531),
[#&#8203;1537](https://redirect.github.com/TypeStrong/ts-node/issues/1537))
- Fix: Add missing `ERR_UNKNOWN_FILE_EXTENSION` constructor; was
throwing `ERR_UNKNOWN_FILE_EXTENSION is not a constructor`
([#&#8203;1562](https://redirect.github.com/TypeStrong/ts-node/issues/1562))
[@&#8203;bluelovers](https://redirect.github.com/bluelovers)
- Fix
[#&#8203;1565](https://redirect.github.com/TypeStrong/ts-node/issues/1565):
entrypoint resolution failed on node v12.0.x and v12.1.x
([#&#8203;1565](https://redirect.github.com/TypeStrong/ts-node/issues/1565),
[#&#8203;1566](https://redirect.github.com/TypeStrong/ts-node/issues/1566))
[@&#8203;davidmurdoch](https://redirect.github.com/davidmurdoch)

##### Docs

- Explain `env -S` flag for shebangs
([docs](https://typestrong.org/ts-node/docs/usage#shebang))
([#&#8203;1448](https://redirect.github.com/TypeStrong/ts-node/issues/1448),
[#&#8203;1545](https://redirect.github.com/TypeStrong/ts-node/issues/1545))
[@&#8203;sheeit](https://redirect.github.com/sheeit),
[@&#8203;chee](https://redirect.github.com/chee)
- Suggest `skipIgnore` when you want to compile files in node_modules
([docs](https://typestrong.org/ts-node/docs/how-it-works))
([#&#8203;1553](https://redirect.github.com/TypeStrong/ts-node/issues/1553))
[@&#8203;webstrand](https://redirect.github.com/webstrand)
- Fix typo in `moduleTypes` on options page
([docs](https://typestrong.org/ts-node/docs/options))
([#&#8203;1630](https://redirect.github.com/TypeStrong/ts-node/issues/1630),
[#&#8203;1633](https://redirect.github.com/TypeStrong/ts-node/issues/1633))

##### Misc

- Adds experimental `experimentalResolverFeatures` option, but it does
not do anything yet
([#&#8203;1514](https://redirect.github.com/TypeStrong/ts-node/issues/1514),
[#&#8203;1614](https://redirect.github.com/TypeStrong/ts-node/issues/1614))

https://github.com/TypeStrong/ts-node/milestone/4

###
[`v10.4.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.4.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.3.1...v10.4.0)

**Added**

- Adds support for targets "es2020" and "es2021" to swc transpiler
([#&#8203;1521](https://redirect.github.com/TypeStrong/ts-node/issues/1521))
- Adds automatic target downgrade when using older versions of swc
([#&#8203;1521](https://redirect.github.com/TypeStrong/ts-node/issues/1521))
- If tsconfig specifies es2020, but your version of swc only supports up
to es2019, ts-node will automatically switch to es2019 instead of
throwing an error

**Changed**

- Improves types and API docs for `creatEsmHooks` ([API
docs](https://typestrong.org/ts-node/api/index.html#createEsmHooks))
([#&#8203;1506](https://redirect.github.com/TypeStrong/ts-node/issues/1506),
[#&#8203;1529](https://redirect.github.com/TypeStrong/ts-node/issues/1529))

**Fixed**

- Fix
[#&#8203;1526](https://redirect.github.com/TypeStrong/ts-node/issues/1526):
data URL handling in new ESM loader hooks API
([#&#8203;1526](https://redirect.github.com/TypeStrong/ts-node/issues/1526),
[#&#8203;1529](https://redirect.github.com/TypeStrong/ts-node/issues/1529))

https://github.com/TypeStrong/ts-node/milestone/8

###
[`v10.3.1`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.3.1)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.3.0...v10.3.1)

**Fixed**

- Add version check to use new loader hooks API for node >=16.12.0
([#&#8203;1522](https://redirect.github.com/TypeStrong/ts-node/issues/1522))
[@&#8203;shrujalshah28](https://redirect.github.com/shrujalshah28)

https://github.com/TypeStrong/ts-node/milestone/7

###
[`v10.3.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.3.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.2.1...v10.3.0)

Questions about this release? Ask in the official discussion thread:
[#&#8203;1507](https://redirect.github.com/TypeStrong/ts-node/issues/1507)

**Added**

- Declare types for node builtin modules within REPL so you do not need
to import them
([#&#8203;1424](https://redirect.github.com/TypeStrong/ts-node/issues/1424),
[#&#8203;1500](https://redirect.github.com/TypeStrong/ts-node/issues/1500))
- Node REPL exposes builtin modules as globals; typechecker now
understands this
- Typechecking should no longer raise errors when using builtins without
first importing
- For example: `util.promisify(setTimeout)(1000)` or
`fs.readFileSync('example.txt')`
- Add `createEsmHooks()` function to create ESM loader hooks ([API
docs](https://typestrong.org/ts-node/api/index.html#createEsmHooks))
([#&#8203;1439](https://redirect.github.com/TypeStrong/ts-node/issues/1439))
[@&#8203;nonara](https://redirect.github.com/nonara)
- Can be used to compose our loader hooks with another loader or
additional logic
- `register()` accepts a ts-node `Service` ([API
docs](https://typestrong.org/ts-node/api/index.html#register))
([#&#8203;1474](https://redirect.github.com/TypeStrong/ts-node/issues/1474))
    -   `register(options)` is still supported; no breaking changes
- Add support for Node.js's new loader hooks API
([#&#8203;1372](https://redirect.github.com/TypeStrong/ts-node/issues/1372),
[#&#8203;1457](https://redirect.github.com/TypeStrong/ts-node/issues/1457),
[#&#8203;1007](https://redirect.github.com/TypeStrong/ts-node/issues/1007))
[@&#8203;jonaskello](https://redirect.github.com/jonaskello)
    -   Node.js has changed their loader hooks API
- ts-node is compatible with all node versions, detects your node
version and exposes the correct hooks API
- Node's new API currently only available in node v17 nightly builds
- Node will eventually backport the changes to node 16, and may also be
backport to 14 and 12
- Add `--emit` to `--help` output
([#&#8203;1400](https://redirect.github.com/TypeStrong/ts-node/issues/1400),
[#&#8203;1484](https://redirect.github.com/TypeStrong/ts-node/issues/1484))
[@&#8203;markbradley27](https://redirect.github.com/markbradley27)

**Changed**

- When ts-node is registered and other libraries
`require('source-map-support')`, they will be redirected to
`@cspotcode/source-map-support`
    -   See complete description in **Fixed** section below

**Fixed**

- Fix
[#&#8203;1440](https://redirect.github.com/TypeStrong/ts-node/issues/1440),
[#&#8203;1441](https://redirect.github.com/TypeStrong/ts-node/issues/1441),
[#&#8203;1438](https://redirect.github.com/TypeStrong/ts-node/issues/1438),
[#&#8203;1495](https://redirect.github.com/TypeStrong/ts-node/issues/1495):
Incorrect stack traces when third-party libraries use
`source-map-support` instead of `@cspotcode/source-map-support`
([#&#8203;1440](https://redirect.github.com/TypeStrong/ts-node/issues/1440),
[#&#8203;1441](https://redirect.github.com/TypeStrong/ts-node/issues/1441),
[#&#8203;1438](https://redirect.github.com/TypeStrong/ts-node/issues/1438),
[#&#8203;1495](https://redirect.github.com/TypeStrong/ts-node/issues/1495),
[cspotcode/node-source-map-support#23](https://redirect.github.com/cspotcode/node-source-map-support/issues/23),
[#&#8203;1496](https://redirect.github.com/TypeStrong/ts-node/issues/1496),
[#&#8203;1497](https://redirect.github.com/TypeStrong/ts-node/issues/1497))
[@&#8203;ejose19](https://redirect.github.com/ejose19)
- When ts-node is registered and other libraries
`require('source-map-support')`, they will be redirected to
`@cspotcode/source-map-support`
- ts-node uses `@cspotcode/source-map-support` for the fixes and
enhancements listed here: [`@cspotcode/source-map-support`
changelog](https://redirect.github.com/cspotcode/node-source-map-support/issues/24)
- To ensure correct stack traces, all libraries must share a compatible
sourcemap support implementation
- Fix
[#&#8203;1363](https://redirect.github.com/TypeStrong/ts-node/issues/1363):
REPL may erroneously combine previous input with next input, eval both
as a single statement
([#&#8203;1363](https://redirect.github.com/TypeStrong/ts-node/issues/1363),
[#&#8203;1480](https://redirect.github.com/TypeStrong/ts-node/issues/1480))
[@&#8203;TheUnlocked](https://redirect.github.com/TheUnlocked)
- For example, entering `100` on first line and `* 2` on second line
would erronously be interpreted as `100 * 2`
- REPL now ensures both lines are separate statements, both when
typechecking and when evaluating
- Fix
[#&#8203;1488](https://redirect.github.com/TypeStrong/ts-node/issues/1488):
Node may log "circular dependency" warning when using `allowJs`
([#&#8203;1488](https://redirect.github.com/TypeStrong/ts-node/issues/1488),
[#&#8203;1489](https://redirect.github.com/TypeStrong/ts-node/issues/1489))
- Fix
[#&#8203;1301](https://redirect.github.com/TypeStrong/ts-node/issues/1301):
Filter empty strings from `TS_NODE_IGNORE` and
`TS_NODE_IGNORE_DIAGNOSTICS`; treat empty environment variable as empty
array
([#&#8203;1301](https://redirect.github.com/TypeStrong/ts-node/issues/1301),
[#&#8203;1483](https://redirect.github.com/TypeStrong/ts-node/issues/1483))
[@&#8203;ValeriaVG](https://redirect.github.com/ValeriaVG)
- `TS_NODE_IGNORE= ts-node ./example.ts` will disable default ignore
rules; will compile files in `./node_modules`

**Docs**

- Update VSCode debug configuration
([Docs](https://typestrong.org/ts-node/docs/recipes/visual-studio-code))
([#&#8203;1466](https://redirect.github.com/TypeStrong/ts-node/issues/1466))
- Update ESM-related messaging to clarify that experimental status is
due to Node.js, not ts-node
([#&#8203;1455](https://redirect.github.com/TypeStrong/ts-node/issues/1455))
- Refer to ts-node consistently
([#&#8203;1481](https://redirect.github.com/TypeStrong/ts-node/issues/1481))
[@&#8203;animafps](https://redirect.github.com/animafps)

https://github.com/TypeStrong/ts-node/milestone/5

###
[`v10.2.1`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.2.1)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.2.0...v10.2.1)

**Fixed**

- Fixes
[#&#8203;1426](https://redirect.github.com/TypeStrong/ts-node/issues/1426):
Do not import typescript outside of configuration/project loading
([#&#8203;1433](https://redirect.github.com/TypeStrong/ts-node/issues/1433),
[#&#8203;1426](https://redirect.github.com/TypeStrong/ts-node/issues/1426))
[@&#8203;Songkeys](https://redirect.github.com/Songkeys)
- We take care to load your project's version of typescript, falling
back to a globally-installed version if necessary.
- 10.2.0 introduced a bug where we did not do this consistently, causing
global or npx installations of ts-node to attempt loading typescript
relative to themselves, not your project.
- This failed if typescript was not globally installed or npx did not
install peer dependencies.

https://github.com/TypeStrong/ts-node/milestone/6

###
[`v10.2.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.2.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.1.0...v10.2.0)

Questions about this release? Ask in the official discussion thread:
[#&#8203;1423](https://redirect.github.com/TypeStrong/ts-node/issues/1423)

**Added**

- Adds top-level await support to REPL
([#&#8203;1383](https://redirect.github.com/TypeStrong/ts-node/issues/1383),
[#&#8203;245](https://redirect.github.com/TypeStrong/ts-node/issues/245))
[@&#8203;ejose19](https://redirect.github.com/ejose19)
- can be disabled with `--no-experimental-repl-await`,
`experimentalReplAwait`, or `TS_NODE_EXPERIMENTAL_REPL_AWAIT` ([CLI
docs](https://typestrong.org/ts-node/docs/options), [API
docs](https://typestrong.org/ts-node/api/interfaces/CreateOptions.html#experimentalReplAwait))
- Setting `"pretty": false` disables pretty formatting of diagnostics
even when stdout is a TTY
([#&#8203;1418](https://redirect.github.com/TypeStrong/ts-node/issues/1418),
[#&#8203;1420](https://redirect.github.com/TypeStrong/ts-node/issues/1420))
[@&#8203;elevatebart](https://redirect.github.com/elevatebart)
- Applies to ts-node's `pretty` option, not to be confused with
TypeScript's `pretty` option
- Ignores diagnostics which are annoying in an interactive REPL
([#&#8203;1396](https://redirect.github.com/TypeStrong/ts-node/issues/1396),
[#&#8203;1120](https://redirect.github.com/TypeStrong/ts-node/issues/1120),
[#&#8203;729](https://redirect.github.com/TypeStrong/ts-node/issues/729),
[#&#8203;850](https://redirect.github.com/TypeStrong/ts-node/issues/850),
[#&#8203;469](https://redirect.github.com/TypeStrong/ts-node/issues/469))
- For example, when you input `const foo = 1` in the REPL, `foo` is
unused. We ignore the resulting diagnostic `foo is declared but its
value is never read`
    -   Diagnostics are only ignored in the REPL
- Diagnostics for non-REPL files imported by the REPL will still be
shown
- Logged stack traces are colorized to match vanilla node's behavior
([#&#8203;1412](https://redirect.github.com/TypeStrong/ts-node/issues/1412),
[#&#8203;1405](https://redirect.github.com/TypeStrong/ts-node/issues/1405))

**Fixed**

- Fix
[#&#8203;1397](https://redirect.github.com/TypeStrong/ts-node/issues/1397):
SWC transpiler should emit ECMAScript imports and exports when
configuration dictates
([#&#8203;1409](https://redirect.github.com/TypeStrong/ts-node/issues/1409),
[#&#8203;1397](https://redirect.github.com/TypeStrong/ts-node/issues/1397))
    -   Enables SWC transpiler to be used alongside `--loader`
- Fix
[#&#8203;1403](https://redirect.github.com/TypeStrong/ts-node/issues/1403):
source-map-support breaks rendering of node errors
([#&#8203;1405](https://redirect.github.com/TypeStrong/ts-node/issues/1405),
[#&#8203;1403](https://redirect.github.com/TypeStrong/ts-node/issues/1403))
- Fix
[#&#8203;1410](https://redirect.github.com/TypeStrong/ts-node/issues/1410):
rendering of async stack frames should include `async` annotations
([#&#8203;1405](https://redirect.github.com/TypeStrong/ts-node/issues/1405),
[#&#8203;1410](https://redirect.github.com/TypeStrong/ts-node/issues/1410))
- Fix
[#&#8203;1411](https://redirect.github.com/TypeStrong/ts-node/issues/1411):
wrong order of process 'exit' event and logging unhandled exception
([#&#8203;1405](https://redirect.github.com/TypeStrong/ts-node/issues/1405),
[#&#8203;1411](https://redirect.github.com/TypeStrong/ts-node/issues/1411))
- Fix
[#&#8203;1419](https://redirect.github.com/TypeStrong/ts-node/issues/1419):
Should not throw `require.resolve` error when `@types/node`
peerDependency is missing
([#&#8203;1419](https://redirect.github.com/TypeStrong/ts-node/issues/1419),
[#&#8203;1422](https://redirect.github.com/TypeStrong/ts-node/issues/1422))

https://github.com/TypeStrong/ts-node/milestone/2

###
[`v10.1.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.1.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v10.0.0...v10.1.0)

Questions about this release? Ask in the official discussion thread:
[#&#8203;1390](https://redirect.github.com/TypeStrong/ts-node/issues/1390)

**Added**

- Add `"moduleType"` option to override module type -- CommonJS or
ECMAScript -- on select files.
([docs](https://typestrong.org/ts-node/docs/module-type-overrides))
([#&#8203;1342](https://redirect.github.com/TypeStrong/ts-node/issues/1342),
[#&#8203;1371](https://redirect.github.com/TypeStrong/ts-node/issues/1371),
[#&#8203;1376](https://redirect.github.com/TypeStrong/ts-node/issues/1376))
- Useful when a configuration file, for example `webpack.config.ts`,
must execute as CommonJS but the rest of the project is ESM
- selectively overrides `package.json` `"type"` and `tsconfig.json`
`"module"`
- akin to `.cjs` and `.mjs` extensions, but for `.ts` and `.tsx` files
- thanks to [@&#8203;jayaddison](https://redirect.github.com/jayaddison)
for help on test coverage
- Implement `"extends"` support for `"ts-node"` options in
`tsconfig.json`
([#&#8203;1328](https://redirect.github.com/TypeStrong/ts-node/issues/1328),
[#&#8203;1356](https://redirect.github.com/TypeStrong/ts-node/issues/1356))
    -   `"ts-node": {}` options will be parsed from extended tsconfigs
    -   allows sharing and deduplicating ts-node configuration
- Un-deprecate `scope` and `scopeDir`; add both to CLI and
`tsconfig.json` options; un-deprecate `TS_NODE_SCOPE` env var; add
`TS_NODE_SCOPE_DIR` env var
([docs](https://typestrong.org/ts-node/docs/options))
([#&#8203;1346](https://redirect.github.com/TypeStrong/ts-node/issues/1346),
[#&#8203;1367](https://redirect.github.com/TypeStrong/ts-node/issues/1367))

**Changed**

- Improve error messages thrown by native ESM loader hooks
([#&#8203;1357](https://redirect.github.com/TypeStrong/ts-node/issues/1357),
[#&#8203;1373](https://redirect.github.com/TypeStrong/ts-node/issues/1373))
[@&#8203;tars0x9752](https://redirect.github.com/tars0x9752)
    -   messages more closely match node; are more descriptive
- Emit `"ts-node"` object at the top of `--showConfig` output instead of
the bottom
([#&#8203;1355](https://redirect.github.com/TypeStrong/ts-node/issues/1355))

**Fixed**

- Fix
[#&#8203;1282](https://redirect.github.com/TypeStrong/ts-node/issues/1282):
Set correct globals in `[stdin]`, `[eval]`, and `<repl>` contexts
([#&#8203;1333](https://redirect.github.com/TypeStrong/ts-node/issues/1333))
    -   More closely align ts-node's behavior with vanilla node
    -   Affects the interactive REPL, piping to stdin, and `ts-node -e`
- Matches node's behavior for globals `__filename`, `__dirname`,
`module` and sub-fields of `module`, `exports`, and builtin module
aliases `fs`, etc
- Fix
[#&#8203;1343](https://redirect.github.com/TypeStrong/ts-node/issues/1343):
Set swc option `keepClassNames` to `true`
([#&#8203;1344](https://redirect.github.com/TypeStrong/ts-node/issues/1344))
- Fix:
[#&#8203;1387](https://redirect.github.com/TypeStrong/ts-node/issues/1387):
REPL outputs 'use strict' after first empty line of input
([#&#8203;1388](https://redirect.github.com/TypeStrong/ts-node/issues/1388))
[@&#8203;ejose19](https://redirect.github.com/ejose19)

**Docs**

- Update ESM docs to say that env vars *are* supported with `node
--loader ts-node/esm`
([docs](https://redirect.github.com/TypeStrong/ts-node/issues/1007))
([#&#8203;1379](https://redirect.github.com/TypeStrong/ts-node/issues/1379))

https://github.com/TypeStrong/ts-node/milestone/3

###
[`v10.0.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v10.0.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v9.1.1...v10.0.0)

Questions about this release? Ask in the official discussion thread:
[#&#8203;1337](https://redirect.github.com/TypeStrong/ts-node/issues/1337)

*Breaking changes are prefixed with **\[BREAKING]***

**Added**

- Adds `--show-config` to log the resolved configuration
([docs](https://typestrong.org/ts-node/docs/troubleshooting#understanding-configuration))
([#&#8203;1100](https://redirect.github.com/TypeStrong/ts-node/issues/1100),
[#&#8203;1243](https://redirect.github.com/TypeStrong/ts-node/issues/1243))
- Bundle and re-export
[@&#8203;tsconfig/node](https://redirect.github.com/tsconfig/node)\*
configurations for convenience
([docs](https://typestrong.org/ts-node/docs/configuration#tsconfigbases))
([#&#8203;1202](https://redirect.github.com/TypeStrong/ts-node/issues/1202),
[#&#8203;1236](https://redirect.github.com/TypeStrong/ts-node/issues/1236),
[#&#8203;1313](https://redirect.github.com/TypeStrong/ts-node/issues/1313))
- Default to appropriate
[@&#8203;tsconfig/node](https://redirect.github.com/tsconfig/node)\*
configuration based on node and typescript versions
([docs](https://typestrong.org/ts-node/docs/configuration#default-config))
([#&#8203;1202](https://redirect.github.com/TypeStrong/ts-node/issues/1202),
[#&#8203;1236](https://redirect.github.com/TypeStrong/ts-node/issues/1236),
[#&#8203;1313](https://redirect.github.com/TypeStrong/ts-node/issues/1313))
- Automatically reference
[@&#8203;types/node](https://redirect.github.com/types/node); use
globally-installed
[@&#8203;types/node](https://redirect.github.com/types/node) if not
locally installed
([#&#8203;1240](https://redirect.github.com/TypeStrong/ts-node/issues/1240),
[#&#8203;1257](https://redirect.github.com/TypeStrong/ts-node/issues/1257))
- Add `swc` integration and new `--transpiler` option to use third-party
transpilers for a massive speed boost on large codebases
([docs](https://typestrong.org/ts-node/docs/transpilers))
([#&#8203;779](https://redirect.github.com/TypeStrong/ts-node/issues/779),
[#&#8203;1160](https://redirect.github.com/TypeStrong/ts-node/issues/1160))
- Add `scopeDir` API option
([docs](https://typestrong.org/ts-node/api/interfaces/RegisterOptions.html#scopeDir))
([#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))
- Add `projectSearchDir` API option
([docs](https://typestrong.org/ts-node/api/interfaces/RegisterOptions.html#projectSearchDir))
([#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))
- Add `--cwd-mode` and `ts-node-cwd` to resolve config file relative to
cwd, not entrypoint script
([#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))

**Changed**

- **\[BREAKING]** Make `--script-mode` default behavior; resolve
tsconfig relative to entrypoint script instead of cwd
([#&#8203;949](https://redirect.github.com/TypeStrong/ts-node/issues/949),
[#&#8203;1197](https://redirect.github.com/TypeStrong/ts-node/issues/1197),
[#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))
    -   In most cases this change will have no noticeable effect
- Primarily benefits portable shell scripts on your `$PATH`, because
`ts-node` will respect the script's local `tsconfig.json`
    -   Use `--cwd-mode` or `ts-node-cwd` if you need legacy behavior
- **\[BREAKING]** `ignore` rules evaluate relative to `tsconfig.json`
directory, otherwise `cwd`
([#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))
- **\[BREAKING]** Remove support for node 10. Minimum supported version
is node 12
([#&#8203;1312](https://redirect.github.com/TypeStrong/ts-node/issues/1312))
- Rename `--dir` to `--cwd`; rename `TS_NODE_DIR` to `TS_NODE_CWD`
([#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))
- `--dir` and `TS_NODE_DIR` are deprecated but still parsed for
backwards-compatibility
- `--dir` effectively changed the working directory of `ts-node`;
renaming makes this behavior more obvious

**Deprecated**

- Deprecate `TS_NODE_SCOPE`
([#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))
- Deprecate `--dir` and `TS_NODE_DIR`
([#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))

**Removed**

- **\[BREAKING]** Internal APIs removed from type declarations
([#&#8203;1242](https://redirect.github.com/TypeStrong/ts-node/issues/1242))
    -   Removed `DEFAULTS`, `normalizeSlashes`, `parse`, `split`
    -   No features were removed
    -   This will only affect consumers of `ts-node`'s programmatic API

**Fixed**

- **\[BREAKING]** Fix
[#&#8203;1229](https://redirect.github.com/TypeStrong/ts-node/issues/1229)
and
[#&#8203;1235](https://redirect.github.com/TypeStrong/ts-node/issues/1235):
always throw `ERR_REQUIRE_ESM` when attempting to execute ESM as CJS,
even when not using `--loader ts-node/esm`
([#&#8203;1232](https://redirect.github.com/TypeStrong/ts-node/issues/1232))
    -   This aligns our behavior with vanilla `node`
- **\[BREAKING]** Fix
[#&#8203;1225](https://redirect.github.com/TypeStrong/ts-node/issues/1225):
`compiler` is loaded relative to `tsconfig.json` instead of entrypoint
script
([#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))
    -   In most cases this change will have no noticable effect
- Fix
[#&#8203;1217](https://redirect.github.com/TypeStrong/ts-node/issues/1217):
REPL not always using passed stdout and stderr
([#&#8203;1224](https://redirect.github.com/TypeStrong/ts-node/issues/1224))
- Fix
[#&#8203;1220](https://redirect.github.com/TypeStrong/ts-node/issues/1220):
`ts-node ./index` may execute the wrong file extension because tsconfig
search poisons the `require.resolve` cache
([#&#8203;1155](https://redirect.github.com/TypeStrong/ts-node/issues/1155))
- Fix
[#&#8203;1322](https://redirect.github.com/TypeStrong/ts-node/issues/1322):
Sourcemaps fail for filenames with spaces or other characters which are
percent-encoded in URLs
([#&#8203;1160](https://redirect.github.com/TypeStrong/ts-node/issues/1160),
[#&#8203;1330](https://redirect.github.com/TypeStrong/ts-node/issues/1330))
- Fix
[#&#8203;1331](https://redirect.github.com/TypeStrong/ts-node/issues/1331):
Resolution of node builtin modules in ESM loader fails on node
>=12.20.0, <13
([#&#8203;1332](https://redirect.github.com/TypeStrong/ts-node/issues/1332))

**Docs**

-   New documentation website: https://typestrong.org/ts-node
    -   README is generated to match the website
    -   Added page explaining CommonJS vs ESM
    -   Added page with Performance advice
    -   Added Troubleshooting page
- Organized and added to "Recipes" section with third-party tool
integrations
    -   Added TypeDoc-generated API docs
- Work was spread across multiple tickets:
[#&#8203;1207](https://redirect.github.com/TypeStrong/ts-node/issues/1207),
[#&#8203;1213](https://redirect.github.com/TypeStrong/ts-node/issues/1213),
[#&#8203;1221](https://redirect.github.com/TypeStrong/ts-node/issues/1221),
[#&#8203;1228](https://redirect.github.com/TypeStrong/ts-node/issues/1228),
[#&#8203;1244](https://redirect.github.com/TypeStrong/ts-node/issues/1244),
[#&#8203;1250](https://redirect.github.com/TypeStrong/ts-node/issues/1250),
[#&#8203;1294](https://redirect.github.com/TypeStrong/ts-node/issues/1294),
[#&#8203;1295](https://redirect.github.com/TypeStrong/ts-node/issues/1295),
[#&#8203;1296](https://redirect.github.com/TypeStrong/ts-node/issues/1296),
[#&#8203;1297](https://redirect.github.com/TypeStrong/ts-node/issues/1297)
- Thanks to these contributors for PRs which improved our documentation
- add troubleshooting tip for syntax errors
([#&#8203;1201](https://redirect.github.com/TypeStrong/ts-node/issues/1201))
[@&#8203;jedwards1211](https://redirect.github.com/jedwards1211)
- Clarify handling of tsx/jsx file extensions
([#&#8203;1179](https://redirect.github.com/TypeStrong/ts-node/issues/1179))
[@&#8203;NaridaL](https://redirect.github.com/NaridaL)
- Added `CONTRIBUTING.md` to document the codebase and our development
workflow

https://github.com/TypeStrong/ts-node/milestone/1

###
[`v9.1.1`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v9.1.1)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v9.1.0...v9.1.1)

No code changes. We re-packed and republished v9.1.1, because the v9.1.0
package was broken due to an npm v7 bug.

**Fixes**

- Published tarball had extra slashes in the paths of dist files.
[#&#8203;1172](https://redirect.github.com/TypeStrong/ts-node/issues/1172)

###
[`v9.1.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v9.1.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v9.0.0...v9.1.0)

**Added**

- Expose ts-node REPL via the API
([#&#8203;1121](https://redirect.github.com/TypeStrong/ts-node/issues/1121))
[@&#8203;MarcManiez](https://redirect.github.com/MarcManiez)
- Allow `--typeCheck` flag to override `--transpileOnly` flag specified
in `tsconfig.json`
([#&#8203;1142](https://redirect.github.com/TypeStrong/ts-node/issues/1142))

**Changed**

- Rename interface `Register` to `Service`. It is still aliased as
`Register` for backwards compatibility
([#&#8203;1158](https://redirect.github.com/TypeStrong/ts-node/issues/1158))
- Update code copied from node's ESM resolver to be the latest from node
15, to keep our ESM resolver's behavior as close as possible to vanilla
node
([#&#8203;1167](https://redirect.github.com/TypeStrong/ts-node/issues/1167))

**Fixed**

- ESM resolver will preserve search portion of URL, used for cache
busting
([#&#8203;1165](https://redirect.github.com/TypeStrong/ts-node/issues/1165))
[@&#8203;frandiox](https://redirect.github.com/frandiox)
- Fix ESM resolution of builtin modules on node >=14.13.1
([#&#8203;1136](https://redirect.github.com/TypeStrong/ts-node/issues/1136))
- Recognize `--es-module-specifier-resolution` as an alias of
`--experimental-specifier-resolution` for node 12 compatibility
([#&#8203;1122](https://redirect.github.com/TypeStrong/ts-node/issues/1122))
[@&#8203;nguyensomniac](https://redirect.github.com/nguyensomniac)

**Docs**

- Fix description of `ts-node-dev` in README
([#&#8203;1131](https://redirect.github.com/TypeStrong/ts-node/issues/1131))
[@&#8203;iamandrewluca](https://redirect.github.com/iamandrewluca)
- Update `transformers` description to clarify incompatibility with
`transpileOnly`
([#&#8203;1123](https://redirect.github.com/TypeStrong/ts-node/issues/1123))

**Misc**

- Changes to test matrix: Test against node 15; drop node 13 tests;
remove 12.16 in favor of latest 12.x.x
([#&#8203;1138](https://redirect.github.com/TypeStrong/ts-node/issues/1138),
[#&#8203;1148](https://redirect.github.com/TypeStrong/ts-node/issues/1148))
- Improve codecov rules to remove misleading test failures
([#&#8203;1159](https://redirect.github.com/TypeStrong/ts-node/issues/1159))

###
[`v9.0.0`](https://redirect.github.com/TypeStrong/ts-node/releases/tag/v9.0.0)

[Compare
Source](https://redirect.github.com/TypeStrong/ts-node/compare/v8.10.2...v9.0.0)

*Breaking changes are labelled \[BREAKING] below.*

**Added**

- Throw `ERR_REQUIRE_ESM` when a file is `require()`d which should be
loaded as ESM
([#&#8203;1031](https://redirect.github.com/TypeStrong/ts-node/issues/1031))
- Re-add `"exports"` declaration to package.json in backwards-compatible
way, enabling `node --loader ts-node/esm` without file extension
([#&#8203;1028](https://redirect.github.com/TypeStrong/ts-node/issues/1028))
- Allow specifying `"require"` option via tsconfig
([#&#8203;925](https://redirect.github.com/TypeStrong/ts-node/issues/925))
- REPL respects node's `NODE_NO_READLINE` environment variable
([#&#8203;1090](https://redirect.github.com/TypeStrong/ts-node/issues/1090))
- Add a transpile-only entrypoint for ESM loader: `node --loader
ts-node/esm/transpile-only`
([#&#8203;1102](https://redirect.github.com/TypeStrong/ts-node/issues/1102))
[@&#8203;concision](https://redirect.github.com/concision)

**Changed**

- \[BREAKING] Drops support for node versions < 10
([#&#8203;1036](https://redirect.github.com/TypeStrong/ts-node/issues/1036))

**Fixed**

- \[BREAKING] Re-add `realpath`, which should fix workflows that use
symlinks, such as `pnpm`, Lerna workspaces, or other mono-repo
configurations
([#&#8203;970](https://redirect.github.com/TypeStrong/ts-node/issues/970))
- Compile files within `node_modules` when `--skip-ignore` or `--ignore`
options are configured to allow it
([#&#8203;970](https://redirect.github.com/TypeStrong/ts-node/issues/970))
- Fix
[#&#8203;884](https://redirect.github.com/TypeStrong/ts-node/issues/884)
by not adding all referenced files to `getSourceFileNames`/`rootNames`
([#&#8203;999](https://redirect.github.com/TypeStrong/ts-node/issues/999))
- Fix
[#&#8203;996](https://redirect.github.com/TypeStrong/ts-node/issues/996):
bump `projectVersion` every time `getSourceFileNames` changes, avoiding
accidentally outdated typechecking
([#&#8203;998](https://redirect.github.com/TypeStrong/ts-node/issues/998))
- Fix
[#&#8203;1051](https://redirect.github.com/TypeStrong/ts-node/issues/1051):
pass transformers object to `ts.transpileModule`
([#&#8203;1054](https://redirect.github.com/TypeStrong/ts-node/issues/1054))
[@&#8203;thetutlage](https://redirect.github.com/thetutlage)
- Fix
[#&#8203;1060](https://redirect.github.com/TypeStrong/ts-node/issues/1060):
use source maps for stack traces in ESM modules
([#&#8203;1087](https://redirect.github.com/TypeStrong/ts-node/issues/1087))
- Fix
[#&#8203;1072](https://redirect.github.com/TypeStrong/ts-node/issues/1072):
Respect `--experimental-specifier-resolution` coming from `NODE_OPTIONS`
in ESM loader
([#&#8203;1085](https://redirect.github.com/TypeStrong/ts-node/issues/1085))
[@&#8203;evg656e](https://redirect.github.com/evg656e)
- Fix
[#&#8203;1098](https://redirect.github.com/TypeStrong/ts-node/issues/1098):
ESM loader should skip `.cjs`, `.mjs`, and any unexpected file
extensions
([#&#8203;1103](https://redirect.github.com/TypeStrong/ts-node/issues/1103))
[@&#8203;concision](https://redirect.github.com/concision)

**Docs**

- Better explain how to compile imports, either CommonJS or using
experimental ESM loader. Resolves
[#&#8203;1075](https://redirect.github.com/TypeStrong/ts-node/issues/1075)
([#&#8203;1086](https://redirect.github.com/TypeStrong/ts-node/issues/1086))

**Misc**

- Fix, re-enable, and add various tests
([#&#8203;1044](https://redirect.github.com/TypeStrong/ts-node/issues/1044),
[#&#8203;1088](https://redirect.github.com/TypeStrong/ts-node/issues/1088),
[#&#8203;1108](ht

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - "every weekday" (UTC).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTkuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJpbXBhY3Qvbm8tY2hhbmdlbG9nLXJlcXVpcmVkIl19-->

Co-authored-by: pulumi-renovate[bot] <189166143+pulumi-renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants