From ca9f09e5d255cadac81382de213581846a755ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kol=C3=A1rik?= Date: Wed, 9 Jul 2014 12:24:10 +0200 Subject: [PATCH] v0.2.2 (add minified file) --- bower.json | 2 +- package.json | 2 +- rvc.js | 2 +- rvc.min.js | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 rvc.min.js diff --git a/bower.json b/bower.json index 6af0529..d8c7920 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "rvc", "description": "RequireJS plugin to load and optimise Ractive components", - "version": "0.2.1", + "version": "0.2.2", "author": "Rich Harris", "license": "MIT", "main": ["rvc.js"], diff --git a/package.json b/package.json index 1ce2cff..4ba6b76 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rvc", - "version": "0.2.1", + "version": "0.2.2", "description": "RequireJS plugin to load and optimise Ractive components", "main": "rvc.js", "repository": { diff --git a/rvc.js b/rvc.js index c5fdc2e..5e970df 100644 --- a/rvc.js +++ b/rvc.js @@ -1,6 +1,6 @@ /* - rvc.js - v0.2.1 - 2014-07-09 + rvc.js - v0.2.2 - 2014-07-09 ========================================================== https://github.com/ractivejs/rvc diff --git a/rvc.min.js b/rvc.min.js new file mode 100644 index 0000000..dd20818 --- /dev/null +++ b/rvc.min.js @@ -0,0 +1 @@ +define(["ractive"],function(a){"use strict";var b=function(){var a=function(b,c,d,e){return 3==arguments.length?(e=d,d=void 0):2==arguments.length&&(e=c,c=d=void 0),{buildCache:{},load:function(f,g,h,i){var j=g.toUrl(f),k="";if(-1!=j.indexOf("?")&&(k=j.substr(j.indexOf("?")),j=j.substr(0,j.length-k.length)),i.precompiled instanceof Array){for(var l=0;lg;g+=1){f=b[g];try{e=new ActiveXObject(f)}catch(h){}if(e){b=[f];break}}if(!c)if("undefined"!=typeof XDomainRequest)e=new XDomainRequest;else if(!("withCredentials"in e))throw new Error("getXhr(): Cross Origin XHR not supported.");if(!e)throw new Error("getXhr(): XMLHttpRequest not available");return e};a.fetch=function(a,b,d){var e=c(a);e.open("GET",a,!requirejs.inlineRequire),e.onreadystatechange=function(){var c,f;if(4===e.readyState)if(c=e.status,c>399&&600>c)f=new Error(a+" HTTP status: "+c),f.xhr=e,d&&d(f);else{if(""==e.responseText)return d(new Error(a+" empty response"));b(e.responseText)}},e.send(null)}}else if("undefined"!=typeof process&&process.versions&&process.versions.node){var d=requirejs.nodeRequire("fs");a.fetch=function(a,b,c){try{b(d.readFileSync(a,"utf8"))}catch(e){c(e)}}}else a.fetch="undefined"!=typeof Packages?function(a,b,c){var d,e,f="utf-8",g=new java.io.File(a),h=java.lang.System.getProperty("line.separator"),i=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(g),f)),j="";try{for(d=new java.lang.StringBuffer,e=i.readLine(),e&&e.length()&&65279===e.charAt(0)&&(e=e.substring(1)),d.append(e);null!==(e=i.readLine());)d.append(h),d.append(e);j=String(d.toString())}catch(k){c&&c(k)}finally{i.close()}b(j)}:function(){throw new Error("Environment unsupported.")};return a}(),c=function(){var a,b=function(a){var b,c,d;return b=a.split("/"),c=b.pop(),d=c.lastIndexOf("."),-1!==d&&(c=c.substr(0,d)),c},c=function(b){function c(a){return a.f}var d=/require\s*\(\s*(?:"([^"]+)"|'([^']+)')\s*\)/g;return function(e){var f,g,h,i,j,k,l,m,n,o,p;if(f=a.parse(e,{noStringify:!0,interpolateScripts:!1,interpolateStyles:!1}),1!==f.v)throw new Error("Mismatched template version! Please ensure you are using the latest version of Ractive.js in your build process as well as in your app");for(h=[],j=[],l=[],n=[],g=f.t,o=g.length;o--;)p=g[o],p&&7===p.t&&("link"===p.e&&p.a&&"ractive"===p.a.rel&&h.push(g.splice(o,1)[0]),"script"!==p.e||p.a&&p.a.type&&"text/javascript"!==p.a.type||j.push(g.splice(o,1)[0]),"style"!==p.e||p.a&&p.a.type&&"text/css"!==p.a.type||l.push(g.splice(o,1)[0]));for(;/^\s*$/.test(g[0]);)g.shift();for(;/^\s*$/.test(g[g.length-1]);)g.pop();for(i=h.map(function(a){var c,d;if(c=a.a.href,d=a.a.name||b(c),"string"!=typeof d)throw new Error("Error parsing link tag");return{name:d,href:c}}),k=j.map(c).join(";");m=d.exec(k);)n.push(m[1]||m[2]);return{template:f,imports:i,script:k,css:l.map(c).join(" "),modules:n}}}(b),d=function(){function a(a,g){g="function"==typeof g?{callback:g}:g||{},g.sourceURL&&(a+="\n//# sourceURL="+g.sourceURL);try{return d(a)}catch(h){if(f)return void c(a,g.sourceURL||"");throw e&&"SyntaxError"===h.name&&b(a),h}}function b(a){var b,c;b="data:text/javascript;charset=utf-8,"+encodeURIComponent(a),c=document.createElement("script"),c.src=b,c.onload=function(){g.removeChild(c)},g.appendChild(c)}function c(a,b){var c=new h;try{c._compile("module.exports = function () {\n"+a+"\n};",b)}catch(d){return void console.error(d)}c.exports()}var d,e,f,g,h;return d=eval,"undefined"!=typeof document?(e=!0,g=document.getElementsByTagName("head")[0]):"undefined"!=typeof process&&(f=!0,h=(require.nodeRequire||require)("module")),a.Function=function(){var b,c,d,e=[];for(b=arguments.length;b--;)e[b]=arguments[b];return c=e.pop(),d="(function ("+e.join(", ")+") {\n"+c+"\n})",a(d)},a}(),e=function(b,c){return function(d,e,f,g){var h,i,j,k,l,m,n,o,p,q;if(e=e||{},i=e.url||"",k=e.loadImport,m=e.loadModule,h=b(d),j=function(){var b,d,j,k,m,n,o;if(b={template:h.template,partials:h.partials,css:h.css,components:l},h.script){try{if(j=h.script+"\n//# sourceURL="+i.substr(i.lastIndexOf("/")+1)+".js",k=new c.Function("component","require","Ractive",h.script),m={},k(m,e.require,a),n=m.exports,"object"==typeof n)for(o in n)n.hasOwnProperty(o)&&(b[o]=n[o]);d=a.extend(b)}catch(p){return void g(p)}f(d)}else d=a.extend(b),f(d)},o=h.imports.length+(m?h.modules.length:0)){if(p=function(){--o||(q?j():setTimeout(j,0))},h.imports.length){if(!k)throw new Error('Component definition includes imports (e.g. ``) but no loadImport method was passed to rcu.make()');l={},h.imports.forEach(function(a){k(a.name,a.href,i,function(b){l[a.name]=b,p()})})}m&&h.modules.length&&(n={},h.modules.forEach(function(a){m(a,a,i,function(b){n[a]=b,p()})}))}else setTimeout(j,0);q=!0}}(c,d),f=function(a,b){var c,d,e;if(!b||"/"===a.charAt(0))return a;for(c=(b||"").split("/"),d=a.split("/"),c.pop();e=d.shift();)".."===e?c.pop():"."!==e&&c.push(e);return c.join("/")},g=function(b,c,d,e){return{init:function(b){a=b},parse:b,make:c,resolve:d,getName:e}}(c,e,f,b);return g}(),d=function(b){return b.init(a),function(a,c,d,e,f){b.make(d,{url:a+".html",loadImport:function(d,e,f,g){e=b.resolve(e,a),c(["rvc!"+e.replace(/\.html$/,"")],g)},loadModule:function(a,b,d,e){c([b],e)},require:function(a){return c(a)}},e,f)}}(c),e=function(){function a(a){return/^[a-z_$][0-9a-z_$]*$/gi.test(a)&&!b.test(a)}var b=/^(abstract|boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|undefined|var|void|volatile|while|with)$/;return function(b,c,d,e){function f(b,c,d,e){function h(a){return d.slice(1)+a.join(","+(d&&"\n")+i)+(d?" ":"")}var i=e+d;switch(b=c?c(b):b,typeof b){case"string":return JSON.stringify(b);case"boolean":case"number":case"function":case"undefined":return""+b}if(null===b)return"null";if(b instanceof RegExp)return b.toString();if(b instanceof Date)return"new Date("+b.getTime()+")";if(g.indexOf(b)>=0)return"{$circularReference:1}";if(g.push(b),Array.isArray(b))return"["+h(b.map(function(a){return f(a,c,d,i)}))+"]";var j=Object.keys(b);return j.length?"{"+h(j.map(function(e){return(a(e)?e:JSON.stringify(e))+":"+f(b[e],c,d,i)}))+"}":"{}"}var g=[];return f(b,c,void 0===d?" ":d||"",e||"")}}(),f=function(a){return a.replace(/^\s+/gm,"")},g=function(a,b,c){return function(d,e,f){var g,h,i=["require","ractive"],j=["require","Ractive"],k=[];g=a.parse(e),g.imports.forEach(function(a,b){var c,d,e;c=a.href,d=a.name,e="_import_"+b,i.push("rvc!"+c.replace(/\.html$/,"")),j.push(e),k.push('"'+d+'":'+e)}),i=i.concat(g.modules),h='define("rvc!'+d+'",'+JSON.stringify(i)+",function("+j.join(",")+"){\n var __options__={\n template:"+b(g.template,null,"","")+",\n"+(g.css?" css:"+JSON.stringify(c(g.css))+",\n":"")+(g.imports.length?" components:{"+k.join(",")+"}\n":"")+" },\n component={};",g.script&&(h+="\n"+g.script+'\n if ( typeof component.exports === "object" ) {\n for ( var __prop__ in component.exports ) {\n if ( component.exports.hasOwnProperty(__prop__) ) {\n __options__[__prop__] = component.exports[__prop__];\n }\n }\n }\n\n '),h+="return Ractive.extend(__options__);\n});",f(h)}}(c,e,f),h=function(b,c,d,e){return c.init(a),b("rvc","html",function(a,b,c,f,g,h){h.isBuild?e(a,b,f,g):d(a,c,b,f,g)})}(b,c,d,g);return h}); \ No newline at end of file