From 33b033836ea3f682aa7acc2802db46f2597f3714 Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 10 Sep 2025 01:14:17 +0000 Subject: [PATCH 1/6] Fix crash when @importing a Sass file that @uses another file --- lib/src/visitor/async_evaluate.dart | 37 ++++++++++++++------------- lib/src/visitor/evaluate.dart | 39 ++++++++++++++++------------- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/lib/src/visitor/async_evaluate.dart b/lib/src/visitor/async_evaluate.dart index dc6d43b73..ea2116664 100644 --- a/lib/src/visitor/async_evaluate.dart +++ b/lib/src/visitor/async_evaluate.dart @@ -1905,22 +1905,26 @@ final class _EvaluateVisitor // CSS from modules used by [stylesheet]. var module = environment.toDummyModule(); _environment.importForwards(module); - if (loadsUserDefinedModules) { - if (module.transitivelyContainsCss) { - // If any transitively used module contains extensions, we need to - // clone all modules' CSS. Otherwise, it's possible that they'll be - // used or imported from another location that shouldn't have the same - // extensions applied. - await _combineCss( - module, - clone: module.transitivelyContainsExtensions, - ).accept(this); - } + try { + if (loadsUserDefinedModules) { + if (module.transitivelyContainsCss) { + // If any transitively used module contains extensions, we need to + // clone all modules' CSS. Otherwise, it's possible that they'll be + // used or imported from another location that shouldn't have the same + // extensions applied. + await _combineCss( + module, + clone: module.transitivelyContainsExtensions, + ).accept(this); + } - var visitor = _ImportedCssVisitor(this); - for (var child in children) { - child.accept(visitor); + var visitor = _ImportedCssVisitor(this); + for (var child in children) { + child.accept(visitor); + } } + } catch (e) { + assert(false, '$e: DEBUG: $children'); } _activeModules.remove(url); @@ -4670,9 +4674,8 @@ final class _ImportedCssVisitor implements ModifiableCssVisitor { void visitCssComment(ModifiableCssComment node) => _visitor._addChild(node); - void visitCssDeclaration(ModifiableCssDeclaration node) { - assert(false, "visitCssDeclaration() should never be called."); - } + void visitCssDeclaration(ModifiableCssDeclaration node) => + _visitor._addChild(node); void visitCssImport(ModifiableCssImport node) { if (_visitor._parent != _visitor._root) { diff --git a/lib/src/visitor/evaluate.dart b/lib/src/visitor/evaluate.dart index 6fb68b56b..a2b188b63 100644 --- a/lib/src/visitor/evaluate.dart +++ b/lib/src/visitor/evaluate.dart @@ -5,7 +5,7 @@ // DO NOT EDIT. This file was generated from async_evaluate.dart. // See tool/grind/synchronize.dart for details. // -// Checksum: a32ff6b83b3365e8dad72b8b12c2c17937a5f28e +// Checksum: c5411a954055bb66780859de6774401d15089a0f // // ignore_for_file: unused_import @@ -1913,22 +1913,26 @@ final class _EvaluateVisitor // CSS from modules used by [stylesheet]. var module = environment.toDummyModule(); _environment.importForwards(module); - if (loadsUserDefinedModules) { - if (module.transitivelyContainsCss) { - // If any transitively used module contains extensions, we need to - // clone all modules' CSS. Otherwise, it's possible that they'll be - // used or imported from another location that shouldn't have the same - // extensions applied. - _combineCss( - module, - clone: module.transitivelyContainsExtensions, - ).accept(this); - } + try { + if (loadsUserDefinedModules) { + if (module.transitivelyContainsCss) { + // If any transitively used module contains extensions, we need to + // clone all modules' CSS. Otherwise, it's possible that they'll be + // used or imported from another location that shouldn't have the same + // extensions applied. + _combineCss( + module, + clone: module.transitivelyContainsExtensions, + ).accept(this); + } - var visitor = _ImportedCssVisitor(this); - for (var child in children) { - child.accept(visitor); + var visitor = _ImportedCssVisitor(this); + for (var child in children) { + child.accept(visitor); + } } + } catch (e) { + assert(false, '$e: DEBUG: $children'); } _activeModules.remove(url); @@ -4652,9 +4656,8 @@ final class _ImportedCssVisitor implements ModifiableCssVisitor { void visitCssComment(ModifiableCssComment node) => _visitor._addChild(node); - void visitCssDeclaration(ModifiableCssDeclaration node) { - assert(false, "visitCssDeclaration() should never be called."); - } + void visitCssDeclaration(ModifiableCssDeclaration node) => + _visitor._addChild(node); void visitCssImport(ModifiableCssImport node) { if (_visitor._parent != _visitor._root) { From d30c094bb33639f71fe6c0387208b2f777b920f4 Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 10 Sep 2025 21:08:25 +0000 Subject: [PATCH 2/6] update changelog and versions --- CHANGELOG.md | 6 ++++++ pkg/sass-parser/CHANGELOG.md | 4 ++++ pkg/sass-parser/package.json | 2 +- pkg/sass_api/CHANGELOG.md | 4 ++++ pkg/sass_api/pubspec.yaml | 4 ++-- pubspec.yaml | 2 +- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 211d76439..39b03b375 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.92.2-dev + +* Fix a crash when a style rule contains a nested `@import`, `@use`s a + user-defined module with top-level declarations emitted when it `@include`s a + top-level mixin. + ## 1.92.1 * Fix a bug where variable definitions from one imported, forwarded module diff --git a/pkg/sass-parser/CHANGELOG.md b/pkg/sass-parser/CHANGELOG.md index 12ed2d361..a84180808 100644 --- a/pkg/sass-parser/CHANGELOG.md +++ b/pkg/sass-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.29-dev + +* No user-visible changes. + ## 0.4.28 * No user-visible changes. diff --git a/pkg/sass-parser/package.json b/pkg/sass-parser/package.json index 0354632f2..3f4040939 100644 --- a/pkg/sass-parser/package.json +++ b/pkg/sass-parser/package.json @@ -1,6 +1,6 @@ { "name": "sass-parser", - "version": "0.4.28", + "version": "0.4.29-dev", "description": "A PostCSS-compatible wrapper of the official Sass parser", "repository": "sass/sass", "author": "Google Inc.", diff --git a/pkg/sass_api/CHANGELOG.md b/pkg/sass_api/CHANGELOG.md index 1db448704..c8c833be1 100644 --- a/pkg/sass_api/CHANGELOG.md +++ b/pkg/sass_api/CHANGELOG.md @@ -1,3 +1,7 @@ +## 15.11.1-dev + +* No user-visible changes. + ## 15.11.0 * No user-visible changes. diff --git a/pkg/sass_api/pubspec.yaml b/pkg/sass_api/pubspec.yaml index 6c13dc35d..af473f072 100644 --- a/pkg/sass_api/pubspec.yaml +++ b/pkg/sass_api/pubspec.yaml @@ -2,7 +2,7 @@ name: sass_api # Note: Every time we add a new Sass AST node, we need to bump the *major* # version because it's a breaking change for anyone who's implementing the # visitor interface(s). -version: 15.11.0 +version: 15.11.1-dev description: Additional APIs for Dart Sass. homepage: https://github.com/sass/dart-sass @@ -10,7 +10,7 @@ environment: sdk: ">=3.6.0 <4.0.0" dependencies: - sass: 1.92.1 + sass: 1.92.2 dev_dependencies: dartdoc: ^8.0.14 diff --git a/pubspec.yaml b/pubspec.yaml index c67d9b1d5..64dabed46 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.92.1 +version: 1.92.2-dev description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass From f4725e2558ce3428bde8d495beac6bb02b4b94d0 Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 10 Sep 2025 21:45:27 +0000 Subject: [PATCH 3/6] ping CI From 2035463c3d33d0665fa28337188cd942912e1a98 Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 10 Sep 2025 21:47:47 +0000 Subject: [PATCH 4/6] oops remove debugging stuff --- lib/src/visitor/async_evaluate.dart | 32 ++++++++++++--------------- lib/src/visitor/evaluate.dart | 34 +++++++++++++---------------- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/lib/src/visitor/async_evaluate.dart b/lib/src/visitor/async_evaluate.dart index ea2116664..1041ffff7 100644 --- a/lib/src/visitor/async_evaluate.dart +++ b/lib/src/visitor/async_evaluate.dart @@ -1905,26 +1905,22 @@ final class _EvaluateVisitor // CSS from modules used by [stylesheet]. var module = environment.toDummyModule(); _environment.importForwards(module); - try { - if (loadsUserDefinedModules) { - if (module.transitivelyContainsCss) { - // If any transitively used module contains extensions, we need to - // clone all modules' CSS. Otherwise, it's possible that they'll be - // used or imported from another location that shouldn't have the same - // extensions applied. - await _combineCss( - module, - clone: module.transitivelyContainsExtensions, - ).accept(this); - } + if (loadsUserDefinedModules) { + if (module.transitivelyContainsCss) { + // If any transitively used module contains extensions, we need to + // clone all modules' CSS. Otherwise, it's possible that they'll be + // used or imported from another location that shouldn't have the same + // extensions applied. + await _combineCss( + module, + clone: module.transitivelyContainsExtensions, + ).accept(this); + } - var visitor = _ImportedCssVisitor(this); - for (var child in children) { - child.accept(visitor); - } + var visitor = _ImportedCssVisitor(this); + for (var child in children) { + child.accept(visitor); } - } catch (e) { - assert(false, '$e: DEBUG: $children'); } _activeModules.remove(url); diff --git a/lib/src/visitor/evaluate.dart b/lib/src/visitor/evaluate.dart index a2b188b63..82802e74f 100644 --- a/lib/src/visitor/evaluate.dart +++ b/lib/src/visitor/evaluate.dart @@ -5,7 +5,7 @@ // DO NOT EDIT. This file was generated from async_evaluate.dart. // See tool/grind/synchronize.dart for details. // -// Checksum: c5411a954055bb66780859de6774401d15089a0f +// Checksum: b79ed685f78b8d5356795eb2d1112f830abaf58e // // ignore_for_file: unused_import @@ -1913,26 +1913,22 @@ final class _EvaluateVisitor // CSS from modules used by [stylesheet]. var module = environment.toDummyModule(); _environment.importForwards(module); - try { - if (loadsUserDefinedModules) { - if (module.transitivelyContainsCss) { - // If any transitively used module contains extensions, we need to - // clone all modules' CSS. Otherwise, it's possible that they'll be - // used or imported from another location that shouldn't have the same - // extensions applied. - _combineCss( - module, - clone: module.transitivelyContainsExtensions, - ).accept(this); - } + if (loadsUserDefinedModules) { + if (module.transitivelyContainsCss) { + // If any transitively used module contains extensions, we need to + // clone all modules' CSS. Otherwise, it's possible that they'll be + // used or imported from another location that shouldn't have the same + // extensions applied. + _combineCss( + module, + clone: module.transitivelyContainsExtensions, + ).accept(this); + } - var visitor = _ImportedCssVisitor(this); - for (var child in children) { - child.accept(visitor); - } + var visitor = _ImportedCssVisitor(this); + for (var child in children) { + child.accept(visitor); } - } catch (e) { - assert(false, '$e: DEBUG: $children'); } _activeModules.remove(url); From 899d697cc0dd6ef6c4f37207b2a779477e1df283 Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 10 Sep 2025 21:56:06 +0000 Subject: [PATCH 5/6] update changelog to be more accurate --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39b03b375..8c4b98b51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ ## 1.92.2-dev -* Fix a crash when a style rule contains a nested `@import`, `@use`s a - user-defined module with top-level declarations emitted when it `@include`s a - top-level mixin. +* Fix a crash when a style rule contains a nested `@import`, and the loaded file + `@use`s a user-defined module as well as `@include` a top-level mixin which + emits top-level declarations. ## 1.92.1 From 4a6c967d423bce99dbd8e90a7c31d3ab56628d49 Mon Sep 17 00:00:00 2001 From: "Carlos (Goodwine)" <2022649+Goodwine@users.noreply.github.com> Date: Thu, 11 Sep 2025 14:09:58 -0700 Subject: [PATCH 6/6] Update CHANGELOG.md Co-authored-by: Natalie Weizenbaum --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c4b98b51..00b267c57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## 1.92.2-dev * Fix a crash when a style rule contains a nested `@import`, and the loaded file - `@use`s a user-defined module as well as `@include` a top-level mixin which + `@use`s a user-defined module as well as `@include`s a top-level mixin which emits top-level declarations. ## 1.92.1