{"id":19904355,"url":"https://github.com/alloc/resolve.exports","last_synced_at":"2025-05-03T00:31:39.637Z","repository":{"id":61612441,"uuid":"553141655","full_name":"alloc/resolve.exports","owner":"alloc","description":"An alternative to the acclaimed `resolve.exports` package. Maintained by a member of the Vite core team.","archived":true,"fork":false,"pushed_at":"2022-11-14T19:17:04.000Z","size":727,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T05:51:29.027Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","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/alloc.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":"2022-10-17T19:30:36.000Z","updated_at":"2024-11-11T17:01:42.000Z","dependencies_parsed_at":"2022-10-18T17:30:29.939Z","dependency_job_id":null,"html_url":"https://github.com/alloc/resolve.exports","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fresolve.exports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fresolve.exports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fresolve.exports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alloc%2Fresolve.exports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alloc","download_url":"https://codeload.github.com/alloc/resolve.exports/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252013626,"owners_count":21680388,"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-11-12T20:28:02.145Z","updated_at":"2025-05-03T00:31:36.442Z","avatar_url":"https://github.com/alloc.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @alloc/resolve.exports\n\nAn improved version of the acclaimed [`resolve.exports`](https://github.com/lukeed/resolve.exports) package.\n\n- written in TypeScript\n- prefer readability over code golfing\n- only 50% larger than the original package (+1.5kB, unminified)\n- tests use [Vitest](https://github.com/vitest-dev/vitest) (100% test coverage)\n- code formatted with Prettier\n\n\u0026nbsp;\n\n### API differences\n\nThis package exports a `resolveExports` function, whose type signature is incompatible with the original `resolve.exports` package. A few options have been removed or renamed to better fit the needs of [Vite](https://github.com/vitejs/vite).\n\nThis package has no [`legacy`](https://github.com/lukeed/resolve.exports/#legacypkg-options) function export.\n\nThis package only throws errors for invalid `exports` syntax. It returns an empty array if no modules are matched.\n\n#### Fallback arrays\n\nTo support the \"fallback array\" feature (useful for glob patterns), the `resolveExports` function will always return an array of paths. If no matches are found, the array will be empty.\n\n#### Renamed options\n\nThe [`require`](https://github.com/lukeed/resolve.exports/#optionsrequire) was renamed to `isRequire` to match the resolve options used by Vite internals. This allows Vite to avoid creating a new object for every call to `resolveExports`.\n\n#### Removed options\n\nThe [`unsafe`](https://github.com/lukeed/resolve.exports/#optionsunsafe) and `browser` options have been removed. There is no way to replicate the behavior of `unsafe` in this package. The [`browser`](https://github.com/lukeed/resolve.exports/#optionsbrowser) option was removed because I want to leave room for future platform conditions (beyond just `browser` and `node`).\n\n#### Bug fixes\n\nThe following issues from `resolve.exports` are fixed by this package:\n\n- https://github.com/lukeed/resolve.exports/issues/7\n- https://github.com/lukeed/resolve.exports/issues/9\n- https://github.com/lukeed/resolve.exports/issues/16\n- https://github.com/lukeed/resolve.exports/issues/17\n- https://github.com/lukeed/resolve.exports/issues/19\n\n\u0026nbsp;\n\n### Type definitions\n\n```ts\ntype ExportMapping = null | string | PackageExports | readonly ExportMapping[]\nexport type PackageExports = {\n  [key: string]: ExportMapping\n}\nexport type PackageJson = {\n  name?: string\n  exports?: ExportMapping\n}\nexport interface ResolveExports {\n  (\n    pkg: PackageJson,\n    entry: string,\n    options?: ResolveExports.Options,\n    inlineConditions?: string[]\n  ): string[]\n}\nexport namespace ResolveExports {\n  export type Options = {\n    /**\n     * Custom conditions to match with.\n     *\n     * @example ['node']\n     */\n    conditions?: readonly string[]\n    /**\n     * When true, the `production` condition is used. Otherwise, the\n     * `development` condition is used.\n     */\n    isProduction?: boolean\n    /**\n     * When true, the `require` condition is used. Otherwise, the\n     * `import` condition is used.\n     */\n    isRequire?: boolean\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fresolve.exports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falloc%2Fresolve.exports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falloc%2Fresolve.exports/lists"}