Skip to content

feat: transpile typescript code instead of transform #60

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Teages
Copy link
Collaborator

@Teages Teages commented May 30, 2025

TODO:

  • remove quote handling
  • remove custom transformer for <template>
  • consider using oxidase in the mkdist plugin as well: I think it is safe to replace it

Copy link

pkg-pr-new bot commented May 30, 2025

Open in StackBlitz

npm i https://pkg.pr.new/vue-sfc-transformer@60

commit: b755af4

@pi0
Copy link
Member

pi0 commented May 30, 2025

Intresting. Have you comparared oxidase with oxc-transform? The former is more actively maintained and is from original author. /cc @Boshen

@Teages
Copy link
Collaborator Author

Teages commented May 30, 2025

Intresting. Have you comparared oxidase with oxc-transform? The former is more actively maintained and is from original author. /cc @Boshen

Yes, maintainer activity is one of my primary considerations when choosing a replacement.

Our use case is quite special: we can’t provide sufficient context to transformers, so they often inadvertently modify our code. For example, even replacing quotes can cause issues. We need to avoid any optimizations introduced by transformers entirely.

oxidase fits perfectly—it strips TypeScript syntax quickly and effectively without unnecessary transformations. It also keep the code position and save us additional work on sourcemap.

Given these reasons, oxidase is an ideal solution for us.

@Teages Teages marked this pull request as ready for review May 30, 2025 16:22
@Teages Teages requested a review from danielroe May 30, 2025 16:22
@Boshen
Copy link

Boshen commented May 31, 2025

oxidase was an experiment. It is not maintained. The author now works with us on another project.

@Teages
Copy link
Collaborator Author

Teages commented May 31, 2025

oxidase was an experiment. It is not maintained. The author now works with us on another project.

@Boshen Is the another project some kind of transpiler? I know our use case is niche, but it's pity that oxidase is no longer maintained.

I tried oxc-parser, but unfortunately the AST it provided lost a lot of keyword position information. (e.g. readonly, public, private and ?)

If we want to strip these keywords accurately, we need to call TypeScript's scanner, which is not much different from ts-blank-space (We also need an additional oxc-parser dependency)

@danielroe What do you think about switching to ts-blank-space?

Copy link
Collaborator Author

@Teages Teages left a comment

Choose a reason for hiding this comment

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

I make a lib with oxc-parser for transpiling https://github.com/Teages/oxc-blank-space

It passed all test from ts-blank-space and enum test from oxidase (ts-blank-space does not support enum).

I haven't done any bench yet, because the performance improve may be not obvious before we migrate to rust. But I think this would be a good start for switching to "transpile".

@Teages Teages changed the title feat: replace esbuild with oxidase feat: transpile typescript code Instead of transform Jun 2, 2025
@Teages Teages changed the title feat: transpile typescript code Instead of transform feat: transpile typescript code instead of transform Jun 2, 2025
@Teages Teages marked this pull request as draft June 6, 2025 18:13
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.

3 participants