-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
[WIP] Add custom transformer plugins #54278
base: main
Are you sure you want to change the base?
Conversation
6ab3057
to
41fc675
Compare
@typescript-bot pack this |
Heya @jakebailey, I've started to run the tarball bundle task on this PR at 41fc675. You can monitor the build here. |
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
41fc675
to
e349801
Compare
if (!host.require) { | ||
return emptyArray; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe allow CompilerOptions to feed transformer factories directly, it will be better for API users.
This comment was marked as off-topic.
This comment was marked as off-topic.
I'm not sure I understand your point; isn't the type checker available on Program? |
Oops, sorry for mis-reading. I'd imported different type. |
It definitely does, it's passed to the
Correct. The core compiler has a limited API. |
May I ask you the reason why limiting the API? I can't do anything with limited API. |
The API provided in this file is the API currently provided by tsc. The other files contain other APIs, including special allocators that add the extra methods to Node and Symbol, but slow down the compiler. It's possible we will be removing those allocators, but there are other benefits to this distinction. Maybe we'll find ways around that too. |
I'm currently making a new branch in By the way, I don't know how much speedup there is by using I'm sorry for criticizing even from the 1st PR. However, type info is very important feature for my typia and nestia projects. Considering the purpose of the TypeScript project, I think this is nonsense. It just sounds me like "I removed the seatbelt and fuel efficiency went up." |
if (config.type !== "transformer") return undefined; | ||
|
||
// TODO(jakebailey): The LS plugin loader is more complicated than this; copy. | ||
const result = host.require!(program.getCurrentDirectory(), config.path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should start from location of tsconfig.json
file, but you're using current-working-directory
.
This is the one of different part with ttypescript
(and ts-patch
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is theoretically the tsconfig dir, but yes, this code is very WIP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in test/tsconfig.json
file and program.getCurrentDirectory()
was typia/
.
- typia/
- node_modules/
- package.json
- tsconfig.json
- test/
- tsconfig.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Oops, but all of this is going to be replaced anyway. This branch is effectively demo code at the moment.
Hello. How about diagnostic messages? How plugin can send warnings and errors as |
And how about |
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
Any updates? |
For #14419
Fixes #54276
I have not finished fleshing out this PR; there's probably a lot wrong with how I am loading the new plugins, but I'd like to get feedback on the usability of this early while we iterate on the design and implementation.
I'll update the proposal and PR description with more info closer to completion.
Also, sorry, but I'm probably going to break my own rules and force push this branch; it futzes with the output files and adds a new
d.ts
and it'll be clearer with single commits. gerrit when?