Closed jathak closed 4 years ago
Yeah, that makes sense. I'll do that.
Hmm. How should this work for extra @use
rules, which aren't added until we visit a reference to one of their members?
For the existing @use
/@import
rules, we can check them all at the beginning for conflicts and then alias both conflicting rules, but for something like @use "color"
and @use "sass:color"
, we won't know that there's a conflict until after we've used the default namespace for the first one.
Okay, I was able to get this working by adding additional logic to References
to also track the source of a member being referenced (including both those from imports and those from built-in modules). The main migrator then uses that information to determine most namespaces for a stylesheet before visiting it, allowing conflicts to be resolved more intelligently. Built-in modules now get priority for their default namespaces and the migrator will now try adding additional path segments to namespaces before it falls back to numerical suffixes.
WDYT about changing this to use parent directory names for these namespaces, rather than numeric suffixes? So instead of
variables
andvariables2
, you'd havea-variables
andb-variables
.