find-entry-point

1.6.2 • Public • Published

Version

Find the entry point of a Node module via the command line or programmatically.



Quick start

npx find-entry-point <modulename>


Install

npm install find-entry-point -g


Usage

Command Line

$> find-entry-point <modulename>

Programmatically

const {findPackageEntryPoint} = require("find-entry-point")
import {findPackageEntryPoint} from "find-entry-point"


Examples


For Js code

const entryPoint = findPackageEntryPoint("to-ansi")
console.log(entryPoint)
// C:\path\to\node_modules\to-ansi\index.cjs
const entryPoint = findPackageEntryPoint("to-ansi", "some-dir/")

For command line

$> find-entry-point --name strip-comments-strings
/projects/find-entry-point/node_modules/strip-comments-strings/index.mjs

$> find-entry-point --name to-ansi --path /projects/some-project-path           
/projects/to-esm/node_modules/to-ansi/index.mjs

$> find-entry-point --name to-ansi --path /projects/some-project-path  --target cjs
/projects/to-esm/node_modules/to-ansi/index.cjs

$> find-entry-point --name to-ansi --path /projects/some-project-path  --target esm
/projects/to-esm/node_modules/to-ansi/index.mjs

$> find-entry-point --name my-module --path /projects/some-project-path  --target browser
/projects/to-esm/node_modules/my-module/index.js


$> find-entry-point --name to-ansi
$> find-entry-point to-ansi
$> find-entry-point node_modules/to-ansi
$> find-entry-point which
$> find-entry-point node_modules/which
$> find-entry-point ../clonefile/node_modules/rimraf
$> find-entry-point --name which --path ../clonefile
$> find-entry-point --name ./
$> find-entry-point --name ./ --target esm
$> find-entry-point --name ./ --target browser

Options


For Js code


Options Description Expect default
silent For hiding messages boolean false
exception For hiding errors boolean false
isBrowser To detect entry point for browser environment (takes precedence over isModule) boolean false
isModule To detect entry point for ESM environment boolean true
isCjs To detect entry point for CommonJs environment boolean false
noAnsi To display errors without ansi colors boolean false
noAmbiguous To prevent looking for ambiguous/non standard enough entrypoint boolean false


For command line

Options Description Expect default
--silent For hiding messages boolean false
--exception For hiding errors boolean false
--target To force environment browser,esm,cjs browser
--noAnsi To disable ANSI symbols boolean false
--noAmbiguous To prevent ambiguous entrypoint boolean false


License

find-entry-point by Patrice Thimothee is marked with CC0 1.0



Package

📁 package                
│
└───📁 cjs
│   │
│   │─ 📝 find-entry-point.cjs            ⇽ CJS version      - Node (8.93k unminified)
│   │
└───📁 esm
│   │
│   │─ 📝 find-entry-point.mjs            ⇽ ESM version      - Node (8.94k unminified)
│   │
└───📁 build
│   │
│   │─ 📝 find-entry-point.min.cjs        ⇽ CJS version      - Node (9.36k minified)
│   │─ 📝 find-entry-point.min.mjs        ⇽ ESM version      - Node (8.74k minified)



Changelog

  • Add a --noAmbiguous option for skipping ambiguous entrypoint
  • Fix undefined variable js error

Readme

Keywords

none

Package Sidebar

Install

npm i find-entry-point

Weekly Downloads

722

Version

1.6.2

License

CC0 1.0

Unpacked Size

53.6 kB

Total Files

8

Last publish

Collaborators

  • thimpat