{"id":15413462,"url":"https://github.com/wooorm/module-exports","last_synced_at":"2025-04-13T21:34:23.401Z","repository":{"id":236075630,"uuid":"791857452","full_name":"wooorm/module-exports","owner":"wooorm","description":"Get the exports of a module","archived":false,"fork":false,"pushed_at":"2024-08-28T12:24:38.000Z","size":139,"stargazers_count":13,"open_issues_count":15,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T11:51:18.470Z","etag":null,"topics":["api","export","module","node","typescript"],"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/wooorm.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":"funding.yml","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},"funding":{"github":"wooorm"}},"created_at":"2024-04-25T14:04:10.000Z","updated_at":"2024-12-14T20:02:12.000Z","dependencies_parsed_at":"2024-04-25T15:28:53.735Z","dependency_job_id":"da2548ed-3d59-498d-96c4-f9d518c9b13c","html_url":"https://github.com/wooorm/module-exports","commit_stats":null,"previous_names":["wooorm/module-exports"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fmodule-exports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fmodule-exports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fmodule-exports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fmodule-exports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wooorm","download_url":"https://codeload.github.com/wooorm/module-exports/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248333602,"owners_count":21086200,"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":["api","export","module","node","typescript"],"created_at":"2024-10-01T16:57:11.633Z","updated_at":"2025-04-13T21:34:18.383Z","avatar_url":"https://github.com/wooorm.png","language":"JavaScript","funding_links":["https://github.com/sponsors/wooorm"],"categories":[],"sub_categories":[],"readme":"# module-exports\n\n[![Build][badge-build-image]][badge-build-url]\n[![Coverage][badge-coverage-image]][badge-coverage-url]\n[![Downloads][badge-downloads-image]][badge-downloads-url]\n\n\u003e 🐉 **Note**: this is new software doing complex things that hasn’t been used\n\u003e much.\n\u003e Here be dragons!\n\nGet the exports of a module.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`Name`](#name)\n  * [`Result`](#result)\n  * [`Symbol`](#symbol)\n  * [`Value`](#value)\n  * [`createFinder()`](#createfinder)\n  * [`defaultFormat(symbols)`](#defaultformatsymbols)\n* [Compatibility](#compatibility)\n* [Version](#version)\n* [Thanks](#thanks)\n* [Security](#security)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package finds out what is exposed from a module.\n\n## When should I use this?\n\nYou can use this to programatically figure out what can be used from a module.\nPrimarily, so that you can then generate docs.\n\n## Install\n\nThis package is [ESM only][github-gist-esm].\nIn Node.js (version 18+), install with [npm][npm-install]:\n\n```sh\nnpm install module-exports\n```\n\n## Use\n\n```js\nimport {toMarkdown} from 'mdast-util-to-markdown'\nimport {createFinder, defaultFormat} from 'module-exports'\n\nconst finder = createFinder()\nconst result = await finder(new URL('index.js', import.meta.url))\n\nconst tree = await defaultFormat(result.symbols)\n\nconsole.log(toMarkdown(tree))\n```\n\nYields:\n\n```markdown\n### `Name`\n\nName fields.\n\n###### Fields\n\n* `name` (`Identifier | NumericLiteral | StringLiteral`)\n  — name node\n* `nameDisplay` (`string`)\n  — serialized symbol name to sort on\n* `nameDisplayPrefix` (`string`)\n  — prefix to display before name\n* `nameDisplaySuffix` (`string`)\n  — suffix to display after name\n\n\u003c!-- … --\u003e\n\n### `defaultFormat(symbols)`\n\nFormat symbols.\n\n###### Parameters\n\n* `symbols` (`ReadonlyArray\u003cSymbol\u003e`)\n  — list of symbols\n\n###### Returns\n\nPromise to an mdast tree of formatted symbols (`Promise\u003cRoot\u003e`).\n```\n\n## API\n\nThis package exports the identifiers\n[`createFinder`][api-create-finder] and\n[`defaultFormat`][api-default-format].\nIt exports the [TypeScript][] types\n[`Name`][api-name],\n[`Result`][api-result],\n[`Symbol`][api-symbol], and\n[`Value`][api-value].\nThere is no default export.\n\n### `Name`\n\nName fields.\n\n###### Fields\n\n* `name` (`Identifier | NumericLiteral | StringLiteral`)\n  — name node\n* `nameDisplay` (`string`)\n  — serialized symbol name to sort on\n* `nameDisplayPrefix` (`string`)\n  — prefix to display before name\n* `nameDisplaySuffix` (`string`)\n  — suffix to display after name\n\n### `Result`\n\nResult.\n\n###### Fields\n\n* `messages` (`Array\u003cVFileMessage\u003e`)\n  — messages\n* `symbols` (`Array\u003cSymbol\u003e`)\n  — symbols\n\n### `Symbol`\n\nValue with name.\n\n###### Extends\n\n* `Name`\n* `Value`\n\n### `Value`\n\nValue without name.\n\n###### Fields\n\n* `description` (`Root | undefined`)\n  — symbol description\n* `heritage` (`Array\u003cValue\u003e`)\n  — things this inherits from\n* `parameters` (`Array\u003cSymbol\u003e`)\n  — parameters\n* `properties` (`Array\u003cSymbol\u003e`)\n  — properties\n* `return` (`Value | undefined`)\n  — return value\n* `typeExpression` (`Type`)\n  — type of value itself\n* `typeExpressionDisplay` (`string`)\n  — seralized type\n\n### `createFinder()`\n\nCreate a finder.\n\n###### Parameters\n\nThere are no parameters.\n\n###### Returns\n\nFinder (`(url: Readonly\u003cURL\u003e) =\u003e Promise\u003cResult\u003e`).\n\n### `defaultFormat(symbols)`\n\nFormat symbols.\n\n###### Parameters\n\n* `symbols` (`ReadonlyArray\u003cSymbol\u003e`)\n  — list of symbols\n\n###### Returns\n\nPromise to an mdast tree of formatted symbols (`Promise\u003cRoot\u003e`).\n\n## Compatibility\n\nThis projects is compatible with maintained versions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `module-exports@2`,\ncompatible with Node.js 18.\n\n## Version\n\n`module-exports` does not strictly follow [SemVer](https://semver.org) yet\nwhile being super new.\n\n## Thanks\n\nSpecial thanks go out to:\n\n* [**@allmaps**][github-allmaps] and\n  [Royal Netherlands Academy of Arts and Sciences (KNAW)][knaw]\n  for funding the initial development\n* [**@mattdesl**][github-mattdesl] for the package name\n\n## Security\n\nThis package is safe.\n\n## Contribute\n\nYes please!\nSee [How to Contribute to Open Source][open-source-guide-contribute].\n\n## License\n\n[MIT][file-license] © [Titus Wormer][wooorm]\n\n\u003c!-- Definitions --\u003e\n\n[api-create-finder]: #createfinder\n\n[api-default-format]: #defaultformatsymbols\n\n[api-name]: #name\n\n[api-result]: #result\n\n[api-symbol]: #symbol\n\n[api-value]: #value\n\n[badge-build-image]: https://github.com/wooorm/module-exports/actions/workflows/main.yml/badge.svg\n\n[badge-build-url]: https://github.com/wooorm/module-exports/actions\n\n[badge-coverage-image]: https://img.shields.io/codecov/c/github/wooorm/module-exports.svg\n\n[badge-coverage-url]: https://codecov.io/github/wooorm/module-exports\n\n[badge-downloads-image]: https://img.shields.io/npm/dm/module-exports.svg\n\n[badge-downloads-url]: https://www.npmjs.com/package/module-exports\n\n[file-license]: license\n\n[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[github-allmaps]: https://github.com/allmaps\n\n[github-mattdesl]: https://github.com/mattdesl\n\n[knaw]: https://www.knaw.nl/en\n\n[npm-install]: https://docs.npmjs.com/cli/install\n\n[open-source-guide-contribute]: https://opensource.guide/how-to-contribute/\n\n[typescript]: https://www.typescriptlang.org\n\n[wooorm]: https://wooorm.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwooorm%2Fmodule-exports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwooorm%2Fmodule-exports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwooorm%2Fmodule-exports/lists"}