All Projects → browserify → Detective

browserify / Detective

Licence: other
Find all calls to require() no matter how deeply nested using a proper walk of the AST

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Detective

Browserify
browser-side require() the node.js way
Stars: ✭ 13,929 (+3499.22%)
Mutual labels:  commonjs, modules
Node Dependency Tree
Get the dependency tree of a module
Stars: ✭ 383 (-1.03%)
Mutual labels:  commonjs, ast
Parcel
The zero configuration build tool for the web. 📦🚀
Stars: ✭ 39,670 (+10150.65%)
Mutual labels:  commonjs, modules
module-dependents
Get the list of npm modules that depend on the specified npm module.
Stars: ✭ 15 (-96.12%)
Mutual labels:  modules, dependencies
Madge
Create graphs from your CommonJS, AMD or ES6 module dependencies
Stars: ✭ 5,635 (+1356.07%)
Mutual labels:  dependencies, commonjs
Minipack
📦 A simplified example of a modern module bundler written in JavaScript
Stars: ✭ 2,625 (+578.29%)
Mutual labels:  commonjs, modules
Cjstoesm
A tool that can transform CommonJS to ESM
Stars: ✭ 109 (-71.83%)
Mutual labels:  commonjs, modules
Pax
The fastest JavaScript bundler in the galaxy.
Stars: ✭ 2,626 (+578.55%)
Mutual labels:  commonjs, modules
Go Modiff
Command line tool for diffing go module dependency changes between versions 📔
Stars: ✭ 24 (-93.8%)
Mutual labels:  dependencies, modules
lint-deps
Lint for unused or missing dependencies in your node.js projects. Customize with plugins or configuration.
Stars: ✭ 48 (-87.6%)
Mutual labels:  modules, dependencies
Compodoc
📔 The missing documentation tool for your Angular, Nest & Stencil application
Stars: ✭ 3,567 (+821.71%)
Mutual labels:  ast
Estree
The ESTree Spec
Stars: ✭ 3,867 (+899.22%)
Mutual labels:  ast
Modgv
Converts 'go mod graph' output into Graphviz's DOT language
Stars: ✭ 358 (-7.49%)
Mutual labels:  dependencies
Repl
The Learning Hub for UoL's Online CS Students
Stars: ✭ 367 (-5.17%)
Mutual labels:  modules
A To Z List Of Useful Node.js Modules
Collection of most awesome node modules that will extend the capability of your node.js application.
Stars: ✭ 315 (-18.6%)
Mutual labels:  modules
Nod
Node.js module generator/boilerplate with Babel, Jest, Flow, Documentation and more
Stars: ✭ 355 (-8.27%)
Mutual labels:  modules
Reshape
💠 transform html with javascript plugins
Stars: ✭ 314 (-18.86%)
Mutual labels:  ast
Modclean
Remove unwanted files and directories from your node_modules folder
Stars: ✭ 309 (-20.16%)
Mutual labels:  modules
Astroid
A common base representation of python source code for pylint and other projects
Stars: ✭ 310 (-19.9%)
Mutual labels:  ast
Javaparser
Java 1-15 Parser and Abstract Syntax Tree for Java, including preview features to Java 13
Stars: ✭ 3,972 (+926.36%)
Mutual labels:  ast

detective

find all calls to require() by walking the AST

build status

example

strings

strings_src.js:

var a = require('a');
var b = require('b');
var c = require('c');

strings.js:

var detective = require('detective');
var fs = require('fs');

var src = fs.readFileSync(__dirname + '/strings_src.js');
var requires = detective(src);
console.dir(requires);

output:

$ node examples/strings.js
[ 'a', 'b', 'c' ]

methods

var detective = require('detective');

detective(src, opts)

Give some source body src, return an array of all the require() calls with string arguments.

The options parameter opts is passed along to detective.find().

var found = detective.find(src, opts)

Give some source body src, return found with:

  • found.strings - an array of each string found in a require()
  • found.expressions - an array of each stringified expression found in a require() call
  • found.nodes (when opts.nodes === true) - an array of AST nodes for each argument found in a require() call

Optionally:

  • opts.word - specify a different function name instead of "require"
  • opts.nodes - when true, populate found.nodes
  • opts.isRequire(node) - a function returning whether an AST CallExpression node is a require call
  • opts.parse - supply options directly to acorn with some support for esprima-style options range and loc
  • opts.ecmaVersion - default: 9

install

With npm do:

npm install detective

license

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].