0.1.6 • Published 4 years ago

module-lens v0.1.6

Weekly downloads
20
License
MIT
Repository
github
Last release
4 years ago

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.