mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-22 13:51:31 +01:00
Update dependencies to null-safe versions
This also replaces package_resolver with package_config, since package_resolver is archived and is incompatible with null-safe Dart packages.
This commit is contained in:
parent
3d39f22cbf
commit
247cb3d816
@ -5,6 +5,7 @@
|
||||
/// We strongly recommend importing this library with the prefix `sass`.
|
||||
library sass;
|
||||
|
||||
import 'package:package_config/package_config_types.dart';
|
||||
import 'package:source_maps/source_maps.dart';
|
||||
|
||||
import 'src/async_import_cache.dart';
|
||||
@ -14,7 +15,6 @@ import 'src/exception.dart';
|
||||
import 'src/import_cache.dart';
|
||||
import 'src/importer.dart';
|
||||
import 'src/logger.dart';
|
||||
import 'src/sync_package_resolver.dart';
|
||||
import 'src/syntax.dart';
|
||||
import 'src/visitor/serialize.dart';
|
||||
|
||||
@ -48,11 +48,11 @@ export 'src/warn.dart' show warn;
|
||||
/// * Each load path specified in the `SASS_PATH` environment variable, which
|
||||
/// should be semicolon-separated on Windows and colon-separated elsewhere.
|
||||
///
|
||||
/// * `package:` resolution using [packageResolver], which is a
|
||||
/// [`SyncPackageResolver`][] from the `package_resolver` package. Note that
|
||||
/// * `package:` resolution using [packageConfig], which is a
|
||||
/// [`PackageConfig`][] from the `package_resolver` package. Note that
|
||||
/// this is a shorthand for adding a [PackageImporter] to [importers].
|
||||
///
|
||||
/// [`SyncPackageResolver`]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html
|
||||
/// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html
|
||||
///
|
||||
/// Dart functions that can be called from Sass may be passed using [functions].
|
||||
/// Each [Callable] defines a top-level function that will be invoked when the
|
||||
@ -90,7 +90,7 @@ String compile(String path,
|
||||
Logger logger,
|
||||
Iterable<Importer> importers,
|
||||
Iterable<String> loadPaths,
|
||||
SyncPackageResolver packageResolver,
|
||||
PackageConfig packageConfig,
|
||||
Iterable<Callable> functions,
|
||||
OutputStyle style,
|
||||
void sourceMap(SingleMapping map),
|
||||
@ -99,9 +99,7 @@ String compile(String path,
|
||||
var result = c.compile(path,
|
||||
logger: logger,
|
||||
importCache: ImportCache(importers,
|
||||
logger: logger,
|
||||
loadPaths: loadPaths,
|
||||
packageResolver: packageResolver),
|
||||
logger: logger, loadPaths: loadPaths, packageConfig: packageConfig),
|
||||
functions: functions,
|
||||
style: style,
|
||||
sourceMap: sourceMap != null,
|
||||
@ -132,11 +130,11 @@ String compile(String path,
|
||||
/// * Each load path specified in the `SASS_PATH` environment variable, which
|
||||
/// should be semicolon-separated on Windows and colon-separated elsewhere.
|
||||
///
|
||||
/// * `package:` resolution using [packageResolver], which is a
|
||||
/// [`SyncPackageResolver`][] from the `package_resolver` package. Note that
|
||||
/// * `package:` resolution using [packageConfig], which is a
|
||||
/// [`PackageConfig`][] from the `package_resolver` package. Note that
|
||||
/// this is a shorthand for adding a [PackageImporter] to [importers].
|
||||
///
|
||||
/// [`SyncPackageResolver`]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html
|
||||
/// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html
|
||||
///
|
||||
/// Dart functions that can be called from Sass may be passed using [functions].
|
||||
/// Each [Callable] defines a top-level function that will be invoked when the
|
||||
@ -178,7 +176,7 @@ String compileString(String source,
|
||||
bool color = false,
|
||||
Logger logger,
|
||||
Iterable<Importer> importers,
|
||||
SyncPackageResolver packageResolver,
|
||||
PackageConfig packageConfig,
|
||||
Iterable<String> loadPaths,
|
||||
Iterable<Callable> functions,
|
||||
OutputStyle style,
|
||||
@ -192,9 +190,7 @@ String compileString(String source,
|
||||
syntax: syntax ?? (indented ? Syntax.sass : Syntax.scss),
|
||||
logger: logger,
|
||||
importCache: ImportCache(importers,
|
||||
logger: logger,
|
||||
packageResolver: packageResolver,
|
||||
loadPaths: loadPaths),
|
||||
logger: logger, packageConfig: packageConfig, loadPaths: loadPaths),
|
||||
functions: functions,
|
||||
style: style,
|
||||
importer: importer,
|
||||
@ -214,7 +210,7 @@ Future<String> compileAsync(String path,
|
||||
{bool color = false,
|
||||
Logger logger,
|
||||
Iterable<AsyncImporter> importers,
|
||||
SyncPackageResolver packageResolver,
|
||||
PackageConfig packageConfig,
|
||||
Iterable<String> loadPaths,
|
||||
Iterable<AsyncCallable> functions,
|
||||
OutputStyle style,
|
||||
@ -223,9 +219,7 @@ Future<String> compileAsync(String path,
|
||||
var result = await c.compileAsync(path,
|
||||
logger: logger,
|
||||
importCache: AsyncImportCache(importers,
|
||||
logger: logger,
|
||||
loadPaths: loadPaths,
|
||||
packageResolver: packageResolver),
|
||||
logger: logger, loadPaths: loadPaths, packageConfig: packageConfig),
|
||||
functions: functions,
|
||||
style: style,
|
||||
sourceMap: sourceMap != null);
|
||||
@ -243,7 +237,7 @@ Future<String> compileStringAsync(String source,
|
||||
bool color = false,
|
||||
Logger logger,
|
||||
Iterable<AsyncImporter> importers,
|
||||
SyncPackageResolver packageResolver,
|
||||
PackageConfig packageConfig,
|
||||
Iterable<String> loadPaths,
|
||||
Iterable<AsyncCallable> functions,
|
||||
OutputStyle style,
|
||||
@ -257,9 +251,7 @@ Future<String> compileStringAsync(String source,
|
||||
syntax: syntax ?? (indented ? Syntax.sass : Syntax.scss),
|
||||
logger: logger,
|
||||
importCache: AsyncImportCache(importers,
|
||||
logger: logger,
|
||||
packageResolver: packageResolver,
|
||||
loadPaths: loadPaths),
|
||||
logger: logger, packageConfig: packageConfig, loadPaths: loadPaths),
|
||||
functions: functions,
|
||||
style: style,
|
||||
importer: importer,
|
||||
|
@ -15,7 +15,6 @@ import 'importer.dart';
|
||||
import 'importer/node.dart';
|
||||
import 'io.dart';
|
||||
import 'logger.dart';
|
||||
import 'sync_package_resolver.dart';
|
||||
import 'syntax.dart';
|
||||
import 'utils.dart';
|
||||
import 'visitor/async_evaluate.dart';
|
||||
@ -77,7 +76,6 @@ Future<CompileResult> compileStringAsync(String source,
|
||||
NodeImporter nodeImporter,
|
||||
Iterable<AsyncImporter> importers,
|
||||
Iterable<String> loadPaths,
|
||||
SyncPackageResolver packageResolver,
|
||||
AsyncImporter importer,
|
||||
Iterable<AsyncCallable> functions,
|
||||
OutputStyle style,
|
||||
|
@ -3,6 +3,7 @@
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:package_config/package_config_types.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
@ -11,7 +12,6 @@ import 'importer.dart';
|
||||
import 'importer/utils.dart';
|
||||
import 'io.dart';
|
||||
import 'logger.dart';
|
||||
import 'sync_package_resolver.dart';
|
||||
import 'utils.dart'; // ignore: unused_import
|
||||
|
||||
/// An in-memory cache of parsed stylesheets that have been imported by Sass.
|
||||
@ -52,16 +52,14 @@ class AsyncImportCache {
|
||||
/// * Each load path specified in the `SASS_PATH` environment variable, which
|
||||
/// should be semicolon-separated on Windows and colon-separated elsewhere.
|
||||
///
|
||||
/// * `package:` resolution using [packageResolver], which is a
|
||||
/// [`SyncPackageResolver`][] from the `package_resolver` package. Note that
|
||||
/// * `package:` resolution using [packageConfig], which is a
|
||||
/// [`PackageConfig`][] from the `package_config` package. Note that
|
||||
/// this is a shorthand for adding a [PackageImporter] to [importers].
|
||||
///
|
||||
/// [`SyncPackageResolver`]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html
|
||||
/// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html
|
||||
AsyncImportCache(Iterable<AsyncImporter> importers,
|
||||
{Iterable<String> loadPaths,
|
||||
SyncPackageResolver packageResolver,
|
||||
Logger logger})
|
||||
: _importers = _toImporters(importers, loadPaths, packageResolver),
|
||||
{Iterable<String> loadPaths, PackageConfig packageConfig, Logger logger})
|
||||
: _importers = _toImporters(importers, loadPaths, packageConfig),
|
||||
_logger = logger ?? const Logger.stderr(),
|
||||
_canonicalizeCache = {},
|
||||
_importCache = {},
|
||||
@ -75,10 +73,10 @@ class AsyncImportCache {
|
||||
_importCache = {},
|
||||
_resultsCache = {};
|
||||
|
||||
/// Converts the user's [importers], [loadPaths], and [packageResolver]
|
||||
/// Converts the user's [importers], [loadPaths], and [packageConfig]
|
||||
/// options into a single list of importers.
|
||||
static List<AsyncImporter> _toImporters(Iterable<AsyncImporter> importers,
|
||||
Iterable<String> loadPaths, SyncPackageResolver packageResolver) {
|
||||
Iterable<String> loadPaths, PackageConfig packageConfig) {
|
||||
var sassPath = getEnvironmentVariable('SASS_PATH');
|
||||
return [
|
||||
...?importers,
|
||||
@ -87,7 +85,7 @@ class AsyncImportCache {
|
||||
if (sassPath != null)
|
||||
for (var path in sassPath.split(isWindows ? ';' : ':'))
|
||||
FilesystemImporter(path),
|
||||
if (packageResolver != null) PackageImporter(packageResolver)
|
||||
if (packageConfig != null) PackageImporter(packageConfig)
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
// DO NOT EDIT. This file was generated from async_compile.dart.
|
||||
// See tool/grind/synchronize.dart for details.
|
||||
//
|
||||
// Checksum: b2cd6037efa37e300daa45ebed20cb4b61526161
|
||||
// Checksum: ef27d750f1d5305373fe9e712cf99697a21e0689
|
||||
//
|
||||
// ignore_for_file: unused_import
|
||||
|
||||
@ -25,7 +25,6 @@ import 'importer.dart';
|
||||
import 'importer/node.dart';
|
||||
import 'io.dart';
|
||||
import 'logger.dart';
|
||||
import 'sync_package_resolver.dart';
|
||||
import 'syntax.dart';
|
||||
import 'utils.dart';
|
||||
import 'visitor/evaluate.dart';
|
||||
@ -87,7 +86,6 @@ CompileResult compileString(String source,
|
||||
NodeImporter nodeImporter,
|
||||
Iterable<Importer> importers,
|
||||
Iterable<String> loadPaths,
|
||||
SyncPackageResolver packageResolver,
|
||||
Importer importer,
|
||||
Iterable<Callable> functions,
|
||||
OutputStyle style,
|
||||
|
@ -5,11 +5,12 @@
|
||||
// DO NOT EDIT. This file was generated from async_import_cache.dart.
|
||||
// See tool/grind/synchronize.dart for details.
|
||||
//
|
||||
// Checksum: 6ac1ee07d6b46134f1616d82782180f1cc3b6d81
|
||||
// Checksum: 31432610e32afefcc7adcda592b811ec50e9b47f
|
||||
//
|
||||
// ignore_for_file: unused_import
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:package_config/package_config_types.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
@ -18,7 +19,6 @@ import 'importer.dart';
|
||||
import 'importer/utils.dart';
|
||||
import 'io.dart';
|
||||
import 'logger.dart';
|
||||
import 'sync_package_resolver.dart';
|
||||
import 'utils.dart'; // ignore: unused_import
|
||||
|
||||
/// An in-memory cache of parsed stylesheets that have been imported by Sass.
|
||||
@ -58,16 +58,14 @@ class ImportCache {
|
||||
/// * Each load path specified in the `SASS_PATH` environment variable, which
|
||||
/// should be semicolon-separated on Windows and colon-separated elsewhere.
|
||||
///
|
||||
/// * `package:` resolution using [packageResolver], which is a
|
||||
/// [`SyncPackageResolver`][] from the `package_resolver` package. Note that
|
||||
/// * `package:` resolution using [packageConfig], which is a
|
||||
/// [`PackageConfig`][] from the `package_config` package. Note that
|
||||
/// this is a shorthand for adding a [PackageImporter] to [importers].
|
||||
///
|
||||
/// [`SyncPackageResolver`]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html
|
||||
/// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html
|
||||
ImportCache(Iterable<Importer> importers,
|
||||
{Iterable<String> loadPaths,
|
||||
SyncPackageResolver packageResolver,
|
||||
Logger logger})
|
||||
: _importers = _toImporters(importers, loadPaths, packageResolver),
|
||||
{Iterable<String> loadPaths, PackageConfig packageConfig, Logger logger})
|
||||
: _importers = _toImporters(importers, loadPaths, packageConfig),
|
||||
_logger = logger ?? const Logger.stderr(),
|
||||
_canonicalizeCache = {},
|
||||
_importCache = {},
|
||||
@ -81,10 +79,10 @@ class ImportCache {
|
||||
_importCache = {},
|
||||
_resultsCache = {};
|
||||
|
||||
/// Converts the user's [importers], [loadPaths], and [packageResolver]
|
||||
/// Converts the user's [importers], [loadPaths], and [packageConfig]
|
||||
/// options into a single list of importers.
|
||||
static List<Importer> _toImporters(Iterable<Importer> importers,
|
||||
Iterable<String> loadPaths, SyncPackageResolver packageResolver) {
|
||||
Iterable<String> loadPaths, PackageConfig packageConfig) {
|
||||
var sassPath = getEnvironmentVariable('SASS_PATH');
|
||||
return [
|
||||
...?importers,
|
||||
@ -93,7 +91,7 @@ class ImportCache {
|
||||
if (sassPath != null)
|
||||
for (var path in sassPath.split(isWindows ? ';' : ':'))
|
||||
FilesystemImporter(path),
|
||||
if (packageResolver != null) PackageImporter(packageResolver)
|
||||
if (packageConfig != null) PackageImporter(packageConfig)
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:package_config/package_config_types.dart';
|
||||
|
||||
import '../importer.dart';
|
||||
import '../sync_package_resolver.dart';
|
||||
|
||||
/// A filesystem importer to use when resolving the results of `package:` URLs.
|
||||
///
|
||||
@ -17,24 +17,24 @@ final _filesystemImporter = FilesystemImporter('.');
|
||||
@sealed
|
||||
class PackageImporter extends Importer {
|
||||
/// The resolver that converts `package:` imports to `file:`.
|
||||
final SyncPackageResolver _packageResolver;
|
||||
final PackageConfig _packageConfig;
|
||||
|
||||
/// Creates an importer that loads stylesheets from `package:` URLs according
|
||||
/// to [packageResolver], which is a [SyncPackageResolver][] from the
|
||||
/// `package_resolver` package.
|
||||
/// to [packageConfig], which is a [PackageConfig][] from the `package_config`
|
||||
/// package.
|
||||
///
|
||||
/// [SyncPackageResolver]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html
|
||||
PackageImporter(this._packageResolver);
|
||||
/// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html
|
||||
PackageImporter(this._packageConfig);
|
||||
|
||||
Uri canonicalize(Uri url) {
|
||||
if (url.scheme == 'file') return _filesystemImporter.canonicalize(url);
|
||||
if (url.scheme != 'package') return null;
|
||||
|
||||
var resolved = _packageResolver.resolveUri(url);
|
||||
var resolved = _packageConfig.resolve(url);
|
||||
if (resolved == null) throw "Unknown package.";
|
||||
|
||||
if (resolved.scheme.isNotEmpty && resolved.scheme != 'file') {
|
||||
throw "Unsupported URL ${resolved}.";
|
||||
throw "Unsupported URL $resolved.";
|
||||
}
|
||||
|
||||
return _filesystemImporter.canonicalize(resolved);
|
||||
|
@ -1,2 +0,0 @@
|
||||
export 'package:package_resolver/package_resolver.dart'
|
||||
if (dart.library.js) 'sync_package_resolver/node.dart';
|
@ -1,15 +0,0 @@
|
||||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
class SyncPackageResolver {
|
||||
static final _error =
|
||||
UnsupportedError('SyncPackageResolver is not supported in JS.');
|
||||
|
||||
static Future<SyncPackageResolver> get current => throw _error;
|
||||
|
||||
Uri resolveUri(Object packageUri) => throw _error;
|
||||
|
||||
factory SyncPackageResolver.config(Map<String, Uri> configMap) =>
|
||||
throw _error;
|
||||
}
|
65
pubspec.yaml
65
pubspec.yaml
@ -12,37 +12,38 @@ environment:
|
||||
sdk: '>=2.6.0 <3.0.0'
|
||||
|
||||
dependencies:
|
||||
args: ">=1.4.0 <3.0.0"
|
||||
async: ">=1.10.0 <3.0.0"
|
||||
charcode: "^1.1.0"
|
||||
cli_repl: ">=0.1.3 <0.3.0"
|
||||
collection: "^1.8.0"
|
||||
meta: "^1.1.7"
|
||||
node_interop: "^1.1.0"
|
||||
js: "^0.6.0"
|
||||
package_resolver: "^1.0.0"
|
||||
path: "^1.6.0"
|
||||
source_maps: "^0.10.5"
|
||||
source_span: "^1.6.0"
|
||||
stack_trace: ">=0.9.0 <2.0.0"
|
||||
stream_transform: ">=0.0.20 <3.0.0"
|
||||
string_scanner: ">=0.1.5 <2.0.0"
|
||||
term_glyph: "^1.0.0"
|
||||
tuple: "^1.0.0"
|
||||
watcher: ">=0.9.6 <2.0.0"
|
||||
args: ^2.0.0
|
||||
async: ^2.5.0
|
||||
charcode: ^1.2.0
|
||||
cli_repl: ^0.2.1-nullsafety
|
||||
collection: ^1.15.0
|
||||
meta: ^1.3.0
|
||||
node_interop: ^2.0.0
|
||||
js: ^0.6.3
|
||||
path: ^1.8.0
|
||||
source_maps: ^0.10.10
|
||||
source_span: ^1.8.1
|
||||
stack_trace: ^1.10.0
|
||||
stream_transform: ^2.0.0
|
||||
string_scanner: ^1.1.0
|
||||
term_glyph: ^1.2.0
|
||||
tuple: ^2.0.0-nullsafety.0
|
||||
watcher: ^1.0.0
|
||||
|
||||
publish_to: none
|
||||
|
||||
dev_dependencies:
|
||||
archive: ">=1.0.0 <3.0.0"
|
||||
analyzer: "^0.40.0"
|
||||
cli_pkg: "^1.1.0"
|
||||
crypto: ">=0.9.2 <3.0.0"
|
||||
dart_style: "^1.2.0"
|
||||
grinder: "^0.8.0"
|
||||
node_preamble: "^1.1.0"
|
||||
pedantic: "^1.0.0"
|
||||
pub_semver: "^1.0.0"
|
||||
stream_channel: ">=1.0.0 <3.0.0"
|
||||
test_descriptor: "^1.1.0"
|
||||
test_process: "^1.0.0-rc.1"
|
||||
test: ">=0.12.42 <2.0.0"
|
||||
yaml: "^2.0.0"
|
||||
archive: ^3.1.2
|
||||
analyzer: ^1.1.0
|
||||
cli_pkg: ^1.3.0
|
||||
crypto: ^3.0.0
|
||||
dart_style: ^2.0.0
|
||||
grinder: ^0.9.0-nullsafety.0
|
||||
node_preamble: ^2.0.0
|
||||
pedantic: ^1.11.0
|
||||
pub_semver: ^2.0.0
|
||||
stream_channel: ^2.1.0
|
||||
test_descriptor: ^2.0.0
|
||||
test_process: ^2.0.0
|
||||
test: ^1.16.7
|
||||
yaml: ^3.1.0
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
@TestOn('vm')
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cli_pkg/testing.dart' as pkg;
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_descriptor/test_descriptor.dart' as d;
|
||||
@ -30,4 +32,4 @@ void ensureSnapshotUpToDate() => pkg.ensureExecutableUpToDate("sass");
|
||||
Future<TestProcess> runSass(Iterable<String> arguments,
|
||||
{Map<String, String> environment}) =>
|
||||
pkg.start("sass", arguments,
|
||||
environment: environment, workingDirectory: d.sandbox);
|
||||
environment: environment, workingDirectory: d.sandbox, encoding: utf8);
|
||||
|
@ -5,6 +5,8 @@
|
||||
@TestOn('vm')
|
||||
@Tags(['node'])
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cli_pkg/testing.dart' as pkg;
|
||||
import 'package:test_process/test_process.dart';
|
||||
import 'package:test_descriptor/test_descriptor.dart' as d;
|
||||
@ -31,4 +33,7 @@ void main() {
|
||||
Future<TestProcess> runSass(Iterable<String> arguments,
|
||||
{Map<String, String> environment}) =>
|
||||
pkg.start("sass", arguments,
|
||||
environment: environment, workingDirectory: d.sandbox, node: true);
|
||||
environment: environment,
|
||||
workingDirectory: d.sandbox,
|
||||
encoding: utf8,
|
||||
node: true);
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
@TestOn('vm')
|
||||
|
||||
import 'package:package_resolver/package_resolver.dart';
|
||||
import 'package:package_config/package_config.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_descriptor/test_descriptor.dart' as d;
|
||||
@ -93,10 +93,10 @@ void main() {
|
||||
await d
|
||||
.file("test.scss", '@import "package:fake_package/test";')
|
||||
.create();
|
||||
var resolver = SyncPackageResolver.config(
|
||||
{"fake_package": p.toUri(d.path('subdir'))});
|
||||
var config =
|
||||
PackageConfig([Package('fake_package', p.toUri(d.path('subdir/')))]);
|
||||
|
||||
var css = compile(d.path("test.scss"), packageResolver: resolver);
|
||||
var css = compile(d.path("test.scss"), packageConfig: config);
|
||||
expect(css, equals("a {\n b: 3;\n}"));
|
||||
});
|
||||
|
||||
@ -109,10 +109,10 @@ void main() {
|
||||
await d
|
||||
.file("test.scss", '@import "package:fake_package/test";')
|
||||
.create();
|
||||
var resolver = SyncPackageResolver.config(
|
||||
{"fake_package": p.toUri(d.path('subdir'))});
|
||||
var config =
|
||||
PackageConfig([Package('fake_package', p.toUri(d.path('subdir/')))]);
|
||||
|
||||
var css = compile(d.path("test.scss"), packageResolver: resolver);
|
||||
var css = compile(d.path("test.scss"), packageConfig: config);
|
||||
expect(css, equals("a {\n b: 3;\n}"));
|
||||
});
|
||||
|
||||
@ -120,9 +120,9 @@ void main() {
|
||||
await d
|
||||
.file("test.scss", '@import "package:fake_package/test_aux";')
|
||||
.create();
|
||||
var resolver = SyncPackageResolver.config({});
|
||||
|
||||
expect(() => compile(d.path("test.scss"), packageResolver: resolver),
|
||||
expect(
|
||||
() => compile(d.path("test.scss"), packageConfig: PackageConfig([])),
|
||||
throwsA(const TypeMatcher<SassRuntimeException>()));
|
||||
});
|
||||
});
|
||||
@ -166,9 +166,9 @@ void main() {
|
||||
expect(css, equals("a {\n b: from-importer;\n}"));
|
||||
});
|
||||
|
||||
test("importers take precedence over packageResolver", () async {
|
||||
test("importers take precedence over packageConfig", () async {
|
||||
await d.dir("package",
|
||||
[d.file("other.scss", "a {b: from-package-resolver}")]).create();
|
||||
[d.file("other.scss", "a {b: from-package-config}")]).create();
|
||||
await d.dir(
|
||||
"importer", [d.file("other.scss", "a {b: from-importer}")]).create();
|
||||
await d
|
||||
@ -177,11 +177,11 @@ void main() {
|
||||
|
||||
var css = compile(d.path("test.scss"),
|
||||
importers: [
|
||||
PackageImporter(SyncPackageResolver.config(
|
||||
{"fake_package": p.toUri(d.path('importer'))}))
|
||||
PackageImporter(PackageConfig(
|
||||
[Package('fake_package', p.toUri(d.path('importer/')))]))
|
||||
],
|
||||
packageResolver: SyncPackageResolver.config(
|
||||
{"fake_package": p.toUri(d.path('package'))}));
|
||||
packageConfig: PackageConfig(
|
||||
[Package('fake_package', p.toUri(d.path('package/')))]));
|
||||
expect(css, equals("a {\n b: from-importer;\n}"));
|
||||
});
|
||||
});
|
||||
|
@ -44,7 +44,7 @@ void main() {
|
||||
var changelogVersion = firstLine.substring(3);
|
||||
|
||||
var pubspec = loadYaml(File("pubspec.yaml").readAsStringSync(),
|
||||
sourceUrl: "pubspec.yaml") as Map<Object, Object>;
|
||||
sourceUrl: Uri(path: "pubspec.yaml")) as Map<dynamic, dynamic>;
|
||||
expect(pubspec, containsPair("version", isA<String>()));
|
||||
var pubspecVersion = pubspec["version"] as String;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user