diff --git a/source/_includes/deprecations.liquid b/source/_includes/deprecations.liquid new file mode 100644 index 000000000..655aec892 --- /dev/null +++ b/source/_includes/deprecations.liquid @@ -0,0 +1,33 @@ +{%- if deprecations.size == 0 -%} +

There are no {{status}} deprecations in the latest version of Dart Sass.

+{%- else -%} +

The following deprecation IDs can be passed to this option:

+ + + + + + {%- if status == "active" -%}{%- endif -%} + + + + +{%- for deprecation in deprecations -%} + + + {%- if status == "active" -%} + + {%- endif -%} + + +{%- endfor -%} + +
IDVersionDescription
+ {%- if deprecation.hasWebpage -%} + + {%- endif -%} + {{deprecation.id}} + {%-if deprecation.hasWebpage -%}{%- endif -%} + {{deprecation.deprecatedIn}}{{deprecation.description}}
+{%- endif -%} + diff --git a/source/documentation/cli/dart-sass.md b/source/documentation/cli/dart-sass.md index b7dfe35eb..c116c9fcb 100644 --- a/source/documentation/cli/dart-sass.md +++ b/source/documentation/cli/dart-sass.md @@ -478,79 +478,7 @@ Remove this setting if you need to keep using this feature. style.scss 1:9 root stylesheet ``` -The following deprecation IDs can be passed to this option: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IDVersionDescription
call-string0.0.0Passing a string directly to meta.call().
elseif1.3.2Using @elseif instead of @else if.
moz-document1.7.2Using @-moz-document (except for the empty url prefix hack).
new-global1.17.2Declaring new variables with !global.
color-module-compat1.23.0Using color module functions in place of plain CSS functions.
slash-div1.33.0Using the / operator for division.
bogus-combinators1.54.0Leading, trailing, and repeated combinators.
strict-unary1.55.0Ambiguous + and - operators.
function-units1.56.0Passing invalid units to built-in functions.
duplicate-var-flags1.62.0Using multiple copies of !global or !default in a single variable declaration.
abs-percent1.65.0Passing percentages to the Sass abs() function.
fs-importer-cwd1.73.0Using the current working directory as an implicit load path.
+{% deprecations 'active' %}{% enddeprecations %} Alternatively, you can pass a Dart Sass version to treat all deprecations that were present in that version as errors. For example, @@ -567,9 +495,6 @@ early, emitting warnings even though the deprecation is not yet active. This option can be combined with `--fatal-deprecation` to emit errors instead of warnings for a future deprecation. -The only currently available future deprecation type is `import`, as seen -here: - ```shellsession $ sass --future-deprecation=import style.scss style.css Deprecation Warning on line 1, column 9 of style.scss: @@ -581,6 +506,8 @@ Remove the --future-deprecation=import flag to silence this warning for now. ╵ ``` +{% deprecations 'future' %}{% enddeprecations %} + #### `--silence-deprecation` {% compatibility 'dart: "1.74.0"' %}{% endcompatibility %} diff --git a/source/helpers/components/deprecations.ts b/source/helpers/components/deprecations.ts new file mode 100644 index 000000000..eec80ce04 --- /dev/null +++ b/source/helpers/components/deprecations.ts @@ -0,0 +1,30 @@ +import fs from 'node:fs'; +import sass from 'sass'; + +import {liquidEngine} from '../engines'; + +/** + * Renders a table of deprecations with the given status. + */ +export default async function deprecations( + _: string, + status: 'active' | 'future' +) { + const deprecations = []; + for (const [id, deprecation] of Object.entries(sass.deprecations)) { + if (deprecation.status === status) { + deprecations.push({ + id: id, + deprecatedIn: deprecation.deprecatedIn, + description: deprecation.description, + hasWebpage: fs.existsSync( + `source/documentation/breaking-changes/${id}.md` + ), + }); + } + } + return liquidEngine.renderFile('deprecations', { + deprecations, + status, + }); +} diff --git a/source/helpers/components/index.ts b/source/helpers/components/index.ts index 7e945e2fe..ae85ddcef 100644 --- a/source/helpers/components/index.ts +++ b/source/helpers/components/index.ts @@ -5,10 +5,12 @@ import {liquidEngine} from '../engines'; import {stripIndent} from '../type'; import {default as codeExample} from './codeExample'; import {compatibility, implStatus} from './compatibility'; +import {default as deprecations} from './deprecations'; import {getDocTocData, getToc} from './toc'; export {codeExample}; export {compatibility, implStatus}; +export {deprecations}; export {getDocTocData, getToc}; /** @@ -69,6 +71,7 @@ export default function componentsPlugin(eleventyConfig: any) { // In the meantime, check the order in the function definition of // `compatibility` in `source/helpers/components/compatibility.ts`. eleventyConfig.addPairedLiquidShortcode('compatibility', compatibility); + eleventyConfig.addPairedLiquidShortcode('deprecations', deprecations); eleventyConfig.addPairedLiquidShortcode('funFact', funFact); eleventyConfig.addPairedLiquidShortcode('headsUp', headsUp); }