{"id":18653239,"url":"https://github.com/babel-utils/babel-collect-imports","last_synced_at":"2025-06-24T15:06:17.125Z","repository":{"id":57188760,"uuid":"116093997","full_name":"babel-utils/babel-collect-imports","owner":"babel-utils","description":"Recursively collect all the internal and external dependencies from an entry point","archived":false,"fork":false,"pushed_at":"2019-02-07T09:38:26.000Z","size":33,"stargazers_count":34,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T02:21:02.454Z","etag":null,"topics":["babel","babylon","dependencies","external","imports","internal","parse"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"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/babel-utils.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-03T05:10:21.000Z","updated_at":"2024-07-18T06:36:25.000Z","dependencies_parsed_at":"2022-08-28T12:51:35.522Z","dependency_job_id":null,"html_url":"https://github.com/babel-utils/babel-collect-imports","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/babel-utils/babel-collect-imports","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babel-utils%2Fbabel-collect-imports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babel-utils%2Fbabel-collect-imports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babel-utils%2Fbabel-collect-imports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babel-utils%2Fbabel-collect-imports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/babel-utils","download_url":"https://codeload.github.com/babel-utils/babel-collect-imports/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babel-utils%2Fbabel-collect-imports/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260656127,"owners_count":23042942,"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":["babel","babylon","dependencies","external","imports","internal","parse"],"created_at":"2024-11-07T07:10:42.372Z","updated_at":"2025-06-24T15:06:17.094Z","avatar_url":"https://github.com/babel-utils.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-collect-imports\n\n\u003e Recursively collect all the internal and external dependencies from an entry point\n\n## Install\n\n```sh\nyarn add babel-collect-imports\n```\n\n## Usage\n\n```js\nconst { collectImportsSync } = require('babel-collect-imports');\n\nlet { internal, external } = collectImportsSync('path/to/entry.js');\n// { internal: ['path/to/entry.js', 'path/to/import.js', 'path/to/other/import.js'],\n//   external: ['lodash', 'react'] }\n```\n\nWhen it discovers an \"internal\" dependency (one that is not a node package), it\nwill follow the import and continue collecting dependencies.\n\n## API\n\n### `collectImportsSync(entry, parserOpts?, resolveOpts?)`\n\n- `entry` should be a full file path\n- `parserOpts` is [Babylon's](https://github.com/babel/babel/tree/master/packages/babylon) options\n- `resolveOpts` is [resolve's](https://github.com/browserify/resolve) options\n\n## FAQ\n\n#### How are \"internal\" vs \"external\" imports determined?\n\nIt's all about the starting dot:\n\n```js\nimport internal from './internal-because-it-starts-with-a-dot';\nimport external from 'external-because-it-does-not-start-with-a-dot';\n```\n\n#### What about my special aliasing system?\n\nYour custom aliasing is bad and you should feel bad. Try playing with\n`resolveOpts`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabel-utils%2Fbabel-collect-imports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbabel-utils%2Fbabel-collect-imports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabel-utils%2Fbabel-collect-imports/lists"}