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

[Feature Request] use ttypescript under the hood to enable applying TS transforms #719

Open
probablyup opened this issue Sep 7, 2020 · 8 comments · May be fixed by #720
Open

[Feature Request] use ttypescript under the hood to enable applying TS transforms #719

probablyup opened this issue Sep 7, 2020 · 8 comments · May be fixed by #720

Comments

@probablyup
Copy link

@probablyup probablyup commented Sep 7, 2020

https://www.npmjs.com/package/ttypescript

The main benefit of going with this solution is being able to specify transformer plugins in tsconfig.json so it's an easy configuration

@probablyup
Copy link
Author

@probablyup probablyup commented Sep 7, 2020

Nvm, I see you're using https://github.com/ezolenko/rollup-plugin-typescript2. Will move the FR there.

update: it's actually meant to be passed as a transform to rollup-plugin-typescript2 https://www.npmjs.com/package/ttypescript#rollup

@wardpeet
Copy link
Collaborator

@wardpeet wardpeet commented Sep 7, 2020

First of all, thank you for opening a PR. Can you elaborate a little bit on why we want to allow typescript transformers? Why not go for a babel plugin?

I'm worried that if we swap typescript with a third party compiler, we will open up to more bugs that are not related to microbundle itself.

@probablyup
Copy link
Author

@probablyup probablyup commented Sep 7, 2020

@berndartmueller
Copy link

@berndartmueller berndartmueller commented Sep 8, 2020

I would also be in favor of including ttypescript so that I can use https://www.npmjs.com/package/ts-transformer-properties-rename to rename TS properties.

@waynevanson
Copy link

@waynevanson waynevanson commented Sep 14, 2020

@wardpeet

from https://github.com/cevek/ttypescript#what-it-is:

Instead of tsc and tsserver, use ttsc and ttsserver wrappers. This wrappers try to use locally installed typescript first.

No version lock-ins - typescript used as peer dependency.

ttypescript uses typescript under the hood. I don't BELEIVE anything should break. However, smoke tests should be written if no one else is certain.

@probablyup
Copy link
Author

@probablyup probablyup commented Sep 14, 2020

Yeah it basically just allows the rollup plugin to also look at tsconfig.json :)

@developit
Copy link
Owner

@developit developit commented Nov 5, 2020

FWIW @berndartmueller Microbundle already provides that exact feature:

// package.json
{
  "mangle": {
    "properties": "^_"
  }
}
@timocov
Copy link

@timocov timocov commented Nov 13, 2020

@developit I think ts-transformer-properties-rename can do even more - it automatically detects what properties are "public" (or "external") and don't rename them, and what properties are internal (not just "private" in terms of class methods/properties, but all objects fields which aren't public/external) and rename them accordingly.

I'd say ts-transformer-properties-rename should be used before properties mangling, because the transformer does not minify them, just add a prefix to name so it's still easy to debug but could be well minified with properties mangling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants
You can’t perform that action at this time.