detective-postcss
Advanced tools
Comparing version 6.1.3 to 7.0.0
@@ -44,14 +44,16 @@ "use strict"; | ||
}); | ||
if (options.url) { | ||
root.walkDecls((decl) => { | ||
const { nodes } = parseValue(decl.value); | ||
const files = nodes.filter(isUrlNode).map(getValueOrUrl); | ||
if (files) { | ||
for (const file of files) { | ||
debug('found %s of %s', 'url() with import', file); | ||
} | ||
references = references.concat(files); | ||
if (!options.url) | ||
return references; | ||
root.walkDecls((decl) => { | ||
const { nodes } = parseValue(decl.value); | ||
const files = nodes | ||
.filter((node) => isUrlNode(node)) | ||
.map((node) => getValueOrUrl(node)); | ||
if (files) { | ||
for (const file of files) { | ||
debug('found %s of %s', 'url() with import', file); | ||
} | ||
}); | ||
} | ||
references = references.concat(files); | ||
} | ||
}); | ||
return references; | ||
@@ -63,11 +65,4 @@ } | ||
function getValueOrUrl(node) { | ||
let ret; | ||
if (isUrlNode(node)) { | ||
// ['file'] | ||
const innerNode = node.nodes[0]; | ||
ret = getValue(innerNode); | ||
} | ||
else { | ||
ret = getValue(node); | ||
} | ||
// ['file'] | ||
const ret = isUrlNode(node) ? getValue(node.nodes[0]) : getValue(node); | ||
// is-url sometimes gets data: URLs wrong | ||
@@ -80,13 +75,6 @@ return !isUrl(ret) && !ret.startsWith('data:') && ret; | ||
} | ||
if (node.type === 'quoted') { | ||
return node.contents; | ||
} | ||
return node.value; | ||
return node.type === 'quoted' ? node.contents : node.value; | ||
} | ||
function isNodeWithValue(node) { | ||
return (node.type === 'word' || | ||
node.type === 'numeric' || | ||
node.type === 'operator' || | ||
node.type === 'punctuation' || | ||
node.type === 'quoted'); | ||
return ['word', 'numeric', 'operator', 'punctuation', 'quoted'].includes(node.type); | ||
} | ||
@@ -93,0 +81,0 @@ function isUrlNode(node) { |
{ | ||
"name": "detective-postcss", | ||
"version": "6.1.3", | ||
"version": "7.0.0", | ||
"description": "Detective to find dependents of CSS (PostCSS dialect)", | ||
@@ -23,18 +23,21 @@ "main": "dist/index.js", | ||
"engines": { | ||
"node": "^12.0.0 || ^14.0.0 || >=16.0.0" | ||
"node": "^14.0.0 || >=16.0.0" | ||
}, | ||
"peerDependencies": { | ||
"postcss": "^8.4.38" | ||
}, | ||
"dependencies": { | ||
"is-url": "^1.2.4", | ||
"postcss": "^8.4.23", | ||
"postcss-values-parser": "^6.0.2" | ||
}, | ||
"devDependencies": { | ||
"@types/is-url": "^1.2.30", | ||
"@types/jest": "^28.1.8", | ||
"jest": "^28.1.3", | ||
"lint-staged": "^13.2.1", | ||
"prettier": "^2.8.8", | ||
"@types/is-url": "^1.2.32", | ||
"@types/jest": "^29.5.12", | ||
"jest": "^29.7.0", | ||
"lint-staged": "^15.2.2", | ||
"postcss": "^8.4.38", | ||
"prettier": "^3.2.5", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^28.0.8", | ||
"typescript": "^5.0.4" | ||
"ts-jest": "^29.1.2", | ||
"typescript": "^5.4.4" | ||
}, | ||
@@ -41,0 +44,0 @@ "scripts": { |
@@ -11,3 +11,3 @@ # node-detective-postcss | ||
```sh | ||
npm install detective-postcss | ||
npm install postcss detective-postcss | ||
``` | ||
@@ -14,0 +14,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
8559
9
112
- Removedpostcss@^8.4.23