Skip to content

Commit cf42954

Browse files
committed
resolver: improve some debug logging
1 parent b0765ae commit cf42954

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

internal/resolver/resolver.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ func NewResolver(call config.APICall, fs fs.FS, log logger.Log, caches *cache.Ca
328328
visited = make(map[string]bool)
329329
}
330330
if options.TSConfigPath != "" {
331+
if r.log.Level <= logger.LevelDebug {
332+
r.debugLogs = &debugLogs{what: fmt.Sprintf("Resolving tsconfig file %q", options.TSConfigPath)}
333+
}
331334
res.tsConfigOverride, err = r.parseTSConfig(options.TSConfigPath, visited)
332335
} else {
333336
source := logger.Source{
@@ -345,6 +348,8 @@ func NewResolver(call config.APICall, fs fs.FS, log logger.Log, caches *cache.Ca
345348
r.log.AddError(nil, logger.Range{}, fmt.Sprintf("Cannot read file %q: %s",
346349
PrettyPath(r.fs, logger.Path{Text: options.TSConfigPath, Namespace: "file"}), err.Error()))
347350
}
351+
} else {
352+
r.flushDebugLogs(flushDueToSuccess)
348353
}
349354
}
350355

@@ -1402,8 +1407,12 @@ func (r resolverQuery) parseTSConfigFromSource(source logger.Source, visited map
14021407
// Suppress warnings about missing base config files inside "node_modules"
14031408
pnpError:
14041409
if !helpers.IsInsideNodeModules(source.KeyPath.Text) {
1405-
r.log.AddID(logger.MsgID_TSConfigJSON_Missing, logger.Warning, &tracker, extendsRange,
1406-
fmt.Sprintf("Cannot find base config file %q", extends))
1410+
var notes []logger.MsgData
1411+
if r.debugLogs != nil {
1412+
notes = r.debugLogs.notes
1413+
}
1414+
r.log.AddIDWithNotes(logger.MsgID_TSConfigJSON_Missing, logger.Warning, &tracker, extendsRange,
1415+
fmt.Sprintf("Cannot find base config file %q", extends), notes)
14071416
}
14081417

14091418
return nil

0 commit comments

Comments
 (0)