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

remove swc experimental options #2057

Closed
wants to merge 1 commit into from
Closed

Conversation

isaacs
Copy link
Contributor

@isaacs isaacs commented Sep 7, 2023

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: #2056

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: TypeStrong#2056
@codecov
Copy link

codecov bot commented Sep 7, 2023

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

📢 Have feedback on the report? Share it here.

@isaacs
Copy link
Contributor Author

isaacs commented Sep 8, 2023

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

tegefaulkes added a commit to MatrixAI/js-workers that referenced this pull request Sep 12, 2023
>=`1.3.83` breaks ts-node until until TypeStrong/ts-node#2057 is merged and published.

[ci skip]
tegefaulkes added a commit to MatrixAI/js-workers that referenced this pull request Sep 12, 2023
>=`1.3.83` breaks ts-node until until TypeStrong/ts-node#2057 is merged and published.
tegefaulkes added a commit to MatrixAI/js-db that referenced this pull request Sep 12, 2023
This fixes a problem with running `ts-node`, turns out swc broke something and is pending a fix in TypeStrong/ts-node#2057.
tegefaulkes added a commit to MatrixAI/js-db that referenced this pull request Sep 12, 2023
This fixes a problem with running `ts-node`, turns out swc broke something and is pending a fix in TypeStrong/ts-node#2057.
tegefaulkes added a commit to MatrixAI/Polykey that referenced this pull request Sep 12, 2023
This fixes a problem with running `ts-node`, turns out swc broke something and is pending a fix in TypeStrong/ts-node#2057.

[ci skip]
@meabed
Copy link

meabed commented Sep 12, 2023

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

@isaacs
Copy link
Contributor Author

isaacs commented Sep 13, 2023

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

@meabed
Copy link

meabed commented Sep 14, 2023

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

@cspotcode cspotcode mentioned this pull request Sep 14, 2023
@cspotcode
Copy link
Collaborator

This is resolved via #2062

Node mandates import assertions for json imports.

@cspotcode cspotcode closed this Sep 16, 2023
@jraoult
Copy link

jraoult commented Sep 17, 2023

@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
Copy link

meabed commented Sep 20, 2023

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

tegefaulkes added a commit to MatrixAI/Polykey that referenced this pull request Oct 4, 2023
This fixes a problem with running `ts-node`, turns out swc broke something and is pending a fix in TypeStrong/ts-node#2057.

[ci skip]
CMCDragonkai pushed a commit to MatrixAI/Polykey that referenced this pull request Oct 4, 2023
This fixes a problem with running `ts-node`, turns out swc broke something and is pending a fix in TypeStrong/ts-node#2057.

[ci skip]
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

Successfully merging this pull request may close these issues.

SWC: Reflect renamed keepImportAssertions configuration option
5 participants