resolve-pkg

WebJar for resolve-pkg

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

resolve-pkg
Последняя версия

Последняя версия

0.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

resolve-pkg
WebJar for resolve-pkg
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/sindresorhus/resolve-pkg

Скачать resolve-pkg

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/resolve-pkg/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>resolve-pkg</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/resolve-pkg/
implementation 'org.webjars.npm:resolve-pkg:0.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/resolve-pkg/
implementation ("org.webjars.npm:resolve-pkg:0.1.0")
'org.webjars.npm:resolve-pkg:jar:0.1.0'
<dependency org="org.webjars.npm" name="resolve-pkg" rev="0.1.0">
  <artifact name="resolve-pkg" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='resolve-pkg', version='0.1.0')
)
libraryDependencies += "org.webjars.npm" % "resolve-pkg" % "0.1.0"
[org.webjars.npm/resolve-pkg "0.1.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : resolve-from jar [2.0.0,3)

Модули Проекта

Данный проект не имеет модулей.

resolve-pkg Build Status

Resolve the path of a package regardless of it having an entry point

Some packages like CLI tools and grunt tasks don't have a entry point, like "main": "foo.js" in package.json, resulting in them not being resolvable by require.resolve(). Unlike require.resolve(), this module also resolves packages without an entry point, returns undefined instead of throwing when the module can't be found, and resolves from process.cwd() instead __dirname by default.

Install

$ npm install resolve-pkg

Usage

const resolvePkg = require('resolve-pkg');

// $ npm install --save-dev grunt-svgmin

resolvePkg('grunt-svgmin/tasks', {cwd: __dirname});
//=> '/Users/sindresorhus/unicorn/node_modules/grunt-svgmin/tasks'

// Fails here as Grunt tasks usually don't have a defined main entry point
require.resolve('grunt-svgmin/tasks');
//=> Error: Cannot find module 'grunt-svgmin'

API

resolvePkg(moduleId, [options])

moduleId

Type: string

What you would use in require().

options

cwd

Type: string
Default: process.cwd()

Directory to resolve from.

Related

  • resolve-cwd - Resolve the path of a module from the current working directory
  • resolve-from - Resolve the path of a module from a given path
  • resolve-global - Resolve the path of a globally installed module
  • import-from - Import a module from a given path
  • import-cwd - Import a module from the current working directory
  • import-lazy - Import a module lazily

License

MIT © Sindre Sorhus

Версии библиотеки

Версия
0.1.0