Installations
npm install module-importer
Developer Guide
Typescript
No
Module System
CommonJS
NPM Version
1.3.10
Score
69.7
Supply Chain
98.3
Quality
75.1
Maintenance
25
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
3,101
Last day
0%
1
Compared to previous day
Last week
0%
1
Compared to previous week
Last month
-20%
4
Compared to previous month
Last year
-91.9%
90
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Module Importer
The module-importer is a fully featured tool for bulk loading modules. It provides support for loading modules locally (peer loading), including any other directory on the filesystem, filtering, and direct loading of individual modules.
The module-importer loads all specified modules into an object that has a collection of keys (keys are the filenames converted to camelcase) and the contents of each module. In addition each imports
object has a property imports._loadedModules
that contains more detailed information on every module loaded.
Table of Contents
Installation
npm install module-importer
Testing
This package has some built-in tests to verify functionality. Tests use Mocha and Chai.
npm install --dev
npm test
Documentation/Usage
Advanced Options
To make full use of the module-importer you can pass an options object upon instantiation.
1var imports = new Importer({ 2 //opts 3});
Available Options
- includeLocal
boolean
Flag for including peer modules - filter
function|regex|string
Filters out modules based on relative path to executing script - includes
Array[objects]
Array of option objects that specifies where else to look for modules
Options Available for an include:- path
string
Path of the file or folder to include. Can be relative or absolute. - direct
boolean
Indicates if the path should be loaded directly as a single module - filter
(see above)
- path
- localPath
string
Spoofs location path of executing script - localFile
string
Spoofs file name of executing script
Accessing Details on Modules Loaded
Detailed information on what modules were loaded and where they were loaded from is located in the _loadedModules
property on imports
1if(!imports.error){ 2 console.log(imports._loadedModules) 3}
Code Examples
Basic Usage
1var Importer = require('module-import'); 2 3//load all local (peer) modules 4var imports = new Importer(); 5 6if(!imports.error){ 7 //do something with loaded modules 8}else{ 9 //handle error 10}
Filtering Local Modules
1 2//load all local (peer) modules 3var imports = new Importer({ 4 //only load models in current directory 5 filter: /model/g 6}); 7
Don't load peer modules and include multiple folders
1//loads only non-peer modules 2var imports = new Importer({ 3 includeLocal: false, 4 includes:[{ 5 //load all controllers 6 //that dont't start with dev 7 path:'../controllers', 8 filter: function(path){ 9 if(path.indexOf('dev') !== 0) return true; 10 } 11 },{ 12 //also load the authentication module 13 path:'../lib/authentication', 14 direct:true 15 }] 16});
Using With Express
TODO: Document Common Usage With Express
License
Copyright (c) 2015, Alexander Wolden
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the
nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/25 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Score
2.6
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to module-importer
@humanwhocodes/module-importer
Universal module importer for Node.js
node-sass-magic-importer
Custom node-sass importer for selector specific imports, node importing, module importing, globbing support and importing files only once
node-sass-package-importer
Custom importer for node-sass to import packages from the `node_modules` directory
sass-module-importer
Import Sass files from NPM and Bower Modules