Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Mike-Dax/node-detective-less
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a068a36bdeb5841f14b3c542a789cd6de8fc1275
Choose a base ref
...
head repository: Mike-Dax/node-detective-less
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cb391fde6f17a1befe729615ff36969d908e1096
Choose a head ref
  • 11 commits
  • 4 files changed
  • 4 contributors

Commits on Oct 20, 2017

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f244e64 View commit details
  2. Update package.json

    danez authored Oct 20, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9ee5b72 View commit details

Commits on Dec 12, 2017

  1. Merge pull request #1 from danez/patch-2

    deps: Update debug to fix security issue
    Mike-Dax authored Dec 12, 2017

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1f23fa4 View commit details
  2. 1.0.1

    Mike-Dax committed Dec 12, 2017
    Copy the full SHA
    c4bdaa2 View commit details

Commits on Sep 11, 2018

  1. Require Node.js 6

    realityking authored and Mike-Dax committed Sep 11, 2018
    Copy the full SHA
    04e472d View commit details
  2. Update to Mocha@5

    realityking authored and Mike-Dax committed Sep 11, 2018
    Copy the full SHA
    4c72a91 View commit details
  3. Update to gonzales-pe@4

    realityking authored and Mike-Dax committed Sep 11, 2018
    Copy the full SHA
    baba3e7 View commit details
  4. Update to node-source-walk@4

    realityking authored and Mike-Dax committed Sep 11, 2018
    Copy the full SHA
    af801e2 View commit details
  5. Make use of some ES2015 features

    realityking authored and Mike-Dax committed Sep 11, 2018
    Copy the full SHA
    3055a20 View commit details
  6. Update debug to version 4

    realityking authored and Mike-Dax committed Sep 11, 2018
    1
    Copy the full SHA
    fbd5ef9 View commit details

Commits on Sep 26, 2018

  1. chore: Version bump.

    Mike-Dax committed Sep 26, 2018
    2
    Copy the full SHA
    cb391fd View commit details
Showing with 36 additions and 25 deletions.
  1. +4 −2 .travis.yml
  2. +10 −8 index.js
  3. +18 −13 package.json
  4. +4 −2 test/test.js
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
language: node_js
node_js:
- "0.10"
- "10"
- "8"
- "6"

notifications:
email: false

sudo: false
sudo: false
18 changes: 10 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var Walker = require('node-source-walk');
var gonzales = require('gonzales-pe');
var debug = require('debug')('detective-less');
'use strict';

const Walker = require('node-source-walk');
const gonzales = require('gonzales-pe');
const debug = require('debug')('detective-less');

/**
* Extract the @import statements from a given less file's content
@@ -12,8 +14,8 @@ module.exports = function detective(fileContent) {
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 ast;
let dependencies = [];
let ast;

try {
debug('content: ' + fileContent);
@@ -25,7 +27,7 @@ module.exports = function detective(fileContent) {

detective.ast = ast;

var walker = new Walker();
const walker = new Walker();

walker.walk(ast, function(node) {
if (!isImportStatement(node)) { return; }
@@ -40,11 +42,11 @@ function isImportStatement(node) {
if (!node || node.type !== 'atrule') { return false; }
if (!node.content.length || node.content[0].type !== 'atkeyword') { return false; }

var atKeyword = node.content[0];
const atKeyword = node.content[0];

if (!atKeyword.content.length) { return false; }

var importKeyword = atKeyword.content[0];
const importKeyword = atKeyword.content[0];

if (importKeyword.type !== 'ident' || importKeyword.content !== 'import') { return false; }

31 changes: 18 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "detective-less",
"version": "1.0.0",
"version": "1.0.2",
"description": "Find the dependencies of a less file",
"main": "index.js",
"scripts": {
@@ -16,25 +16,30 @@
"ast",
"dependencies"
],
"contributors": [{
"name": "Joel Kemp",
"email": "joel@mrjoelkemp.com"
},
{
"name": "Michael Orenstein",
"email": "michael@whiteshadows.me"
}],
"contributors": [
{
"name": "Joel Kemp",
"email": "joel@mrjoelkemp.com"
},
{
"name": "Michael Orenstein",
"email": "michael@whiteshadows.me"
}
],
"license": "MIT",
"bugs": {
"url": "https://github.com/Mike-Dax/node-detective-less/issues"
},
"homepage": "https://github.com/Mike-Dax/node-detective-less",
"engines": {
"node": ">= 6.0"
},
"devDependencies": {
"mocha": "~2.0.1"
"mocha": "^5.2.0"
},
"dependencies": {
"debug": "~2.2.0",
"gonzales-pe": "^3.4.4",
"node-source-walk": "^3.2.0"
"debug": "^4.0.0",
"gonzales-pe": "^4.2.3",
"node-source-walk": "^4.0.0"
}
}
6 changes: 4 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var detective = require('../');
var assert = require('assert');
'use strict';

const detective = require('../');
const assert = require('assert');

describe('detective-less', function() {
function test(src, deps, opts) {