← All repos

resolve-pkg-maps

Resolve package.json `exports` & `imports` maps

conditionalexportsimportsnodejspackage-jsonresolversubpaths
Browse cluster: Cluster 135
1commits
1contributors
2languages

Tech stack & purpose

resolve-pkg-maps is a utility library for resolving Node.js package.json `exports` and `imports` maps, implementing the ESM resolution algorithm and tested against Node.js for accuracy. The project is built in TypeScript and provides two main functions—`resolveExports()` and `resolveImports()`—that accept export/import map definitions, a request path, and an array of conditions, returning arrays of resolved file paths. It addresses limitations in similar tools like `resolve.exports` by supporting both exports and imports maps, returning multiple fallback paths for the user to handle, and omitting support for deprecated subpath folder mappings in favor of subpath patterns.

Languages

TypeScript
99.0%
JavaScript
1.0%

Contributors