Skip to content

Commit

Permalink
chore(release): release latest changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 1, 2024
1 parent 793e75b commit fa27f36
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 82 deletions.
17 changes: 0 additions & 17 deletions .changeset/flat-mirrors-film.md

This file was deleted.

64 changes: 0 additions & 64 deletions .changeset/shaggy-readers-reflect.md

This file was deleted.

79 changes: 79 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,84 @@
# @freshgum/typedi

## 0.7.3

### Patch Changes

- 02fe3cc: 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.](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.

- ad8f4f6: Dedicated entry-points have been added for web-facing builds <sup>([#184][gh-issue-184])</sup>.
You're now able to use modules from contrib/ without relying on a bundler,
or importing contrib/ packages separately from `/esm5/`.

> [!NOTE] > **The changes made here do not impact current UMD / MJS entry-points.**
>
> If you're using these, you won't experience any changes.
> To make use of contrib/ modules, you'll need to switch to the new builds shown above.
The new entry-points are as follows (all files are under `./build/bundles/`):

- `typedi.full.min.mjs` <sup>(ES Module format.)</sup>
- `typedi.full.mjs`
- `typedi.umd.full.js` <sup>([UMD][umd-module-explainer] modules.)</sup>
- `typedi.umd.full.min.js`

You can now do the following:

```js
import Container, { Contrib } from 'https://unpkg.dev/@freshgum/typedi/build/bundles/typedi.full.mjs';

// Let's use some modules:
const { TransientRef, ES } = Contrib;
assert(TransientRef.TransientRefHost);
```

The same can be done using UMD modules, like so:

```html
<!doctype html>
<html>
<head>
<!-- ... -->
</head>
<body>
<!-- Be sure to use subresource integrity in production! ;-) -->
<script src="https://unpkg.dev/@freshgum/typedi/build/bundles/typedi.umd.full.min.js"></script>
<script>
const { Container, Contrib } = TypeDI;
// ...
</script>
</body>
</html>
```

> [!TIP]
> If you've noticed, you can actually import the Container through unpkg!
>
> Here's a link to the latest bundles: https://unpkg.dev/browse/@freshgum/typedi/build/bundles/
***

I've been wanting to implement this for a while, but life has repeatedly found itself in the way.
When spending some time on it, it was mostly a simple job: the majority of the work lied in creating
a new build step to generate a barrel file for contrib/, and then integrating Rollup with that.

If you're interested, the original code for this lies in [#184][gh-issue-184]. It's actually quite interesting!

[umd-module-explainer]: https://jameshfisher.com/2020/10/04/what-are-umd-modules/
[gh-issue-184]: https://github.com/freshgum-bubbles/typedi/pull/184

## 0.7.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@freshgum/typedi",
"version": "0.7.2",
"version": "0.7.3",
"description": "Elegant Dependency Injection in JavaScript and TypeScript.",
"homepage": "https://typedi.js.org",
"main": "./build/esm5/entry/index.mjs",
Expand Down

0 comments on commit fa27f36

Please sign in to comment.