detective-cjs
Advanced tools
Comparing version 1.0.5 to 2.0.0
13
index.js
var Walker = require('node-source-walk'); | ||
var types = require('ast-module-types'); | ||
var escodegen = require('escodegen'); | ||
@@ -10,5 +9,3 @@ /** | ||
module.exports = function(content) { | ||
var walker = new Walker({ | ||
ecmaVersion: 6 | ||
}); | ||
var walker = new Walker(); | ||
@@ -26,10 +23,6 @@ var dependencies = []; | ||
if (node.arguments[0].type === 'Literal') { | ||
if (node.arguments[0].type === 'Literal' || node.arguments[0].type === 'StringLiteral') { | ||
dependency = node.arguments[0].value; | ||
} else { | ||
dependency = escodegen.generate(node.arguments[0]); | ||
dependencies.push(dependency); | ||
} | ||
dependencies.push(dependency); | ||
}); | ||
@@ -36,0 +29,0 @@ |
{ | ||
"name": "detective-cjs", | ||
"version": "1.0.5", | ||
"version": "2.0.0", | ||
"description": "Get the dependencies of a CommonJS module by traversing its AST", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "jscs -p google index.js test && mocha test/test.js" | ||
"test": "jscs index.js test && mocha test/test.js" | ||
}, | ||
@@ -30,2 +30,3 @@ "repository": { | ||
"jscs": "~2.4.0", | ||
"jscs-preset-mrjoelkemp": "~1.0.0", | ||
"mocha": "~2.0.1", | ||
@@ -35,6 +36,5 @@ "sinon": "~1.12.2" | ||
"dependencies": { | ||
"ast-module-types": "^2.2.1", | ||
"escodegen": "^1.5.0", | ||
"node-source-walk": "^2.0.0" | ||
"ast-module-types": "^2.3.2", | ||
"node-source-walk": "^3.0.0" | ||
} | ||
} |
@@ -7,3 +7,3 @@ #### detective-cjs [![npm](http://img.shields.io/npm/v/detective-cjs.svg)](https://npmjs.org/package/detective-cjs) [![npm](http://img.shields.io/npm/dm/detective-cjs.svg)](https://npmjs.org/package/detective-cjs) | ||
But brah, substack already built this: node-detective. Yes, but I needed the capability to reuse an AST | ||
But dude, substack already built this: node-detective. Yes, but I needed the capability to reuse an AST | ||
and this was unlikely to be merged timely. I can also support jsx and other syntactic constructs faster. | ||
@@ -23,3 +23,3 @@ | ||
* Supports JSX and any other features that [node-source-walk](https://github.com/mrjoelkemp/node-source-walk) supports. | ||
* Supports JSX, ES7, and any other features that [node-source-walk](https://github.com/mrjoelkemp/node-source-walk) supports. | ||
@@ -26,0 +26,0 @@ #### License |
Sorry, the diff of this file is not supported yet
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
2
2497
4
4
23
+ Addedbabylon@6.18.0(transitive)
+ Addednode-source-walk@3.3.0(transitive)
- Removedescodegen@^1.5.0
- Removedacorn@2.7.0(transitive)
- Removedacorn-jsx@2.0.1(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removedescodegen@1.14.3(transitive)
- Removedesprima@4.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedlevn@0.3.0(transitive)
- Removednode-source-walk@2.1.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedtype-check@0.3.2(transitive)
- Removedword-wrap@1.2.5(transitive)
Updatedast-module-types@^2.3.2
Updatednode-source-walk@^3.0.0