{"id":13526808,"url":"https://github.com/browserify/detective","last_synced_at":"2025-12-18T02:57:15.683Z","repository":{"id":470532,"uuid":"1914120","full_name":"browserify/detective","owner":"browserify","description":"Find all calls to require() no matter how deeply nested using a proper walk of the AST","archived":false,"fork":false,"pushed_at":"2024-06-23T05:28:23.000Z","size":120,"stargazers_count":414,"open_issues_count":10,"forks_count":60,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-10-29T21:22:02.147Z","etag":null,"topics":["ast","commonjs","dependencies","javascript","modules"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/browserify.png","metadata":{"files":{"readme":"readme.markdown","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-06-18T01:14:05.000Z","updated_at":"2024-08-19T06:31:21.000Z","dependencies_parsed_at":"2024-11-19T23:45:48.774Z","dependency_job_id":"741f04cc-46a5-4168-b1c3-012923d5d4f7","html_url":"https://github.com/browserify/detective","commit_stats":{"total_commits":144,"total_committers":24,"mean_commits":6.0,"dds":0.5763888888888888,"last_synced_commit":"51d5e1af8f7fd14629197b63fd0c55e54c67f12d"},"previous_names":["substack/node-detective"],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fdetective","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fdetective/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fdetective/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserify%2Fdetective/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/browserify","download_url":"https://codeload.github.com/browserify/detective/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248197464,"owners_count":21063619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","commonjs","dependencies","javascript","modules"],"created_at":"2024-08-01T06:01:35.293Z","updated_at":"2025-12-18T02:57:15.644Z","avatar_url":"https://github.com/browserify.png","language":"JavaScript","readme":"# detective\n\nfind all calls to `require()` by walking the AST\n\n[![build status](https://secure.travis-ci.org/browserify/detective.png)](http://travis-ci.org/browserify/detective)\n\n# example\n\n## strings\n\nstrings_src.js:\n\n``` js\nvar a = require('a');\nvar b = require('b');\nvar c = require('c');\n```\n\nstrings.js:\n\n``` js\nvar detective = require('detective');\nvar fs = require('fs');\n\nvar src = fs.readFileSync(__dirname + '/strings_src.js');\nvar requires = detective(src);\nconsole.dir(requires);\n```\n\noutput:\n\n```\n$ node examples/strings.js\n[ 'a', 'b', 'c' ]\n```\n\n# methods\n\n``` js\nvar detective = require('detective');\n```\n\n## detective(src, opts)\n\nGive some source body `src`, return an array of all the `require()` calls with\nstring arguments.\n\nThe options parameter `opts` is passed along to `detective.find()`.\n\n## var found = detective.find(src, opts)\n\nGive some source body `src`, return `found` with:\n\n* `found.strings` - an array of each string found in a `require()`\n* `found.expressions` - an array of each stringified expression found in a\n`require()` call\n* `found.nodes` (when `opts.nodes === true`) - an array of AST nodes for each\nargument found in a `require()` call\n\nOptionally:\n\n* `opts.word` - specify a different function name instead of `\"require\"`\n* `opts.nodes` - when `true`, populate `found.nodes`\n* `opts.isRequire(node)` - a function returning whether an AST `CallExpression`\nnode is a require call\n* `opts.parse` - supply options directly to\n[acorn](https://npmjs.org/package/acorn) with some support for esprima-style\noptions `range` and `loc`\n* `opts.ecmaVersion` - default: 9\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install detective\n```\n\n# license\n\nMIT\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserify%2Fdetective","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowserify%2Fdetective","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserify%2Fdetective/lists"}