Skip to content package
pkg-entry-points v1.1.2 Get all entry-points for an npm package. Supports the `exports` field in `package.json`.
node >=20.19.5 0 deps esm cjs types open source
overview readme
license MIT
deps 0
unpacked 25.6 kB
files 7
node >=20.19.5 $ npm install pkg-entry-points@1.1.2n npmREADME GitHub-flavored package documentation.
downloads Across all versions.
Download trend unavailable.
compatibility Runtime metadata.
keywords Tagged topics.
node.js package.json entry points entry-points exports conditions entries
versions Latest published Jun 8, 2026
maintainers Registry package owners.
install size Estimated unpacked size across 1 packages.
25.6 kB
Includes dependencies.
contents pkg-entry-points
Get all entry-points for an npm package. Supports the exports field to expand subpaths and condition combinations.
Already a sponsor? Join the discussion in the Development repo !
Install
npm install pkg-entry-points copy
Usage
To get all entry-points for a package located at ./node_modules/my-package:
import { getPackageEntryPoints, type PackageEntryPoints } from 'pkg-entry-points'
const packageExports : PackageEntryPoints = await getPackageEntryPoints ( './node_modules/my-package' )
console. log (packageExports)
/*
{
'.': [
[conditions, internalPath],
],
'./entry-file': [
[['types'], './dist/entry-file.d.ts'],
[['import'], './dist/entry-file.mjs'],
[['require'], './dist/entry-file.js'],
],
...,
}
*/ copy
Example: vue - using exports conditions
Entry-points evaluated from the vue package :
vue entry-points
{
"." : [
[
[
"types" ,
],
"./dist/vue.d.ts" ,
],
[
[
"require" ,
],
"./index.js" ,
],
[
[
"import" ,
"node" ,
],
"./index.mjs" ,
],
[
[
"default" ,
"import" ,
],
"./dist/vue.runtime.esm-bundler.js" ,
Example: typescript - no exports (legacy main field, etc.)
Entry-points evaluated from the typescript package :
typescript entry-points
{
"./lib/cancellationToken.js" : [
[
[
"default" ,
],
"./lib/cancellationToken.js" ,
],
],
"./lib/cs/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/cs/diagnosticMessages.generated.json" ,
],
],
"./lib/de/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/de/diagnosticMessages.generated.json" ,
],
],
"./lib/es/diagnosticMessages.generated.json" : [
API
getPackageEntryPoints(packagePath, fs?)
Returns: Promise<PackageEntryPoints>
Type definitions (both PackageEntryPoints and ConditionToPath are exported):
type PackageEntryPoints = {
[subpath : string ] : ConditionToPath []
}
type ConditionToPath = [ conditions : string [], internalPath : string ] copy
Description
Returns all possible entry-points of an npm package.
If the package has a package.json#exports property, it will return an object where the keys are expanded subpaths and the values are arrays of tuples containing an array of possible import combinations paired with the internal file path it resolves to.
If the package does not have an exports property, it will return an object where the keys are the internal file paths, mapping to arrays of possible import combinations.
Parameters
packagePath
Type: string
Required
The path to the package to get the exports for.
fs
Type: typeof import('fs/promises')
Optional
Default: fs.promises
The file-system to use. Defaults to Node.js's fs/promises module.
Utils to resolve package.json subpath & conditional exports /imports maps in resolvers.
],
],
"./server-renderer" : [
[
[
"types" ,
],
"./server-renderer/index.d.ts" ,
],
[
[
"import" ,
],
"./server-renderer/index.mjs" ,
],
[
[
"require" ,
],
"./server-renderer/index.js" ,
],
],
"./compiler-sfc" : [
[
[
"types" ,
],
"./compiler-sfc/index.d.ts" ,
],
[
[
"import" ,
],
"./compiler-sfc/index.mjs" ,
],
[
[
"require" ,
],
"./compiler-sfc/index.js" ,
],
],
"./dist/vue.cjs.js" : [
[
[
"default" ,
],
"./dist/vue.cjs.js" ,
],
],
"./dist/vue.cjs.prod.js" : [
[
[
"default" ,
],
"./dist/vue.cjs.prod.js" ,
],
],
"./dist/vue.d.ts" : [
[
[
"default" ,
],
"./dist/vue.d.ts" ,
],
],
"./dist/vue.esm-browser.js" : [
[
[
"default" ,
],
"./dist/vue.esm-browser.js" ,
],
],
"./dist/vue.esm-browser.prod.js" : [
[
[
"default" ,
],
"./dist/vue.esm-browser.prod.js" ,
],
],
"./dist/vue.esm-bundler.js" : [
[
[
"default" ,
],
"./dist/vue.esm-bundler.js" ,
],
],
"./dist/vue.global.js" : [
[
[
"default" ,
],
"./dist/vue.global.js" ,
],
],
"./dist/vue.global.prod.js" : [
[
[
"default" ,
],
"./dist/vue.global.prod.js" ,
],
],
"./dist/vue.runtime.esm-browser.js" : [
[
[
"default" ,
],
"./dist/vue.runtime.esm-browser.js" ,
],
],
"./dist/vue.runtime.esm-browser.prod.js" : [
[
[
"default" ,
],
"./dist/vue.runtime.esm-browser.prod.js" ,
],
],
"./dist/vue.runtime.esm-bundler.js" : [
[
[
"default" ,
],
"./dist/vue.runtime.esm-bundler.js" ,
],
],
"./dist/vue.runtime.global.js" : [
[
[
"default" ,
],
"./dist/vue.runtime.global.js" ,
],
],
"./dist/vue.runtime.global.prod.js" : [
[
[
"default" ,
],
"./dist/vue.runtime.global.prod.js" ,
],
],
"./package.json" : [
[
[
"default" ,
],
"./package.json" ,
],
],
"./macros" : [
[
[
"default" ,
],
"./macros.d.ts" ,
],
],
"./macros-global" : [
[
[
"default" ,
],
"./macros-global.d.ts" ,
],
],
"./ref-macros" : [
[
[
"default" ,
],
"./ref-macros.d.ts" ,
],
],
}
copy
[
[
"default" ,
],
"./lib/es/diagnosticMessages.generated.json" ,
],
],
"./lib/fr/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/fr/diagnosticMessages.generated.json" ,
],
],
"./lib/it/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/it/diagnosticMessages.generated.json" ,
],
],
"./lib/ja/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/ja/diagnosticMessages.generated.json" ,
],
],
"./lib/ko/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/ko/diagnosticMessages.generated.json" ,
],
],
"./lib/pl/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/pl/diagnosticMessages.generated.json" ,
],
],
"./lib/pt-br/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/pt-br/diagnosticMessages.generated.json" ,
],
],
"./lib/ru/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/ru/diagnosticMessages.generated.json" ,
],
],
"./lib/tr/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/tr/diagnosticMessages.generated.json" ,
],
],
"./lib/tsc.js" : [
[
[
"default" ,
],
"./lib/tsc.js" ,
],
],
"./lib/tsserver.js" : [
[
[
"default" ,
],
"./lib/tsserver.js" ,
],
],
"./lib/tsserverlibrary.js" : [
[
[
"default" ,
],
"./lib/tsserverlibrary.js" ,
],
],
"./lib/typesMap.json" : [
[
[
"default" ,
],
"./lib/typesMap.json" ,
],
],
"./lib/typescript.js" : [
[
[
"default" ,
],
"./lib/typescript.js" ,
],
],
"./lib/typingsInstaller.js" : [
[
[
"default" ,
],
"./lib/typingsInstaller.js" ,
],
],
"./lib/watchGuard.js" : [
[
[
"default" ,
],
"./lib/watchGuard.js" ,
],
],
"./lib/zh-cn/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/zh-cn/diagnosticMessages.generated.json" ,
],
],
"./lib/zh-tw/diagnosticMessages.generated.json" : [
[
[
"default" ,
],
"./lib/zh-tw/diagnosticMessages.generated.json" ,
],
],
"./package.json" : [
[
[
"default" ,
],
"./package.json" ,
],
],
"." : [
[
[
"default" ,
],
"./lib/typescript.js" ,
],
],
}
copy