Comparing version 0.28.0 to 0.29.0
@@ -11,2 +11,3 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
import chalk from 'chalk'; | ||
import path from 'path'; | ||
import upperFirst from 'lodash/upperFirst'; | ||
@@ -37,15 +38,24 @@ import formatModuleName from './helpers/formatModuleName'; | ||
this.tool.debug('Locating ' + typeName + ' module ' + chalk.yellow(name)); | ||
var modulesToAttempt = [formatModuleName(appName, typeName, name, false)]; | ||
var modulesToAttempt = []; | ||
var isFilePath = false; | ||
var importedModule = void 0; | ||
var moduleName = void 0; | ||
if (scoped) { | ||
modulesToAttempt.unshift(formatModuleName(appName, typeName, name, true)); | ||
if (name.match(/^\.|\/|\\|[A-Z]:/)) { | ||
this.tool.debug('Locating ' + typeName + ' from path ' + chalk.cyan(name)); | ||
modulesToAttempt.push(path.normalize(name)); | ||
isFilePath = true; | ||
} else { | ||
this.tool.debug('Locating ' + typeName + ' module ' + chalk.yellow(name)); | ||
modulesToAttempt.push(formatModuleName(appName, typeName, name, false)); | ||
if (scoped) { | ||
modulesToAttempt.unshift(formatModuleName(appName, typeName, name, true)); | ||
} | ||
this.tool.debug('Resolving in order: ' + modulesToAttempt.join(', ')); | ||
} | ||
this.tool.debug('Resolving in order: ' + modulesToAttempt.join(', ')); | ||
modulesToAttempt.some(function (modName) { | ||
@@ -79,6 +89,10 @@ try { | ||
this.tool.debug('Found with ' + chalk.yellow(moduleName)); | ||
if (isFilePath) { | ||
this.tool.debug('Found with ' + chalk.cyan(moduleName)); | ||
} else { | ||
this.tool.debug('Found with ' + chalk.yellow(moduleName)); | ||
module.name = name; | ||
module.moduleName = moduleName; | ||
module.name = name; | ||
module.moduleName = moduleName; | ||
} | ||
@@ -85,0 +99,0 @@ return module; |
@@ -23,2 +23,6 @@ 'use strict'; | ||
var _path = require('path'); | ||
var _path2 = _interopRequireDefault(_path); | ||
var _upperFirst = require('lodash/upperFirst'); | ||
@@ -42,2 +46,8 @@ | ||
/** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
var ModuleLoader = function () { | ||
@@ -63,15 +73,24 @@ function ModuleLoader(tool, typeName, classReference) { | ||
this.tool.debug('Locating ' + typeName + ' module ' + _chalk2.default.yellow(name)); | ||
var modulesToAttempt = [(0, _formatModuleName2.default)(appName, typeName, name, false)]; | ||
var modulesToAttempt = []; | ||
var isFilePath = false; | ||
var importedModule = void 0; | ||
var moduleName = void 0; | ||
if (scoped) { | ||
modulesToAttempt.unshift((0, _formatModuleName2.default)(appName, typeName, name, true)); | ||
if (name.match(/^\.|\/|\\|[A-Z]:/)) { | ||
this.tool.debug('Locating ' + typeName + ' from path ' + _chalk2.default.cyan(name)); | ||
modulesToAttempt.push(_path2.default.normalize(name)); | ||
isFilePath = true; | ||
} else { | ||
this.tool.debug('Locating ' + typeName + ' module ' + _chalk2.default.yellow(name)); | ||
modulesToAttempt.push((0, _formatModuleName2.default)(appName, typeName, name, false)); | ||
if (scoped) { | ||
modulesToAttempt.unshift((0, _formatModuleName2.default)(appName, typeName, name, true)); | ||
} | ||
this.tool.debug('Resolving in order: ' + modulesToAttempt.join(', ')); | ||
} | ||
this.tool.debug('Resolving in order: ' + modulesToAttempt.join(', ')); | ||
modulesToAttempt.some(function (modName) { | ||
@@ -105,6 +124,10 @@ try { | ||
this.tool.debug('Found with ' + _chalk2.default.yellow(moduleName)); | ||
if (isFilePath) { | ||
this.tool.debug('Found with ' + _chalk2.default.cyan(moduleName)); | ||
} else { | ||
this.tool.debug('Found with ' + _chalk2.default.yellow(moduleName)); | ||
module.name = name; | ||
module.moduleName = moduleName; | ||
module.name = name; | ||
module.moduleName = moduleName; | ||
} | ||
@@ -155,8 +178,4 @@ return module; | ||
return ModuleLoader; | ||
}(); /** | ||
* @copyright 2017, Miles Johnson | ||
* @license https://opensource.org/licenses/MIT | ||
* | ||
*/ | ||
}(); | ||
exports.default = ModuleLoader; |
{ | ||
"name": "boost", | ||
"version": "0.28.0", | ||
"version": "0.29.0", | ||
"description": "Robust pipeline for creating build tools that separate logic into routines and tasks.", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -10,2 +10,3 @@ /** | ||
import chalk from 'chalk'; | ||
import path from 'path'; | ||
import upperFirst from 'lodash/upperFirst'; | ||
@@ -41,15 +42,28 @@ import formatModuleName from './helpers/formatModuleName'; | ||
this.tool.debug(`Locating ${typeName} module ${chalk.yellow(name)}`); | ||
// Determine modules to attempt to load | ||
const modulesToAttempt = [formatModuleName(appName, typeName, name, false)]; | ||
const modulesToAttempt = []; | ||
let isFilePath = false; | ||
let importedModule; | ||
let moduleName; | ||
if (scoped) { | ||
modulesToAttempt.unshift(formatModuleName(appName, typeName, name, true)); | ||
// File path | ||
if (name.match(/^\.|\/|\\|[A-Z]:/)) { | ||
this.tool.debug(`Locating ${typeName} from path ${chalk.cyan(name)}`); | ||
modulesToAttempt.push(path.normalize(name)); | ||
isFilePath = true; | ||
// Module name | ||
} else { | ||
this.tool.debug(`Locating ${typeName} module ${chalk.yellow(name)}`); | ||
modulesToAttempt.push(formatModuleName(appName, typeName, name, false)); | ||
if (scoped) { | ||
modulesToAttempt.unshift(formatModuleName(appName, typeName, name, true)); | ||
} | ||
this.tool.debug(`Resolving in order: ${modulesToAttempt.join(', ')}`); | ||
} | ||
this.tool.debug(`Resolving in order: ${modulesToAttempt.join(', ')}`); | ||
modulesToAttempt.some((modName) => { | ||
@@ -92,7 +106,12 @@ try { | ||
this.tool.debug(`Found with ${chalk.yellow(moduleName)}`); | ||
if (isFilePath) { | ||
this.tool.debug(`Found with ${chalk.cyan(moduleName)}`); | ||
module.name = name; | ||
module.moduleName = moduleName; | ||
} else { | ||
this.tool.debug(`Found with ${chalk.yellow(moduleName)}`); | ||
module.name = name; | ||
module.moduleName = moduleName; | ||
} | ||
return module; | ||
@@ -99,0 +118,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
371826
4563