Socket
Socket
Sign inDemoInstall

detective-sass

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detective-sass - npm Package Compare versions

Comparing version 4.1.1 to 4.1.2

32

index.js

@@ -21,5 +21,3 @@ 'use strict';

const isEnabledUrl = options && options.url;
let dependencies = [];
const isUrlEnabled = options && options.url;
let ast = {};

@@ -37,12 +35,12 @@

const walker = new Walker();
let dependencies = [];
walker.walk(ast, (node) => {
walker.walk(ast, node => {
if (isImportStatement(node)) {
dependencies = dependencies.concat(extractDependencies(node));
dependencies = [...dependencies, ...extractDependencies(node)];
return;
}
if (isEnabledUrl && isUrlNode(node)) {
dependencies = dependencies.concat(extractUriDependencies(node));
return;
if (isUrlEnabled && isUrlNode(node)) {
dependencies = [...dependencies, ...extractUriDependencies(node)];
}

@@ -64,5 +62,7 @@ });

if (importKeyword.type !== 'ident' || importKeyword.content !== 'import') return false;
return ['ident', 'import'].includes(importKeyword.type);
}
return true;
function isUrlNode(node) {
return node.type === 'uri';
}

@@ -72,14 +72,10 @@

return importStatementNode.content
.filter((innerNode) => innerNode.type === 'string' || innerNode.type === 'ident')
.map((identifierNode) => identifierNode.content.replace(/["']/g, ''));
.filter(innerNode => ['string', 'ident'].includes(innerNode.type))
.map(identifierNode => identifierNode.content.replace(/["']/g, ''));
}
function isUrlNode(node) {
return node.type === 'uri';
}
function extractUriDependencies(importStatementNode) {
return importStatementNode.content
.filter((innerNode) => innerNode.type === 'string' || innerNode.type === 'ident' || innerNode.type === 'raw')
.map((identifierNode) => identifierNode.content.replace(/["']/g, ''));
.filter(innerNode => ['string', 'ident', 'raw'].includes(innerNode.type))
.map(identifierNode => identifierNode.content.replace(/["']/g, ''));
}
{
"name": "detective-sass",
"version": "4.1.1",
"version": "4.1.2",
"description": "Find the dependencies of a sass file",

@@ -10,7 +10,7 @@ "main": "index.js",

"scripts": {
"lint": "eslint index.js \"test/*.js\"",
"fix": "npm run lint -- --fix",
"mocha": "mocha",
"test": "npm run lint && npm run mocha",
"test:ci": "c8 npm run mocha"
"lint": "xo",
"fix": "xo --fix",
"uvu": "uvu test -i fixtures",
"test": "npm run lint && npm run uvu",
"test:ci": "c8 npm run uvu"
},

@@ -38,9 +38,43 @@ "repository": {

"gonzales-pe": "^4.3.0",
"node-source-walk": "^5.0.0"
"node-source-walk": "^5.0.1"
},
"devDependencies": {
"c8": "^7.13.0",
"eslint": "^8.36.0",
"mocha": "^9.2.2"
"uvu": "^0.5.6",
"xo": "^0.52.4"
},
"xo": {
"space": true,
"ignores": [
"test/fixtures/*"
],
"rules": {
"arrow-body-style": "off",
"capitalized-comments": "off",
"comma-dangle": [
"error",
"never"
],
"curly": [
"error",
"multi-line"
],
"operator-linebreak": [
"error",
"after"
],
"object-curly-spacing": [
"error",
"always"
],
"space-before-function-paren": [
"error",
"never"
],
"unicorn/prefer-module": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-top-level-await": "off",
"unicorn/prevent-abbreviations": "off"
}
}
}

@@ -1,2 +0,2 @@

### detective-sass [![CI](https://img.shields.io/github/actions/workflow/status/dependents/node-detective-sass/ci.yml?branch=main&label=CI&logo=github)](https://github.com/dependents/node-detective-sass/actions/workflows/ci.yml?query=branch%3Amain) [![npm](https://img.shields.io/npm/v/detective-sass)](https://www.npmjs.com/package/detective-sass) [![npm](https://img.shields.io/npm/dm/detective-sass)](https://www.npmjs.com/package/detective-sass)
### detective-sass [![CI](https://img.shields.io/github/actions/workflow/status/dependents/node-detective-sass/ci.yml?branch=main&label=CI&logo=github)](https://github.com/dependents/node-detective-sass/actions/workflows/ci.yml?query=branch%3Amain) [![npm version](https://img.shields.io/npm/v/detective-sass?logo=npm&logoColor=fff)](https://www.npmjs.com/package/detective-sass) [![npm downloads](https://img.shields.io/npm/dm/detective-sass)](https://www.npmjs.com/package/detective-sass)

@@ -37,2 +37,2 @@ > Find the dependencies of a sass file

MIT
[MIT](LICENSE)
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