Skip to content

Commit 9b54325

Browse files
authoredSep 26, 2024··
fix: ignore sass deprecation warning (#657)
Quick fix for now, in the mid term we should add proper support for the new API fixes #656
1 parent 9d49f3d commit 9b54325

File tree

3 files changed

+36
-50
lines changed

3 files changed

+36
-50
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"postcss-load-config": "^3.1.4",
7878
"prettier": "^3.3.2",
7979
"pug": "^3.0.2",
80-
"sass": "^1.56.2",
80+
"sass": "^1.79.3",
8181
"stylus": "^0.55.0",
8282
"sugarss": "^4.0.0",
8383
"svelte": "^4.0.0",

‎pnpm-lock.yaml

+26-48
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/transformers/scss.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,24 @@ const tildeImporter: LegacySyncImporter = (url, prev) => {
3333
return { contents };
3434
};
3535

36+
const infoRegex = /dart-sass\s(\d+)\.(\d+)\.(\d+)/;
37+
3638
const transformer: Transformer<Options.Sass> = async ({
3739
content,
3840
filename,
3941
options = {},
4042
}) => {
41-
const { renderSync } = await import('sass');
43+
const { renderSync, info } = await import('sass');
4244

4345
const { prependData, ...restOptions } = options;
46+
const match = info.match(infoRegex) ?? [0, 0, 0, 0];
47+
const [_, major, minor] = match.map(Number);
4448
const sassOptions: LegacyStringOptions<'sync'> = {
4549
...restOptions,
50+
silenceDeprecations:
51+
major >= 1 && minor >= 79
52+
? ['legacy-js-api', ...(restOptions.silenceDeprecations || [])]
53+
: undefined,
4654
includePaths: getIncludePaths(filename, options.includePaths),
4755
sourceMap: true,
4856
sourceMapEmbed: false,

0 commit comments

Comments
 (0)
Please sign in to comment.