{"id":17736724,"url":"https://github.com/parro-it/electron-detective","last_synced_at":"2025-03-31T19:17:20.611Z","repository":{"id":66074139,"uuid":"56177857","full_name":"parro-it/electron-detective","owner":"parro-it","description":null,"archived":false,"fork":false,"pushed_at":"2016-04-13T18:58:55.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-15T00:06:07.479Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parro-it.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","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":"2016-04-13T18:53:22.000Z","updated_at":"2024-04-15T00:06:07.480Z","dependencies_parsed_at":"2023-03-20T13:49:49.685Z","dependency_job_id":null,"html_url":"https://github.com/parro-it/electron-detective","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Felectron-detective","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Felectron-detective/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Felectron-detective/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Felectron-detective/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parro-it","download_url":"https://codeload.github.com/parro-it/electron-detective/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246523847,"owners_count":20791444,"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":[],"created_at":"2024-10-26T00:24:11.692Z","updated_at":"2025-03-31T19:17:20.578Z","avatar_url":"https://github.com/parro-it.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# detect-import-require\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nThis is like [detective](https://www.npmjs.com/package/detective), but with a narrow focus and thin API, specifically aimed at supporting either `import` and/or `require` statements, and not much more.\n\n## Install\n\n```sh\nnpm install detect-import-require --save\n```\n\n## Example\n\nGiven the following file:\n\n`source.js`\n```js\nvar foo = require('a').foo\nvar bar = require('./blah.js')\nimport { uniq } from 'lodash'\nimport { resolve } from 'path'\n```\n\n```js\nvar fs = require('fs')\nvar detect = require('detect-import-require')\n\nvar src = fs.readFileSync('source.js', 'utf8')\nconsole.log(detect(src))\n//=\u003e [ 'a', './blah.js', 'lodash', 'path' ]\n```\n\n## Usage\n\n[![NPM](https://nodei.co/npm/detect-import-require.png)](https://www.npmjs.com/package/detect-import-require)\n\n#### `modules = detect(src, [opt])`\n\nReturns an array of module names (require paths) from the given `src` String or Buffer, which is assumed to be ES6/ES5. By default, looks for `import` and `require` statements. Results are not de-duplicated, and are in the order they are found.\n\nOptions:\n\n- `imports` (Boolean) - whether to look for `import` statements, default true\n- `requires` (Boolean) - whether to look for `require` statements, default true\n\n#### `modules = detect.find(src, [opt])`\n\nTakes the same options as above, but returns an object with the following additional data:\n\n```js\n{\n  strings: [],\n  expressions: [],\n  nodes: []\n}\n```\n\nWhere `strings` is the array of module names, `expressions` is an array of expressions from dynamic `require()` statements, and `nodes` is an array of AST nodes for each found require/import statement.\n\nExpressions do not appear in imports, and look like this:\n\n```js\n[\n  \"path.join(__dirname, '/foo.js')\",\n  \"__dirname + '/file.js'\"\n]\n```\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/Jam3/detect-import-require/blob/master/LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Felectron-detective","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparro-it%2Felectron-detective","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Felectron-detective/lists"}