load-module
Standard dynamic imports with a few extra features
Last updated 3 years ago by 75lb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install load-module 
SYNC missed versions from official npm registry.

view on npm npm module downloads Gihub repo dependents Gihub package dependents Node.js CI Coverage Status js-standard-style

load-module

Standard dynamic imports intended for runtime loading of user-defined modules (e.g. plugins).

  • Search for modules in one or more specific folders.
  • Specify a base folder from which to resolve from (e.g. the current working directory).

Synopsis

import { loadModule } from 'load-module'

const ViewClass = await loadModule('default-view', { paths: '~/my-view-folder'})
const view = new ViewClass()

load-module

loadModule(specifier, options)

Kind: exported function

Param Type Description
specifier string A valid Node.js module specifier.
options.paths string[] One or more directories to pass to both loadModuleResolvedFrom and loadModuleRelativeTo.
options.resolvedFromPaths string[] Specific directories to pass to loadModuleResolvedFrom.
options.relativeToPaths string[] Specific directories to pass to loadModuleRelativeTo.

loadModuleSpecifier(specifier)

Kind: exported function

Param Type Description
specifier string A valid Node.js module specifier.

loadModuleResolvedFrom(specifier, paths)

Kind: exported function

Param Type Description
specifier string A valid Node.js module specifier.
paths string | Array.<string> One or more additional directories from which to resolve the supplied specifier from.

loadModuleRelativeTo(specifier, paths)

Kind: exported function

Param Type Description
specifier string A valid module path.
paths string | Array.<string> One or more additional directories in which to search for the supplied module path.

© 2017-21 Lloyd Brookes <75pound@gmail.com>.

Tested by test-runner. Documented by jsdoc-to-markdown.

Current Tags

  • 4.2.1                                ...           latest (3 years ago)
  • 4.0.0-2                                ...           next (4 years ago)

24 Versions

  • 4.2.1                                ...           3 years ago
  • 4.2.0                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.1                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 4.0.0-2                                ...           4 years ago
  • 4.0.0-1                                ...           4 years ago
  • 4.0.0-0                                ...           4 years ago
  • 3.0.1-0                                ...           4 years ago
  • 3.0.0                                ...           5 years ago
  • 2.0.2                                ...           5 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.2.5                                ...           7 years ago
  • 0.2.4                                ...           7 years ago
  • 0.2.3                                ...           8 years ago
  • 0.2.2                                ...           8 years ago
  • 0.2.1                                ...           8 years ago
  • 0.2.0                                ...           8 years ago
  • 0.1.3                                ...           8 years ago
  • 0.1.2                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |