module-lookup-amd
Resolve aliased dependency paths using a RequireJS config
Last updated 6 months ago by xhmikosr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install module-lookup-amd 
SYNC missed versions from official npm registry.

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

ESM

import lookup from '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
  configPath: 'path/to/config/directory', // optional
  fileSystem: {} // optional
});

CommonJS

const { default: lookup } = require('module-lookup-amd');
  • partial: the dependency that you want to lookup
  • filename: the path of the file that contains the dependency (i.e., parent module)
  • directory: Used to resolve files if you're not using a requirejs config
  • config: the path to your RequireJS configuration file
    • As an optimization, you can provide a pre-parsed config object (the contents of the RequireJS config in object form) as config. You are then required to provide a configPath or directory argument which is assumed to be the location where your config would have been.
  • configPath: path to the config file (or its directory) used to determine the module resolution directory; inferred automatically when config is a string path
  • fileSystem: An alternative fs implementation to use for filesystem interactions. Defaults to Node.js's fs implementation if not supplied.

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

Current Tags

  • 10.0.1                                ...           latest (6 months ago)

41 Versions

  • 10.0.1                                ...           6 months ago
  • 10.0.0                                ...           6 months ago
  • 9.1.3                                ...           7 months ago
  • 9.1.2                                ...           7 months ago
  • 9.1.1                                ...           9 months ago
  • 9.1.0                                ...           10 months ago
  • 9.0.5                                ...           a year ago
  • 9.0.4                                ...           2 years ago
  • 9.0.3                                ...           2 years ago
  • 9.0.2                                ...           2 years ago
  • 9.0.1                                ...           3 years ago
  • 9.0.0                                ...           3 years ago
  • 8.0.5                                ...           4 years ago
  • 8.0.4                                ...           4 years ago
  • 8.0.3                                ...           4 years ago
  • 8.0.2                                ...           4 years ago
  • 8.0.1                                ...           4 years ago
  • 8.0.0                                ...           4 years ago
  • 7.0.1                                ...           6 years ago
  • 7.0.0                                ...           6 years ago
  • 6.2.0                                ...           8 years ago
  • 6.1.0                                ...           8 years ago
  • 6.0.0                                ...           8 years ago
  • 5.0.2                                ...           8 years ago
  • 5.0.1                                ...           9 years ago
  • 5.0.0                                ...           9 years ago
  • 4.0.5                                ...           9 years ago
  • 4.0.4                                ...           10 years ago
  • 4.0.3                                ...           10 years ago
  • 4.0.2                                ...           10 years ago
  • 4.0.1                                ...           10 years ago
  • 4.0.0                                ...           10 years ago
  • 3.0.0                                ...           11 years ago
  • 2.0.5                                ...           11 years ago
  • 2.0.4                                ...           11 years ago
  • 2.0.3                                ...           11 years ago
  • 2.0.2                                ...           11 years ago
  • 2.0.1                                ...           11 years ago
  • 2.0.0                                ...           11 years ago
  • 1.0.0                                ...           12 years ago
  • 0.0.0                                ...           12 years ago
Downloads
Total 169
Today 0
This Week 1
This Month 49
Last Day 0
Last Week 5
Last Month 120
Dependencies (3)
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE