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

Executable Tokens #174

Merged
merged 13 commits into from
May 30, 2024
Merged

Executable Tokens #174

merged 13 commits into from
May 30, 2024

Conversation

freshgum-bubbles
Copy link
Owner

@freshgum-bubbles freshgum-bubbles commented May 10, 2024

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:

  • Testing

Copy link

changeset-bot bot commented May 10, 2024

🦋 Changeset detected

Latest commit: 33c60bf

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

@freshgum-bubbles freshgum-bubbles changed the title Callable Tokens Executable Tokens May 11, 2024
The code for virtual (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.](https://github.com/freshgum-bubbles/typedi/blob/cd4b8437ac14882a0ed4d1964d76e29b32bd1b3e/src/container-instance.class.mts#L331)

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.
@freshgum-bubbles freshgum-bubbles force-pushed the feat/callable-tokens branch 2 times, most recently from efaf724 to a6027c5 Compare May 30, 2024 13:17
freshgum-bubbles and others added 11 commits May 30, 2024 14:18
Importing from index seems to break things.
Probably an import short-circuit.
Remove support for VIRTUAL_IDENTIFIERS and replace
it with support for ExecutableTokens instead.

These have the exact same use-case, and both are
virtual, so this is not a breaking change.
lint-staged...
If this becomes public API, this skeleton page
will be useful.
@freshgum-bubbles freshgum-bubbles marked this pull request as ready for review May 30, 2024 13:19
@freshgum-bubbles freshgum-bubbles merged commit cb095ad into develop May 30, 2024
12 of 13 checks passed
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.

None yet

1 participant