-
Notifications
You must be signed in to change notification settings - Fork 354
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
Complete implementation the deprecations API #2207
Changes from 8 commits
92d899a
ded1a32
bff24d8
8424aa8
3efd6e7
69b003a
b679a4a
1f445a5
5cb6bc0
aa37f3f
ae664f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,38 @@ | ||
## 1.74.0 | ||
|
||
### JS API | ||
|
||
* The deprecations API is now available in the JS API! The `compile` methods | ||
support the same `fatalDeprecations` and `futureDeprecations` options that | ||
were already available in the Dart API and the CLI, as well as a new | ||
`silenceDeprecations` option that allows you to silence deprecation warnings | ||
of a given type. | ||
|
||
### Command-Line Interface | ||
|
||
* Add a new `--silence-deprecation` flag to match the new JS API. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, although to a lesser extent, the CLI users are a somewhat different set than the JS API users. Better to keep the CLI descriptions as self-contained as possible—it's less net effort for us to duplicate some prose than for a bunch of readers to read extra paragraphs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
* Previously, if a future deprecation was passed to `--fatal-deprecation` but | ||
not `--future-deprecation`, it would be treated as fatal despite not being | ||
enabled. Both flags are now required to treat a future deprecation as fatal | ||
with a warning emitted if `--fatal-deprecation` is passed without | ||
`--future-deprecation`, matching the JS API's behavior. | ||
|
||
### Dart API | ||
|
||
* The `compile` methods now take in a `silenceDeprecations` parameter to match | ||
the JS API. | ||
|
||
* Add `Deprecation.obsoleteIn` to match the JS API. This is currently null for | ||
all deprecations, but will be used once some deprecations become obsolete in | ||
Dart Sass 2.0.0. | ||
|
||
* Fix a bug where `compileStringToResultAsync` ignored `fatalDeprecations` and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd mark this as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
`futureDeprecations`. | ||
|
||
* The behavior around making future deprecations fatal mentioned in the CLI | ||
section above has also been changed in the Dart API. | ||
|
||
## 1.73.0 | ||
|
||
* Add support for nesting in plain CSS files. This is not processed by Sass at | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,14 @@ final class ExecutableOptions { | |
"Stylesheets imported through load paths count as dependencies.") | ||
..addFlag('verbose', | ||
help: "Print all deprecation warnings even when they're repetitive.") | ||
..addMultiOption('silence-deprecation', | ||
help: 'Deprecations to ignore.', | ||
allowedHelp: { | ||
for (var deprecation in Deprecation.values) | ||
if (deprecation.deprecatedIn != null && | ||
deprecation.description != null) | ||
deprecation.id: deprecation.description!, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
}) | ||
..addMultiOption('fatal-deprecation', | ||
help: 'Deprecations to treat as errors. You may also pass a Sass\n' | ||
'version to include any behavior deprecated in or before it.\n' | ||
|
@@ -521,6 +529,12 @@ final class ExecutableOptions { | |
: p.absolute(path)); | ||
} | ||
|
||
/// The set of deprecations whose warnings should be silenced. | ||
Set<Deprecation> get silenceDeprecations => { | ||
for (var id in _options['silence-deprecation'] as List<String>) | ||
Deprecation.fromId(id) ?? _fail('Invalid deprecation "$id".') | ||
}; | ||
|
||
/// The set of deprecations that cause errors. | ||
Set<Deprecation> get fatalDeprecations => _fatalDeprecations ??= () { | ||
var deprecations = <Deprecation>{}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a fair bet that most JS API users don't know or follow the Dart API, so it's probably better to frame this as adding three new features to the JS API rather than bringing two from the Dart API and adding one new
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done