freshgum-bubbles / typedi

Elegant Dependency Injection in TypeScript and JavaScript.
http://typedi.js.org/
MIT License
53 stars 3 forks source link

Executable Tokens #174

Closed freshgum-bubbles closed 6 months ago

freshgum-bubbles commented 6 months ago

The code for virtual tokens (such as HostContainer()) has been moved into individual tokens, as opposed to hosting logic for these tokens in ContainerInstance.

This means that we no longer have to check for individual tokens in the container's .get code-path, which has historically been the case.

Instead, logic for these tokens is now moved into special tokens called Executable Tokens.

This yields numerous advantages, one of which being that, should a certain special token go unused, its code can safely be removed from a bundle via dead-code elimination.

While this is mostly an internal change, the concept of Executable Tokens works quite well, and so I'm considering making it part of the public API surface + documentation after further testing.

Checklist:

changeset-bot[bot] commented 6 months ago

🦋 Changeset detected

Latest commit: 33c60bfc77b8fcc6c906d53748ff034472d4eb5e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------- | ----- | | @freshgum/typedi | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 5 months ago

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.