From c8ac543d1e89eb3e3181c17b7cfaf7e795c2886b Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Mon, 29 Jul 2019 22:32:53 +0100 Subject: [PATCH 1/7] Re-add support for Node Carbon (#785) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently npm and Yarn won't avoid installing a package version that declares incompatibility with them, so dropping compatibility for an old version is actually a breaking change 😭. --- .travis.yml | 3 +++ CHANGELOG.md | 4 ++++ package/package.json | 2 +- pubspec.yaml | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a91e2e19..1f5155ef5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,6 +77,9 @@ jobs: node_js: stable install: pub run grinder before-test script: tool/travis/task/node_tests.sh + - <<: *node-tests + name: Node tests | Dart stable | Node Carbon + node_js: lts/carbon - <<: *node-tests name: Node tests | Dart stable | Node Dubnium node_js: lts/dubnium diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d4112387..5b20e33fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ * Clarify the error message when the wrong number of positional arguments are passed along with a named argument. +### JavaScript API + +* Re-add support for Node Carbon (8.x). + ## 1.22.8 ### JavaScript API diff --git a/package/package.json b/package/package.json index f6f8fb0dd..0231c3f62 100644 --- a/package/package.json +++ b/package/package.json @@ -14,7 +14,7 @@ "url": "https://github.com/nex3" }, "engines": { - "node": ">=10.0.0" + "node": ">=8.9.0" }, "dependencies": { "chokidar": ">=2.0.0 <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c53ff476d..5fd4e0dea 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.22.9-dev +version: 1.22.9 description: A Sass implementation in Dart. author: Dart Team homepage: https://github.com/sass/dart-sass From 057d891c27750b146fdee32b9255393fdd4f7669 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Mon, 5 Aug 2019 16:18:32 -0700 Subject: [PATCH 2/7] Update the author declaration in the pubspec (#788) --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 5fd4e0dea..2d85af5a4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: sass version: 1.22.9 description: A Sass implementation in Dart. -author: Dart Team +author: Sass Team homepage: https://github.com/sass/dart-sass executables: From e8a50acf31b72f51df6d173996ee6096e21a726f Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Fri, 9 Aug 2019 16:48:27 -0700 Subject: [PATCH 3/7] Build the Mac OS deployment on Mac OS (#794) This allows it to build a native executable, rather than a script snapshot. I don't know why we weren't doing this already. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1f5155ef5..871ca3af0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -221,6 +221,7 @@ jobs: if: *deploy-if env: *github-env script: skip + os: osx deploy: provider: script script: pub run grinder github-mac-os From 0e5ed4a37dcb57ac724cca3f26c1941e9a7c89f5 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 14 Aug 2019 12:20:47 -0700 Subject: [PATCH 4/7] Fix dash-insensitivity in get-function() (#795) Closes #792 --- CHANGELOG.md | 5 +++++ lib/src/visitor/async_evaluate.dart | 6 ++++-- lib/src/visitor/evaluate.dart | 8 +++++--- pubspec.yaml | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b20e33fb..4956277b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.22.10 + +* Fix a bug in which `get-function()` would fail to find a dash-separated + function when passed a function name with underscores. + ## 1.22.9 * Include argument names when reporting range errors and selector parse errors. diff --git a/lib/src/visitor/async_evaluate.dart b/lib/src/visitor/async_evaluate.dart index 4d7721357..fbc142c34 100644 --- a/lib/src/visitor/async_evaluate.dart +++ b/lib/src/visitor/async_evaluate.dart @@ -331,8 +331,10 @@ class _EvaluateVisitor var callable = css ? PlainCssCallable(name.text) - : _addExceptionSpan(_callableNode, - () => _getFunction(name.text, namespace: module?.text)); + : _addExceptionSpan( + _callableNode, + () => _getFunction(name.text.replaceAll("_", "-"), + namespace: module?.text)); if (callable != null) return SassFunction(callable); throw "Function not found: $name"; diff --git a/lib/src/visitor/evaluate.dart b/lib/src/visitor/evaluate.dart index d771c817f..b8b05f9d4 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: c8527e9c89f7ebbab760b62b70da66d1b01b2bf3 +// Checksum: fdeda387299e1ad0e9d50f22ae32ab0cf1ff6e30 // // ignore_for_file: unused_import @@ -339,8 +339,10 @@ class _EvaluateVisitor var callable = css ? PlainCssCallable(name.text) - : _addExceptionSpan(_callableNode, - () => _getFunction(name.text, namespace: module?.text)); + : _addExceptionSpan( + _callableNode, + () => _getFunction(name.text.replaceAll("_", "-"), + namespace: module?.text)); if (callable != null) return SassFunction(callable); throw "Function not found: $name"; diff --git a/pubspec.yaml b/pubspec.yaml index 2d85af5a4..6812c9b05 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.22.9 +version: 1.22.10 description: A Sass implementation in Dart. author: Sass Team homepage: https://github.com/sass/dart-sass From fc8c987fc1703c3e18c6a46dfedb07259308d4e7 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Fri, 16 Aug 2019 14:00:14 -0700 Subject: [PATCH 5/7] Fix a few @extend edge cases (#797) --- CHANGELOG.md | 11 +++++++++++ lib/src/extend/functions.dart | 20 +++++++++++++------- pubspec.yaml | 2 +- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4956277b6..565c48d6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## 1.22.11 + +* Fix a couple edge cases in `@extend` logic and related selector functions: + + * Recognize `:matches()` and similar pseudo-selectors as superselectors of + matching complex selectors. + + * Recognize `::slotted()` as a superselector of other `::slotted()` selectors. + + * Regonize `:current()` with a vendor prefix as a superselector. + ## 1.22.10 * Fix a bug in which `get-function()` would fail to find a dash-separated diff --git a/lib/src/extend/functions.dart b/lib/src/extend/functions.dart index 0e222178e..c9a0fb217 100644 --- a/lib/src/extend/functions.dart +++ b/lib/src/extend/functions.dart @@ -598,7 +598,7 @@ bool complexIsSuperselector(List complex1, if (remaining1 == 1) { return compoundIsSuperselector( compound1, complex2.last as CompoundSelector, - parents: complex2.skip(i2 + 1)); + parents: complex2.take(complex2.length - 1).skip(i2)); } // Find the first index where `complex2.sublist(i2, afterSuperselector)` is @@ -673,11 +673,12 @@ bool compoundIsSuperselector( } } - // [compound1] can't be a superselector of a selector with pseudo-elements - // that [compound2] doesn't share. + // [compound1] can't be a superselector of a selector with non-selector + // pseudo-elements that [compound2] doesn't share. for (var simple2 in compound2.components) { if (simple2 is PseudoSelector && simple2.isElement && + simple2.selector == null && !_simpleIsSuperselectorOfCompound(simple2, compound1)) { return false; } @@ -736,10 +737,13 @@ bool _selectorPseudoIsSuperselector( case 'has': case 'host': case 'host-context': - case 'slotted': return _selectorPseudosNamed(compound2, pseudo1.name) .any((pseudo2) => pseudo1.selector.isSuperselector(pseudo2.selector)); + case 'slotted': + return _selectorPseudosNamed(compound2, pseudo1.name, isClass: false) + .any((pseudo2) => pseudo1.selector.isSuperselector(pseudo2.selector)); + case 'not': return pseudo1.selector.components.every((complex) { return compound2.components.any((simple2) { @@ -764,7 +768,7 @@ bool _selectorPseudoIsSuperselector( }); case 'current': - return _selectorPseudosNamed(compound2, 'current') + return _selectorPseudosNamed(compound2, pseudo1.name) .any((pseudo2) => pseudo1.selector == pseudo2.selector); case 'nth-child': @@ -783,6 +787,8 @@ bool _selectorPseudoIsSuperselector( /// Returns all pseudo selectors in [compound] that have a selector argument, /// and that have the given [name]. Iterable _selectorPseudosNamed( - CompoundSelector compound, String name) => + CompoundSelector compound, String name, {bool isClass = true}) => compound.components.whereType().where((pseudo) => - pseudo.isClass && pseudo.selector != null && pseudo.name == name); + pseudo.isClass == isClass && + pseudo.selector != null && + pseudo.name == name); diff --git a/pubspec.yaml b/pubspec.yaml index 6812c9b05..5053af775 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.22.10 +version: 1.22.11 description: A Sass implementation in Dart. author: Sass Team homepage: https://github.com/sass/dart-sass From a89c67b563b68d46a8071dc9a30328bd5be0a454 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 28 Aug 2019 14:09:35 -0700 Subject: [PATCH 6/7] Fix unquoted plain-CSS imports (#800) Closes #799 --- CHANGELOG.md | 2 ++ lib/src/parse/sass.dart | 19 ++++++++++++++++--- lib/src/parse/stylesheet.dart | 5 +++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 565c48d6d..ae5181a66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## 1.22.11 +* Don't try to load unquoted plain-CSS indented-syntax imports. + * Fix a couple edge cases in `@extend` logic and related selector functions: * Recognize `:matches()` and similar pseudo-selectors as superselectors of diff --git a/lib/src/parse/sass.dart b/lib/src/parse/sass.dart index fe5aebbea..eb39aa269 100644 --- a/lib/src/parse/sass.dart +++ b/lib/src/parse/sass.dart @@ -9,6 +9,7 @@ import '../ast/sass.dart'; import '../interpolation_buffer.dart'; import '../logger.dart'; import '../util/character.dart'; +import '../value.dart'; import 'stylesheet.dart'; /// A parser for the indented syntax. @@ -98,9 +99,21 @@ class SassParser extends StylesheetParser { scanner.readChar(); next = scanner.peekChar(); } - - return DynamicImport(parseImportUrl(scanner.substring(start.position)), - scanner.spanFrom(start)); + var url = scanner.substring(start.position); + var span = scanner.spanFrom(start); + + if (isPlainImportUrl(url)) { + // Serialize [url] as a Sass string because [StaticImport] expects it to + // include quotes. + return StaticImport( + Interpolation([SassString(url).toString()], span), span); + } else { + try { + return DynamicImport(parseImportUrl(url), span); + } on FormatException catch (innerError) { + error("Invalid URL: ${innerError.message}", span); + } + } } bool scanElse(int ifIndentation) { diff --git a/lib/src/parse/stylesheet.dart b/lib/src/parse/stylesheet.dart index 0bcde8c71..e25e5ac20 100644 --- a/lib/src/parse/stylesheet.dart +++ b/lib/src/parse/stylesheet.dart @@ -1002,7 +1002,7 @@ abstract class StylesheetParser extends Parser { var urlSpan = scanner.spanFrom(start); whitespace(); var queries = tryImportQueries(); - if (_isPlainImportUrl(url) || queries != null) { + if (isPlainImportUrl(url) || queries != null) { return StaticImport( Interpolation([urlSpan.text], urlSpan), scanner.spanFrom(start), supports: queries?.item1, media: queries?.item2); @@ -1028,7 +1028,8 @@ abstract class StylesheetParser extends Parser { } /// Returns whether [url] indicates that an `@import` is a plain CSS import. - bool _isPlainImportUrl(String url) { + @protected + bool isPlainImportUrl(String url) { if (url.length < 5) return false; if (url.endsWith(".css")) return true; From d9ebb5eff03fc306774c27cdf4251706dc3c2bd2 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Fri, 30 Aug 2019 13:46:17 -0700 Subject: [PATCH 7/7] Fix Travis (#809) Travis is using an older version of Ruby Gems which started having trouble installing Bundler. See rbenv/rbenv#1138 --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 871ca3af0..9d3976022 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,11 +35,16 @@ jobs: - &specs name: sass-spec | Dart stable | synchronous language: ruby + # Work around an issue where bundler isn't installed correctly on Ruby 2.5. + # We should remove this, and the explicit "gem install bundler" line, once + # Travis uses Ruby 2.6 by default. + rvm: 2.6 install: - export sass_spec_ref=`tool/travis/sass-spec-ref.sh` - git init sass-spec - git -C sass-spec fetch git://github.com/sass/sass-spec "$sass_spec_ref" --depth 1 - git -C sass-spec checkout FETCH_HEAD + - gem install bundler - bundle install --gemfile=sass-spec/Gemfile --jobs=3 --retry=3 script: tool/travis/task/specs.sh - <<: *specs