ResolverExtensions returns extensions used for import path resolution, including index-file patterns for JS/TS/Python ecosystems. Sorted by length descending so longer extensions match first (.tsx before .ts), with empty string last as the final fallback.
()
| 137 | // Sorted by length descending so longer extensions match first (.tsx before .ts), |
| 138 | // with empty string last as the final fallback. |
| 139 | func ResolverExtensions() []string { |
| 140 | var exts []string |
| 141 | for ext := range extToLang { |
| 142 | exts = append(exts, ext) |
| 143 | } |
| 144 | // Sort by length descending, then alphabetically for stability |
| 145 | sort.Slice(exts, func(i, j int) bool { |
| 146 | if len(exts[i]) != len(exts[j]) { |
| 147 | return len(exts[i]) > len(exts[j]) |
| 148 | } |
| 149 | return exts[i] < exts[j] |
| 150 | }) |
| 151 | // Index-file patterns for module resolution |
| 152 | exts = append(exts, "/index.js", "/index.ts", "/index.tsx", "/__init__.py", "/mod.rs") |
| 153 | // Empty string last — bare path match as final fallback |
| 154 | exts = append(exts, "") |
| 155 | return exts |
| 156 | } |
| 157 | |
| 158 | // LangDisplay maps internal language names to display names |
| 159 | var LangDisplay = map[string]string{ |
no outgoing calls
no test coverage detected