Skip to content

Commit 13f065d

Browse files
committed
Fix prefix removal without a trailing dash
1 parent 6deefe5 commit 13f065d

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

lib/src/migrators/module.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,12 @@ class _ModuleMigrationVisitor extends MigrationVisitor {
12561256
var unprivateName = isPrivate ? _privateToPublic(name) : name;
12571257
var prefix = _prefixFor(unprivateName);
12581258
if (prefix == null) return name;
1259-
return (isPrivate ? '-' : '') + unprivateName.substring(prefix.length);
1259+
1260+
var withoutPrefix = unprivateName.substring(prefix.length);
1261+
if (_isPrivate(withoutPrefix)) {
1262+
withoutPrefix = _privateToPublic(withoutPrefix);
1263+
}
1264+
return (isPrivate ? '-' : '') + withoutPrefix;
12601265
}
12611266

12621267
/// Returns the namespace that built-in module [module] is loaded under.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<==> arguments
2+
--remove-prefix=lib
3+
4+
<==> input/entrypoint.scss
5+
$lib-a: 5;
6+
$lib_b: $lib-a + 2;
7+
8+
@function lib-fn($lib-local) {
9+
@return $lib-local;
10+
}
11+
12+
@mixin lib-mixin {
13+
lib-property: lib-value;
14+
}
15+
16+
lib-selector {
17+
lib-property: lib-fn(0);
18+
@include lib-mixin;
19+
}
20+
21+
<==> output/entrypoint.scss
22+
$a: 5;
23+
$b: $a + 2;
24+
25+
@function fn($lib-local) {
26+
@return $lib-local;
27+
}
28+
29+
@mixin mixin {
30+
lib-property: lib-value;
31+
}
32+
33+
lib-selector {
34+
lib-property: fn(0);
35+
@include mixin;
36+
}
37+
38+
<==> output/entrypoint.import.scss
39+
@forward "entrypoint" as lib-*;

0 commit comments

Comments
 (0)