Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/antfu/pkg-exports

Get exports of an local npm package.
https://github.com/antfu/pkg-exports

Last synced: 13 days ago
JSON representation

Get exports of an local npm package.

Awesome Lists containing this project

README

        

# pkg-exports

[![NPM version](https://img.shields.io/npm/v/pkg-exports?color=a1b858&label=)](https://www.npmjs.com/package/pkg-exports)

Get exports of an local npm package.

## Install

```bash
npm i pkg-exports
```

## Usage

### `getExportsRuntime`

Get the exports by evaluate the module in worker thread.

```ts
import { getExportsRuntime } from 'pkg-exports'

const exports = await getExportsRuntime('vue')
console.log(exports) // ['ref', 'computed', ...]
```

### `getExportsStatic`

Get the exports by static analysis (only work with ESM). **Experimental**.

```ts
import { getExportsStatic } from 'pkg-exports'

const exports = await getExportsStatic('vue')
console.log(exports) // ['ref', 'computed', ...]
```

## Sponsors





## License

[MIT](./LICENSE) License © 2022 [Anthony Fu](https://github.com/antfu)