diff --git a/package.json b/package.json index fda4163..b297f8d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dirkluijk/needle-di", - "version": "0.0.1", + "version": "0.0.2", "description": "A simple TypeScript library for dependency injection", "keywords": ["dependency injection", "di", "dependency", "injection", "typescript", "type-safe"], "homepage": "https://github.com/dirkluijk/needle-di", diff --git a/src/examples.test.ts b/src/examples.test.ts index cd1227f..526cfd4 100644 --- a/src/examples.test.ts +++ b/src/examples.test.ts @@ -1,26 +1,22 @@ -import { bootstrap, Container, inject, injectable } from './index.js'; -import { describe, expect, it } from 'vitest'; +import { bootstrap, Container, inject, injectable } from "./index.js"; +import { describe, expect, it } from "vitest"; @injectable() // eslint-disable-next-line @typescript-eslint/no-extraneous-class -class FooService { -} +class FooService {} @injectable() class BarService { - constructor( - private fooService: FooService = inject(FooService), - ) { - } + constructor(private fooService: FooService = inject(FooService)) {} } -describe('Examples', () => { - it('Bootstrap', () => { - // to create the DI container: - const container = new Container(); - const barService = container.get(BarService); +describe("Examples", () => { + it("Bootstrap", () => { + // to create the DI container: + const container = new Container(); + const barService = container.get(BarService); - expect(barService).toBeInstanceOf(BarService); - expect(bootstrap(BarService)).toBeInstanceOf(BarService); - }); -}); \ No newline at end of file + expect(barService).toBeInstanceOf(BarService); + expect(bootstrap(BarService)).toBeInstanceOf(BarService); + }); +}); diff --git a/src/index.ts b/src/index.ts index 9feec31..0eaf86f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -export { inject, Container, bootstrap } from "./container.js"; +export { inject, Container, bootstrap, injectAsync } from "./container.js"; export { injectable } from "./decorators.js"; export type { FactoryProvider, @@ -7,6 +7,7 @@ export type { ConstructorProvider, ClassProvider, ValueProvider, + AsyncFactoryProvider, } from "./providers.js"; export { InjectionToken } from "./tokens.js"; export type { Token } from "./tokens.js";