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

Support for classes that extend DIContainer with new option #29

Closed

Conversation

cmidgley
Copy link
Contributor

New feature:

  • Support implementations that extend DIContainer: Adds a new environment variable DI_COMPILER_CLASS_NAME (and associated di.diClassName option) to specify one or more names of classes that inherit from DIContainer. This allows one to extend DI with custom functionality without needing to request changes to the repo (and allowed me to rip out some likely wanted junk from a prior pull request and implement it in my own class).

Bugs fixed:

  • Options with transformers: Unlike loaders, transformers use the di() call which did not allow any of the environment variable / di.xxx options to be used. This adds functionality to the di() call to get and apply options from resolveOptions.

  • Adust DIProgramOptions type to be consistent with use: The DiProgramOptions interface specified program: TS.Program, which is lacking the extensions added for options. Adjusted to match implementation by changing to program: TS.Program & DiIsolatedModulesOptions.

  • Retain identifier options: The identifier option was being dropped in the getBaseVistorContext function with identifer: []. Retained the options by changing to identifier: rest.identifier ?? [].

This passes all test cases, but no new test cases added as I didn't see any test code that tested options.

…l name(s) for the DIContainer class. Also fix for option DI_COMPILER_IDENTIFIER/identifier being ignored.
…e def for DiProgramOptions to include DiIsolatedModulesOptions (matching how it was implemented)
@cmidgley
Copy link
Contributor Author

I no longer need this. Unless you would like it, I'm taking it down.

@cmidgley cmidgley closed this Jul 15, 2024
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.

1 participant