
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
amdetective
Advanced tools
Like node-detective, but for AMD/r.js files. Finds all calls to `require()` in AMD modules by walking the AST.
Find all calls to require()
in AMD modules by walking the AST.
This module uses code extracted from r.js rather than trying to write it's own version of r.js parsing. It depends on esprima (but not r.js).
npm install amdetective
First, create detect.js
which is just a four line CLI wrapper around amdetective
:
var fs = require('fs'),
amdetective = require('amdetective');
console.log('Reading file from first argument: ' + process.argv[2]);
console.log(amdetective(fs.readFileSync(process.argv[2]).toString()));
Now, let's run it on a bunch of examples to see some output. You can also run this command on your own files to get more realistic examples.
require(['module1', 'path/to/module2'], function(a, b){
// ...
});
Running node detect.js simple.js
produces:
Reading file from first argument: simple.js
[ 'module1', 'path/to/module2' ]
define(function(require) {
var a = require('some/file'),
b = require('json!foo/bar');
// ...
});
Running node detect.js simple2.js
produces:
Reading file from first argument: simple2.js
[ 'require', 'some/file', 'json!foo/bar' ]
define("foo/title",
["my/cart", "my/inventory"],
function(cart, inventory) {
}
);
Running node detect.js simple2.js
produces:
Reading file from first argument: named.js
[ { name: 'foo/title', deps: [ 'my/cart', 'my/inventory' ] } ]
Note how named modules are treated differently - this is just something that the underlying resolution code does so be prepared to deal with it.
Given some source body src
, return an array of all the require()
call arguments detected by AMD/r.js.
The options parameter opts
is passed along to parse.recurse()
in lib/parse.js. This is normally the build config options if it is passed.
BSD
FAQs
Like node-detective, but for AMD/r.js files. Finds all calls to `require()` in AMD modules by walking the AST.
The npm package amdetective receives a total of 668 weekly downloads. As such, amdetective popularity was classified as not popular.
We found that amdetective demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.