module-lens
v0.1.6
Published
Simple module specifier utilities.
Readme
Module Lens
Installation
yarn add module-lensUsage
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.
