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

feat(bindings/ts): Add transform/strip-only mode #9138

Merged
merged 7 commits into from
Jul 4, 2024
Merged

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Jul 4, 2024

Description:

This PR adds strip-only/transform mode to @swc/wasm-typescript.

  • Both mode errors on decorator usages.
  • In strip-only mode, enum and TypeScript parameter properties are treated as an invalid syntax.
  • In transform mode, those are transpiled.

@kdy1 kdy1 added this to the Planned milestone Jul 4, 2024
@kdy1 kdy1 self-assigned this Jul 4, 2024
@kdy1 kdy1 requested a review from a team as a code owner July 4, 2024 07:38
kodiakhq[bot]
kodiakhq bot previously approved these changes Jul 4, 2024
Copy link
Member Author

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swc-bump:

  • dbg-swc

Copy link

socket-security bot commented Jul 4, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

🚮 Removed packages: npm/eventsource@2.0.2, npm/evp_bytestokey@1.0.3

View full report↗︎

Copy link

socket-security bot commented Jul 4, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@kdy1 kdy1 merged commit a08bb46 into swc-project:main Jul 4, 2024
147 checks passed
@kdy1 kdy1 deleted the wasm-ts branch July 4, 2024 08:51
@kdy1 kdy1 modified the milestones: Planned, v1.6.10 Jul 6, 2024
@GeoffreyBooth
Copy link

@kdy1 Thank you for adding this! Is there a way I can test this new mode in the SWC playground? When I go to https://swc.rs/playground and choose 1.6.8-nightly-20240706.1 and try to add "mode": "strip-only" at various places in the JSON config editor, they all error.

@kdy1
Copy link
Member Author

kdy1 commented Jul 13, 2024

Fast TS strip is a separate tool, so if you want to try it on the web, we may need to build another playground. The fastest way to test output is adding a test file (or modify one) in https://github.com/swc-project/swc/tree/2fe2feeb1fb0d1776295da28b0af792e2a19da3f/crates/swc_fast_ts_strip/tests and run UPDATE=1 cargo test -p swc_fast_ts_strip. It requires rustup to run.

@GeoffreyBooth
Copy link

@kdy1 Thanks. I think if --experimental-strip-types ships in Node, users will want a way to see what source code Node is evaluating. Adding this to the existing playground, or creating a new one, sounds like a great idea if you’re up for it.

@kdy1
Copy link
Member Author

kdy1 commented Jul 14, 2024

@GeoffreyBooth I filed swc-project/swc-playground#42

@kdy1
Copy link
Member Author

kdy1 commented Jul 24, 2024

@GeoffreyBooth Now the SWC playground has one!
image

Thank you, @g-plane !

@swc-project swc-project locked as resolved and limited conversation to collaborators Aug 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants