Skip to content

Commit bdc08fd

Browse files
authored
Merge pull request #2246 from sass/deprecation-cli
Fix deprecation flags in the CLI and add tests
2 parents 54a6dec + 9a9e483 commit bdc08fd

10 files changed

+570
-7
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 1.77.2
2+
3+
### Command-Line Interface
4+
5+
* Properly handle the `--silence-deprecation` flag.
6+
7+
* Handle the `--fatal-deprecation` and `--future-deprecation` flags for
8+
`--interactive` mode.
9+
110
## 1.77.1
211

312
* Fix a crash that could come up with importers in certain contexts.

lib/src/executable/compile_stylesheet.dart

+4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Future<void> _compileStylesheetWithoutErrorHandling(ExecutableOptions options,
110110
verbose: options.verbose,
111111
sourceMap: options.emitSourceMap,
112112
charset: options.charset,
113+
silenceDeprecations: options.silenceDeprecations,
113114
fatalDeprecations: options.fatalDeprecations,
114115
futureDeprecations: options.futureDeprecations)
115116
: await compileAsync(source,
@@ -121,6 +122,7 @@ Future<void> _compileStylesheetWithoutErrorHandling(ExecutableOptions options,
121122
verbose: options.verbose,
122123
sourceMap: options.emitSourceMap,
123124
charset: options.charset,
125+
silenceDeprecations: options.silenceDeprecations,
124126
fatalDeprecations: options.fatalDeprecations,
125127
futureDeprecations: options.futureDeprecations);
126128
} else {
@@ -135,6 +137,7 @@ Future<void> _compileStylesheetWithoutErrorHandling(ExecutableOptions options,
135137
verbose: options.verbose,
136138
sourceMap: options.emitSourceMap,
137139
charset: options.charset,
140+
silenceDeprecations: options.silenceDeprecations,
138141
fatalDeprecations: options.fatalDeprecations,
139142
futureDeprecations: options.futureDeprecations)
140143
: compile(source,
@@ -146,6 +149,7 @@ Future<void> _compileStylesheetWithoutErrorHandling(ExecutableOptions options,
146149
verbose: options.verbose,
147150
sourceMap: options.emitSourceMap,
148151
charset: options.charset,
152+
silenceDeprecations: options.silenceDeprecations,
149153
fatalDeprecations: options.fatalDeprecations,
150154
futureDeprecations: options.futureDeprecations);
151155
}

lib/src/executable/repl.dart

+9-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import '../exception.dart';
1212
import '../executable/options.dart';
1313
import '../import_cache.dart';
1414
import '../importer/filesystem.dart';
15+
import '../logger/deprecation_processing.dart';
1516
import '../logger/tracking.dart';
1617
import '../parse/parser.dart';
1718
import '../utils.dart';
@@ -20,7 +21,12 @@ import '../visitor/evaluate.dart';
2021
/// Runs an interactive SassScript shell according to [options].
2122
Future<void> repl(ExecutableOptions options) async {
2223
var repl = Repl(prompt: '>> ');
23-
var logger = TrackingLogger(options.logger);
24+
var trackingLogger = TrackingLogger(options.logger);
25+
var logger = DeprecationProcessingLogger(trackingLogger,
26+
silenceDeprecations: options.silenceDeprecations,
27+
fatalDeprecations: options.fatalDeprecations,
28+
futureDeprecations: options.futureDeprecations,
29+
limitRepetition: !options.verbose);
2430
var evaluator = Evaluator(
2531
importer: FilesystemImporter.cwd,
2632
importCache: ImportCache(
@@ -46,8 +52,8 @@ Future<void> repl(ExecutableOptions options) async {
4652
print(evaluator.evaluate(Expression.parse(line, logger: logger)));
4753
}
4854
} on SassException catch (error, stackTrace) {
49-
_logError(
50-
error, getTrace(error) ?? stackTrace, line, repl, options, logger);
55+
_logError(error, getTrace(error) ?? stackTrace, line, repl, options,
56+
trackingLogger);
5157
}
5258
}
5359
}

pkg/sass_api/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 10.4.2
2+
3+
* No user-visible changes.
4+
15
## 10.4.1
26

37
* No user-visible changes.

pkg/sass_api/pubspec.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ 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: 10.4.1
5+
version: 10.4.2
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.77.1
13+
sass: 1.77.2
1414

1515
dev_dependencies:
16-
dartdoc: ^6.0.0
16+
dartdoc: ">=6.0.0 <9.0.0"
1717

1818
dependency_overrides:
1919
sass: { path: ../.. }

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.77.1
2+
version: 1.77.2
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

test/cli/dart/deprecations_test.dart

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2024 Google Inc. Use of this source code is governed by an
2+
// MIT-style license that can be found in the LICENSE file or at
3+
// https://opensource.org/licenses/MIT.
4+
5+
@TestOn('vm')
6+
7+
import 'package:test/test.dart';
8+
9+
import '../dart_test.dart';
10+
import '../shared/deprecations.dart';
11+
12+
void main() {
13+
setUpAll(ensureSnapshotUpToDate);
14+
sharedTests(runSass);
15+
}

test/cli/node/deprecations_test.dart

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2024 Google Inc. Use of this source code is governed by an
2+
// MIT-style license that can be found in the LICENSE file or at
3+
// https://opensource.org/licenses/MIT.
4+
5+
@TestOn('vm')
6+
@Tags(['node'])
7+
8+
import 'package:test/test.dart';
9+
10+
import '../../ensure_npm_package.dart';
11+
import '../node_test.dart';
12+
import '../shared/deprecations.dart';
13+
14+
void main() {
15+
setUpAll(ensureNpmPackage);
16+
sharedTests(runSass);
17+
}

0 commit comments

Comments
 (0)