-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathsass-quiet.js
More file actions
31 lines (25 loc) · 1.16 KB
/
sass-quiet.js
File metadata and controls
31 lines (25 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Wrapper around sass to suppress legacy-js-api deprecation warnings
// Should be removed when sass-preprocessor is upgraded to the version that works with modern sass api
// Install the stderr filter globally as early as possible
if (!process.stderr._originalWrite) {
process.stderr._originalWrite = process.stderr.write;
process.stderr.write = function (chunk, encoding, callback) {
const chunkStr = typeof chunk === 'string' ? chunk : (chunk?.toString?.() || '');
// Filter out sass legacy API deprecation warnings
if (chunkStr.includes('Deprecation Warning [legacy-js-api]') ||
chunkStr.includes('DEPRECATION WARNING [legacy-js-api]') ||
chunkStr.includes('The legacy JS API is deprecated') ||
chunkStr.includes('More info: https://sass-lang.com/d/legacy-js-api')) {
// Suppress the warning - just call the callback
if (typeof encoding === 'function') {
encoding();
} else if (typeof callback === 'function') {
callback();
}
return true;
}
return process.stderr._originalWrite.call(this, chunk, encoding, callback);
};
}
const sass = require('sass');
module.exports = sass;