1
+ import { createLogger } from "./logger" ;
1
2
import { NormalizedConfig } from "./normalizer" ;
2
3
import { resolveStrategies } from "./strategy-resolver" ;
3
4
import { StrategyFn , StrategyResult , StrategyStatus } from "./types" ;
@@ -59,6 +60,7 @@ interface MergeArgs<TContext> {
59
60
filePath ?: string ;
60
61
ctx : MergeContext < TContext > ;
61
62
conflicts : Conflict [ ] ;
63
+ logger : Awaited < ReturnType < typeof createLogger > > ;
62
64
}
63
65
64
66
/** Utility: plain-object check. */
@@ -105,7 +107,7 @@ export const BuiltInStrategies = {
105
107
} ,
106
108
107
109
merge : async < TContext > ( args : MergeArgs < TContext > ) : Promise < StrategyResult > => {
108
- const { ours, theirs, base, path, filePath, ctx, conflicts } = args ;
110
+ const { ours, theirs, base, path, filePath, ctx, conflicts, logger } = args ;
109
111
110
112
// Plain objects
111
113
if ( isPlainObject ( ours ) && isPlainObject ( theirs ) ) {
@@ -120,6 +122,7 @@ export const BuiltInStrategies = {
120
122
filePath,
121
123
ctx,
122
124
conflicts,
125
+ logger,
123
126
} ) ;
124
127
}
125
128
return { status : StrategyStatus_OK , value : result } ;
@@ -164,6 +167,7 @@ export const mergeObject = async <TContext>({
164
167
filePath,
165
168
ctx,
166
169
conflicts,
170
+ logger,
167
171
} : MergeArgs < TContext > ) : Promise < unknown > => {
168
172
if ( ours === theirs ) return ours ;
169
173
@@ -175,6 +179,8 @@ export const mergeObject = async <TContext>({
175
179
ctx . _strategyCache . set ( path , strategies ) ;
176
180
}
177
181
182
+ logger . debug ( filePath ?? "all" , `path: ${ path } , strategies: ${ strategies . join ( ", " ) || "none" } ` ) ;
183
+
178
184
for ( const strategy of strategies ) {
179
185
const fn = ( BuiltInStrategies as any ) [ strategy ] ?? ctx . strategies [ strategy ] ;
180
186
@@ -188,6 +194,7 @@ export const mergeObject = async <TContext>({
188
194
filePath,
189
195
ctx,
190
196
conflicts,
197
+ logger,
191
198
} ) ;
192
199
193
200
switch ( result . status ) {
0 commit comments