From b73bff016c2c90a51a652a9691481ff1d7ddba63 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 2 Nov 2022 14:19:04 -0700 Subject: [PATCH 1/2] Make `cloneCss() clone modules that transitively contain CSS Previously we were only cloning modules that directly contained CSS, but this created a problem where extensions could be added to their *shared* extension store across `load-css()` boundaries and thereby applied to upstream CSS. Closes #3322 --- CHANGELOG.md | 4 ++++ lib/src/async_environment.dart | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61562152c..95d87efde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,10 @@ * Properly mark the warning for passing numbers with units to `random()` as a deprecation warning. +* Fix a bug where `@extend` could behave unpredicatably when used along with + `meta.load-css()` and shared modules that contained no CSS themselves but + loaded CSS from other modules. + ### Dart API * Emit a deprecation warning when passing a `sassIndex` with units to diff --git a/lib/src/async_environment.dart b/lib/src/async_environment.dart index a86c9f025..e6865b0ad 100644 --- a/lib/src/async_environment.dart +++ b/lib/src/async_environment.dart @@ -1014,7 +1014,7 @@ class _EnvironmentModule implements Module { } Module cloneCss() { - if (css.children.isEmpty) return this; + if (!transitivelyContainsCss) return this; var newCssAndExtensionStore = cloneCssStylesheet(css, extensionStore); return _EnvironmentModule._( From 2049092154812819e287993484e155b31f371491 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 2 Nov 2022 17:22:02 -0700 Subject: [PATCH 2/2] Resynchronize --- lib/src/environment.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/environment.dart b/lib/src/environment.dart index 9869e1290..128bd3285 100644 --- a/lib/src/environment.dart +++ b/lib/src/environment.dart @@ -5,7 +5,7 @@ // DO NOT EDIT. This file was generated from async_environment.dart. // See tool/grind/synchronize.dart for details. // -// Checksum: 88f81b417129a74e4eb776d518c8e019dbf2ec36 +// Checksum: 38c688423116df1e489aa6eafc16de1bf9bc2bf5 // // ignore_for_file: unused_import @@ -1022,7 +1022,7 @@ class _EnvironmentModule implements Module { } Module cloneCss() { - if (css.children.isEmpty) return this; + if (!transitivelyContainsCss) return this; var newCssAndExtensionStore = cloneCssStylesheet(css, extensionStore); return _EnvironmentModule._(