-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
Use custom transformer when building solution references #1550
Use custom transformer when building solution references #1550
Conversation
This allows us to share the function between `initializeInstance` and `makeSolutionBuilderHost`. `makeSolutionBuilderHost` is called as a part of `buildSolutionReferences`. `buildSolutionReferences` is called before `initializeInstance` where the custom transformers are initialized.
This allows us to pass on the custom transformer while the project references are built.
Thanks for this - little snowed right now. Will look when I can |
src/servicesHost.ts
Outdated
if (options) { | ||
// The `configFilePath` is the same value that is used as the `project` parameter of | ||
// `getCustomtransformers` below. | ||
const project = options.configFilePath?.toString(); |
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.
is the toString
necessary?
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.
isn't it always a string?
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.
You're right. I don't know what I was thinking. It's a string.
Have updated your branch - it's possible you might need to do some repairs |
`options.configFilePath` is always a string, there's no reason we need `toString()` too.
Failing tests following merge I'm afraid - could you take a look please? |
In a previous commit, I removed `.toString()` without validating what the Typescript compiler would say. This change does a runtime check that the project variable is an actual string.
71a8d37
to
ed3f70f
Compare
I think we might be nearly there. Could you update the version in the package.json and put an entry in the changeling.md please? |
Thanks! |
This PR adds support for custom transformers in project references.
While attempting to use custom transformers, I realized that the transformers were only being applied to the main target and not to any of my referenced projects. After a bit of spelunking, I found that #1025 was a similar issue to my own. #1274 attempted to solve the problem, but some changes needed to be made in Typescript to allow for custom transformers in project references. All the necessary changes to support are available in Typescript v4.3+.
I've modeled my changes after @gasnier's original PR (#1025). This change set:
getCustomTransformers
logic out ofinitializeInstance
and into a dedicated function, so that it can be shared.makeSolutionBuilderHost
to include the newgetCustomTransformer
field in thesolutionBuilderHost
and have it return the transformers made available in the loader options.Fixes #1025