diff --git a/CHANGELOG.md b/CHANGELOG.md index 03a033cbe..e7250d48b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -170,6 +170,12 @@ ### JS API +* While the legacy API has been deprecated since we released the modern API, we + now emit warnings when the legacy API is used to make sure users are aware + that it will be removed in Dart Sass 2.0.0. In the meantime, you can silence + these warnings by passing `legacy-js-api` in `silenceDeprecations` when using + the legacy API. + * Modify `SassColor` to accept a new `space` option, with support for all the new color spaces defined in Color Level 4. diff --git a/lib/src/async_compile.dart b/lib/src/async_compile.dart index 6598fcb57..78d3e3256 100644 --- a/lib/src/async_compile.dart +++ b/lib/src/async_compile.dart @@ -159,6 +159,12 @@ Future _compileStylesheet( bool quietDeps, bool sourceMap, bool charset) async { + if (nodeImporter != null) { + logger?.warnForDeprecation( + Deprecation.legacyJsApi, + 'The legacy JS API is deprecated and will be removed in ' + 'Dart Sass 2.0.0.'); + } var evaluateResult = await evaluateAsync(stylesheet, importCache: importCache, nodeImporter: nodeImporter, diff --git a/lib/src/compile.dart b/lib/src/compile.dart index 64f102566..b0132f3af 100644 --- a/lib/src/compile.dart +++ b/lib/src/compile.dart @@ -5,7 +5,7 @@ // DO NOT EDIT. This file was generated from async_compile.dart. // See tool/grind/synchronize.dart for details. // -// Checksum: 4d72aeb3c39a2e607d1889755e07b7e489eddfa6 +// Checksum: 4141eec2214ef480b6fdf07e5090202cdea3eb89 // // ignore_for_file: unused_import @@ -168,6 +168,12 @@ CompileResult _compileStylesheet( bool quietDeps, bool sourceMap, bool charset) { + if (nodeImporter != null) { + logger?.warnForDeprecation( + Deprecation.legacyJsApi, + 'The legacy JS API is deprecated and will be removed in ' + 'Dart Sass 2.0.0.'); + } var evaluateResult = evaluate(stylesheet, importCache: importCache, nodeImporter: nodeImporter, diff --git a/lib/src/deprecation.dart b/lib/src/deprecation.dart index 097ece323..ca50b3261 100644 --- a/lib/src/deprecation.dart +++ b/lib/src/deprecation.dart @@ -15,7 +15,7 @@ enum Deprecation { // DO NOT EDIT. This section was generated from the language repo. // See tool/grind/generate_deprecations.dart for details. // - // Checksum: 5470e7252641d3eaa7093b072b52e423c3b77375 + // Checksum: 0243e0f7ee85127d6e1bda5c08e363509959e758 /// Deprecation for passing a string directly to meta.call(). callString('call-string', @@ -109,6 +109,10 @@ enum Deprecation { deprecatedIn: '1.79.0', description: 'Using global color functions instead of sass:color.'), + /// Deprecation for legacy JS API. + legacyJsApi('legacy-js-api', + deprecatedIn: '1.79.0', description: 'Legacy JS API.'), + /// Deprecation for @import rules. import.future('import', description: '@import rules.'),