( cfg: NativeAstConfig | undefined, projectRoot: string )
| 80 | * same diagnostics sink. |
| 81 | */ |
| 82 | export function resolveNativeAst( |
| 83 | cfg: NativeAstConfig | undefined, |
| 84 | projectRoot: string |
| 85 | ): NativeAstResolved { |
| 86 | if (!cfg || !cfg.enabled) return DISABLED; |
| 87 | |
| 88 | const cached = resolvedCache.get(cfg); |
| 89 | if (cached) return cached; |
| 90 | |
| 91 | const languages = new Set(cfg.languages ?? []); |
| 92 | const resolved: NativeAstResolved = { |
| 93 | mode: cfg.enabled === "strict" ? "strict" : "on", |
| 94 | languages, |
| 95 | authoritative: languages.size > 0, |
| 96 | pluginDirs: defaultPluginDirs(projectRoot, cfg.pluginDir), |
| 97 | diagnostics: [], |
| 98 | warnings: [], |
| 99 | }; |
| 100 | resolvedCache.set(cfg, resolved); |
| 101 | return resolved; |
| 102 | } |
| 103 | |
| 104 | /** Ordered plugin search path. Explicit override first, then user/data dirs, then install dir. */ |
| 105 | function defaultPluginDirs(projectRoot: string, override?: string): string[] { |
no test coverage detected