@@ -51,19 +51,20 @@ import * as Effect from "effect/Effect"
5151
5252// Adjusts the default Config layer to ensure that plugins are always initialised before
5353// any other layers read the current config
54- const ConfigWithPluginPriority = Layer . unwrap (
54+ const ConfigWithPluginPriority = Layer . effect (
55+ Config . Service ,
5556 Effect . gen ( function * ( ) {
56- const configSvc = yield * Config . Service
57- const pluginSvc = yield * Plugin . Service
57+ const config = yield * Config . Service
58+ const plugin = yield * Plugin . Service
5859
59- return Layer . succeed ( Config . Service , {
60- ...configSvc ,
61- get : ( ) => Effect . andThen ( pluginSvc . init ( ) , configSvc . get ) ,
62- getGlobal : ( ) => Effect . andThen ( pluginSvc . init ( ) , configSvc . getGlobal ) ,
63- getConsoleState : ( ) => Effect . andThen ( pluginSvc . init ( ) , configSvc . getConsoleState ) ,
64- } )
60+ return {
61+ ...config ,
62+ get : ( ) => Effect . andThen ( plugin . init ( ) , config . get ) ,
63+ getGlobal : ( ) => Effect . andThen ( plugin . init ( ) , config . getGlobal ) ,
64+ getConsoleState : ( ) => Effect . andThen ( plugin . init ( ) , config . getConsoleState ) ,
65+ }
6566 } ) ,
66- ) . pipe ( Layer . provideMerge ( Layer . merge ( Plugin . defaultLayer , Config . defaultLayer ) ) )
67+ ) . pipe ( Layer . provide ( Layer . merge ( Plugin . defaultLayer , Config . defaultLayer ) ) )
6768
6869export const AppLayer = Layer . mergeAll (
6970 Npm . defaultLayer ,
0 commit comments