dependents / node-module-lookup-amd

Resolve aliased dependency paths using a RequireJS config
MIT License
6 stars 8 forks source link
requirejs

module-lookup-amd

CI npm version npm downloads

Resolve AMD dependency paths to an absolute path on the filesystem

This module takes in a partial and synchronously gives back its absolute path on the filesystem.

I built this for Dependents' jump to dependency feature that lets you click on a module name and open the relevant file.

npm install module-lookup-amd

Usage

const lookup = require('module-lookup-amd');

const realPath = lookup({
  partial: 'someModule',
  filename: 'file/containing/partial',
  directory: 'path/to/all/js/files', // optional
  config: 'path/to/my/requirejs/config', // optional
  fileSystem: {} // optional
});

CLI

Assumes a global -g installation

lookup-amd -c path/to/my/config.js -f path/to/file/containing/dependency -d path/containing/all/files my/dependency/name

License

MIT