Comparing version 0.22.0 to 0.23.0
@@ -22,4 +22,5 @@ import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray'; | ||
key: 'emit', | ||
value: function emit(eventName, initialValue) { | ||
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
value: function emit(eventName) { | ||
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
var initialValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
@@ -38,4 +39,5 @@ var event = new Event(eventName, initialValue); | ||
key: 'emitCascade', | ||
value: function emitCascade(eventName, initialValue) { | ||
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
value: function emitCascade(eventName) { | ||
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
var initialValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
@@ -42,0 +44,0 @@ var event = new Event(eventName, initialValue); |
@@ -33,11 +33,25 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
var moduleName = formatModuleName(appName, typeName, name, scoped); | ||
var modulesToAttempt = [formatModuleName(appName, typeName, name, false)]; | ||
var importedModule = void 0; | ||
var moduleName = void 0; | ||
try { | ||
importedModule = requireModule(moduleName); | ||
} catch (error) { | ||
throw new Error('Missing ' + typeName + ' module "' + moduleName + '".'); | ||
if (scoped) { | ||
modulesToAttempt.unshift(formatModuleName(appName, typeName, name, true)); | ||
} | ||
modulesToAttempt.some(function (modName) { | ||
try { | ||
importedModule = requireModule(modName); | ||
moduleName = modName; | ||
return true; | ||
} catch (error) { | ||
return false; | ||
} | ||
}); | ||
if (!importedModule || !moduleName) { | ||
throw new Error('Missing ' + typeName + '. Attempted import in order: ' + modulesToAttempt.join(', ')); | ||
} | ||
if (importedModule instanceof this.classReference) { | ||
@@ -44,0 +58,0 @@ throw new TypeError('A ' + typeName + ' class instance was exported from "' + moduleName + '". ' + (upperFirst(appName) + ' requires a ' + typeName + ' class definition to be exported.')); |
@@ -53,3 +53,3 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
process.on('exit', function (code) { | ||
_this.emit('exit', null, [code]); | ||
_this.emit('exit', [code]); | ||
}); | ||
@@ -56,0 +56,0 @@ return _this; |
@@ -41,4 +41,5 @@ 'use strict'; | ||
key: 'emit', | ||
value: function emit(eventName, initialValue) { | ||
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
value: function emit(eventName) { | ||
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
var initialValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
@@ -57,4 +58,5 @@ var event = new _Event2.default(eventName, initialValue); | ||
key: 'emitCascade', | ||
value: function emitCascade(eventName, initialValue) { | ||
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
value: function emitCascade(eventName) { | ||
var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
var initialValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; | ||
@@ -61,0 +63,0 @@ var event = new _Event2.default(eventName, initialValue); |
@@ -61,11 +61,25 @@ 'use strict'; | ||
var moduleName = (0, _formatModuleName2.default)(appName, typeName, name, scoped); | ||
var modulesToAttempt = [(0, _formatModuleName2.default)(appName, typeName, name, false)]; | ||
var importedModule = void 0; | ||
var moduleName = void 0; | ||
try { | ||
importedModule = (0, _requireModule2.default)(moduleName); | ||
} catch (error) { | ||
throw new Error('Missing ' + typeName + ' module "' + moduleName + '".'); | ||
if (scoped) { | ||
modulesToAttempt.unshift((0, _formatModuleName2.default)(appName, typeName, name, true)); | ||
} | ||
modulesToAttempt.some(function (modName) { | ||
try { | ||
importedModule = (0, _requireModule2.default)(modName); | ||
moduleName = modName; | ||
return true; | ||
} catch (error) { | ||
return false; | ||
} | ||
}); | ||
if (!importedModule || !moduleName) { | ||
throw new Error('Missing ' + typeName + '. Attempted import in order: ' + modulesToAttempt.join(', ')); | ||
} | ||
if (importedModule instanceof this.classReference) { | ||
@@ -72,0 +86,0 @@ throw new TypeError('A ' + typeName + ' class instance was exported from "' + moduleName + '". ' + ((0, _upperFirst2.default)(appName) + ' requires a ' + typeName + ' class definition to be exported.')); |
@@ -100,3 +100,3 @@ 'use strict'; | ||
process.on('exit', function (code) { | ||
_this.emit('exit', null, [code]); | ||
_this.emit('exit', [code]); | ||
}); | ||
@@ -103,0 +103,0 @@ return _this; |
{ | ||
"name": "boost", | ||
"version": "0.22.0", | ||
"version": "0.23.0", | ||
"description": "Robust pipeline for creating build tools that separate logic into routines and tasks.", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -1,39 +0,4 @@ | ||
# Boost | ||
# 🚀 Boost | ||
[![Build Status](https://travis-ci.org/milesj/boost.svg?branch=master)](https://travis-ci.org/milesj/boost) | ||
Robust pipeline for creating build tools that separate logic into routines and tasks. | ||
# Example | ||
If Babel + Babili was created using this library, the implementation would look something like the following. | ||
```js | ||
(new Pipeline('babel', require('./.babelrc'))) | ||
.pipe(new LocateRoutine('locate')) // Glob initial files | ||
.pipe(new ResolveRoutine('resolve')) // Resolve dependency lookups | ||
.pipe(new TransformRoutine('transform')) // Apply transformations | ||
.pipe(new MinifyRoutine('minify')) // Apply minification | ||
.pipe(new BundleRoutine('bundle', { // Bundle and or output the files | ||
out: './lib', | ||
})) | ||
.run('./src'); | ||
``` | ||
# Lifecycle | ||
``` | ||
app | ||
-> define command | ||
-> add metadata | ||
-> add routines | ||
-> run command | ||
-> init tool | ||
-> load configuration | ||
-> load plugins | ||
-> load UI | ||
-> init pipeline | ||
-> set tool | ||
-> set routines | ||
-> configure routines | ||
-> run pipeline | ||
``` | ||
Create build tools using a robust pipeline that separates logic into routines and tasks. |
@@ -18,3 +18,3 @@ /** | ||
*/ | ||
emit(eventName: string, initialValue: *, args?: EventArguments = []): Event { | ||
emit(eventName: string, args?: EventArguments = [], initialValue?: * = null): Event { | ||
const event = new Event(eventName, initialValue); | ||
@@ -35,3 +35,3 @@ | ||
*/ | ||
emitCascade(eventName: string, initialValue: *, args?: EventArguments = []): Event { | ||
emitCascade(eventName: string, args?: EventArguments = [], initialValue?: * = null): Event { | ||
const event = new Event(eventName, initialValue); | ||
@@ -38,0 +38,0 @@ const listeners = Array.from(this.getListeners(event.name)); |
@@ -36,11 +36,29 @@ /** | ||
const { appName, scoped } = this.options; | ||
const moduleName = formatModuleName(appName, typeName, name, scoped); | ||
// Determine modules to attempt to load | ||
const modulesToAttempt = [formatModuleName(appName, typeName, name, false)]; | ||
let importedModule; | ||
let moduleName; | ||
try { | ||
importedModule = requireModule(moduleName); | ||
} catch (error) { | ||
throw new Error(`Missing ${typeName} module "${moduleName}".`); | ||
if (scoped) { | ||
modulesToAttempt.unshift(formatModuleName(appName, typeName, name, true)); | ||
} | ||
modulesToAttempt.some((modName) => { | ||
try { | ||
importedModule = requireModule(modName); | ||
moduleName = modName; | ||
return true; | ||
} catch (error) { | ||
return false; | ||
} | ||
}); | ||
if (!importedModule || !moduleName) { | ||
throw new Error( | ||
`Missing ${typeName}. Attempted import in order: ${modulesToAttempt.join(', ')}`, | ||
); | ||
} | ||
// An instance was returned instead of the class definition | ||
@@ -47,0 +65,0 @@ if (importedModule instanceof this.classReference) { |
@@ -64,3 +64,3 @@ /** | ||
process.on('exit', (code) => { | ||
this.emit('exit', null, [code]); | ||
this.emit('exit', [code]); | ||
}); | ||
@@ -67,0 +67,0 @@ } |
Sorry, the diff of this file is not supported yet
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
360754
4292
5