Socket
Socket
Sign inDemoInstall

doiuse

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

doiuse - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

stream.js

39

cli.js
#!/usr/bin/env node
var fs = require('fs'),
concat = require('concat-stream'),
postcss = require('postcss');
var fs = require('fs');
var formatBrowserName = require('./dist/lib/util').formatBrowserName,
doiuse = require('./');
defaultBrowsers = require('./').default,
doiuse = require('./stream');

@@ -18,3 +17,3 @@ var yargs = require('yargs')

description: 'Autoprefixer-like browser criteria.',
default: doiuse.default.join(', ')
default: defaultBrowsers.join(', ')
})

@@ -42,17 +41,2 @@ .string('b')

// Callback to report each unsupported feature usage.
function report(usageInfo) {
console.log(argv.json ? JSON.stringify(usageInfo) : usageInfo.message);
}
// Set up the linter instance
var linter = doiuse({
browserSelection: argv.b.split(',').map(function(s){return s.trim();}),
onUnsupportedFeatureUse: report
});
var processor = postcss(linter);
// Informational output

@@ -88,11 +72,14 @@ if(argv.l) { argv.v = ++argv.verbose; }

var browsers = argv.b.split(',').map(function(s){return s.trim();});
var options = {json: argv.json};
if(argv._.length > 0)
argv._.forEach(function(file){
processor.process(fs.readFileSync(file), {
from: file
});
fs.createReadStream()
.pipe(doiuse(browsers, options))
.pipe(process.stdout);
});
else
process.stdin.pipe(concat(function(css) {
processor.process(css);
}));
process.stdin
.pipe(doiuse(browsers, options))
.pipe(process.stdout);
{
"name": "doiuse",
"version": "0.1.5",
"version": "0.1.6",
"description": "Lint CSS for browser support against caniuse database.",

@@ -30,2 +30,3 @@ "main": "dist/index.js",

"concat-stream": "^1.4.6",
"duplexer2": "0.0.2",
"lodash": "^2.4.1",

@@ -32,0 +33,0 @@ "postcss": "^3.0.2",

@@ -16,3 +16,7 @@ [![Build Status](https://travis-ci.org/anandthakker/doiuse.svg?branch=master)](https://travis-ci.org/anandthakker/doiuse)

doiuse --browsers "ie >= 9, > 1%, last 2 versions" main.css
# or
cat main.css | doiuse --browsers "ie >= 9, > 1%, last 2 versions"
```
**Sample output:**

@@ -70,2 +74,17 @@ ```

# API Details:
## As a transform stream
```javascript
var doiuse = require('doiuse/stream');
process.stdin
.pipe(doiuse(['ie >= 8', '> 1%'], {json: false}))
.pipe(process.stdout);
```
Setting `json: true` yields ld-json output.
## As a postcss plugin
`postcss(doiuse(opts)).process(css)`, where `opts` is:

@@ -72,0 +91,0 @@ ```javascript

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc