{"id":19123427,"url":"https://github.com/dependents/module-definition","last_synced_at":"2026-04-20T06:11:37.967Z","repository":{"id":15140332,"uuid":"17867659","full_name":"dependents/module-definition","owner":"dependents","description":"Determines whether a JavaScript file is in the CommonJS, AMD, or ES6 format","archived":false,"fork":false,"pushed_at":"2026-04-14T05:47:38.000Z","size":752,"stargazers_count":9,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-14T07:33:11.107Z","etag":null,"topics":["amd","ast","commonjs","es6","javascript","module"],"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/dependents.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-03-18T13:59:02.000Z","updated_at":"2026-04-14T05:47:41.000Z","dependencies_parsed_at":"2024-04-09T07:23:51.720Z","dependency_job_id":"4c23f4b4-40f9-497b-9e46-bfeb8f344185","html_url":"https://github.com/dependents/module-definition","commit_stats":{"total_commits":83,"total_committers":9,"mean_commits":9.222222222222221,"dds":0.5542168674698795,"last_synced_commit":"4cb577d490be654c56ef7b27a4bcf64afbd3ee9e"},"previous_names":["mrjoelkemp/module-definition"],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/dependents/module-definition","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dependents%2Fmodule-definition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dependents%2Fmodule-definition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dependents%2Fmodule-definition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dependents%2Fmodule-definition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dependents","download_url":"https://codeload.github.com/dependents/module-definition/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dependents%2Fmodule-definition/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31991444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"ssl_error","status_checked_at":"2026-04-18T20:23:29.375Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["amd","ast","commonjs","es6","javascript","module"],"created_at":"2024-11-09T05:25:37.373Z","updated_at":"2026-04-20T06:11:37.951Z","avatar_url":"https://github.com/dependents.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# module-definition\n\n[![CI](https://img.shields.io/github/actions/workflow/status/dependents/module-definition/ci.yml?branch=main\u0026label=CI\u0026logo=github)](https://github.com/dependents/module-definition/actions/workflows/ci.yml?query=branch%3Amain)\n[![npm version](https://img.shields.io/npm/v/module-definition?logo=npm\u0026logoColor=fff)](https://www.npmjs.com/package/module-definition)\n[![npm downloads](https://img.shields.io/npm/dm/module-definition)](https://www.npmjs.com/package/module-definition)\n\nDetermines the module definition type (CommonJS, AMD, ES6, or none) for a given JavaScript file\nby walking through the AST.\n\n```sh\nnpm install module-definition\n```\n\n## Usage\n\n```js\nconst getModuleType = require('module-definition');\n\n// Async\ngetModuleType('myscript.js', (error, type) =\u003e {\n  console.log(type);\n});\n\n// Sync\nlet type = getModuleType.sync('myscript.js');\nconsole.log(type);\n\n// From source (string or an AST)\ntype = getModuleType.fromSource('define({foo: \"foo\"});');\nconsole.log(type);\n```\n\nPasses one of the following strings to the given callback or returns the string in sync API:\n\n* amd\n* commonjs\n* es6\n* none\n\nYou may also pass an AST to `fromSource` to avoid an internal parsing of the source.\n\nWhen specifying a filename, using the sync or async API, you can also provide an `options` object with an alternative `fs` implementation used to read the source file with.\n\n```js\nconst myFs = GetFs();\nconst options = { fileSystem: myFs };\n\n// Async\ngetModuleType('myscript.js', (error, type) =\u003e {\n  console.log(type);\n}, options);\n\n// Sync\nconst type = getModuleType.sync('myscript.js', options);\n```\n\n## CLI\n\n*Assumes a global install module-definition with `npm install -g module-definition`*\n\n```sh\nmodule-definition filename\n```\n\n### License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdependents%2Fmodule-definition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdependents%2Fmodule-definition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdependents%2Fmodule-definition/lists"}