Skip to content

[WIP] Support for Ember#131

Draft
gossi wants to merge 2 commits intosxzz:mainfrom
gossi:ember
Draft

[WIP] Support for Ember#131
gossi wants to merge 2 commits intosxzz:mainfrom
gossi:ember

Conversation

@gossi
Copy link

@gossi gossi commented Nov 7, 2025

Hello,

this is some Ember folks seeking support to generate types for Ember's Template format with .gts file extension, so we can use tsdown for building Ember addons. Ember's tooling luckily already sits on top of Volar, with an API very similar to vue-tsc so we hope the integration is quite similar, too.

This is a draft PR, mostly for us to exchange comments on specific parts of the code. Formally finalizing the PR is to do, first goal is to make the code to work.


// ember.writeGlobalTypes(vueOptions, ts.sys.writeFile)
return ember.createEmberLanguagePlugin<string>(
// ts,
Copy link
Author

Choose a reason for hiding this comment

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

@machty Vue allows passing in TS as part of their API. Ember does search it by itself. Maybe not wrong to open up the API to accept TS and only search when it isn't provided?

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/rolldown-plugin-dts@131

commit: da3d324

@socket-security
Copy link

@socket-security
Copy link

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm safer-buffer is 94.0% likely obfuscated

Confidence: 0.94

Location: Package overview

From: pnpm-lock.yamlnpm/@embroider/addon-dev@8.1.0npm/safer-buffer@2.1.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/safer-buffer@2.1.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@sxzz
Copy link
Owner

sxzz commented Jan 13, 2026

Hi @gossi, is there any progress on this? If you'd like to continue with this PR, I’d be glad to accept it. Otherwise, would you mind closing it?

@gossi
Copy link
Author

gossi commented Jan 18, 2026

Sorry, I totally forgot about it. Thanks for the reminder.

The goal: Get type generation for ember going in oxc/rolldown environment

One More Try

I did in fact look into it again once more and noticed an issue. Given this input:

// main.ts
import { SuperTable } from './super-table.gts'

export { SuperTable }

I saw the following issue:

Error: Build failed with 1 error:

[plugin rolldown-plugin-dts:fake-js]
SyntaxError: Export 'SuperTable' is not defined. (1:9)

which is even more interesting, when I logged the code for that error:

export { SuperTable }

From here:

const file = parse(code, {
sourceType: 'module',
})

So, we were wondering if there is some sort of "optimization" going on, that leads to a missing import statement?

Another Idea: ember rolldown plugin

Since I run into that issue, I came to the idea, to make a rolldown plugin for ember and then use it. Until now it is a rollup plugin with no-longer-needed compat. So getting rid of it and making it a rolldown plugin, using only the parts needed for now and using the filter mechanism to speed them up for use in rolldown. In essence it transforms .gts and .gjs files, to turn the <template> into proper JS. From there on, you can consider these files correct JS files. That went pretty straight forward, output is really good.

I wanted to have type generation, so I used it with tsdown which comes with this plugin already, turned dts on and boom, that blow up, because it didn't understand the .gts extension. I changed the plugin to rewrite .gts to .ts but not finding success that day.

You can read the full story here: embroider-build/embroider#2658

Discuss the Options

Remember the goal: Get type generation for ember going in oxc/rolldown environment

That still stands. I found another way, that gives a choice for finding a good strategy. On the technical level, performance is a very important factor here, as this is what oxc is all about.

Performance Considerations

  • Rolldown plugins to use the filter property to speed up oxc tasks
  • Rolldown plugins only for transform can take a narrow filter (only .gts/.gjs) for transform
  • Rolldown plugins for transform and extension re-writing are more costly as they need to do more operations
  • Type generation through tsgo is projectively the fastest
  • Type generation through ember-tsc will put a slowing layer in the middle

With that in mind let's discuss the options.

1. ember rolldown plugin only

  • Single package, less managing overhead
  • Performance:
    • Rollup plugin: Feels like unnecessary transforms are needed (extension rewrite, slow filter)
    • Type generation: Excellent (tsgo ready, as long as the types are cool with that)

2. ember rolldown plugin + ember-tsc through rolldown-plugin-dts

  • Multiple packages, managing overhead
  • Performance:
    • Rollup plugin: Excellent
    • Type generation: ember-tsc middleware

3. ember rolldown plugin + rolldown-plugin-dts (Best of both worlds)

Is this possible?

  • Single package, less managing overhead
  • Performance:
    • Rollup plugin: Excellent
    • Type generation: Execllent

Well, that I haven't tried. That depends on the anwser to a question I have: Can rolldown-plugin-dts/Typescript treat additional file extensions as .ts and follow as usual?

  • If the answer is yes: We can configure it as part of this plugin and we are good
  • If the answer is no: Please help me find a good strategy for integration with the oxc/rolldown ecosystem.

Thanks a lot

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