Socket
Socket
Sign inDemoInstall

detective-cjs

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detective-cjs - npm Package Compare versions

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

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