{"id":15375991,"url":"https://github.com/thepassle/find-dependencies","last_synced_at":"2025-03-01T09:26:27.081Z","repository":{"id":46392487,"uuid":"418056893","full_name":"thepassle/find-dependencies","owner":"thepassle","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-18T08:52:47.000Z","size":85,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T23:33:05.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thepassle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-17T07:43:44.000Z","updated_at":"2021-10-18T08:52:50.000Z","dependencies_parsed_at":"2022-09-23T00:11:16.244Z","dependency_job_id":null,"html_url":"https://github.com/thepassle/find-dependencies","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/thepassle%2Ffind-dependencies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thepassle%2Ffind-dependencies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thepassle%2Ffind-dependencies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thepassle%2Ffind-dependencies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thepassle","download_url":"https://codeload.github.com/thepassle/find-dependencies/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241345724,"owners_count":19947823,"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-01T14:05:31.270Z","updated_at":"2025-03-01T09:26:27.052Z","avatar_url":"https://github.com/thepassle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# find-dependencies\n\nGiven an array of paths, scans all modules and returns all depending paths.\n\nIntended to be used on post-build, frontend facing, ESM based code.\n\n## Usage\n\n```js\nconst inputPaths = ['my-package/index.js'];\n```\n\nWhere `my-package/index.js` contains:\n\n```js\nimport '@scoped/package';\nimport {b} from '@scoped/package/baz/index.js';\nimport c from 'export-map';\nimport d from 'nested';\nimport e from 'regular';\nimport g from './bla.js';\nimport('dynamic-import');\n```\n\n```js\nconst inputPaths = ['my-package/index.js'];\nconst dependencies = await findDependencies(inputPaths);\n```\n\nWill output:\n\n```js\n[\n  '/users/blank/my-package/node_modules/@scoped/package/index.js',\n  '/users/blank/my-package/node_modules/@scoped/package/baz/index.js',\n  '/users/blank/my-package/node_modules/export-map/long/path/index.js',\n  '/users/blank/my-package/node_modules/nested/index.js',\n  '/users/blank/my-package/node_modules/regular/index.js',\n  '/users/blank/my-package/node_modules/dynamic-import/index.js',\n  '/users/blank/my-package/node_modules/nested/node_modules/regular/index.js'\n]\n```\n\n## Configuration\n\n```js\nexport interface Options {\n  /** \n   * In case `node_modules` is higher up in the file tree, for example in a monorepo\n   * Defaults to 3 \n   */\n  nodeModulesDepth?: number,\n  /** Defaults to `process.cwd()` */\n  basePath?: string\n}\n```\n\n```js\nfindDependencies(inputPaths, {\n  basePath: 'foo/bar',\n  nodeModulesDepth: 5,\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthepassle%2Ffind-dependencies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthepassle%2Ffind-dependencies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthepassle%2Ffind-dependencies/lists"}