0.0.6 • Published 11 months ago

locale-pkg v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

locale-pkg

NPM version

Get information on local packages. Works on both CJS and ESM.

Install

npm i locale-pkg

Usage

import {
  getPackageInfo,
  importModule,
  isPackageExists,
  resolveModule,
} from 'locale-pkg'

isPackageExists('locale-pkg') // true
isPackageExists('foo') // false

await getPackageInfo('locale-pkg')
/* {
 *   name: "locale-pkg",
 *   version: "0.1.0",
 *   rootPath: "/path/to/node_modules/locale-pkg",
 *   packageJson: {
 *     ...
 *   }
 * }
 */

// similar to `require.resolve` but works also in ESM
resolveModule('locale-pkg')
// '/path/to/node_modules/local-pkg/dist/index.cjs'

// similar to `await import()` but works also in CJS
const { importModule } = await importModule('locale-pkg')

License

MIT License © 2023 Joruno-w

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago