Socket
Socket
Sign inDemoInstall

detective-stylus

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detective-stylus - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

16

index.js

@@ -0,1 +1,3 @@

'use strict';
/**

@@ -8,10 +10,9 @@ * Extract the @import/@require statements from a given stylus file's content

module.exports = function(fileContent) {
if (typeof fileContent === 'undefined') { throw new Error('content not given'); }
if (typeof fileContent !== 'string') { throw new Error('content is not a string'); }
if (typeof fileContent === 'undefined') throw new Error('content not given');
if (typeof fileContent !== 'string') throw new Error('content is not a string');
var dependencies = [];
var importRegex = /\@(import|require)\s['"](.*)['"](\.styl)?/g;
const dependencies = [];
const importRegex = /@(?:import|require)\s['"](.*)['"](?:\.styl)?/g;
let matches = null;
var matches;
do {

@@ -21,5 +22,4 @@ matches = importRegex.exec(fileContent);

if (matches) {
dependencies.push(matches[2]);
dependencies.push(matches[1]);
}
} while (matches);

@@ -26,0 +26,0 @@

{
"name": "detective-stylus",
"version": "1.0.0",
"version": "1.0.1",
"description": "Get the dependencies of a Stylus file",
"main": "index.js",
"directories": {
"test": "test"
},
"files": [
"index.js"
],
"scripts": {
"test": "mocha"
"lint": "eslint index.js \"test/*.js\"",
"mocha": "mocha",
"test": "npm run lint && npm run mocha"
},
"repository": {
"type": "git",
"url": "https://github.com/mrjoelkemp/node-detective-stylus.git"
"url": "git+https://github.com/dependents/node-detective-stylus.git"
},

@@ -23,8 +25,15 @@ "keywords": [

],
"author": "Joel Kemp <joel@mrjoelkemp.com> (http://www.mrjoelkemp.com/)",
"author": "Joel Kemp <joel@mrjoelkemp.com> (https://mrjoelkemp.com/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/mrjoelkemp/node-detective-stylus/issues"
"url": "https://github.com/dependents/node-detective-stylus/issues"
},
"homepage": "https://github.com/mrjoelkemp/node-detective-stylus"
"homepage": "https://github.com/dependents/node-detective-stylus",
"engines": {
"node": ">=6.0"
},
"devDependencies": {
"eslint": "^5.16.0",
"mocha": "^6.2.3"
}
}

@@ -1,12 +0,14 @@

### detective-stylus [![npm](http://img.shields.io/npm/v/detective-stylus.svg)](https://npmjs.org/package/detective-stylus) [![npm](http://img.shields.io/npm/dm/detective-stylus.svg)](https://npmjs.org/package/detective-stylus)
### detective-stylus [![CI](https://github.com/dependents/detective-stylus/actions/workflows/ci.yml/badge.svg)](https://github.com/dependents/detective-stylus/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/detective-stylus)](https://www.npmjs.com/package/detective-stylus) [![npm](http://img.shields.io/npm/dm/detective-stylus)](https://www.npmjs.com/package/detective-stylus)
> Find the dependencies of a Stylus file
`npm install detective-stylus`
```sh
npm install detective-stylus
```
It's the Stylus counterpart to
[detective](https://github.com/substack/node-detective),
[detective-amd](https://github.com/mrjoelkemp/node-detective-amd),
[detective-es6](https://github.com/mrjoelkemp/node-detective-es6),
and [detective-sass](https://github.com/mrjoelkemp/node-detective-sass)
[detective-amd](https://github.com/dependents/node-detective-amd),
[detective-es6](https://github.com/dependents/node-detective-es6),
and [detective-sass](https://github.com/dependents/node-detective-sass)

@@ -18,9 +20,9 @@ Note: this detective uses a regex to find the `@import` or `@require` statements.

```js
var detective = require('detective-stylus');
const detective = require('detective-stylus');
var content = fs.readFileSync('styles.styl', 'utf8');
const content = fs.readFileSync('styles.styl', 'utf8');
// list of imported file names (ex: '_foo.styl', '_foo', etc)
var dependencies = detective(content);
const dependencies = detective(content);
```
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