Comparing version 0.0.9 to 0.0.10
{ | ||
"name": "brink", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "", | ||
"main": "./brink.js", | ||
"main": "./src/brink/brink.js", | ||
"directories": { | ||
@@ -36,2 +36,3 @@ "lib": "./brink" | ||
"mocha": "~1.16.2", | ||
"require-main": "^0.1.1", | ||
"string-length": "^1.0.0", | ||
@@ -38,0 +39,0 @@ "text-table": "^0.2.0", |
# brink.js | ||
#####The modular MVC framework. [API Docs](http://brinkjs.com/ "Brink.js API Docs") | ||
####The modular MVC framework | ||
--------------------- | ||
#####[API Docs](http://brinkjs.com/ "Brink.js API Docs") | ||
- Works in the browser and node.js. | ||
- No external dependencies. | ||
- Stays out of your way. | ||
- SMALL. < 10kb (minified and gzipped) | ||
- < 10kb (minified and gzipped) | ||
- Solves low-level problems with as little magic and opinion as possible. | ||
@@ -25,6 +28,6 @@ - Use as much or as little of it as you want. | ||
- ###### Not yet implemented and/or documented: | ||
- Models & Collections | ||
- Promise based publish/subscribe | ||
- DOM-aware client-side templating | ||
###### Not yet implemented and/or documented: | ||
- Models & Collections | ||
- Promise based publish/subscribe | ||
- DOM-aware client-side templating | ||
@@ -31,0 +34,0 @@ ----------------------------- |
@@ -178,3 +178,7 @@ 'use strict'; | ||
$b.configure({paths : {brink : __dirname}}); | ||
$b.init(); | ||
$b.configure({paths : null}); | ||
module.exports = $b; | ||
} |
@@ -48,3 +48,2 @@ $b( | ||
/*********************************************************************** | ||
`Brink.Class` provides several useful inheritance helpers | ||
@@ -65,34 +64,5 @@ and other utilities not found on `Brink.Object`: | ||
var i, | ||
p, | ||
meta; | ||
this.__autoBindMethods = true; | ||
return this._super.apply(this, arguments); | ||
this._super.apply(this, arguments); | ||
meta = this.__meta; | ||
/* | ||
Auto-binding methods is very expensive as we have to do | ||
it every time an instance is created. It roughly doubles | ||
the time it takes to instantiate | ||
Still, it's not really an issue unless you are creating thousands | ||
of instances at once. Creating 10,000 instances with auto-bound | ||
methods should still take < 500ms. | ||
We auto-bind on $b.Class and not on $b.Object because it's | ||
far more likely you'd be creating a lot of Object instances at once | ||
and shouldn't need the overhead of this. | ||
*/ | ||
if (config.AUTO_BIND_METHODS || 1) { | ||
for (i = 0; i < meta.methods.length; i ++) { | ||
p = meta.methods[i]; | ||
if (!~p.indexOf('__')) { | ||
this[p] = bindFunction(this[p], this); | ||
} | ||
} | ||
} | ||
return this; | ||
}, Obj.prototype.__init), | ||
@@ -106,3 +76,4 @@ | ||
@param {Function} handler A function to handle the notifications. | ||
@param {Number} [priority] Lower is higher priority (priority of 0 will hear about the notifications before any other handler) | ||
@param {Number} [priority] Lower is higher priority | ||
(priority of 0 will hear about the notifications before any other handler) | ||
************************************************************************/ | ||
@@ -109,0 +80,0 @@ subscribe : function (name, handler, priority) { |
@@ -55,3 +55,4 @@ $b( | ||
var p, | ||
var i, | ||
p, | ||
meta; | ||
@@ -72,5 +73,3 @@ | ||
for (p in o) { | ||
this.prop(p, o[p]); | ||
} | ||
this.__appendToMeta(o, meta); | ||
} | ||
@@ -82,2 +81,24 @@ | ||
/* | ||
Auto-binding methods is very expensive as we have to do | ||
it every time an instance is created. It roughly doubles | ||
the time it takes to instantiate | ||
Still, it's not really an issue unless you are creating thousands | ||
of instances at once. Creating 10,000 instances with auto-bound | ||
methods should still take < 500ms. | ||
We auto-bind by default on $b.Class and not on $b.Object because it's | ||
far more likely you'd be creating a lot of Object instances at once | ||
and shouldn't need the overhead of this. | ||
*/ | ||
if (this.__autoBindMethods) { | ||
for (i = 0; i < meta.methods.length; i ++) { | ||
p = meta.methods[i]; | ||
if (!~p.indexOf('__')) { | ||
this[p] = bindFunction(this[p], this); | ||
} | ||
} | ||
} | ||
if (this.init) { | ||
@@ -96,2 +117,6 @@ this.init.apply(this, arguments); | ||
init : function () { | ||
}, | ||
__buildMeta : function () { | ||
@@ -120,20 +145,24 @@ | ||
__parsePrototype : function () { | ||
this.__appendToMeta(this, this.__buildMeta(), true); | ||
}, | ||
__appendToMeta : function (o, meta, isThis) { | ||
var p, | ||
v, | ||
meta; | ||
v; | ||
meta = this.__buildMeta(); | ||
for (p in o) { | ||
for (p in this) { | ||
v = o[p]; | ||
v = this[p]; | ||
if (isFunction(v)) { | ||
if (p !== 'constructor' && !~meta.methods.indexOf(p)) { | ||
meta.methods.push(p); | ||
meta.methods.push(p); | ||
if (!isThis) { | ||
this[p] = o[p]; | ||
} | ||
} | ||
} | ||
else if (this.hasOwnProperty(p)) { | ||
else if (o.hasOwnProperty(p)) { | ||
@@ -152,3 +181,2 @@ if (p !== '__meta') { | ||
} | ||
}, | ||
@@ -155,0 +183,0 @@ |
@@ -104,3 +104,3 @@ $b( | ||
metas.forEach(function (item) { | ||
console.log(item.id); | ||
console.log('\t' + item.id); | ||
}); | ||
@@ -116,5 +116,3 @@ | ||
modules.push(meta.id); | ||
moduleSrc = fs.readFileSync(meta.url, {encoding : 'utf8'}); | ||
moduleSrc = fs.readFileSync(require.resolve(meta.url), {encoding : 'utf8'}); | ||
moduleSrc = replaceAnonymousDefine(meta.id, moduleSrc); | ||
@@ -121,0 +119,0 @@ |
@@ -87,3 +87,4 @@ (function () { | ||
var idPart; | ||
var meta, | ||
idPart; | ||
@@ -98,10 +99,10 @@ if (id) { | ||
_metas[id] = { | ||
module : this.module, | ||
id : this.id, | ||
url : this.url, | ||
attachPath : this.attachPath, | ||
order : moduleIndex ++ | ||
}; | ||
meta = _metas[id] || {id : this.id}; | ||
meta.module = this.module; | ||
meta.url = this.url || meta.url; | ||
meta.attachPath = this.attachPath || meta.attachPath; | ||
meta.order = meta.order || moduleIndex ++; | ||
_metas[id] = meta; | ||
module = this.module.exports || this.module; | ||
@@ -155,3 +156,3 @@ | ||
*/ | ||
context = (path.indexOf('.') < 0) ? '' : context; | ||
context = (path && path.indexOf('.') < 0) ? '' : context; | ||
@@ -162,3 +163,3 @@ /** | ||
*/ | ||
if (~_rem.indexOf(path) || ~path.indexOf('!')) { | ||
if (path && (~_rem.indexOf(path) || ~path.indexOf('!'))) { | ||
return path.replace(/([\d,\w,\s,\.\/]*)(?=\!)/, function ($0, $1) { | ||
@@ -165,0 +166,0 @@ return _resolve($1, context); |
@@ -27,3 +27,2 @@ $b( | ||
``` | ||
@@ -30,0 +29,0 @@ |
@@ -44,3 +44,3 @@ $b( | ||
val = get(obj, key[i]); | ||
if (val == null) { | ||
if (val == null && createIfNull) { | ||
val = obj[key[i]] = {}; | ||
@@ -47,0 +47,0 @@ } |
@@ -21,3 +21,4 @@ $b( | ||
@param {Object|Array} obj2 The `Object` or `Array` containing values to merge. | ||
@param {Boolean} [deep=false] Whether or not to deep copy objects when merging (`true`) or shallow copy (`false`) | ||
@param {Boolean} [deep=false] Whether or not to deep copy objects when merging | ||
(`true`) or shallow copy (`false`) | ||
@return {Object|Array} The merged `Object` or `Array`. | ||
@@ -24,0 +25,0 @@ ************************************************************************/ |
@@ -44,3 +44,4 @@ $b( | ||
@param {Object} obj The object containing the property/properties to set. | ||
@param {String|Object} key The name of the property to set. If setting multiple properties, an `Object` containing key : value pairs. | ||
@param {String|Object} key The name of the property to set. | ||
If setting multiple properties, an `Object` containing key : value pairs. | ||
@param {Any} [val] The value of the property. | ||
@@ -47,0 +48,0 @@ @return {Object} The Object passed in as the first argument. |
@@ -1,22 +0,5 @@ | ||
var fs = require('fs'), | ||
includer = require('includer'), | ||
wrench = require('wrench'), | ||
uglify = require('uglify-js'); | ||
require('require-main')(); | ||
$b = require('../src/brink/brink.js'); | ||
$b.configure({ | ||
baseUrl : __dirname + '/../src' | ||
}); | ||
$b.build({ | ||
cwd : __dirname, | ||
file : '../brink.js', | ||
exclude : [], | ||
minify : false | ||
}); | ||
$b.build({ | ||
cwd : __dirname, | ||
file : '../dist/brink-prod.js', | ||
@@ -23,0 +6,0 @@ minifiedFile : '../dist/brink-prod.min.js', |
@@ -7,2 +7,4 @@ var p, | ||
require('require-main')(); | ||
fs = require('fs'); | ||
@@ -18,4 +20,2 @@ path = require('path'); | ||
require('../src/brink/brink.js'); | ||
global.expect = chai.expect; | ||
@@ -42,10 +42,4 @@ | ||
$b.configure({ | ||
baseUrl : __dirname + '/../src' | ||
mocha.run(function(failures) { | ||
process.exit(failures); | ||
}); | ||
$b.init(function () { | ||
mocha.run(function(failures) { | ||
process.exit(failures); | ||
}); | ||
}); |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
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
196
15
3
728653
18
105
14237