Add support for imports ending in "/index"
PiperOrigin-RevId: 208694382
diff --git a/ts_auto_deps/analyze/loader.go b/ts_auto_deps/analyze/loader.go
index 47f24be..00948cd 100644
--- a/ts_auto_deps/analyze/loader.go
+++ b/ts_auto_deps/analyze/loader.go
@@ -138,9 +138,10 @@
for label, rule := range labelToRule {
_, pkg, file := edit.ParseLabel(label)
+ // Trim "/index" suffixes that were added to path in the queries above.
pathWithoutExtension := strings.TrimSuffix(filepath.Join(pkg, stripTSExtension(file)), string(filepath.Separator)+"index")
for _, path := range paths {
- if pathWithoutExtension == path {
+ if pathWithoutExtension == strings.TrimSuffix(path, string(filepath.Separator)+"index") {
results[path] = rule
} else if pathWithoutExtension == strings.TrimSuffix(path, ".ngsummary") {
results[path] = rule