module-lens
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

NPM Package Build Status Coverage Status

Module Lens

Installation

yarn add module-lens

Usage

import {resolve} from 'module-lens';
 
let path = resolve('foo/bar', {
  sourceFileName: __filename,
  baseUrlDirName: __dirname,
});
 
console.log(path);
 
let specifier = build(path, {
  sourceFileName: __filename,
  baseUrlDirName: __dirname,
});
 
console.log(specifier);

Difference from Package "resolve" by Browserify

The popular module resolving package resolve resolves a module specifier to a file, and throws an error if not being able to resolve to the final entry point. The resolve of Module Lens, however, does only minimal checks to determine where should the specifier be resolved to.

Module Lens resolve does not resolve a specifier to the final entry point, for example:

// if we have module "rxjs" installed:
resolve('rxjs/not-exists', {sourceFileName: __filename}); // -> 'node_modules/rxjs/not-exists'

License

MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i module-lens

Weekly Downloads

12

Version

0.1.6

License

MIT

Unpacked Size

20 kB

Total Files

19

Last publish

Collaborators

  • vilicvane