Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

find-requires

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-requires - npm Package Compare versions

Comparing version 0.1.6 to 0.2.0

index.js

16

lib/ast.js
'use strict';
var last = require('es5-ext/lib/Array/prototype/last')
var last = require('es5-ext/array/#/last')
, runInNewContext = require('vm').runInNewContext

@@ -14,5 +14,3 @@ , esprima = require('esprima')

var dep, lines;
if (!ast || (typeof ast !== 'object')) {
return;
}
if (!ast || (typeof ast !== 'object')) return;
if (isArray(ast)) {

@@ -23,5 +21,3 @@ ast.forEach(walker, this);

keys(ast).forEach(function (key) {
if (key !== 'range') {
walker.call(this, ast[key]);
}
if (key !== 'range') walker.call(this, ast[key]);
}, this);

@@ -45,3 +41,3 @@ if ((ast.type === 'CallExpression') && (ast.callee.type === 'Identifier') &&

dep.value = String(runInNewContext(dep.raw));
} catch (e2) {}
} catch (ignore) {}
}

@@ -57,5 +53,3 @@ } else if (!ast.arguments.length) {

module.exports = function (code) {
if (code == null) {
throw new TypeError('Expected code string');
}
if (code == null) throw new TypeError('Expected code string');
code = String(code);

@@ -62,0 +56,0 @@ var ctx = { code: code, deps: [] };

'use strict';
var last = require('es5-ext/lib/Array/prototype/last')
var last = require('es5-ext/array/#/last')

@@ -75,7 +75,6 @@ , stringify = JSON.stringify, min = Math.min

throw e;
} else {
// not RegExp
current = slash + 1;
return false;
}
// not RegExp
current = slash + 1;
return false;
}

@@ -109,3 +108,3 @@ return pass(slash, '/');

argsError = function () {
var e = new Error("Cannot parse code" + " @" + (current) + ": " +
var e = new Error("Cannot parse code @" + current + ": " +
stringify(code.slice(current - 8, current + 10)) + "." +

@@ -137,3 +136,3 @@ " Found unexpected code in `require` call. Try AST parser instead.");

if (!ws) return;
e = new Error("Cannot parse code" + " @" + (require) + ": " +
e = new Error("Cannot parse code @" + require + ": " +
stringify(code.slice(require - 8, require + 17)) + "." +

@@ -140,0 +139,0 @@ " `require` preceded by unexpected code. Try AST parser instead.");

{
"name": "find-requires",
"version": "0.1.6",
"version": "0.2.0",
"description": "Find all require() calls. Fast and solid implementation backed with direct scanner and esprima AST parser",
"author": "Mariusz Nowak <medyk@medikoo.com>",
"keywords": [

@@ -20,4 +21,2 @@ "analyze",

],
"author": "Mariusz Nowak <medikoo+find-requires@medikoo.com>",
"main": "lib",
"repository": {

@@ -27,21 +26,13 @@ "type": "git",

},
"bugs": {
"email": "medikoo+find-requires@medikoo.com",
"url": "https://github.com/medikoo/find-requires/issues"
},
"dependencies": {
"esprima": "1.x",
"es5-ext": "~0.9.2"
"esprima": "~1.1.1",
"es5-ext": "~0.10.2"
},
"devDependencies": {
"tad": "~0.1.15"
"tad": "0.2.x"
},
"scripts": {
"test": "node ./node_modules/tad/bin/tad lib"
"test": "node ./node_modules/tad/bin/tad"
},
"licence": "MIT",
"optionalDependencies": {},
"engines": {
"node": ">=0.4"
}
"licence": "MIT"
}

@@ -70,7 +70,6 @@ require('on\u0065')

require("object3" + { foo: bar() });
/"/, require("object3" + { foo: bar() });
require.foo;
function test() {

@@ -119,3 +118,5 @@ a();return require(('four') + 'teen');

}
isNaN();require('mid-thirty')
require('inner' + require(require('marko')) + 'elo')
require('thirty\

@@ -122,0 +123,0 @@ break-line \

@@ -36,2 +36,4 @@ require('on\u0065')

var maro = [,,,]
// require('comment');

@@ -87,2 +89,2 @@ var raz = 4; // require('comment2')

module.exports = require('thirty\two')
module.exports = /"/, require('thirty\two')

@@ -14,3 +14,3 @@ 'use strict';

'\'twenty/seven\'', '"twenty/eight', '"twenty/nine"', '"thirty"',
'thirty\tbreak-line \tone', 'thirty\two'];
'mid-thirty', 'marko', 'thirty\tbreak-line \tone', 'thirty\two'];

@@ -17,0 +17,0 @@ readFile(pg + '/edge.js', 'utf-8', function (err, str) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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