1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-12 10:52:47 +00:00

updated package.json

This commit is contained in:
2016-01-04 12:25:28 -05:00
parent 3443c97de4
commit 80ca24a715
1168 changed files with 73752 additions and 26424 deletions

19
node_modules/broadway/lib/broadway.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/*
* broadway.js: Top-level include for the broadway module.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var path = require('path'),
utile = require('utile');
var broadway = exports;
broadway.App = require('./broadway/app').App;
broadway.common = require('./broadway/common');
broadway.features = require('./broadway/features');
broadway.formats = require('nconf').formats;
broadway.plugins = utile.requireDirLazy(path.join(__dirname, 'broadway', 'plugins'));

225
node_modules/broadway/lib/broadway/app.js generated vendored Normal file
View File

@@ -0,0 +1,225 @@
/*
* app.js: Core Application object for managing plugins and features in broadway
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var utile = require('utile'),
async = utile.async,
events = require('eventemitter2'),
bootstrapper = require('./bootstrapper'),
common = require('./common'),
features = require('./features');
var App = exports.App = function (options) {
//
// Setup options and `App` constants.
//
options = options || {};
this.root = options.root;
this.delimiter = options.delimiter || '::';
//
// Inherit from `EventEmitter2`
//
events.EventEmitter2.call(this, {
delimiter: this.delimiter,
wildcard: true
});
//
// Setup other relevant options such as the plugins
// for this instance.
//
this.options = options;
this.env = options.env || process.env['NODE_ENV'] || 'development'
this.plugins = options.plugins || {};
this.initialized = false;
this.bootstrapper = options.bootstrapper || bootstrapper;
this.initializers = {};
this.initlist = [];
//
// Bootstrap this instance
//
this.bootstrapper.bootstrap(this);
};
//
// Inherit from `EventEmitter2`.
//
utile.inherits(App, events.EventEmitter2);
//
// ### function init (options, callback)
// #### @options {Object} **Optional** Additional options to initialize with.
// #### @callback {function} Continuation to respond to when complete.
// Initializes this instance by the following procedure:
//
// 1. Initializes all plugins (starting with `core`).
// 2. Creates all directories in `this.config.directories` (if any).
// 3. Ensures the files in the core directory structure conform to the
// features required by this application.
//
App.prototype.init = function (options, callback) {
if (!callback && typeof options === 'function') {
callback = options;
options = {};
}
if (this.initialized) {
return callback();
}
var self = this;
options = options || {};
callback = callback || function () {};
this.env = options.env || this.env;
this.options = common.mixin({}, this.options, options);
function onComplete() {
self.initialized = true;
self.emit('init');
callback();
}
function ensureFeatures (err) {
return err
? onError(err)
: features.ensure(this, onComplete);
}
function initPlugin(plugin, next) {
if (typeof self.initializers[plugin] === 'function') {
return self.initializers[plugin].call(self, function (err) {
if (err) {
return next(err);
}
self.emit(['plugin', plugin, 'init']);
self.initializers[plugin] = true;
next();
});
}
next();
}
function initPlugins() {
async.forEach(self.initlist, initPlugin, ensureFeatures);
}
//
// Emit and respond with any errors that may short
// circuit the process.
//
function onError(err) {
self.emit(['error', 'init'], err);
callback(err);
}
//
// Run the bootstrapper, initialize plugins, and
// ensure features for this instance.
//
this.bootstrapper.init(this, initPlugins);
};
//
// ### function use(plugin, callback)
// Attachs the plugin with the specific name to this `App` instance.
//
App.prototype.use = function (plugin, options, callback) {
options = options || {};
if (typeof plugin === 'undefined') {
console.log('Cannot load invalid plugin!');
return callback && callback(new Error('Invalid plugin'));
}
var name = plugin.name,
self = this;
// If the plugin doesn't have a name, use itself as an identifier for the plugins hash.
if (!name) {
name = common.uuid();
}
if (this.plugins[name]) {
return callback && callback();
}
//
// Setup state on this instance for the specified plugin
//
this.plugins[name] = plugin;
this.options[name] = common.mixin({}, options, this.options[name] || {});
//
// Attach the specified plugin to this instance, extending
// the `App` with new functionality.
//
if (this.plugins[name].attach && options.attach !== false) {
this.plugins[name].attach.call(this, options);
}
//
// Setup the initializer only if `options.init` is
// not false. This allows for some plugins to be lazy-loaded
//
if (options.init === false) {
return callback && callback();
}
if (!this.initialized) {
this.initializers[name] = plugin.init || true;
this.initlist.push(name);
return callback && callback();
}
else if (plugin.init) {
plugin.init.call(this, function (err) {
var args = err
? [['plugin', name, 'error'], err]
: [['plugin', name, 'init']];
self.emit.apply(self, args);
return callback && (err ? callback(err) : callback());
});
}
};
//
// ### function remove(name)
// Detaches the plugin with the specific name from this `App` instance.
//
App.prototype.remove = function (name) {
// if this is a plugin object set the name to the plugins name
if (name.name) {
name = name.name;
}
if (this.plugins[name] && this.plugins[name].detach) {
this.plugins[name].detach.call(this);
}
delete this.plugins[name];
delete this.options[name];
delete this.initializers[name];
var init = this.initlist.indexOf(name);
if (init !== -1) {
this.initlist.splice(1, init);
}
}
//
// ### function inspect ()
// Inspects the modules and features used by the current
// application directory structure
//
App.prototype.inspect = function () {
};

84
node_modules/broadway/lib/broadway/bootstrapper.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
/*
* bootstrapper.js: Default logic for bootstrapping broadway applications.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var broadway = require('../broadway');
//
// ### bootstrap (app, callback)
// #### @app {broadway.App} Application to bootstrap
// #### @callback {function} Continuation to respond to when complete.
// Bootstraps the specified `app`.
//
exports.bootstrap = function (app) {
app.options['config'] = app.options['config'] || {};
app.options['config'].init = false;
app.use(broadway.plugins.config);
//
// Remove initializers run by the bootstrapper.
//
delete app.initializers['config'];
app.initlist.pop();
//
// Set the current environment in the config
//
app.config.set('env', app.env);
};
//
// ### bootstrap (app, callback)
// #### @app {broadway.App} Application to bootstrap
// #### @callback {function} Continuation to respond to when complete.
// Runs the initialization step of the bootstrapping process
// for the specified `app`.
//
exports.init = function (app, callback) {
broadway.plugins.config.init.call(app, function (err) {
if (err) {
return callback(err);
}
if (app.config.get('handleExceptions')) {
app.use(broadway.plugins.exceptions, app.options['exceptions'] || {});
}
app.use(broadway.plugins.directories, app.options['directories'] || {});
app.use(broadway.plugins.log, app.options['log'] || {});
//
// Ensure the `directories` and `log` plugins initialize before
// any other plugins. Since we cannot depend on ordering (if they were
// manually added) splice the specific indexes
//
var log = app.initlist.indexOf('log');
app.initlist.unshift.apply(
app.initlist,
app.initlist.splice(log)
);
var directories = app.initlist.indexOf('directories');
app.initlist.unshift.apply(
app.initlist,
app.initlist.splice(directories)
);
//
// Put the godot plugin before the log if it exists
//
var godot = app.initlist.indexOf('godot');
if(~godot) {
app.initlist.unshift.apply(
app.initlist,
app.initlist.splice(godot)
);
}
callback();
});
};

75
node_modules/broadway/lib/broadway/browser.js generated vendored Normal file
View File

@@ -0,0 +1,75 @@
/*
* browser.js: Browser specific functionality for broadway.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var id = 0;
var common = {
mixin: function (target) {
var objs = Array.prototype.slice.call(arguments, 1);
objs.forEach(function (o) {
Object.keys(o).forEach(function (attr) {
var getter = o.__lookupGetter__(attr);
if (!getter) {
target[attr] = o[attr];
}
else {
target.__defineGetter__(attr, getter);
}
});
});
return target;
},
uuid: function () {
return String(id++);
}
};
var App = exports.App = function (options) {
//
// Setup options and `App` constants.
//
var self = this;
options = options || {};
this.root = options.root;
this.delimiter = options.delimiter || '::';
//
// Inherit from `EventEmitter2`
//
exports.EventEmitter2.call(this, {
delimiter: this.delimiter,
wildcard: true
});
//
// Setup other relevant options such as the plugins
// for this instance.
//
this.options = options;
this.plugins = options.plugins || {};
this.initialized = false;
this.bootstrapper = { init: function (app, func) {} };
this.initializers = {};
};
var inherit = function (ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}
inherit(exports.App, exports.EventEmitter2);

View File

@@ -0,0 +1,78 @@
/*
* app.js: Common utility functions for working with directories
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var utile = require('utile'),
async = utile.async,
mkdirp = utile.mkdirp,
rimraf = utile.rimraf;
var directories = exports;
//
// ### function create (dirs, callback)
// #### @dirs {Object} Directories to create
// #### @callback {function} Continuation to respond to when complete
// Creates all of the specified `directories` in the current environment.
//
directories.create = function (dirs, callback) {
function createDir(dir, next) {
mkdirp(dir, 0755, function () {
next(null, dir);
});
}
if (!dirs) {
return callback();
}
async.mapSeries(Object.keys(dirs).map(function (key) {
return dirs[key]
}), createDir, callback);
};
//
// ### function remove (dirs, callback)
// #### @dirs {Object} Directories to remove
// #### @callback {function} Continuation to respond to when complete
// Removes all of the specified `directories` in the current environment.
//
directories.remove = function (dirs, callback) {
function removeDir (dir, next) {
rimraf(dir, function () {
next(null, dir);
});
}
if (!dirs) {
return callback();
}
async.mapSeries(Object.keys(dirs).map(function (key) {
return dirs[key]
}), removeDir, callback);
};
//
// ### function normalize (root, dirs)
// #### @keys {Object} Set of keys to normalize upon.
// #### @dirs {Object} Set of directories to normalize.
// Normalizes the specified `dirs` against the relative
// `root` of the application.
//
directories.normalize = function (keys, dirs) {
var normalized = {};
Object.keys(dirs).forEach(function (key) {
normalized[key] = dirs[key];
Object.keys(keys).forEach(function (constant) {
normalized[key] = normalized[key].replace(constant, keys[constant]);
});
});
return normalized;
};

18
node_modules/broadway/lib/broadway/common/index.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/*
* common.js: Top-level include for the `common` module.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var common = module.exports = require('utile');
common.directories = require('./directories');
// A naive shared "unique ID" generator for cases where `plugin.name` is
// undefined.
var id = 0;
common.uuid = function () {
return String(id++);
}

48
node_modules/broadway/lib/broadway/features/index.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
/*
* index.js: Top-level include for the features module.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
exports.ensure = function (app, callback) {
return callback();
}
exports.all = [
{
name: 'Entry Point',
test: function (target, name) {
return typeof target.start === 'function' ||
typeof target.createServer === 'function';
},
allExports: ['start', 'createServer', 'init', 'getRoutes']
},
{
name: 'Resource',
test: function (target, name) {
var methods = ['create', 'get', 'update', 'destroy'],
resource = target[capitalize(name)];
if (typeof resource !== 'function') {
return false;
}
for (var i = 0; i < methods.length; i++) {
if (typeof resource[method] !== 'function') {
return false;
}
}
},
allExports: ['addRoutes', 'init']
},
{
name: 'Configurator',
exports: ['config'],
},
{
name: 'Serve Files',
exports: 'serve'
}
];

46
node_modules/broadway/lib/broadway/plugins/config.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
/*
* config.js: Default configuration management plugin which attachs nconf to App instances
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var nconf = require('nconf');
//
// ### Name this plugin
//
exports.name = 'config';
//
// ### function attach (options)
// #### @options {Object} Options for this plugin
// Extends `this` (the application) with configuration functionality
// from `nconf`.
//
exports.attach = function (options) {
options = options || {};
this.config = new nconf.Provider(options);
//
// Setup a default store
//
this.config.use('literal');
this.config.stores.literal.readOnly = false;
};
//
// ### function init (done)
// #### @done {function} Continuation to respond to when complete.
// Initalizes the `nconf.Provider` associated with this instance.
//
exports.init = function (done) {
//
// Remark: There should be code here for automated remote
// seeding and loading
//
this.config.load(function (err) {
return err ? done(err) : done();
});
};

View File

@@ -0,0 +1,49 @@
/*
* directories.js: Plugin for creating directories for a required for a broadway App.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var common = require('../common');
//
// ### Name this plugin
//
exports.name = 'directories';
//
// ### function attach (options)
// #### @options {Object} Options for this plugin
// #### @done {function} Continuation to respond to when complete.
// Prepopulates the directory structure of `this` (the application).
//
exports.attach = function (options) {
options = options || {};
if (this.config) {
//
// Merge options with any pre-existing application config.
//
options = common.mixin({}, options, this.config.get('directories') || {});
}
options = common.directories.normalize({'#ROOT': this.root}, options);
this.options['directories'] = options;
if (this.config) {
this.config.merge('directories', options);
}
};
//
// ### function init (done)
// #### @done {function} Continuation to respond to when complete.
// Creates the directories associated with this instance.
//
exports.init = function (done) {
common.directories.create(this.options['directories'], function (err) {
return err ? done(err) : done();
});
};

View File

@@ -0,0 +1,70 @@
/*
* exceptions.js: Plugin responsible for logging all uncaughtExceptions in a flatiron App.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var winston = require('winston'),
common = require('../common');
var exceptions = exports;
//
// ### Setup default state for the exceptions plugin
//
exceptions.name = 'exceptions';
exceptions.initalized = false;
var defaultConfig = exceptions.defaultConfig = {
console: {
colorize: false,
json: true,
level: 'silly'
}
};
//
// ### function attach (options)
// #### @options {Object} Options for this plugin
// Extends `this` the application with exception handling
// functionality from `winston`.
//
exceptions.attach = function (options) {
options = options || {};
if (this.config) {
options = common.mixin({}, options, this.config.get('exceptions') || {});
}
if (exceptions.initalized) {
return;
}
var exceptionHandlers = [];
//
// Create the exceptionHandlers defaulting to Console and Loggly.
//
exceptionHandlers.push(new winston.transports.Console(options.console || defaultConfig.console));
Object.keys(options).forEach(function (name) {
if (name === 'console') {
return;
}
exceptionHandlers.push(new (winston.transports[common.capitalize(name)])(options[name]));
});
//
// Update the state of the plugin with the logger.
//
exceptions.logger = new winston.Logger({ exceptionHandlers: exceptionHandlers });
exceptions.initalized = true;
//
// Have the logger handle uncaught exceptions.
//
exceptions.logger.handleExceptions();
};

40
node_modules/broadway/lib/broadway/plugins/inspect.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
/*
* inspect.js: Plugin responsible for attaching inspection behavior using `cliff` and `eyes`.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
//
// ### Name this plugin
//
exports.name = 'inspect';
//
// ### function init (done)
// #### @done {function} Continuation to respond to when complete.
// Attaches inspection behavior through `cliff` and `eyes`.
//
exports.init = function (done) {
var namespace = 'default',
app = this;
if (app.options['inspect'] && app.options['inspect'].namespace) {
namespace = app.options['inspect'].namespace;
}
app.inspect = require('cliff');
app.inspect.logger = app.log.get('namespace');
done();
};
//
// ### function detact()
// Removes inspection behavior exposed by this plugin.
//
exports.detach = function () {
if (this.inspect) {
delete this.inspect;
}
};

227
node_modules/broadway/lib/broadway/plugins/log.js generated vendored Normal file
View File

@@ -0,0 +1,227 @@
/*
* log.js: Default logging plugin which attachs winston to App instances
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var winston = require('winston'),
common = require('../common');
var log = exports;
//
// ### Setup default state for the exceptions plugin
//
log.name = 'log';
log.ignore = ['broadway'];
//
// ### function attach (options)
// #### @options {Object} Options for this plugin
// Extends `this` (the application) with logging functionality from `winston`.
//
log.attach = function (options) {
options = options || {};
var app = this,
namespaces,
logAll,
level,
oldGodot,
service;
if (this.config) {
//
// Merge options with any pre-existing application config.
//
options = common.mixin({}, options, this.config.get('log') || {});
}
//
// Setup namespaces and then remove them from
// `options` so they are not caught by `winston`.
//
namespaces = options.namespaces || {};
delete options.namespaces;
//
// Setup logAll and then remove them from
// `options` so they are not caught by `winston`.
//
logAll = options.logAll || false;
if (options.logAll) {
delete options.logAll;
}
//
// Setup level and then remove them from
// `options` so they are not caught by `winston`.
//
level = options.level || false;
if (options.level) {
delete options.level;
}
//
// Make proper godot options for the winston plugin if it exists
//
if (this.godot && options.godot) {
oldGodot = options.godot;
service = this.config.get('service')
|| options.service
|| oldGodot.service
|| 'app';
options.godot = {
godot: this.godot,
service: service + '/logs',
handleExceptions: oldGodot.handleExceptions === false ? false : true
};
}
//
// Hoist up relevant logging functions onto the app
// if requested.
//
this.log = new winston.Container(options);
this.log.namespaces = namespaces;
this.log.get('default').extend(this.log);
//
// Set the default console loglevel to options.level
//
this.log.get('default').transports.console.level = level || 'info';
Object.defineProperty(this.log, 'logAll', {
get: function () {
return this._logAll;
},
set: function (val) {
if (val === this._logAll) {
//
// If the value is identical return
//
return;
}
if (val) {
app.onAny(log.logEvent);
app.off(['log'], log.logEvent);
app.off(['log', '*'], log.logEvent);
app.off(['log', '*', '*'], log.logEvent);
}
else {
app.offAny(log.logEvent);
app.on(['log'], log.logEvent);
app.on(['log', '*'], log.logEvent);
app.on(['log', '*', '*'], log.logEvent);
}
this._logAll = val;
}
});
//
// Listen to relevant `app` events and
// log them appropriately.
//
this.log.logAll = logAll;
//
// Add any namespaced containers to this App instance.
//
Object.keys(this.log.namespaces).forEach(function (namespace) {
app.log.add(app.log.namespaces[namespace]);
});
};
//
// ### function logEvent ([level], msg, meta)
// #### @msg {string} Message to log
// #### @meta {Object} **Optional** Metadata to log
// Logs the specified `msg` and `meta` according to
// the following conditions:
//
// #### `log` events
// 1. `log` - Logs to the default logger and level.
// 2. `log::[level]` - Logs to the default logger.
// 3. `log::[level]::[namespace]` - Logs to a namespaced logger.
//
// ### `[namespaced]` events
// If `app.log.logAll` is set, then find a logger at `namespace`,
// otherwise the default logger is used.
//
// 1. `[namespace]::**(level, msg, meta)` - Logs the event as the
// message to the logger for the specified namespace and level.
// 2. `[namespace]::[level]::**(msg, meta)` - Logs the event and
// the message to the logger for the specified namespace and level.
//
log.logEvent = function (/* level, msg, meta */) {
var parts = Array.isArray(this.event) ? this.event : this.event.split(this.delimiter),
ev = parts[0],
namespace,
logger,
level,
meta,
msg;
if (log.ignore.indexOf(ev) !== -1) {
return;
}
//
// Determine the `namespace` to log the event to
//
if (ev === 'log') {
namespace = parts[2] || 'default';
logger = this.log.get('default');
}
else if (this.log.logAll) {
namespace = this.log.namespaces[ev] ? this.log.namespaces[ev] : 'default';
logger = this.log.get(namespace);
}
else {
return;
}
//
// Parse arguments now that we have the logger.
//
Array.prototype.slice.call(arguments).forEach(function (a) {
switch (typeof a) {
case 'object': {
meta = a;
break;
}
case 'string': {
if (logger[a]) {
level = a;
}
else {
msg = a;
}
}
}
});
if (ev === 'log') {
level = parts[1] || level || 'info';
}
else if (this.log.logAll) {
if (logger[parts[1]]) {
level = parts[1];
parts.splice(1, 1);
}
}
if (level in logger.levels === false) {
level = 'info';
}
parts = parts.join(this.delimiter);
meta = meta || {};
msg = msg || parts;
logger.log(level, msg, meta);
this.emit(['broadway', 'logged'], level, msg, meta, parts);
};