TypeStrong / ts-node

TypeScript execution and REPL for node.js
https://typestrong.org/ts-node
MIT License
12.86k stars 536 forks source link

remove swc experimental options #2057

Closed isaacs closed 1 year ago

isaacs commented 1 year ago

This removes support for keeping import assertions, which were broken in swc at some point, and unconditionally transpiled into import attributes. (Ie, import/with instead of import/assert.)

No version of node supports import attributes with this syntax yet, so anyone using swc to import json in ESM is out of luck no matter what.

And swc 1.3.83 broke the option that ts-node was using. The position of the swc project is that experimental features are not supported, and may change in patch versions without warning, making them unsafe to rely on (as evidenced here, and the reason why this behavior changed unexpectedly in the first place).

Better to just not use experimental swc features, and let it remove import assertions rather than transpile them into something that node can't run.

Fix: https://github.com/TypeStrong/ts-node/issues/2056

codecov[bot] commented 1 year ago

Codecov Report

Merging #2057 (670d0ea) into main (47d4f45) will increase coverage by 0.11%. The diff coverage is n/a.

Files Changed Coverage Δ
src/transpilers/swc.ts 81.81% <ø> (ø)

... and 3 files with indirect coverage changes

:loudspeaker: Have feedback on the report? Share it here.

isaacs commented 1 year ago

2009 is rebased onto this, so landing that would close this as well. Happy to separate them if that's easier.

meabed commented 1 year ago

@isaacs would it be possible to move this forward soon?

isaacs commented 1 year ago

@meabed ready to land, as far as I'm concerned. I'm not the one who needs to say yes, though.

meabed commented 1 year ago

@wololodev - hope you well, could this get merged soon? Thank you 😄

cspotcode commented 1 year ago

This is resolved via #2062

Node mandates import assertions for json imports.

jraoult commented 1 year ago

@cspotcode The least official release of ts-node is more than a year old so I can imagine the main branch to be quite packed in changes and might take time to be ready for release. Are you planing to cherry pick and release this particular fix soon? Im trying to see if I should just patch ts-node in my repo or just wait.

meabed commented 1 year ago

@cspotcode Thank you fixing and merging this fix - would it be released soon?