css-has-pseudo
Advanced tools
Comparing version 0.8.0 to 0.9.0
# Changes to CSS Has Pseudo | ||
### 0.9.0 (November 26, 2018) | ||
- Improved CLI usage | ||
### 0.8.0 (November 26, 2018) | ||
@@ -4,0 +8,0 @@ |
23
cli.js
@@ -48,8 +48,2 @@ #!/usr/bin/env node | ||
if (process.argv.length < 3) { | ||
console.log(['CSS Has Pseudo\n', ' Transforms CSS with :has {}\n', 'Usage:\n', ' css-has-pseudo source.css transformed.css', ' css-has-pseudo --in=source.css --out=transformed.css --opts={}', ' echo "body:has(:focus) {}" | css-has-pseudo\n'].join('\n')); | ||
process.exit(0); | ||
} // get process and plugin options from the command line | ||
const fileRegExp = /^[\w\/.]+$/; | ||
@@ -81,2 +75,7 @@ const argRegExp = /^--(\w+)=("|')?(.+)\2$/; | ||
(argo.from === '<stdin>' ? getStdin() : readFile(argo.from)).then(css => { | ||
if (argo.from === '<stdin>' && !css) { | ||
console.log(['CSS Has Pseudo\n', ' Transforms CSS with :has {}\n', 'Usage:\n', ' css-has-pseudo source.css transformed.css', ' css-has-pseudo --from=source.css --to=transformed.css --opts={}', ' echo "body:has(:focus) {}" | css-has-pseudo\n'].join('\n')); | ||
process.exit(0); | ||
} | ||
const pluginOpts = JSON.parse(argo.opts.replace(relaxedJsonPropRegExp, '"$2": ').replace(relaxedJsonValueRegExp, '$1"$2"$3')); | ||
@@ -96,2 +95,12 @@ const processOptions = Object.assign({ | ||
} | ||
}).catch(error => { | ||
if (Object(error).name === 'CssSyntaxError') { | ||
throw new Error(`PostCSS had trouble reading the file (${error.reason} on line ${error.line}, column ${error.column}).`); | ||
} | ||
if (Object(error).errno === -2) { | ||
throw new Error(`Sorry, "${error.path}" could not be read.`); | ||
} | ||
throw error; | ||
}).then(result => { | ||
@@ -101,3 +110,3 @@ console.log(result); | ||
}, error => { | ||
console.error(error); | ||
console.error(Object(error).message || 'Something bad happened and we don’t even know what it was.'); | ||
process.exit(1); | ||
@@ -104,0 +113,0 @@ }); |
{ | ||
"name": "css-has-pseudo", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"description": "Style elements relative to other elements in CSS", | ||
@@ -5,0 +5,0 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56470
392