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 2.1.2 to 2.2.0

test/cases/ignore-file.css

6

lib/doiuse.js

@@ -6,2 +6,3 @@ 'use strict';

var Detector = require('./detect-feature-use');
var Multimatch = require('multimatch');

@@ -12,2 +13,3 @@ function doiuse(options) {

var ignore = options.ignore;
var ignoreFiles = options.ignoreFiles;

@@ -42,2 +44,6 @@ if (!browserQuery) {

if (ignoreFiles && Multimatch(usage.source.input.from, ignoreFiles).length > 0) {
return;
}
var message = features[feature].title + ' not supported by: ' + features[feature].missing + ' (' + feature + ')';

@@ -44,0 +50,0 @@

4

package.json
{
"name": "doiuse",
"version": "2.1.2",
"version": "2.2.0",
"description": "Lint CSS for browser support against caniuse database.",

@@ -37,2 +37,3 @@ "main": "lib/doiuse.js",

"lodash": "^3.5.0",
"multimatch": "^2.0.0",
"postcss": "^5.0.8",

@@ -45,2 +46,3 @@ "source-map": "^0.4.2",

"babel": "^5.2.13",
"postcss-import": "^7.1.3",
"standard": "^4.3.1",

@@ -47,0 +49,0 @@ "tape": "^4.0.0"

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

ignore: ['rem'], // an optional array of features to ignore
ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore
onFeatureUsage: function(usageInfo) {

@@ -82,2 +83,3 @@ console.log(usageInfo.message);

ignore: ['rem'], // an optional array of features to ignore
ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore
onFeatureUsage: function (usageInfo) {

@@ -122,2 +124,3 @@ console.log(usageInfo.message)

ignore: ['rem'], // an optional array of features to ignore
ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore
onFeatureUsage: function(usageInfo) { } // a callback for usages of features not supported by the selected browsers

@@ -124,0 +127,0 @@ }

@@ -5,2 +5,3 @@ var fs = require('fs')

var doiuse = require('../')
var atImport = require('postcss-import')
var hasKeys = require('./has-keys')

@@ -60,1 +61,51 @@

})
test('ignores specified files and calls back for others', function (t) {
var run, ignoreCss, processCss, pcss
ignoreCss = fs.readFileSync(require.resolve('./cases/ignore-file.css'))
processCss = fs.readFileSync(require.resolve('./cases/gradient.css'))
run = false
pcss = function () {
return postcss(doiuse({
browsers: ['ie 6'],
ignoreFiles: ['**/ignore-file.css'],
onFeatureUsage: function (usageInfo) {
run = true
}
}))
}
pcss().process(ignoreCss, {from: './cases/ignore-file.css'})
.then(function () {
t.false(run, 'should be false')
})
.then(function () {
return pcss().process(processCss, {from: './cases/gradient.css'})
})
.then(function () {
t.true(run, 'should be true')
t.end()
})
})
test('ignores rules from some imported files, and not others', function (t) {
var count, css, cssPath
cssPath = require.resolve('./cases/ignore-import.css')
css = fs.readFileSync(cssPath)
count = 0
postcss([atImport(),
doiuse({
browsers: ['ie 6'],
ignoreFiles: ['**/ignore-file.css'],
onFeatureUsage: function (usageInfo) {
count++
}
})])
.process(css, {from: cssPath})
.then(function () {
t.equal(count, 2)
t.end()
})
})
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