detective-postcss
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -6,4 +6,5 @@ declare function detective(src: any, options?: detective.Options): any[]; | ||
} | ||
function MalformedCssError(): void; | ||
class MalformedCssError { | ||
} | ||
} | ||
export = detective; |
@@ -69,3 +69,4 @@ "use strict"; | ||
} | ||
return !isUrl(ret) && ret; | ||
// is-url sometimes gets data: URLs wrong | ||
return !isUrl(ret) && !ret.startsWith('data:') && ret; | ||
} | ||
@@ -85,3 +86,7 @@ function isUrlNode(node) { | ||
(function (detective) { | ||
function MalformedCssError() { } | ||
var MalformedCssError = /** @class */ (function () { | ||
function MalformedCssError() { | ||
} | ||
return MalformedCssError; | ||
}()); | ||
detective.MalformedCssError = MalformedCssError; | ||
@@ -88,0 +93,0 @@ MalformedCssError.prototype = Object.create(Error.prototype); |
{ | ||
"name": "detective-postcss", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Detective to find dependents of CSS (PostCSS dialect)", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -69,3 +69,4 @@ import * as d from 'debug'; | ||
} | ||
return !isUrl(ret) && ret; | ||
// is-url sometimes gets data: URLs wrong | ||
return !isUrl(ret) && !ret.startsWith('data:') && ret; | ||
} | ||
@@ -94,3 +95,3 @@ | ||
export function MalformedCssError() {} | ||
export class MalformedCssError {} | ||
MalformedCssError.prototype = Object.create(Error.prototype); | ||
@@ -97,0 +98,0 @@ } |
@@ -138,2 +138,16 @@ import detective = require('../src'); | ||
}); | ||
it('ignores base64 data: urls', () => { | ||
assert( | ||
'.x { background: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}', | ||
[] | ||
); | ||
}); | ||
it('ignores SVG data: urls', () => { | ||
const css = `svg { | ||
-webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 32 32" width="32" height="32" xmlns="http://www.w3.org/2000/svg"><defs><mask id="mask"><rect x="0" y="0" width="32" height="32" fill="#fff"/><rect x="14" y="-10" width="40" height="20" rx="10" fill="#000"/></mask></defs><rect x="0" y="0" width="32" height="32" mask="url(#mask)"/></svg>'); | ||
}`; | ||
assert(css, []); | ||
}); | ||
}); | ||
@@ -140,0 +154,0 @@ |
146283
351