mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-27 04:34:59 +01:00
parent
9621979b71
commit
495c6f3163
@ -2,6 +2,8 @@
|
||||
|
||||
* Fix importing files relative to `package:`-imported files.
|
||||
|
||||
* Don't claim that "package:" URLs aren't supported when they actually are.
|
||||
|
||||
### Dart API
|
||||
|
||||
* Explicitly require that importers' `canonicalize()` methods be able to take
|
||||
|
@ -27,6 +27,7 @@ import '../extend/extender.dart';
|
||||
import '../importer.dart';
|
||||
import '../importer/node.dart';
|
||||
import '../importer/utils.dart';
|
||||
import '../io.dart';
|
||||
import '../logger.dart';
|
||||
import '../parse/keyframe_selector.dart';
|
||||
import '../syntax.dart';
|
||||
@ -851,7 +852,7 @@ class _EvaluateVisitor
|
||||
if (tuple != null) return tuple;
|
||||
}
|
||||
|
||||
if (url.startsWith('package:')) {
|
||||
if (url.startsWith('package:') && isNode) {
|
||||
// Special-case this error message, since it's tripped people up in the
|
||||
// past.
|
||||
throw "\"package:\" URLs aren't supported on this platform.";
|
||||
|
@ -5,7 +5,7 @@
|
||||
// DO NOT EDIT. This file was generated from async_evaluate.dart.
|
||||
// See tool/synchronize.dart for details.
|
||||
//
|
||||
// Checksum: be2d44a3dc50defd98446d806b4c21bfe54a4ba9
|
||||
// Checksum: e7642c8d4c838f0afe94b882794e81b0937ba1a1
|
||||
//
|
||||
// ignore_for_file: unused_import
|
||||
|
||||
@ -36,6 +36,7 @@ import '../extend/extender.dart';
|
||||
import '../importer.dart';
|
||||
import '../importer/node.dart';
|
||||
import '../importer/utils.dart';
|
||||
import '../io.dart';
|
||||
import '../logger.dart';
|
||||
import '../parse/keyframe_selector.dart';
|
||||
import '../syntax.dart';
|
||||
@ -851,7 +852,7 @@ class _EvaluateVisitor
|
||||
if (tuple != null) return tuple;
|
||||
}
|
||||
|
||||
if (url.startsWith('package:')) {
|
||||
if (url.startsWith('package:') && isNode) {
|
||||
// Special-case this error message, since it's tripped people up in the
|
||||
// past.
|
||||
throw "\"package:\" URLs aren't supported on this platform.";
|
||||
|
@ -5,6 +5,7 @@
|
||||
@TestOn('vm')
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_descriptor/test_descriptor.dart' as d;
|
||||
|
||||
import '../dart_test.dart';
|
||||
import '../shared/errors.dart';
|
||||
@ -12,4 +13,21 @@ import '../shared/errors.dart';
|
||||
void main() {
|
||||
setUpAll(ensureSnapshotUpToDate);
|
||||
sharedTests(runSass);
|
||||
|
||||
test("for package urls", () async {
|
||||
await d.file("test.scss", "@import 'package:nope/test';").create();
|
||||
|
||||
var sass = await runSass(["--no-unicode", "test.scss"]);
|
||||
expect(
|
||||
sass.stderr,
|
||||
emitsInOrder([
|
||||
"Error: Can't find stylesheet to import.",
|
||||
" ,",
|
||||
"1 | @import 'package:nope/test';",
|
||||
" | ^^^^^^^^^^^^^^^^^^^",
|
||||
" '",
|
||||
" test.scss 1:9 root stylesheet"
|
||||
]));
|
||||
await sass.shouldExit(65);
|
||||
});
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
@Tags(['node'])
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_descriptor/test_descriptor.dart' as d;
|
||||
|
||||
import '../../ensure_npm_package.dart';
|
||||
import '../node_test.dart';
|
||||
@ -14,4 +15,21 @@ import '../shared/errors.dart';
|
||||
void main() {
|
||||
setUpAll(ensureNpmPackage);
|
||||
sharedTests(runSass);
|
||||
|
||||
test("for package urls", () async {
|
||||
await d.file("test.scss", "@import 'package:nope/test';").create();
|
||||
|
||||
var sass = await runSass(["--no-unicode", "test.scss"]);
|
||||
expect(
|
||||
sass.stderr,
|
||||
emitsInOrder([
|
||||
"Error: \"package:\" URLs aren't supported on this platform.",
|
||||
" ,",
|
||||
"1 | @import 'package:nope/test';",
|
||||
" | ^^^^^^^^^^^^^^^^^^^",
|
||||
" '",
|
||||
" test.scss 1:9 root stylesheet"
|
||||
]));
|
||||
await sass.shouldExit(65);
|
||||
});
|
||||
}
|
||||
|
@ -113,21 +113,4 @@ void sharedTests(Future<TestProcess> runSass(Iterable<String> arguments)) {
|
||||
expect(sass.stderr, emitsThrough(contains("\.dart")));
|
||||
await sass.shouldExit(65);
|
||||
});
|
||||
|
||||
test("for package urls", () async {
|
||||
await d.file("test.scss", "@import 'package:nope/test';").create();
|
||||
|
||||
var sass = await runSass(["--no-unicode", "test.scss"]);
|
||||
expect(
|
||||
sass.stderr,
|
||||
emitsInOrder([
|
||||
"Error: \"package:\" URLs aren't supported on this platform.",
|
||||
" ,",
|
||||
"1 | @import 'package:nope/test';",
|
||||
" | ^^^^^^^^^^^^^^^^^^^",
|
||||
" '",
|
||||
" test.scss 1:9 root stylesheet"
|
||||
]));
|
||||
await sass.shouldExit(65);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user