Skip to content

Detect dependency loops in module migrator#249

Open
pamelalozano16 wants to merge 1 commit intosass:mainfrom
pamelalozano16:fix#137
Open

Detect dependency loops in module migrator#249
pamelalozano16 wants to merge 1 commit intosass:mainfrom
pamelalozano16:fix#137

Conversation

@pamelalozano16
Copy link
Contributor

Fix #137.

@pamelalozano16 pamelalozano16 force-pushed the fix#137 branch 5 times, most recently from 76e48bd to c594c32 Compare June 19, 2024 00:06
@pamelalozano16 pamelalozano16 requested a review from jathak June 19, 2024 00:22
@pamelalozano16 pamelalozano16 force-pushed the fix#137 branch 3 times, most recently from 8592cc3 to 64aaa98 Compare June 20, 2024 19:27
@pamelalozano16 pamelalozano16 force-pushed the fix#137 branch 3 times, most recently from bbc3981 to 0eab116 Compare February 23, 2026 22:51
@@ -1,3 +1,6 @@
## 2.0.4
* Detect dependency loops in module migrator fix.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a clearer way to describe this change to end users is something like:

Previously, migrating certain files with implicit dependencies on one another could create dependency loops. This fixes the migrator to instead error when it encounters these situations, as a working migration is not possible without some sort of manual refactoring.

Also, put this under a "Module Migrator" header

final Set<ForwardType> forwards;

/// Dependencies where keys represent source URIs and values represent imported URIs.
final DependencyGraph _dependencies = DependencyGraph();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: The type here is unnecessary since it can be inferred from the initializer.

Suggested change
final DependencyGraph _dependencies = DependencyGraph();
final _dependencies = DependencyGraph();

Error: Dependency loop detected: entrypoint -> library.
To resolve this issue, consider either of the following:
1. Remove the import statement that causes the dependency loop.
2. Declare the variables used in the other stylesheet within the same stylesheet.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this handle functions and mixins?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module migrator can generate @use loops

2 participants