fix(core): defer cyclic layer dependencies

This commit is contained in:
Dax Raad 2026-07-17 20:25:21 -04:00
commit c4830c147d
4 changed files with 16 additions and 3 deletions

View file

@ -74,7 +74,7 @@ type MakeInput<
T extends Tag | undefined = undefined,
> = NodeIdentity & {
readonly layer: Implementation
readonly deps: Items & CheckDependencies<Implementation, NoInfer<Items>>
readonly deps: (Items | (() => Items)) & CheckDependencies<Implementation, NoInfer<Items>>
readonly tag?: T
}
@ -90,7 +90,9 @@ export function make<
name: input.service !== undefined ? input.service.key : input.name,
service: input.service,
implementation: input.layer,
dependencies: input.deps,
get dependencies() {
return typeof input.deps === "function" ? input.deps() : input.deps
},
tag: input.tag,
}
}