Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Upgrade broccoli-persistent-filter to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
nlfurniss committed Sep 9, 2020
1 parent b303765 commit a886967
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
language: node_js
node_js:
- '8'
- '6'
- '10'
28 changes: 14 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,20 @@ module.exports = class extends Filter {
return 'css';
}

processString(text, relativePath) {
const options = Object.assign({
async processString(text, relativePath) {
const options = {
from: relativePath,
to: relativePath
}, this.options);
to: relativePath,
...this.options
};

// Support explicit override of inline sourcemaps
if (options.sourcemap !== null || options.sourcemap !== undefined) {
options.map = options.sourcemap ? 'inline' : false;
}

return postcss(autoprefixer(options))
const result = await postcss(autoprefixer(options))
.process(text, options)
.then(result => {
const warnings = result.warnings();

if (warnings.length > 0) {
console.error(warnings.join('\n'));
}

return result.css;
})
.catch(error => {
if (error.name === 'CssSyntaxError') {
// TODO: Find a way to hide the stack so to adhere to the PostCSS guidelines
Expand All @@ -49,5 +41,13 @@ module.exports = class extends Filter {

throw error;
});

const warnings = result.warnings();

if (warnings.length > 0) {
console.error(warnings.join('\n'));
}

return result.css;
}
};
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=6"
"node": ">=10"
},
"scripts": {
"test": "xo && broccoli build temp && ava"
Expand All @@ -31,7 +31,8 @@
],
"dependencies": {
"autoprefixer": "^9.8.4",
"broccoli-persistent-filter": "^1.1.6",
"broccoli-persistent-filter": "^3.0.0",
"chokidar": "^3.0.0",
"postcss": "^7.0.2"
},
"devDependencies": {
Expand Down

0 comments on commit a886967

Please sign in to comment.