Socket
Socket
Sign inDemoInstall

module-lookup-amd

Package Overview
Dependencies
19
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    module-lookup-amd

Resolve aliased dependency paths using a RequireJS config


Version published
Weekly downloads
683K
decreased by-10.2%
Maintainers
3
Install size
1.89 MB
Created
Weekly downloads
 

Readme

Source

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
});
  • 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 directory argument which is assumed to be the location where your config would have been.
  • 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

Keywords

FAQs

Last updated on 10 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc