@ealmansi/jagger
Advanced tools
Comparing version 0.1.28 to 0.1.29
@@ -9,12 +9,6 @@ export declare namespace Jagger { | ||
} | ||
function instance<Class extends new (...args: any) => any>(klass: Class): { | ||
(...args: ConstructorParameters<Class>): InstanceType<Class>; | ||
}; | ||
function as<SubType extends Type, Type>(): { | ||
(value: SubType): Type; | ||
}; | ||
function array<Values extends Array<Type>, Type>(): { | ||
(...values: Values): Array<Type>; | ||
}; | ||
function instance<Class extends new (...args: any) => any>(klass: Class): Provider<ConstructorParameters<Class>, InstanceType<Class>>; | ||
function as<SubType extends Type, Type>(): Provider<[SubType], Type>; | ||
function array<Values extends Type[], Type>(): Provider<Values, Type[]>; | ||
} | ||
//# sourceMappingURL=Jagger.d.ts.map |
@@ -7,5 +7,7 @@ import ts from "typescript"; | ||
const componentModuleInstances = new Map(); | ||
const componentModuleInstancesSet = new Map(); | ||
const componentTypeResolutions = new Map(); | ||
for (const component of graph.components) { | ||
componentModuleInstances.set(component, []); | ||
componentModuleInstancesSet.set(component, new Set()); | ||
componentTypeResolutions.set(component, []); | ||
@@ -42,4 +44,10 @@ const module = orThrow(graph.componentModule.get(component)); | ||
resolverTypeResolution.set(resolver, returnTypeResolution); | ||
const moduleInstancesSet = orThrow(componentModuleInstancesSet.get(component)); | ||
const moduleInstances = orThrow(componentModuleInstances.get(component)); | ||
for (const typeResolutionModule of getTypeResolutionModules(returnTypeResolution)) { | ||
orThrow(componentModuleInstances.get(component)).push(typeResolutionModule); | ||
if (moduleInstancesSet.has(typeResolutionModule)) { | ||
continue; | ||
} | ||
moduleInstancesSet.add(typeResolutionModule); | ||
moduleInstances.push(typeResolutionModule); | ||
} | ||
@@ -46,0 +54,0 @@ for (const typeResolution of getTypeResolutionTypeResolutions(returnTypeResolution)) { |
{ | ||
"name": "@ealmansi/jagger", | ||
"version": "0.1.28", | ||
"version": "0.1.29", | ||
"description": "WIP", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -27,3 +27,3 @@ # @ealmansi/jagger | ||
class Logger { | ||
export class Logger { | ||
constructor() {} | ||
@@ -35,3 +35,3 @@ log(message: string): void { | ||
class App { | ||
export class App { | ||
constructor(private readonly logger: Logger) {} | ||
@@ -43,3 +43,3 @@ start() { | ||
class AppModule extends Jagger.Module { | ||
export class AppModule extends Jagger.Module { | ||
provideLogger = Jagger.instance(Logger); | ||
@@ -49,9 +49,10 @@ provideApp = Jagger.instance(App); | ||
abstract class AppComponent extends Jagger.Component { | ||
export abstract class AppComponent extends Jagger.Component { | ||
static module: AppModule; | ||
abstract provideApp(): App; | ||
abstract buildApp(): App; | ||
} | ||
// in index.ts | ||
const app = new AppComponentImpl().provideApp(); | ||
app.start(); // App started! | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68960
701
55