Skip to content

Commit ab19f94

Browse files
authored
Deprecate @import and global builtins (#2282)
1 parent f7b2e63 commit ab19f94

23 files changed

+255
-204
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 1.80.0
2+
3+
* `@import` is now officially deprecated, as are global built-in functions that
4+
are available within built-in modules. See [the Sass blog post] for more
5+
details on the deprecation process.
6+
7+
[the Sass blog post]: https://sass-lang.com/blog/import-is-deprecated/
8+
9+
### Embedded Host
10+
11+
* Fix an error that would sometimes occur when deprecation warnings were
12+
emitted when using a custom importer with the legacy API.
13+
114
## 1.79.6
215

316
* Fix a bug where Sass would add an extra `*/` after loud comments with

lib/src/callable/async_built_in.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ class AsyncBuiltInCallable implements AsyncCallable {
9999
/// available as function [name] in built-in module [module].
100100
void warnForGlobalBuiltIn(String module, String name) {
101101
warnForDeprecation(
102-
'Global built-in functions will be deprecated in the future.\n'
103-
'Remove the --future-deprecation=global-builtin flag to silence this '
104-
'warning for now.',
102+
'Global built-in functions are deprecated and will be removed in Dart '
103+
'Sass 3.0.0.\n'
104+
'Use $module.$name instead.\n\n'
105+
'More info and automated migrator: https://sass-lang.com/d/import',
105106
Deprecation.globalBuiltin);
106107
}

lib/src/deprecation.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum Deprecation {
1515
// DO NOT EDIT. This section was generated from the language repo.
1616
// See tool/grind/generate_deprecations.dart for details.
1717
//
18-
// Checksum: 0243e0f7ee85127d6e1bda5c08e363509959e758
18+
// Checksum: 47c97f7824eb25d7f1e64e3230938b88330d40b4
1919

2020
/// Deprecation for passing a string directly to meta.call().
2121
callString('call-string',
@@ -114,10 +114,11 @@ enum Deprecation {
114114
deprecatedIn: '1.79.0', description: 'Legacy JS API.'),
115115

116116
/// Deprecation for @import rules.
117-
import.future('import', description: '@import rules.'),
117+
import('import', deprecatedIn: '1.80.0', description: '@import rules.'),
118118

119119
/// Deprecation for global built-in functions that are available in sass: modules.
120-
globalBuiltin.future('global-builtin',
120+
globalBuiltin('global-builtin',
121+
deprecatedIn: '1.80.0',
121122
description:
122123
'Global built-in functions that are available in sass: modules.'),
123124

lib/src/parse/stylesheet.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,9 +1057,9 @@ abstract class StylesheetParser extends Parser {
10571057
if (argument is DynamicImport) {
10581058
logger.warnForDeprecation(
10591059
Deprecation.import,
1060-
'Sass @import rules will be deprecated in the future.\n'
1061-
'Remove the --future-deprecation=import flag to silence this '
1062-
'warning for now.',
1060+
'Sass @import rules are deprecated and will be removed in Dart '
1061+
'Sass 3.0.0.\n\n'
1062+
'More info and automated migrator: https://sass-lang.com/d/import',
10631063
span: argument.span);
10641064
}
10651065
if ((_inControlDirective || _inMixin) && argument is DynamicImport) {

pkg/sass-parser/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.0
2+
3+
* No user-visible changes.
4+
15
## 0.2.6
26

37
* No user-visible changes.

pkg/sass-parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sass-parser",
3-
"version": "0.2.6",
3+
"version": "0.3.0",
44
"description": "A PostCSS-compatible wrapper of the official Sass parser",
55
"repository": "sass/sass",
66
"author": "Google Inc.",

pkg/sass_api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 13.1.0
2+
3+
* No user-visible changes.
4+
15
## 13.0.1
26

37
* Fix a bug where `LoudComment`s parsed from the indented syntax would include

pkg/sass_api/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 13.0.1
5+
version: 13.1.0
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: ">=3.0.0 <4.0.0"
1111

1212
dependencies:
13-
sass: 1.79.6
13+
sass: 1.80.0
1414

1515
dev_dependencies:
1616
dartdoc: ^8.0.14

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.79.6
2+
version: 1.80.0
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

test/cli/dart/errors_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ void main() {
1616
sharedTests(runSass);
1717

1818
test("for package urls", () async {
19-
await d.file("test.scss", "@import 'package:nope/test';").create();
19+
await d.file("test.scss", "@use 'package:nope/test';").create();
2020

2121
var sass = await runSass(["--no-unicode", "test.scss"]);
2222
expect(
2323
sass.stderr,
2424
emitsInOrder([
2525
"Error: Can't find stylesheet to import.",
2626
" ,",
27-
"1 | @import 'package:nope/test';",
28-
" | ^^^^^^^^^^^^^^^^^^^",
27+
"1 | @use 'package:nope/test';",
28+
" | ^^^^^^^^^^^^^^^^^^^^^^^^",
2929
" '",
30-
" test.scss 1:9 root stylesheet"
30+
" test.scss 1:1 root stylesheet"
3131
]));
3232
await sass.shouldExit(65);
3333
});

0 commit comments

Comments
 (0)