Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Dart 1 #353

Merged
merged 4 commits into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ language: ruby

env:
# Language specs, defined in sass/sass-spec
- TASK=specs DART_CHANNEL=dev DART_VERSION=latest
- TASK=specs DART_CHANNEL=stable DART_VERSION=latest
- TASK=specs DART_CHANNEL=stable DART_VERSION=latest ASYNC=true
- TASK=specs DART_CHANNEL=dev DART_VERSION=latest
- TASK=specs DART_CHANNEL=dev DART_VERSION=latest ASYNC=true

# Unit tests, defined in test/.
- TASK=tests DART_CHANNEL=dev DART_VERSION=latest
- TASK=tests DART_CHANNEL=stable DART_VERSION=latest

# This should be NODE_VERSION=latest, but that's breaking due to
# laverdet/node-fibers#378.
Expand All @@ -23,8 +21,8 @@ env:
- TASK=tests DART_CHANNEL=dev DART_VERSION=latest NODE_VERSION=lts/carbon

# Miscellaneous checks.
- TASK=analyze DART_CHANNEL=dev DART_VERSION=latest
- TASK=format DART_CHANNEL=dev DART_VERSION=latest
- TASK=analyze DART_CHANNEL=dev DART_VERSION=latest
- TASK=format DART_CHANNEL=dev DART_VERSION=latest

rvm:
- 2.3.1
Expand Down
2 changes: 1 addition & 1 deletion lib/src/ast/sass/argument_declaration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ArgumentDeclaration implements SassNode {
}

