Skip to content

Commit 8207c2b

Browse files
authored
Fix bug adding duplicate namespaces to variable reassignments (#281)
1 parent 6984c16 commit 8207c2b

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
## 2.4.1
2+
3+
### Module Migrator
4+
5+
* Fix a bug where a duplicate namespace would be added to a reassignment of a
6+
variable from another module when running on a partially migrated file.
7+
18
## 2.4.0
29

3-
### Module System Migration
10+
### Module Migrator
411

512
* Better handling of late `@import` rules. Previously, these were treated
613
identically to nested imports, but now they can be hoisted to the top of the
@@ -24,7 +31,7 @@
2431

2532
## 2.3.3
2633

27-
### Module System Migration
34+
### Module Migrator
2835

2936
* Fix some bugs in the conversion of private names that are referenced across
3037
files to public names, especially when `--remove-prefix` and/or multiple

lib/src/migrators/module.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ class _ModuleMigrationVisitor extends MigrationVisitor {
12361236
/// renaming or namespacing if necessary.
12371237
@override
12381238
void visitVariableDeclaration(VariableDeclaration node) {
1239-
if (builtInOnly) {
1239+
if (builtInOnly || node.namespace != null) {
12401240
super.visitVariableDeclaration(node);
12411241
return;
12421242
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass_migrator
2-
version: 2.4.0
2+
version: 2.4.1
33
description: A tool for running migrations on Sass files
44
homepage: https://github.com/sass/migrator
55

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<==> arguments
2+
--migrate-deps
3+
4+
<==> input/entrypoint.scss
5+
@use "library";
6+
@import "imported";
7+
8+
library.$var1: blue;
9+
$var2: gold;
10+
11+
a {
12+
color: library.$var1;
13+
background: $var2;
14+
}
15+
16+
<==> input/_library.scss
17+
$var1: red;
18+
19+
<==> input/_imported.scss
20+
$var2: white;
21+
22+
<==> output/entrypoint.scss
23+
@use "library";
24+
@use "imported";
25+
26+
library.$var1: blue;
27+
imported.$var2: gold;
28+
29+
a {
30+
color: library.$var1;
31+
background: imported.$var2;
32+
}

0 commit comments

Comments
 (0)