Comparing version 0.3.0 to 0.3.1
0.3.1 / 2012-07-07 | ||
================== | ||
* Merge branch 'refactor/clean' | ||
* finish commenting | ||
* reader middleware comments | ||
* minify middleware comments | ||
* indent middleware comments | ||
* base comments | ||
* comments like what (part 1) | ||
0.3.0 / 2012-06-30 | ||
@@ -3,0 +14,0 @@ ================== |
@@ -10,3 +10,3 @@ var fs = require('fs') | ||
exports.version = '0.3.0'; | ||
exports.version = '0.3.1'; | ||
@@ -13,0 +13,0 @@ |
@@ -0,1 +1,11 @@ | ||
/*! | ||
* Folio Asset Generator | ||
* Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
/*! | ||
* Module Requirements | ||
*/ | ||
var breeze = require('breeze') | ||
@@ -8,6 +18,24 @@ , Drip = require('drip') | ||
/*! | ||
* Logger | ||
*/ | ||
var logger = require('./logger'); | ||
/*! | ||
* Primary Export | ||
*/ | ||
module.exports = Glossary; | ||
/** | ||
* Glossary | ||
* | ||
* Handles build level options and stack. | ||
* | ||
* @param {String} unique identifier | ||
* @name Glossary | ||
* @api public | ||
*/ | ||
function Glossary (name) { | ||
@@ -23,4 +51,18 @@ Drip.call(this, { delimeter: ':' }); | ||
/*! | ||
* Inherit from Drip | ||
*/ | ||
inherits(Glossary, Drip); | ||
/** | ||
* # use (handle) | ||
* | ||
* Add a handler to the the end of the | ||
* transfermation stack. | ||
* | ||
* @param {Function} handler fuction | ||
* @api public | ||
*/ | ||
Glossary.prototype.use = function (fn) { | ||
@@ -37,7 +79,26 @@ this._stack.push(fn); | ||
/** | ||
* # .root (dir[, dir]) | ||
* | ||
* Set the root directly to be prepended to | ||
* all of the stack operations that require a path. | ||
* | ||
* @param {String} path root | ||
* @api public | ||
*/ | ||
Glossary.prototype.root = function () { | ||
this._attrs.root = path.resolve.call(path, arguments); | ||
return this; | ||
} | ||
}; | ||
/** | ||
* # .silent (boolean) | ||
* | ||
* Toggle the log display. | ||
* | ||
* @param {Boolean} toggle | ||
* @api public | ||
*/ | ||
Glossary.prototype.silent = function (level) { | ||
@@ -48,2 +109,14 @@ this._attrs.silent = level; | ||
/** | ||
* # .compile (cb) | ||
* | ||
* Start the compile cycle for the current stack. | ||
* Takes an optional callback to be invoked upon | ||
* completion. | ||
* | ||
* @param {Function} callback | ||
* @cb {Error|null} if error | ||
* @api public | ||
*/ | ||
Glossary.prototype.compile = function (cb) { | ||
@@ -50,0 +123,0 @@ var self = this |
@@ -0,3 +1,24 @@ | ||
/*! | ||
* Folio Logger Customizations | ||
* Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
/*! | ||
* Module Requirements | ||
*/ | ||
var quantum = require('quantum'); | ||
/** | ||
* .theme (logger, event) | ||
* | ||
* Custom console display theme for quantum logger. | ||
* | ||
* @param {Object} quantum logger | ||
* @param {Object} log event | ||
* @name theme | ||
* @api private | ||
*/ | ||
exports.theme = function (logger, event) { | ||
@@ -24,2 +45,10 @@ var color = logger._levels.colors[event.level] | ||
/** | ||
* levels | ||
* | ||
* Custom log levels object for quantum logger. | ||
* | ||
* @api private | ||
*/ | ||
exports.levels = { | ||
@@ -26,0 +55,0 @@ levels: { |
@@ -0,5 +1,29 @@ | ||
/*! | ||
* Folio Base Middleware | ||
* Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
/*! | ||
* Module Requirements | ||
*/ | ||
var inherits = require('util').inherits; | ||
/*! | ||
* Primary Export | ||
*/ | ||
module.exports = Base; | ||
/** | ||
* Base (constructor) | ||
* | ||
* Setup base constructor for all middleware. | ||
* Contains a settings object and reference | ||
* to the source glossary. | ||
* | ||
* @api private | ||
*/ | ||
function Base () { | ||
@@ -10,14 +34,51 @@ this.attrs = {}; | ||
/** | ||
* ### .handle () | ||
* | ||
* Returns the public api chainable functions. | ||
* Must include `pop` to return to the glossary. | ||
* | ||
* @returns api chain | ||
* @api public | ||
*/ | ||
Base.prototype.handle = function () { | ||
return { | ||
end: this.end.bind(this) | ||
}; | ||
var api = {}; | ||
api.pop = this.pop.bind(this); | ||
return api; | ||
}; | ||
Base.prototype.compile = function (cb) { | ||
cb(); | ||
/** | ||
* ### .compile (str, logger, callback) | ||
* | ||
* Each base should implement a `compile` | ||
* method that can asyncronously handle | ||
* transforming the incoming string and | ||
* return the new source further down | ||
* the chain. | ||
* | ||
* @param {String} string of incoming source | ||
* @param {Object} logger | ||
* @param {Function} callback | ||
* @cb Error or null | ||
* @cb transformed string | ||
* @name compile | ||
* @api public | ||
*/ | ||
Base.prototype.compile = function (str, log, cb) { | ||
cb(null, str); | ||
}; | ||
/** | ||
* ### .pop () | ||
* | ||
* Return the glossary for chaining. | ||
* | ||
* @name pop | ||
* @api public | ||
*/ | ||
Base.prototype.pop = function () { | ||
return this.glossary; | ||
}; |
@@ -0,7 +1,35 @@ | ||
/*! | ||
* Folio Indentation Middleware | ||
* Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
/*! | ||
* Module Requirements | ||
*/ | ||
var inherits = require('util').inherits; | ||
/*! | ||
* Folio Requirements | ||
*/ | ||
var Base = require('./base') | ||
/*! | ||
* Primary Export | ||
*/ | ||
module.exports = Indent; | ||
/** | ||
* ## Indent | ||
* | ||
* The indentation middleware will take | ||
* the incoming source and prepend a given string | ||
* to every line. Useful for indentation. | ||
* | ||
* @header Indent | ||
*/ | ||
function Indent () { | ||
@@ -12,4 +40,12 @@ Base.call(this); | ||
/*! | ||
* Inherit from Base | ||
*/ | ||
inherits(Indent, Base); | ||
/*! | ||
* Expose the Api | ||
*/ | ||
Indent.prototype.handle = function () { | ||
@@ -19,2 +55,18 @@ var self = this | ||
/** | ||
* ### .line (string) | ||
* | ||
* Note what to prepend to each line. | ||
* | ||
* // ... | ||
* .use(folio.indent()) | ||
* .line(' ') // two spaces | ||
* // ... | ||
* | ||
* @param {String} prepend string | ||
* @returns api for chaning | ||
* @name line | ||
* @api public | ||
*/ | ||
api.line = function (str) { | ||
@@ -25,2 +77,12 @@ self.attrs.indent = str; | ||
/** | ||
* ### .pop () | ||
* | ||
* Return to the glossary. | ||
* | ||
* @returns Glossary | ||
* @name pop | ||
* @api public | ||
*/ | ||
api.pop = this.pop.bind(this); | ||
@@ -31,2 +93,17 @@ | ||
/*! | ||
* ### .compile (string, logger, callback) | ||
* | ||
* Take the given `line` string and apply | ||
* it to each line of the incoming string. | ||
* | ||
* @param {String} string of incoming source | ||
* @param {Object} logger | ||
* @param {Function} callback | ||
* @cb Error or null | ||
* @cb transformed string | ||
* @name compile | ||
* @api public | ||
*/ | ||
Indent.prototype.compile = function (str, log, cb) { | ||
@@ -33,0 +110,0 @@ var self = this |
@@ -0,9 +1,35 @@ | ||
/*! | ||
* Folio Minification Middleware | ||
* Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
/*! | ||
* Module Requirements | ||
*/ | ||
var inherits = require('util').inherits | ||
, uglify = require('uglify-js'); | ||
/*! | ||
* Folio Requirements | ||
*/ | ||
var Base = require('./base') | ||
module.exports = Save; | ||
/*! | ||
* Primary Export | ||
*/ | ||
function Save () { | ||
module.exports = Minify; | ||
/** | ||
* ## Minify | ||
* | ||
* Minify the incoming source. | ||
* | ||
* @header Minify | ||
*/ | ||
function Minify () { | ||
Base.call(this); | ||
@@ -15,8 +41,28 @@ this.name = 'minify'; | ||
inherits(Save, Base); | ||
/*! | ||
* Inherit from Base | ||
*/ | ||
Save.prototype.handle = function () { | ||
inherits(Minify, Base); | ||
/*! | ||
* Expose the Api | ||
*/ | ||
Minify.prototype.handle = function () { | ||
var self = this | ||
, api = {}; | ||
/** | ||
* ### .mangle (boolean) | ||
* | ||
* Toggle the mange uglify option. Defaults | ||
* to true. | ||
* | ||
* @param {Boolean} mangle switch | ||
* @return api for chaining | ||
* @name mangle | ||
* @api public | ||
*/ | ||
api.mangle = function (bln) { | ||
@@ -29,2 +75,14 @@ self.attrs.mangle = 'boolean' == typeof bln | ||
/** | ||
* ### .sqeeze (boolean) | ||
* | ||
* Toggle the squeeze uglify option. Defaults | ||
* to true. | ||
* | ||
* @param {Boolean} sqeeze switch | ||
* @return api for chaining | ||
* @name mangle | ||
* @api public | ||
*/ | ||
api.squeeze = function (str) { | ||
@@ -37,2 +95,12 @@ self.attrs.sqeeze = 'boolean' == typeof bln | ||
/** | ||
* ### .pop () | ||
* | ||
* Return to the glossary. | ||
* | ||
* @returns Glossary | ||
* @name pop | ||
* @api public | ||
*/ | ||
api.pop = this.pop.bind(this); | ||
@@ -43,3 +111,18 @@ | ||
Save.prototype.compile = function (str, log, cb) { | ||
/*! | ||
* ### .compile (string, logger, callback) | ||
* | ||
* Apply a minification strategy to the incoming | ||
* string. apply mangle and sqeeze accordingly. | ||
* | ||
* @param {String} string of incoming source | ||
* @param {Object} logger | ||
* @param {Function} callback | ||
* @cb Error or null | ||
* @cb transformed string | ||
* @name compile | ||
* @api public | ||
*/ | ||
Minify.prototype.compile = function (str, log, cb) { | ||
var jsp = uglify.parser | ||
@@ -46,0 +129,0 @@ , pro = uglify.uglify |
@@ -0,1 +1,11 @@ | ||
/*! | ||
* Folio Reader Middleware | ||
* Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
/*! | ||
* Module Requirements | ||
*/ | ||
var inherits = require('util').inherits | ||
@@ -5,4 +15,12 @@ , fs = require('fsagent') | ||
/*! | ||
* Folio Requirements | ||
*/ | ||
var Base = require('./base') | ||
/*! | ||
* Primary Export | ||
*/ | ||
module.exports = Reader; | ||
@@ -15,4 +33,12 @@ | ||
/*! | ||
* Inherit from Base | ||
*/ | ||
inherits(Reader, Base); | ||
/*! | ||
* Expose the Api | ||
*/ | ||
Reader.prototype.handle = function () { | ||
@@ -22,2 +48,16 @@ var self = this | ||
/** | ||
* ### .file (filename) | ||
* | ||
* Provide the filename to read into the | ||
* source chain. If the file provided is | ||
* not an absolute path, it will be resolved | ||
* according the glossary's root directory. | ||
* | ||
* @param {String} filename | ||
* @returns api for chaining | ||
* @name file | ||
* @api public | ||
*/ | ||
api.file = function (file) { | ||
@@ -28,2 +68,12 @@ self.attrs.file = file; | ||
/** | ||
* ### .pop () | ||
* | ||
* Return to the glossary. | ||
* | ||
* @returns Glossary | ||
* @name pop | ||
* @api public | ||
*/ | ||
api.pop = this.pop.bind(this); | ||
@@ -34,2 +84,17 @@ | ||
/*! | ||
* ### .compile (string, logger, callback) | ||
* | ||
* Read the provided file and append it to whatever | ||
* is provided and the current string. | ||
* | ||
* @param {String} string of incoming source | ||
* @param {Object} logger | ||
* @param {Function} callback | ||
* @cb Error or null | ||
* @cb transformed string | ||
* @name compile | ||
* @api public | ||
*/ | ||
Reader.prototype.compile = function (str, log, cb) { | ||
@@ -36,0 +101,0 @@ var self = this |
@@ -0,1 +1,11 @@ | ||
/*! | ||
* Folio Indentation Middleware | ||
* Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
/*! | ||
* Module Requirements | ||
*/ | ||
var breeze = require('breeze') | ||
@@ -6,5 +16,13 @@ , fs = require('fsagent') | ||
/*! | ||
* Folio Requirements | ||
*/ | ||
var Base = require('./base') | ||
, browser = require('./requires/includes/require'); | ||
/*! | ||
* Primary Export | ||
*/ | ||
module.exports = Requires; | ||
@@ -17,4 +35,12 @@ | ||
/*! | ||
* Inherit from Base | ||
*/ | ||
inherits(Requires, Base); | ||
/*! | ||
* Expose the Api | ||
*/ | ||
Requires.prototype.handle = function () { | ||
@@ -24,16 +50,81 @@ var self = this | ||
var apiKeys = [ | ||
'package' | ||
, 'dir' | ||
, 'entry' | ||
, 'header' | ||
]; | ||
apiKeys.forEach(function (spec) { | ||
api[spec] = function (s) { | ||
self.attrs[spec] = s; | ||
// helper function | ||
function mountable (key) { | ||
return function (val) { | ||
self.attrs[key] = val; | ||
return this; | ||
}; | ||
}); | ||
} | ||
} | ||
/** | ||
* ### .package (name) | ||
* | ||
* Note the main export to expose for this | ||
* package. | ||
* | ||
* @param {String} name | ||
* @returns api for chaining | ||
* @name package | ||
* @api public | ||
*/ | ||
api.package = mountable('package'); | ||
/** | ||
* ### .dir (name) | ||
* | ||
* Set the starting point directory to traverse | ||
* for required files. If a relative path is given, | ||
* it was be resolved from glossary root. | ||
* | ||
* @param {String} name | ||
* @returns api for chaining | ||
* @name dir | ||
* @api public | ||
*/ | ||
api.dir = mountable('dir'); | ||
/** | ||
* ### .entry (name) | ||
* | ||
* Set the entry point for the module. An alias | ||
* will be created from this file to the package | ||
* name. | ||
* | ||
* @param {String} name | ||
* @returns api for chaining | ||
* @name entry | ||
* @api public | ||
*/ | ||
api.entry = mountable('entry'); | ||
/** | ||
* ### .header (toggle) | ||
* | ||
* Toggle whether the common JS header should | ||
* be included in this pass. Defaults | ||
* to true. | ||
* | ||
* @param {Boolean} toggle | ||
* @returns api for chaining | ||
* @name header | ||
* @api public | ||
*/ | ||
api.header = mountable('header'); | ||
/** | ||
* ### .ignore (file) | ||
* | ||
* Add a file to the ignore list. Files are | ||
* resolved relative to the required `dir`. | ||
* | ||
* @param {String} file path | ||
* @returns api for chaining | ||
* @name ignore | ||
* @api public | ||
*/ | ||
api.ignore = function (file) { | ||
@@ -45,2 +136,15 @@ var ignore = self.attrs.ignore || (self.attrs.ignore = []); | ||
/** | ||
* ### .replace (from, to) | ||
* | ||
* Replace `require` calls from in each | ||
* file `from` path `to` path. | ||
* | ||
* @param {String} from file | ||
* @param {String} to file | ||
* @returns api for chaining | ||
* @name replace | ||
* @api public | ||
*/ | ||
api.replace = function (from, to) { | ||
@@ -56,2 +160,12 @@ var replace = self.attrs.replace || (self.attrs.replace = []); | ||
/** | ||
* ### .pop () | ||
* | ||
* Return to the glossary. | ||
* | ||
* @returns Glossary | ||
* @name pop | ||
* @api public | ||
*/ | ||
api.pop = this.pop.bind(this); | ||
@@ -62,2 +176,19 @@ | ||
/*! | ||
* ### .compile (string, logger, callback) | ||
* | ||
* Read in a directory tree of the provided directory. | ||
* Remove an ignores, replace any require replacements, | ||
* and wrap in browser commonjs require loader. Include | ||
* the common js header if needed. | ||
* | ||
* @param {String} string of incoming source | ||
* @param {Object} logger | ||
* @param {Function} callback | ||
* @cb Error or null | ||
* @cb transformed string | ||
* @name compile | ||
* @api public | ||
*/ | ||
Requires.prototype.compile = function (str, log, cb) { | ||
@@ -175,2 +306,12 @@ var self = this | ||
/*! | ||
* parseInheritance (source) | ||
* | ||
* Replace `__proto__` to a cross-browser compatible | ||
* equivalant. | ||
* | ||
* @param {String} source | ||
* @returns source modified | ||
* @api private | ||
*/ | ||
@@ -185,2 +326,13 @@ function parseInheritance (js) { | ||
/*! | ||
* parseReplace (source, replace) | ||
* | ||
* Do all the replacements as indicated | ||
* from the spec. | ||
* | ||
* @param {String} source | ||
* @param {Object} replace spec | ||
* @api private | ||
*/ | ||
function parseReplace (js, replace) { | ||
@@ -187,0 +339,0 @@ function iterator (spec) { |
@@ -0,1 +1,11 @@ | ||
/*! | ||
* Folio Minification Middleware | ||
* Copyright(c) 2012 Jake Luer <jake@alogicalparadox.com> | ||
* MIT Licensed | ||
*/ | ||
/*! | ||
* Module Requirements | ||
*/ | ||
var fs = require('fsagent') | ||
@@ -5,6 +15,24 @@ , path = require('path') | ||
/*! | ||
* Folio Requirements | ||
*/ | ||
var Base = require('./base') | ||
/*! | ||
* Primary Export | ||
*/ | ||
module.exports = Save; | ||
/** | ||
* ## Save | ||
* | ||
* Save the incoming source to a file. Pass | ||
* the source unmodified to the next | ||
* chain. | ||
* | ||
* @header Save | ||
*/ | ||
function Save () { | ||
@@ -15,4 +43,12 @@ Base.call(this); | ||
/*! | ||
* Inherit from Base | ||
*/ | ||
inherits(Save, Base); | ||
/*! | ||
* Expose the Api | ||
*/ | ||
Save.prototype.handle = function () { | ||
@@ -22,2 +58,13 @@ var self = this | ||
/** | ||
* ### .file (name) | ||
* | ||
* Specify the file name relative to the | ||
* Glossary root. | ||
* | ||
* @param {String} file path/name | ||
* @returns api for chaining | ||
* @api public | ||
*/ | ||
api.file = function (str) { | ||
@@ -28,2 +75,12 @@ self.attrs.file = str; | ||
/** | ||
* ### .pop () | ||
* | ||
* Return to the glossary. | ||
* | ||
* @returns Glossary | ||
* @name pop | ||
* @api public | ||
*/ | ||
api.pop = this.pop.bind(this); | ||
@@ -34,2 +91,17 @@ | ||
/*! | ||
* ### .compile (string, logger, callback) | ||
* | ||
* Save the incoming string and pass it along | ||
* to the next compile in the stack. | ||
* | ||
* @param {String} string of incoming source | ||
* @param {Object} logger | ||
* @param {Function} callback | ||
* @cb Error or null | ||
* @cb transformed string | ||
* @name compile | ||
* @api public | ||
*/ | ||
Save.prototype.compile = function (str, log, cb) { | ||
@@ -36,0 +108,0 @@ var self = this |
@@ -5,3 +5,3 @@ { | ||
"description": "Tiny static javascript build and serve utility.", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
34578
1243
0