String toString() {
var components = new List.from(arguments.map((arg) => arg.toString()));
var components = new List.of(arguments.map((arg) => arg.toString()));
if (restArgument != null) components.add('$restArgument...');
return components.join(', ');
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/async_import_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import 'dart:async';

import 'package:path/path.dart' as p;
import 'package:tuple/tuple.dart';

import 'ast/sass.dart';
import 'importer.dart';
import 'logger.dart';
import 'sync_package_resolver.dart';
import 'utils.dart'; // ignore: unused_import
import 'util/path.dart';

/// An in-memory cache of parsed stylesheets that have been imported by Sass.
class AsyncImportCache {
Expand Down Expand Up @@ -142,7 +142,7 @@ class AsyncImportCache {
// stack traces.
var displayUrl = originalUrl == null
? canonicalUrl
: originalUrl.resolve(pUrl.basename(canonicalUrl.path));
: originalUrl.resolve(p.url.basename(canonicalUrl.path));
return result.isIndented
? new Stylesheet.parseSass(result.contents,
url: displayUrl, logger: _logger)
Expand Down
4 changes: 1 addition & 3 deletions lib/src/callable/async.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import 'dart:async';

import 'package:async/async.dart';

import '../value.dart';
import '../value/external/value.dart' as ext;
import 'async_built_in.dart';
Expand Down Expand Up @@ -34,6 +32,6 @@ abstract class AsyncCallable {
new AsyncBuiltInCallable(name, arguments, (arguments) {
var result = callback(arguments);
if (result is ext.Value) return result as Value;
return DelegatingFuture.typed(result as Future);
return (result as Future).then((value) => value as Value);
});
}
2 changes: 1 addition & 1 deletion lib/src/compile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'dart:async';

import 'package:path/path.dart' as p;
import 'package:source_maps/source_maps.dart';
import 'package:source_span/source_span.dart';

Expand All @@ -16,7 +17,6 @@ import 'importer/node.dart';
import 'io.dart';
import 'logger.dart';
import 'sync_package_resolver.dart';
import 'util/path.dart';
import 'visitor/async_evaluate.dart';
import 'visitor/evaluate.dart';
import 'visitor/serialize.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/executable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:isolate';

import 'package:path/path.dart' as p;
import 'package:stack_trace/stack_trace.dart';

import 'exception.dart';
Expand All @@ -15,7 +16,6 @@ import 'executable/watch.dart';
import 'import_cache.dart';
import 'io.dart';
import 'stylesheet_graph.dart';
import 'util/path.dart';

main(List<String> args) async {
var printedError = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/executable/compile_stylesheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';

import 'package:dart2_constant/convert.dart' as convert;
import 'package:path/path.dart' as p;
import 'package:source_maps/source_maps.dart';

import '../../sass.dart';
Expand All @@ -13,7 +14,6 @@ import '../async_import_cache.dart';
import '../import_cache.dart';
import '../io.dart';
import '../stylesheet_graph.dart';
import '../util/path.dart';
import '../visitor/async_evaluate.dart';
import '../visitor/evaluate.dart';
import '../visitor/serialize.dart';
Expand Down
8 changes: 4 additions & 4 deletions lib/src/executable/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import 'package:args/args.dart';
import 'package:charcode/charcode.dart';
import 'package:collection/collection.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as p;

import '../../sass.dart';
import '../io.dart';
import '../util/character.dart';
import '../util/path.dart';

/// The parsed and processed command-line options for the Sass executable.
///
Expand Down Expand Up @@ -248,7 +248,7 @@ class ExecutableOptions {
}
}
_sourcesToDestinations =
new UnmodifiableMapView(new PathMap.of({source: destination}));
new UnmodifiableMapView(new p.PathMap.of({source: destination}));
}
_sourceDirectoriesToDestinations = const {};
return;
Expand All @@ -260,8 +260,8 @@ class ExecutableOptions {
// to report errors for sources as users entered them, rather than after
// directories have been resolved.
var seen = new Set<String>();
var sourcesToDestinations = new PathMap<String>();
var sourceDirectoriesToDestinations = new PathMap<String>();
var sourcesToDestinations = new p.PathMap<String>();
var sourceDirectoriesToDestinations = new p.PathMap<String>();
for (var argument in _options.rest) {
String source;
String destination;
Expand Down
8 changes: 4 additions & 4 deletions lib/src/executable/watch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:collection';

import 'package:path/path.dart' as p;
import 'package:stack_trace/stack_trace.dart';
import 'package:stream_transform/stream_transform.dart';
import 'package:watcher/watcher.dart';
Expand All @@ -14,7 +15,6 @@ import '../importer/filesystem.dart';
import '../io.dart';
import '../stylesheet_graph.dart';
import '../util/multi_dir_watcher.dart';
import '../util/path.dart';
import 'compile_stylesheet.dart';
import 'options.dart';

Expand Down Expand Up @@ -157,7 +157,7 @@ class _Watcher {
return events
.transform(debounceBuffer(new Duration(milliseconds: 25)))
.expand((buffer) {
var typeForPath = new PathMap<ChangeType>();
var typeForPath = new p.PathMap<ChangeType>();
for (var event in buffer) {
var oldType = typeForPath[event.path];
if (oldType == null) {
Expand All @@ -178,7 +178,7 @@ class _Watcher {
/// necessary.
Future _recompileDownstream(Iterable<StylesheetNode> nodes) async {
var seen = new Set<StylesheetNode>();
var toRecompile = new Queue<StylesheetNode>.from(nodes);
var toRecompile = new Queue.of(nodes);

while (!toRecompile.isEmpty) {
var node = toRecompile.removeFirst();
Expand Down Expand Up @@ -229,7 +229,7 @@ class _Watcher {
for (var node in _graph.nodes.values) {
var importChanged = false;
for (var url in node.upstream.keys) {
if (_name(pUrl.basename(url.path)) != name) continue;
if (_name(p.url.basename(url.path)) != name) continue;
_graph.clearCanonicalize(url);

// If the import produces a different canonicalized URL than it did
Expand Down
24 changes: 14 additions & 10 deletions lib/src/extend/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import '../utils.dart';
///
/// For example, `.foo` is a superselector of `:matches(.foo)`.
final _subselectorPseudos =
new Set<String>.from(['matches', 'any', 'nth-child', 'nth-last-child']);
new Set.of(['matches', 'any', 'nth-child', 'nth-last-child']);

/// Returns the contents of a [SelectorList] that matches only elements that are
/// matched by both [complex1] and [complex2].
Expand Down Expand Up @@ -183,8 +183,8 @@ List<List<ComplexSelectorComponent>> weave(
Iterable<List<ComplexSelectorComponent>> _weaveParents(
List<ComplexSelectorComponent> parents1,
List<ComplexSelectorComponent> parents2) {
var queue1 = new Queue<ComplexSelectorComponent>.from(parents1);
var queue2 = new Queue<ComplexSelectorComponent>.from(parents2);
var queue1 = new Queue.of(parents1);
var queue2 = new Queue.of(parents2);

var initialCombinators = _mergeInitialCombinators(queue1, queue2);
if (initialCombinators == null) return null;
Expand Down Expand Up @@ -316,9 +316,9 @@ List<List<List<ComplexSelectorComponent>>> _mergeFinalCombinators(
// is a supersequence of the other, use that, otherwise give up.
var lcs = longestCommonSubsequence(combinators1, combinators2);
if (listEquals(lcs, combinators1)) {
result.addFirst([new List.from(combinators2.reversed)]);
result.addFirst([new List.of(combinators2.reversed)]);
} else if (listEquals(lcs, combinators2)) {
result.addFirst([new List.from(combinators1.reversed)]);
result.addFirst([new List.of(combinators1.reversed)]);
} else {
return null;
}
Expand Down Expand Up @@ -789,8 +789,12 @@ bool _selectorPseudoIsSuperselector(
/// and that have the given [name].
Iterable<PseudoSelector> _selectorPseudosNamed(
CompoundSelector compound, String name) =>
DelegatingIterable.typed(compound.components.where((simple) =>
simple is PseudoSelector &&
simple.isClass &&
simple.selector != null &&
simple.name == name));
// TODO(nweiz): Use whereType() when we only have to support Dart 2 runtime
// semantics.
compound.components
.where((pseudo) =>
pseudo is PseudoSelector &&
pseudo.isClass &&
pseudo.selector != null &&
pseudo.name == name)
.cast();
6 changes: 3 additions & 3 deletions lib/src/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'value.dart';
final _microsoftFilterStart = new RegExp(r'^[a-zA-Z]+\s*=');

/// Feature names supported by Dart sass.
final _features = new Set<String>.from([
final _features = new Set.of([
"global-variable-shadowing",
"extend-selector-pseudoclass",
"units-level-3",
Expand Down Expand Up @@ -806,13 +806,13 @@ final List<BuiltInCallable> coreFunctions = new UnmodifiableListView([
new BuiltInCallable("map-merge", r"$map1, $map2", (arguments) {
var map1 = arguments[0].assertMap("map1");
var map2 = arguments[1].assertMap("map2");
return new SassMap(new Map.from(map1.contents)..addAll(map2.contents));
return new SassMap(new Map.of(map1.contents)..addAll(map2.contents));
}),

new BuiltInCallable("map-remove", r"$map, $keys...", (arguments) {
var map = arguments[0].assertMap("map");
var keys = arguments[1];
var mutableMap = new Map<Value, Value>.from(map.contents);
var mutableMap = new Map.of(map.contents);
for (var key in keys.asList) {
mutableMap.remove(key);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/import_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
// DO NOT EDIT. This file was generated from async_import_cache.dart.
// See tool/synchronize.dart for details.
//
// Checksum: 411ad1e666d5a138e69b51d9bdb58e9b22e88632
// Checksum: 393366deba2879fc8ca5f538263627e0b77c0bf2

import 'package:path/path.dart' as p;
import 'package:tuple/tuple.dart';

import 'ast/sass.dart';
import 'importer.dart';
import 'logger.dart';
import 'sync_package_resolver.dart';
import 'utils.dart'; // ignore: unused_import
import 'util/path.dart';

/// An in-memory cache of parsed stylesheets that have been imported by Sass.
class ImportCache {
Expand Down Expand Up @@ -145,7 +145,7 @@ class ImportCache {
// stack traces.
var displayUrl = originalUrl == null
? canonicalUrl
: originalUrl.resolve(pUrl.basename(canonicalUrl.path));
: originalUrl.resolve(p.url.basename(canonicalUrl.path));
return result.isIndented
? new Stylesheet.parseSass(result.contents,
url: displayUrl, logger: _logger)
Expand Down
3 changes: 2 additions & 1 deletion lib/src/importer/filesystem.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'package:path/path.dart' as p;

import '../importer.dart';
import '../io.dart' as io;
import '../util/path.dart';
import 'result.dart';
import 'utils.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/src/importer/node/implementation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import 'dart:async';

import 'package:js/js.dart';
import 'package:path/path.dart' as p;
import 'package:tuple/tuple.dart';

import '../../io.dart';
import '../../node/importer_result.dart';
import '../../node/utils.dart';
import '../../util/path.dart';
import '../utils.dart';

typedef _Importer(String url, String prev, [void done(result)]);
Expand Down
3 changes: 2 additions & 1 deletion lib/src/importer/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'package:path/path.dart' as p;

import '../io.dart';
import '../util/path.dart';

/// Resolves an imported path using the same logic as the filesystem importer.
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/io/node.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import 'dart:convert';

import 'package:dart2_constant/convert.dart' as convert;
import 'package:js/js.dart';
import 'package:path/path.dart' as p;
import 'package:source_span/source_span.dart';
import 'package:watcher/watcher.dart';

import '../exception.dart';
import '../node/chokidar.dart';
import '../util/path.dart';

@JS()
class _FS {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/logger/stderr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'package:path/path.dart' as p;
import 'package:source_span/source_span.dart';
import 'package:stack_trace/stack_trace.dart';

import '../io.dart';
import '../logger.dart';
import '../util/path.dart';
import '../utils.dart';

/// A logger that prints warnings to standard error.
Expand Down
Loading