Comparing version 2.0.1 to 2.0.2
@@ -15,10 +15,2 @@ 'use strict'; | ||
} | ||
var cb = function cb(usageInfo) { | ||
if (ignore && ignore.indexOf(usageInfo.feature) !== -1) { | ||
return; | ||
} | ||
if (onFeatureUsage) { | ||
onFeatureUsage(usageInfo); | ||
} | ||
}; | ||
@@ -40,3 +32,3 @@ var _missingSupport = missingSupport(browserQuery); | ||
postcss: function postcss(css) { | ||
postcss: function postcss(css, result) { | ||
return detector.process(css, function (_ref) { | ||
@@ -46,19 +38,29 @@ var feature = _ref.feature; | ||
var loc = usage.source; | ||
loc.original = css.source.input.map ? { | ||
start: css.source.input.map.consumer().originalPositionFor(loc.start), | ||
end: css.source.input.map.consumer().originalPositionFor(loc.end) | ||
} : { | ||
start: loc.start, | ||
end: loc.end | ||
}; | ||
if (ignore && ignore.indexOf(feature) !== -1) { | ||
return; | ||
} | ||
var message = (loc.original.start.source || loc.input.file || loc.input.from) + ':' + loc.original.start.line + ':' + loc.original.start.column + ': ' + features[feature].title + ' not supported by: ' + features[feature].missing; | ||
var message = features[feature].title + ' not supported by: ' + features[feature].missing + ' (' + feature + ')'; | ||
return cb({ | ||
feature: feature, | ||
featureData: features[feature], | ||
usage: usage, | ||
message: message | ||
}); | ||
result.warn(message, { node: usage, plugin: 'doiuse' }); | ||
if (onFeatureUsage) { | ||
var loc = usage.source; | ||
loc.original = css.source.input.map ? { | ||
start: css.source.input.map.consumer().originalPositionFor(loc.start), | ||
end: css.source.input.map.consumer().originalPositionFor(loc.end) | ||
} : { | ||
start: loc.start, | ||
end: loc.end | ||
}; | ||
message = (loc.original.start.source || loc.input.file || loc.input.from) + ':' + loc.original.start.line + ':' + loc.original.start.column + ': ' + message; | ||
onFeatureUsage({ | ||
feature: feature, | ||
featureData: features[feature], | ||
usage: usage, | ||
message: message | ||
}); | ||
} | ||
}); | ||
@@ -65,0 +67,0 @@ } |
{ | ||
"name": "doiuse", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Lint CSS for browser support against caniuse database.", | ||
@@ -5,0 +5,0 @@ "main": "lib/doiuse.js", |
@@ -7,19 +7,19 @@ var cp_exec = require('child_process').exec | ||
var cssFile = path.join(__dirname, '/cases/gradient.css') | ||
var pathToCli = ' node ' + path.join(__dirname, '../cli.js') | ||
var catCss = ' cat ' + cssFile + ' | tee /dev/tty ' | ||
var expected = '<streaming css input>:8:1: CSS Gradients not supported by: IE (8,9)\n' + | ||
'<streaming css input>:12:1: CSS Gradients not supported by: IE (8,9)\n' + | ||
'<streaming css input>:16:1: CSS Repeating Gradients not supported by: IE (8,9)\n' + | ||
'<streaming css input>:20:1: CSS Repeating Gradients not supported by: IE (8,9)\n' | ||
var expected_css_gradients = '<streaming css input>:8:1: CSS Gradients not supported by: IE (8,9) (css-gradients)\n' + | ||
'<streaming css input>:12:1: CSS Gradients not supported by: IE (8,9) (css-gradients)\n' | ||
var expected_css_repeating_gradients = '<streaming css input>:16:1: CSS Repeating Gradients not supported by: IE (8,9) (css-repeating-gradients)\n' + | ||
'<streaming css input>:20:1: CSS Repeating Gradients not supported by: IE (8,9) (css-repeating-gradients)\n' | ||
var expected = expected_css_gradients + expected_css_repeating_gradients | ||
var commands = { | ||
cat: ' cat ' + cssFile + ' | tee /dev/tty ', | ||
doiuse: ' node ' + path.join(__dirname, '../cli.js') + ' --browsers="IE >= 8" ' | ||
cat: catCss, | ||
doiuse: pathToCli + ' --browsers="IE >= 8" ' | ||
} | ||
var expected_with_ignore = '<streaming css input>:16:1: CSS Repeating Gradients not supported by: IE (8,9)\n' + | ||
'<streaming css input>:20:1: CSS Repeating Gradients not supported by: IE (8,9)\n' | ||
var expected_with_ignore = expected_css_repeating_gradients | ||
var commands_with_ignore = { | ||
cat: ' cat ' + cssFile + ' | tee /dev/tty ', | ||
doiuse: ' node ' + path.join(__dirname, '../cli.js') + ' --browsers="IE >= 8" --ignore="css-gradients" ' | ||
cat: catCss, | ||
doiuse: pathToCli + ' --browsers="IE >= 8" --ignore="css-gradients" ' | ||
} | ||
@@ -26,0 +26,0 @@ |
Sorry, the diff of this file is not supported yet
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
58518
1634