Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

riverjs

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

riverjs - npm Package Compare versions

Comparing version 1.0.72 to 1.0.73

bin/compile.js

15

bin/config.js

@@ -5,2 +5,3 @@

, fs = require('fs')
, package = require('../package')
, path = require('path')

@@ -17,3 +18,8 @@ , config = path.join(cwd,'/river.json')

function read(){
return JSON.parse(fs.readFileSync(config,'utf8'));
var data = JSON.parse(fs.readFileSync(config,'utf8'));
if(data.version !== package.version){
return write();
}else{
return data;
}
}

@@ -24,6 +30,9 @@

var defaultConfig = {
version:package.version,
dist : app + '/build',
alias : {
'river.grammer' : app+'.grammar'
}
'river.grammer' : path.join(app,'grammar').replace(/\//,'.')
},
sourcemap : false,
minify : false
};

@@ -30,0 +39,0 @@ fs.writeFile(config,JSON.stringify(defaultConfig,null," "),function(err){

85

bin/river.js

@@ -6,4 +6,7 @@ #!/usr/bin/env node

, $path = require('path')
, es = require('riverjs-event-sequence')
, serial = es.serial
, parallel = es.parallel
, package = require('../package')
, exclude = /node_modules/
, exclude = /node_modules|build/
, targetfile = /\.js\s*$/

@@ -13,3 +16,5 @@ , rootPath

, dist = config.dist
, alias = config.alias;
, alias = config.alias
, compile = require('./compile')
, map = {};

@@ -51,19 +56,36 @@ command.help = function(){

buildFile(dist);
readPath(path);
//readPathSync(path);
readPath(path).on('end',function(){
var str="";
if(config.sourcemap){
fs.writeFile($path.join(dist,'app.map'),map.value);
str = "//# sourceMappingURL=app.map";
}
fs.writeFile($path.join(dist,'app.js'),map.data + str);
});
}
function readPath(path){
var me = this;
var queue = me instanceof parallel ? me : new parallel();
fs.stat(path,function(err,value){
if(err) throw err;
if(value.isFile()) readFile(path);
if(value.isDirectory()) readDirectory(path);
if(value.isFile()) queue.push(readFile,path);
if(value.isDirectory()) queue.push(readDirectory,path);
if(me instanceof parallel) queue.end();
});
return queue;
}
function readFile(path){
if(!targetfile.test(path)) return;
var me = this;
if(!targetfile.test(path)){ me.end(); return; }
fs.readFile(path,'utf8',function(err,value){
var namespace = path.replace(/^\.\/|\.js$/g,'').replace(/\//g,'.');
var data = header(namespace) + '\n' + value + '\n' + footer() + '\n';
appendToBuffer(data);
var code = header(namespace) + '\n' + value + '\n' + footer() + '\n';
generateSourceMap(code,path);
me.end();
});

@@ -73,9 +95,14 @@ }

function readDirectory(path){
if(exclude.test(path)) return;
var me = this;
if(exclude.test(path)) {
me.end();
return;
}
fs.readdir(path,function(err,value){
if(err) throw err;
for (var i = 0, len = value.length; i < len; i++) {
var childpath = path + '/' + value[i];
readPath(childpath);
var childpath = $path.join(path,value[i]);
me.push(readPath,childpath);
}
me.end();
});

@@ -120,7 +147,8 @@ }

function appendToBuffer(data) {
fs.appendFile($path.join(dist,'app.js'),data,function(err){
if(err) throw err;
});
function generateSourceMap(code,path) {
if(config.minify){
compile.minify(code,path,map);
}else{
compile.parse(code,path,map);
}
}

@@ -144,1 +172,26 @@

}
function readPathSync(path){
var stat = fs.statSync(path);
if(stat.isFile()) readFileSync(path);
if(stat.isDirectory()) readDirectorySync(path);
}
function readFileSync(path){
if(!targetfile.test(path)) return;
var content = fs.readFileSync(path,'utf8');
var namespace = path.replace(/^\.\/|\.js$/g,'').replace(/\//g,'.');
var code = header(namespace) + '\n' + content + '\n' + footer() + '\n';
generateSourceMap(code,path);
}
function readDirectorySync(path){
if(exclude.test(path)) return;
var me = this;
var value = fs.readdirSync(path);
for (var i = 0, len = value.length; i < len; i++) {
var childpath = path + '/' + value[i];
readPathSync(childpath);
}
}

@@ -121,3 +121,12 @@ /*

});
doc.nodeValue = doc.nodeValue.replace(/\r|\n/g,'').replace(/{{.*}}/, context.scope[key]);
//'a.b.c.d'
var ns = key.split('.');
var value = {};
for(var i=0;i<ns.length;i++){
if(typeof value === 'object'){
value = value[ns[i]] || context.scope[ns[i]]
}
}
value = typeof value == 'object' ? JSON.stringify(value) : value;
doc.nodeValue = doc.nodeValue.replace(/\r|\n/g,'').replace(/{{.*}}/, value);
}

@@ -124,0 +133,0 @@ }

@@ -1,2 +0,2 @@

var _$river={sandbox:function(){var e={};return{create:function(t,n){t=t.toLowerCase(),e[t]=n},run:function(t){var n={need:function(t){t=t.toLowerCase();var r=Object.create(n);r.exports={};var o=e[t]&&e[t].call(r,r.exports,r.need,r)||void 0;return o="function"==typeof r.exports?r.exports:Object.keys(r.exports).length?r.exports:o},exports:{}};t.call(n,n.exports,n.need,n)}}}};_$river.module=_$river.sandbox(),Object.create=Object.create||function(e){var t=function(){};return t.prototype=e,new t};var define=_$river.module.create,main=_$river.module.run;define("river.engine",function(){function e(e){return i.need("river.grammer."+e)}function t(t,r){var o={hasRepeat:!1,context:r},i={scope:{},node:t,eom:{},reg:c};return t.attributes&&t.attributes.length&&a.loop(t.attributes,function(l){var s=l.nodeName,u=l.nodeValue.replace(c,""),p=e(s);"repeat"===s&&(o.hasRepeat=!0),"scope"===s?(o.context=i,p.call(o.context,u,o.context.scope,o.context.node),r&&a.inherit(o.context.scope,r.scope)):a.isFunction(p)&&(o.context?(o.context.node=t,p.call(o.context,u,o.context.scope,o.context.node),n(l,o.context)):(o.context=i,e("scope").call(o.context,u),p.call(o.context,u,o.context.scope,o.context.node)))}),o}function n(e,t){if(c.test(e.nodeValue)){var n=e.nodeValue.replace(/\r|\n/g,"").replace(c,"");t.eom[n]||(t.eom[n]=[]),t.eom[n].push({element:e,expression:e.nodeValue}),e.nodeValue=e.nodeValue.replace(/\r|\n/g,"").replace(/{{.*}}/,t.scope[n])}}function r(e,t){if(e.childNodes&&e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n],i=t?t.context:void 0,a=o(r,i);if(a.hasRepeat)break}}function o(e,o){var i=t(e,o);return i.context&&n(e,i.context),"CODE"===e.nodeName||"PRE"===e.nodeName||i.hasRepeat||(i.context?r(e,i):r(e)),i}var i=this,a=i.need("river.core.tools"),c=/.*{{\s*|\s*}}.*/g;return{scan:o}}),main(function(){var e=this;document.addEventListener("DOMContentLoaded",function(){var t=e.need("river.engine").scan;t(document)})}),define("river.scenario",function(){function e(e,t){var n=document.createEvent("MouseEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function t(e,t,n,r){var o=document.createEvent("Events");o.initEvent(e,!0,!0),o.view=null,o.altKey=!1,o.ctrlKey=!1,o.shiftKey=!1,o.metaKey=!1,o.keyCode=t,o.charCode=n,r.dispatchEvent(o)}this.need("river.core.tools");return{trigger:e,key:t}}),define("river.core.Date",function(){function e(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(var n in t)new RegExp("("+n+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[n]:("00"+t[n]).substr((""+t[n]).length)));return e}var t=function(t){var n=new Date,r=new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours()+parseInt(t),n.getUTCMinutes(),n.getUTCSeconds());return{date:r,toString:function(t){return r.toString=e,r.toString(t)}}};return{getDateByCity:t}}),define("river.core.model",function(){function e(r,o,i,a){var c=this;if(f(r)||d(r))i&&i[o]?v(i[o],function(e){e.element.nodeValue=e.expression.replace(/{{.*}}/,r)}):i&&!i[o]&&h(i,function(e){v(e,function(e){e.element.nodeValue=e.expression.replace(/{{.*}}/,r)})});else if(u(r)){a=a?a:[];var l=t(i[o]),s=l.ele.parent.children,g=r.length-s.length,m=Math.abs(g),y=g>0,x=0>g;if(y)for(var b=r.slice(r.length-m,r.length),N=0;m>N;N++)n.call(c,i[o],l.eom,l.ele,b[N]);else if(x){Array.prototype.splice.call(i[o],0,m);for(var j=0;m>j;j++)s[j].parentNode.removeChild(s[j])}v(r,function(t,n){e.call(c,t,n,i[o][n],a[n])})}else p(r)&&(a=a?a:{},h(r,function(t,n){e.call(c,t,n,i,a[n])}))}function t(e){var t,n=a.clone(e[0]);return h(n,function(e){t||v(e,function(e){t||(t=e)})}),{eom:n,ele:t}}function n(e,t,n,o){e.push(t);var i=n.repeat.cloneNode(!0);n.parent.appendChild(i),n.element=r.call(this,i,o)[0]}function r(e,t,n){n=n||[];var i=this;return e.attributes&&o(e,i,t),e.childNodes&&e.childNodes.length?v(e.childNodes,function(e){r.call(i,e,t,n)}):n.push(e),n}function o(e,t,n){for(var r=e.attributes,o=0;o<r.length;o++){var i=r[o],a=s.need("river.grammer."+i.nodeName);a&&a.call({scope:t,node:e},i.nodeValue,t,e,n)}}function i(e,t){c[e]=t,l[e]={},this.$$ns=e}var a=this.need("river.core.tools"),c={},l={},s=this,u=a.isArray,p=a.isObject,f=a.isString,d=a.isNumber,h=a.each,v=a.loop;return i.prototype.apply=function(){var t=c[this.$$ns],n=l[this.$$ns],r=this;h(this,function(o,i){t[i]&&!a.expect(n[i]).toEqual(o)&&(e.call(r,o,i,t,n[i]),n[i]=a.clone(o))})},i.prototype.watch=function(){},i.prototype.inject=function(e){var t=this;h(e,function(n,r){t[r]=e[r]})},i}),define("river.core.tools",function(){function e(e,t){var n=function(){for(var t in e)e.hasOwnProperty&&e.hasOwnProperty(t)?this[t]=e[t]:n.prototype[t]=e[t]};for(var r in t)n.prototype[r]=t[r];var o=new n;for(var i in o)e[i]=o[i];return e}function t(e){var t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]}function n(){for(var e="$$",t=1;8>=t;t++){var n=Math.floor(16*Math.random()).toString(16);e+=n,(3==t||5==t)&&(e+="-")}return e}function r(e,t){for(var n={},r=0;r<e.length;r++)t.call(n,e[r],r)}function o(e,t){var n={};for(var r in e)e.hasOwnProperty&&e.hasOwnProperty(r)&&t.call(n,e[r],r)}function i(e,t){return window.Object.prototype.toString.call(t)==="[object "+e+"]"}function a(e,t){if("object"!=typeof e)return e;t=t?t:i("Object",e)?{}:[];for(var n in e){var r=i("Object",e[n]),o=i("Array",e[n]),c=r||o;c?(t[n]=r?{}:[],a(e[n],t[n])):t[n]=e[n]}return t}function c(e,t){this._diffFlag=!0;for(var n in t){var r=i("Object",t[n])||i("Array",t[n]);if(r&&e)c.call(this,e[n],t[n]);else{if(!e)return void(this._diffFlag=!1);e[n]!=t[n]&&(this._diffFlag=!1)}}return this._diffFlag}function l(e){function t(t){return n?e==t:r?c.call({},t,e)&&c.call({},e,t):void 0}var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e,r="function"!=typeof e;return{toEqual:t}}var s=(Object.prototype.toString,{inherit:e,compile:t,guid:n,loop:r,each:o,clone:a,expect:l,isArray:function(e){return i("Array",e)},isObject:function(e){return i("Object",e)},isFunction:function(e){return i("Function",e)},isString:function(e){return i("String",e)},isNumber:function(e){return i("Number",e)}});return s}),define("river.grammer.jbind",function(){function e(e){function t(t){t!==o&&(r[e]=t,o=t,r.apply())}var n,r=this.scope,o=this.node.value=r[e];this.node.onfocus=function(){var e=this;n=setInterval(function(){t(e.value)},30)},this.node.onblur=function(){clearInterval(n)}}return e}),define("river.grammer.jChange",function(){function e(e){var t=this.scope[e],n=this.scope;this.node.onchange=function(){t.call({},this.value),n.apply()}}return e}),define("river.grammer.jclick",function(){function e(e,t,n,r){var o=e.replace(/\(.*\)/,""),i=t[o],a=/\((.*)\)/,c=e.match(a),l=[];c&&c.length&&(l=c[1].split(","));for(var s=[],u=0,p=l;p>u;u++){var f=t[l[u]]?t[l[u]]:l[u];s.push(f)}r&&(s=[r]);this.eom;n.onclick=function(){i.apply(n,s),t.apply()}}return e}),define("river.grammer.jcompile",function(){return function(){{var e=this.node,t=(this.scope,this.reg);e.textContent.replace(t,"")}}}),define("river.grammer.jon",function(){function e(e,t,n,r){var o=e.replace(/\(.*\)/,""),i=o.replace(/\s*\|.*/,""),a=o.replace(/.*\|\s*/,""),c=t[a],l=/\((.*)\)/,s=e.match(l),u=[];s&&s.length&&(u=s[1].split(","));for(var p=[],f=0,d=u.length;d>f;f++){var h=t[u[f]]?t[u[f]]:u[f];p.push(h)}r&&(p=[r]);var v=(this.eom,"on"+i);n[v]=function(e){c.apply(n,[e].concat(p)),t.apply()}}return e}),define("river.grammer.repeat",function(){function e(e){return c.need("river.grammer."+e)}function t(e){var t=/.*in\s/,a=/\sin.*/,c=/.*\./,l=e.replace(t,"").replace(c,""),s=this.scope[l],u=e.replace(a,""),p=this.node.parentNode,f=p.removeChild(this.node),d=document.createDocumentFragment(),h=this.reg,v=this.eom[l]=[];i=this.scope,f.removeAttribute("repeat"),r=f,o=p,s&&s.length&&(s.forEach(function(e,t){var r=f.cloneNode(!0),o={};n(h,r,e,u,o,t),v.push(o),d.appendChild(r)}),p.appendChild(d))}function n(c,s,u,p,f){var d=!1;if(s.attributes&&s.attributes.length&&Array.prototype.forEach.call(s.attributes,function(n){if(c.test(n.nodeValue)){var h=n.nodeValue.replace(c,"").replace(p+".","");f[h]||(f[h]=[]),f[h].push({element:n,expression:n.nodeValue,repeat:r,parent:o}),n.nodeValue=n.nodeValue.replace(/{{.*}}/,u[h])}if(l.node=s,l.scope=u,l.reg=c,l.eom=f,"repeat"===n.nodeName)d=!0,t.call(l,n.nodeValue.replace(c,""));else{var v=e(n.nodeName);a.isFunction(v)&&v.call(l,n.nodeValue.replace(c,""),i,l.node,u)}}),c.test(s.nodeValue)){var h=s.nodeValue.replace(c,"").replace(p+".","");f[h]||(f[h]=[]),f[h].push({element:s,expression:s.nodeValue,repeat:r,parent:o});var v=a.isObject(u)?u[h]:u;s.nodeValue=s.nodeValue.replace(/{{.*}}/,v)}s.childNodes&&s.childNodes.length&&!d&&Array.prototype.forEach.call(s.childNodes,function(e){n(c,e,u,p,f,u)})}var r,o,i,a=this.need("river.core.tools"),c=(this.need("river.engine").scan,this),l={};return t}),define("river.grammer.scope",function(){function e(e){var o=t.need(e);if(r.isObject(o))this.scope=o;else if(r.isFunction(o)){var i=new n(e,this.eom);this.scope=i,o.call(i)}else{var a=r.guid();this.scope=new n(a,this.eom)}}var t=this,n=t.need("river.core.model"),r=t.need("river.core.tools");return e});
var _$river={sandbox:function(){var e={};return{create:function(t,n){t=t.toLowerCase(),e[t]=n},run:function(t){var n={need:function(t){t=t.toLowerCase();var r=Object.create(n);r.exports={};var o=e[t]&&e[t].call(r,r.exports,r.need,r)||void 0;return o="function"==typeof r.exports?r.exports:Object.keys(r.exports).length?r.exports:o},exports:{}};t.call(n,n.exports,n.need,n)}}}};_$river.module=_$river.sandbox(),Object.create=Object.create||function(e){var t=function(){};return t.prototype=e,new t};var define=_$river.module.create,main=_$river.module.run;define("river.engine",function(){function e(e){return i.need("river.grammer."+e)}function t(t,r){var o={hasRepeat:!1,context:r},i={scope:{},node:t,eom:{},reg:c};return t.attributes&&t.attributes.length&&a.loop(t.attributes,function(l){var s=l.nodeName,u=l.nodeValue.replace(c,""),p=e(s);"repeat"===s&&(o.hasRepeat=!0),"scope"===s?(o.context=i,p.call(o.context,u,o.context.scope,o.context.node),r&&a.inherit(o.context.scope,r.scope)):a.isFunction(p)&&(o.context?(o.context.node=t,p.call(o.context,u,o.context.scope,o.context.node),n(l,o.context)):(o.context=i,e("scope").call(o.context,u),p.call(o.context,u,o.context.scope,o.context.node)))}),o}function n(e,t){if(c.test(e.nodeValue)){var n=e.nodeValue.replace(/\r|\n/g,"").replace(c,"");t.eom[n]||(t.eom[n]=[]),t.eom[n].push({element:e,expression:e.nodeValue});for(var r=n.split("."),o={},i=0;i<r.length;i++)"object"==typeof o&&(o=o[r[i]]||t.scope[r[i]]);o="object"==typeof o?JSON.stringify(o):o,e.nodeValue=e.nodeValue.replace(/\r|\n/g,"").replace(/{{.*}}/,o)}}function r(e,t){if(e.childNodes&&e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n],i=t?t.context:void 0,a=o(r,i);if(a.hasRepeat)break}}function o(e,o){var i=t(e,o);return i.context&&n(e,i.context),"CODE"===e.nodeName||"PRE"===e.nodeName||i.hasRepeat||(i.context?r(e,i):r(e)),i}var i=this,a=i.need("river.core.tools"),c=/.*{{\s*|\s*}}.*/g;return{scan:o}}),main(function(){var e=this;document.addEventListener("DOMContentLoaded",function(){var t=e.need("river.engine").scan;t(document)})}),define("river.scenario",function(){function e(e,t){var n=document.createEvent("MouseEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function t(e,t,n,r){var o=document.createEvent("Events");o.initEvent(e,!0,!0),o.view=null,o.altKey=!1,o.ctrlKey=!1,o.shiftKey=!1,o.metaKey=!1,o.keyCode=t,o.charCode=n,r.dispatchEvent(o)}this.need("river.core.tools");return{trigger:e,key:t}}),define("river.core.Date",function(){function e(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(var n in t)new RegExp("("+n+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[n]:("00"+t[n]).substr((""+t[n]).length)));return e}var t=function(t){var n=new Date,r=new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours()+parseInt(t),n.getUTCMinutes(),n.getUTCSeconds());return{date:r,toString:function(t){return r.toString=e,r.toString(t)}}};return{getDateByCity:t}}),define("river.core.model",function(){function e(r,o,i,a){var c=this;if(f(r)||d(r))i&&i[o]?v(i[o],function(e){e.element.nodeValue=e.expression.replace(/{{.*}}/,r)}):i&&!i[o]&&h(i,function(e){v(e,function(e){e.element.nodeValue=e.expression.replace(/{{.*}}/,r)})});else if(u(r)){a=a?a:[];var l=t(i[o]),s=l.ele.parent.children,g=r.length-s.length,m=Math.abs(g),y=g>0,x=0>g;if(y)for(var b=r.slice(r.length-m,r.length),N=0;m>N;N++)n.call(c,i[o],l.eom,l.ele,b[N]);else if(x){Array.prototype.splice.call(i[o],0,m);for(var j=0;m>j;j++)s[j].parentNode.removeChild(s[j])}v(r,function(t,n){e.call(c,t,n,i[o][n],a[n])})}else p(r)&&(a=a?a:{},h(r,function(t,n){e.call(c,t,n,i,a[n])}))}function t(e){var t,n=a.clone(e[0]);return h(n,function(e){t||v(e,function(e){t||(t=e)})}),{eom:n,ele:t}}function n(e,t,n,o){e.push(t);var i=n.repeat.cloneNode(!0);n.parent.appendChild(i),n.element=r.call(this,i,o)[0]}function r(e,t,n){n=n||[];var i=this;return e.attributes&&o(e,i,t),e.childNodes&&e.childNodes.length?v(e.childNodes,function(e){r.call(i,e,t,n)}):n.push(e),n}function o(e,t,n){for(var r=e.attributes,o=0;o<r.length;o++){var i=r[o],a=s.need("river.grammer."+i.nodeName);a&&a.call({scope:t,node:e},i.nodeValue,t,e,n)}}function i(e,t){c[e]=t,l[e]={},this.$$ns=e}var a=this.need("river.core.tools"),c={},l={},s=this,u=a.isArray,p=a.isObject,f=a.isString,d=a.isNumber,h=a.each,v=a.loop;return i.prototype.apply=function(){var t=c[this.$$ns],n=l[this.$$ns],r=this;h(this,function(o,i){t[i]&&!a.expect(n[i]).toEqual(o)&&(e.call(r,o,i,t,n[i]),n[i]=a.clone(o))})},i.prototype.watch=function(){},i.prototype.inject=function(e){var t=this;h(e,function(n,r){t[r]=e[r]})},i}),define("river.core.tools",function(){function e(e,t){var n=function(){for(var t in e)e.hasOwnProperty&&e.hasOwnProperty(t)?this[t]=e[t]:n.prototype[t]=e[t]};for(var r in t)n.prototype[r]=t[r];var o=new n;for(var i in o)e[i]=o[i];return e}function t(e){var t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]}function n(){for(var e="$$",t=1;8>=t;t++){var n=Math.floor(16*Math.random()).toString(16);e+=n,(3==t||5==t)&&(e+="-")}return e}function r(e,t){for(var n={},r=0;r<e.length;r++)t.call(n,e[r],r)}function o(e,t){var n={};for(var r in e)e.hasOwnProperty&&e.hasOwnProperty(r)&&t.call(n,e[r],r)}function i(e,t){return window.Object.prototype.toString.call(t)==="[object "+e+"]"}function a(e,t){if("object"!=typeof e)return e;t=t?t:i("Object",e)?{}:[];for(var n in e){var r=i("Object",e[n]),o=i("Array",e[n]),c=r||o;c?(t[n]=r?{}:[],a(e[n],t[n])):t[n]=e[n]}return t}function c(e,t){this._diffFlag=!0;for(var n in t){var r=i("Object",t[n])||i("Array",t[n]);if(r&&e)c.call(this,e[n],t[n]);else{if(!e)return void(this._diffFlag=!1);e[n]!=t[n]&&(this._diffFlag=!1)}}return this._diffFlag}function l(e){function t(t){return n?e==t:r?c.call({},t,e)&&c.call({},e,t):void 0}var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e,r="function"!=typeof e;return{toEqual:t}}var s=(Object.prototype.toString,{inherit:e,compile:t,guid:n,loop:r,each:o,clone:a,expect:l,isArray:function(e){return i("Array",e)},isObject:function(e){return i("Object",e)},isFunction:function(e){return i("Function",e)},isString:function(e){return i("String",e)},isNumber:function(e){return i("Number",e)}});return s}),define("river.grammer.jbind",function(){function e(e){function t(t){t!==o&&(r[e]=t,o=t,r.apply())}var n,r=this.scope,o=this.node.value=r[e];this.node.onfocus=function(){var e=this;n=setInterval(function(){t(e.value)},30)},this.node.onblur=function(){clearInterval(n)}}return e}),define("river.grammer.jChange",function(){function e(e){var t=this.scope[e],n=this.scope;this.node.onchange=function(){t.call({},this.value),n.apply()}}return e}),define("river.grammer.jclick",function(){function e(e,t,n,r){var o=e.replace(/\(.*\)/,""),i=t[o],a=/\((.*)\)/,c=e.match(a),l=[];c&&c.length&&(l=c[1].split(","));for(var s=[],u=0,p=l;p>u;u++){var f=t[l[u]]?t[l[u]]:l[u];s.push(f)}r&&(s=[r]);this.eom;n.onclick=function(){i.apply(n,s),t.apply()}}return e}),define("river.grammer.jcompile",function(){return function(){{var e=this.node,t=(this.scope,this.reg);e.textContent.replace(t,"")}}}),define("river.grammer.jon",function(){function e(e,t,n,r){var o=e.replace(/\(.*\)/,""),i=o.replace(/\s*\|.*/,""),a=o.replace(/.*\|\s*/,""),c=t[a],l=/\((.*)\)/,s=e.match(l),u=[];s&&s.length&&(u=s[1].split(","));for(var p=[],f=0,d=u.length;d>f;f++){var h=t[u[f]]?t[u[f]]:u[f];p.push(h)}r&&(p=[r]);var v=(this.eom,"on"+i);n[v]=function(e){c.apply(n,[e].concat(p)),t.apply()}}return e}),define("river.grammer.repeat",function(){function e(e){return c.need("river.grammer."+e)}function t(e){var t=/.*in\s/,a=/\sin.*/,c=/.*\./,l=e.replace(t,"").replace(c,""),s=this.scope[l],u=e.replace(a,""),p=this.node.parentNode,f=p.removeChild(this.node),d=document.createDocumentFragment(),h=this.reg,v=this.eom[l]=[];i=this.scope,f.removeAttribute("repeat"),r=f,o=p,s&&s.length&&(s.forEach(function(e,t){var r=f.cloneNode(!0),o={};n(h,r,e,u,o,t),v.push(o),d.appendChild(r)}),p.appendChild(d))}function n(c,s,u,p,f){var d=!1;if(s.attributes&&s.attributes.length&&Array.prototype.forEach.call(s.attributes,function(n){if(c.test(n.nodeValue)){var h=n.nodeValue.replace(c,"").replace(p+".","");f[h]||(f[h]=[]),f[h].push({element:n,expression:n.nodeValue,repeat:r,parent:o}),n.nodeValue=n.nodeValue.replace(/{{.*}}/,u[h])}if(l.node=s,l.scope=u,l.reg=c,l.eom=f,"repeat"===n.nodeName)d=!0,t.call(l,n.nodeValue.replace(c,""));else{var v=e(n.nodeName);a.isFunction(v)&&v.call(l,n.nodeValue.replace(c,""),i,l.node,u)}}),c.test(s.nodeValue)){var h=s.nodeValue.replace(c,"").replace(p+".","");f[h]||(f[h]=[]),f[h].push({element:s,expression:s.nodeValue,repeat:r,parent:o});var v=a.isObject(u)?u[h]:u;s.nodeValue=s.nodeValue.replace(/{{.*}}/,v)}s.childNodes&&s.childNodes.length&&!d&&Array.prototype.forEach.call(s.childNodes,function(e){n(c,e,u,p,f,u)})}var r,o,i,a=this.need("river.core.tools"),c=(this.need("river.engine").scan,this),l={};return t}),define("river.grammer.scope",function(){function e(e){var o=t.need(e);if(r.isObject(o))this.scope=o;else if(r.isFunction(o)){var i=new n(e,this.eom);this.scope=i,o.call(i)}else{var a=r.guid();this.scope=new n(a,this.eom)}}var t=this,n=t.need("river.core.model"),r=t.need("river.core.tools");return e});
//# sourceMappingURL=river.map

@@ -71,3 +71,12 @@ define('river.engine',function() {

});
doc.nodeValue = doc.nodeValue.replace(/\r|\n/g,'').replace(/{{.*}}/, context.scope[key]);
//'a.b.c.d'
var ns = key.split('.');
var value = {};
for(var i=0;i<ns.length;i++){
if(typeof value === 'object'){
value = value[ns[i]] || context.scope[ns[i]]
}
}
value = typeof value == 'object' ? JSON.stringify(value) : value;
doc.nodeValue = doc.nodeValue.replace(/\r|\n/g,'').replace(/{{.*}}/, value);
}

@@ -74,0 +83,0 @@ }

{
"name": "riverjs",
"version": "1.0.72",
"version": "1.0.73",
"description": "a simple font-end framework with extendable two-way binding",

@@ -10,6 +10,7 @@ "main": "Gruntfile.js",

"dependencies": {
"jsdom": "~0.5.7"
"uglify-js": "*",
"riverjs-event-sequence": "0.0.7"
},
"bin":{
"riverjs":"bin/river.js"
"bin": {
"riverjs": "bin/river.js"
},

@@ -16,0 +17,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc