detective-stylus
Advanced tools
Comparing version 3.0.0 to 4.0.0
12
index.js
@@ -6,15 +6,15 @@ 'use strict'; | ||
* | ||
* @param {String} fileContent | ||
* @param {String} content | ||
* @return {String[]} | ||
*/ | ||
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'); | ||
module.exports = function(content) { | ||
if (content === undefined) throw new Error('content not given'); | ||
if (typeof content !== 'string') throw new Error('content is not a string'); | ||
const importRegex = /@(?:import|require)\s['"](.*)['"](?:\.styl)?/g; | ||
const dependencies = []; | ||
const importRegex = /@(?:import|require)\s['"](.*)['"](?:\.styl)?/g; | ||
let matches = null; | ||
do { | ||
matches = importRegex.exec(fileContent); | ||
matches = importRegex.exec(content); | ||
@@ -21,0 +21,0 @@ if (matches) { |
{ | ||
"name": "detective-stylus", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Get the dependencies of a Stylus file", | ||
@@ -10,4 +10,4 @@ "main": "index.js", | ||
"scripts": { | ||
"lint": "eslint index.js \"test/*.js\"", | ||
"fix": "npm run lint -- --fix", | ||
"lint": "xo", | ||
"fix": "xo --fix", | ||
"mocha": "mocha", | ||
@@ -35,9 +35,43 @@ "test": "npm run lint && npm run mocha", | ||
"engines": { | ||
"node": ">=12" | ||
"node": ">=14" | ||
}, | ||
"devDependencies": { | ||
"c8": "^7.11.0", | ||
"eslint": "^8.10.0", | ||
"mocha": "^9.2.1" | ||
"c8": "^7.13.0", | ||
"mocha": "^10.2.0", | ||
"xo": "^0.54.2" | ||
}, | ||
"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,3 +0,7 @@ | ||
### detective-stylus [![CI](https://img.shields.io/github/actions/workflow/status/dependents/node-detective-stylus/ci.yml?branch=main&label=CI&logo=github)](https://github.com/dependents/node-detective-stylus/actions/workflows/ci.yml?query=branch%3Amain) [![npm](https://img.shields.io/npm/v/detective-stylus)](https://www.npmjs.com/package/detective-stylus) [![npm](https://img.shields.io/npm/dm/detective-stylus)](https://www.npmjs.com/package/detective-stylus) | ||
# detective-stylus | ||
[![CI](https://img.shields.io/github/actions/workflow/status/dependents/node-detective-stylus/ci.yml?branch=main&label=CI&logo=github)](https://github.com/dependents/node-detective-stylus/actions/workflows/ci.yml?query=branch%3Amain) | ||
[![npm version](https://img.shields.io/npm/v/detective-stylus)](https://www.npmjs.com/package/detective-stylus) | ||
[![npm downloads](https://img.shields.io/npm/dm/detective-stylus)](https://www.npmjs.com/package/detective-stylus) | ||
> Find the dependencies of a Stylus file | ||
@@ -17,3 +21,3 @@ | ||
### Usage | ||
## Usage | ||
@@ -30,4 +34,4 @@ ```js | ||
### License | ||
## License | ||
MIT | ||
[MIT](LICENSE) |
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
4513
36