Skip to content

v2.0.0

Choose a tag to compare

@github-actions github-actions released this 09 Feb 01:59
· 11 commits to master since this release

Breaking Changes

Tree-shakeable architecture with subpath exports

The library has been restructured into independent subpath exports for optimal tree-shaking:

  • katagami — Core container (createContainer, Container, ContainerError)
  • katagami/scope — Scoped child containers (createScope, Scope)
  • katagami/disposable — TC39 Explicit Resource Management (disposable())

Import only what you use — unused entry points are completely eliminated from the bundle. The package now declares sideEffects: false.

Disposal extracted to katagami/disposable

Container no longer implements AsyncDisposable directly. Instead, wrap a container or scope with the disposable() function from katagami/disposable to attach [Symbol.asyncDispose].

// Before (v1.x)
await using container = createContainer().registerSingleton(DB, () => new Database());

// After (v2.x)
import { disposable } from 'katagami/disposable';
await using container = disposable(
  createContainer().registerSingleton(DB, () => new Database())
);

createScope() moved to katagami/scope

container.createScope() method has been removed. Use the standalone createScope(container) function from katagami/scope instead.

// Before (v1.x)
const scope = container.createScope();

// After (v2.x)
import { createScope } from 'katagami/scope';
const scope = createScope(container);

Internal state accessor

Container internals are now exposed via a Symbol-keyed [INTERNALS] property, enabling extension modules (scope, disposable) to access internal state without coupling to class internals.

Other

  • Added multilingual README (Japanese, Korean, Chinese, Spanish, German, French)

Full Changelog: v1.1.0...v2.0.0