Releases: molszanski/iti
Releases · molszanski/iti
0.7.0 - ESM / CJS
What's Changed
- Improved ESM and CJS / Node.js support
- Migrated to vitest for a better ESM support
0.5.0
What's Changed
- add container disposal support by @molszanski in #26
- add destructuring support by @molszanski in #24
- init website by @molszanski in #29
- project cleanup by @molszanski in #28
- Cleanup by @molszanski in #30
- Healthy repo by @molszanski in #32
Container Disposal
basic usage
import { createContainer } from "iti"
container = createContainer()
.add({ a: () => "123" })
.addDisposer({ a: () => {} })
container.get("a") === "123" // true
await container.disposeAll() // Promise<void>
async case
const container = createContainer()
.add(() => ({
dbConnection: async () => {
/** connect to db and return an instance */
},
}))
.addDisposer({
// ↓ `db` is a resolved value of a `dbConnection` token. Pretty handy
dbConnection: (db) => db.close(),
})
const db = await container.get("dbConnection")
await container.disposeAll()
Much Better Ts performance
Some huge projects consumed too much RAM and had some perf limits:
i18next/react-i18next#1417
TS2589: Type instantiation is excessively deep and possibly infinite
This was one of know issues:
https://itijs.org/docs/patterns-and-tips#known-issues
I believe that the issue is solved with this release
Full Changelog: 0.4.2...0.5.0
0.4.2
What's Changed
- adds a yarn workspace setup and extracts react to a separate package by @molszanski in #12
- Develop by @molszanski in #13
- update project name by @molszanski in #14
- Develop by @molszanski in #15
- Bump version by @molszanski in #16
- Develop by @molszanski in #17
- Beta by @molszanski in #18
- Update deps by @molszanski in #19
Full Changelog: 0.2.0...0.4.2
0.2.0
0.2.0
adds containerRequested
, containerCreated
and containerRemoved
events
const kitchenApp = new RootContainer((ctx) => ({
// you can use tokens (`oven`, `kitchen`) here and later on
oven: async () => ovenContainer(),
kitchen: async () => kitchenContainer(await ctx.oven()),
}))
kitchenApp.on("containerCreated", (event) => {
console.log(`event: 'containerCreated' ~~> token: '${event.key}'`)
// `event.container` is also avaliable here
})
kitchenApp.on("containerRequested", (event) => {
console.log(`event: 'containerRequested' ~~> token: '${event.key}' `)
})
kitchenApp.on("containerRemoved", (event) => {
console.log(`event: 'containerRemoved' ~~> token: '${event.key}' `)
})
await kitchenApp.containers.kitchen
// event: 'containerRequested' ~~> token: 'kitchen'
// event: 'containerRequested' ~~> token: 'oven'
// event: 'containerCreated' ~~> token: 'oven'
// event: 'containerCreated' ~~> token: 'kitchen'
// Notice how oven was created before kitchen.
// This is because kitcen depends on oven
What's Changed
- adds container set and container set react hooks by @molszanski in #2
- Add jest and type tests by @molszanski in #3
- Reduces size, refactors core and removes dead code and improves API with overloads by @molszanski in #5
- removes
containerSetNew
hook by @molszanski in #6 - updates docs by @molszanski in #7
- updates docs by @molszanski in #9
- adds new events by @molszanski in #8
Full Changelog: https://github.com/molszanski/snow-splash/commits/0.2.0