From d258b9687b9814ec32c691ecd1fe40c14b62cde5 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Tue, 25 Mar 2014 22:23:14 -0400 Subject: [PATCH 1/3] expose to commonjs --- archive/v0.1.2/mithril-tests.js | 2 ++ archive/v0.1.2/mithril.min.js | 2 +- archive/v0.1.2/mithril.min.map | 2 +- archive/v0.1.2/mithril.min.zip | Bin 20069 -> 20151 bytes mithril.js | 2 ++ 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/archive/v0.1.2/mithril-tests.js b/archive/v0.1.2/mithril-tests.js index 9bec759a..c73033cf 100644 --- a/archive/v0.1.2/mithril-tests.js +++ b/archive/v0.1.2/mithril-tests.js @@ -417,6 +417,8 @@ new function(window) { } } + if (window.module) window.module.exports = m + //testing API m.deps = function(mock) {return window = mock} }(this) diff --git a/archive/v0.1.2/mithril.min.js b/archive/v0.1.2/mithril.min.js index de690171..c0431d1a 100644 --- a/archive/v0.1.2/mithril.min.js +++ b/archive/v0.1.2/mithril.min.js @@ -4,5 +4,5 @@ http://github.com/lhorie/mithril.js (c) Leo Horie License: MIT */ -!new function(a){function b(e,f,g){if(null!==f&&void 0!==f){var h=s.call(g),i=s.call(f);if(h!=i&&(null!==g&&void 0!==g&&d(g.nodes),g=new f.constructor,g.nodes=[]),"[object Array]"==i){for(var j=[],k=g.length===f.length,l=0;l-1?new f.constructor(f):f,g.nodes=[n]}else if(g.valueOf()!==f.valueOf()){if(f.$trusted){var q=g.nodes[0],j=[q];if(q){for(;q=q.nextSibling;)j.push(q);d(j);var p=e.lastChild;e.insertAdjacentHTML("beforeend",f),n=p?p.nextSibling:e.firstChild}else e.innerHTML=f}else n=g.nodes[0],e.appendChild(n),n.nodeValue=f;g=new f.constructor(f),g.nodes=[n]}else g.nodes.intact=!0}return g}}function c(a,b,c){for(var d in b){var e=b[d];if(!(d in c)||c[d]!==e){if(c[d]=e,"config"==d)continue;if(0==d.indexOf("on")&&"function"==typeof e&&(e=f(e,a)),"style"==d)for(var g in e)a.style[g]=e[g];else d in a?a[d]=e:a.setAttribute(d,e)}}return c}function d(a){for(var b=0;b16)m.redraw();else{var b=a.cancelAnimationFrame||a.clearTimeout,c=a.requestAnimationFrame||a.setTimeout;b(E),E=c(m.redraw,0)}}function h(a,b,c){J={};for(var d in b){if(d==c)return!void m.module(a,b[d]);var e=new RegExp("^"+d.replace(/:[^\/]+/g,"([^\\/]+)")+"$");if(e.test(c))return!void c.replace(e,function(){for(var c=d.match(/:[^\/]+/g),e=[].slice.call(arguments,1,-2),f=0;f0&&("GET"==a.method?a.url=a.url+(a.url.indexOf("?")<0?"?":"&")+n(b):a.data=c(b)),a}function p(a,b){var c=a.match(/:\w+/g);if(c&&b)for(var d=0;d0&&(f.attrs[d]=h.join(" "))}f=e(f),f.attrs=e(f.attrs),f.children=b?a[2]:a[1];for(var j in c)f.attrs[j]=j==d?(f.attrs[j]||"")+" "+c[j]:c[j];return f};var v,w={insertAdjacentHTML:function(b,c){a.document.write(c),a.document.close()},appendChild:function(b){void 0===v&&(v=a.document.createElement("html")),"HTML"==b.nodeName?v=b:v.appendChild(b),a.document.documentElement!==v&&a.document.replaceChild(v,a.document.documentElement)}},x=[],y={};m.render=function(c,d){var e=x.indexOf(c),f=0>e?x.push(c)-1:e,g=c==a.document||c==a.document.documentElement?w:c;y[f]=b(g,d,y[f])},m.trust=function(a){return a=new String(a),a.$trusted=!0,a};var z,A={view:function(){}},B={},C=0,D=0,E=0;m.module=function(a,b){m.startComputation(),z=a,A=b,B=new b.controller,m.endComputation()},m.redraw=function(){m.render(z||a.document,A.view(B)),D=C};var F=0,G=null;m.startComputation=function(){F++},m.endComputation=function(){F=Math.max(F-1,0),0==F&&(g(),G&&(G(),G=null))},m.withAttr=function(a,b){return function(c){b(a in c.currentTarget?c.currentTarget[a]:c.currentTarget.getAttribute(a))}};var H={pathname:"",hash:"#",search:"?"},I=function(){},J={};m.route=function(){if(3==arguments.length){var b=arguments[0],c=arguments[1],d=arguments[2];I=function(a){var e=a.slice(H[m.route.mode].length);h(b,d,e)||m.route(c,!0)};var e="hash"==m.route.mode?"onhashchange":"onpopstate";a[e]=function(){I(a.location[m.route.mode])},G=j,a[e]()}else if(arguments[0].addEventListener){var f=arguments[0],g=arguments[1];g||(f.removeEventListener("click",i),f.addEventListener("click",i))}else if("string"==typeof arguments[0]){var k=arguments[0],l=arguments[1]===!0;a.history.pushState?(G=function(){a.history[l?"replaceState":"pushState"](null,a.document.title,H[m.route.mode]+k),j()},I(H[m.route.mode]+k)):a.location[m.route.mode]=k}},m.route.param=function(a){return J[a]},m.route.mode="search",m.prop=function(a){return function(){return arguments.length&&(a=arguments[0]),a}},m.deferred=function(){var a=[],b=[],c={resolve:function(b){for(var c=0;c-1?new f.constructor(f):f,g.nodes=[n]}else if(g.valueOf()!==f.valueOf()){if(f.$trusted){var q=g.nodes[0],j=[q];if(q){for(;q=q.nextSibling;)j.push(q);d(j);var p=e.lastChild;e.insertAdjacentHTML("beforeend",f),n=p?p.nextSibling:e.firstChild}else e.innerHTML=f}else n=g.nodes[0],e.appendChild(n),n.nodeValue=f;g=new f.constructor(f),g.nodes=[n]}else g.nodes.intact=!0}return g}}function c(a,b,c){for(var d in b){var e=b[d];if(!(d in c)||c[d]!==e){if(c[d]=e,"config"==d)continue;if(0==d.indexOf("on")&&"function"==typeof e&&(e=f(e,a)),"style"==d)for(var g in e)a.style[g]=e[g];else d in a?a[d]=e:a.setAttribute(d,e)}}return c}function d(a){for(var b=0;b16)m.redraw();else{var b=a.cancelAnimationFrame||a.clearTimeout,c=a.requestAnimationFrame||a.setTimeout;b(E),E=c(m.redraw,0)}}function h(a,b,c){J={};for(var d in b){if(d==c)return!void m.module(a,b[d]);var e=new RegExp("^"+d.replace(/:[^\/]+/g,"([^\\/]+)")+"$");if(e.test(c))return!void c.replace(e,function(){for(var c=d.match(/:[^\/]+/g),e=[].slice.call(arguments,1,-2),f=0;f0&&("GET"==a.method?a.url=a.url+(a.url.indexOf("?")<0?"?":"&")+n(b):a.data=c(b)),a}function p(a,b){var c=a.match(/:\w+/g);if(c&&b)for(var d=0;d0&&(f.attrs[d]=h.join(" "))}f=e(f),f.attrs=e(f.attrs),f.children=b?a[2]:a[1];for(var j in c)f.attrs[j]=j==d?(f.attrs[j]||"")+" "+c[j]:c[j];return f};var v,w={insertAdjacentHTML:function(b,c){a.document.write(c),a.document.close()},appendChild:function(b){void 0===v&&(v=a.document.createElement("html")),"HTML"==b.nodeName?v=b:v.appendChild(b),a.document.documentElement!==v&&a.document.replaceChild(v,a.document.documentElement)}},x=[],y={};m.render=function(c,d){var e=x.indexOf(c),f=0>e?x.push(c)-1:e,g=c==a.document||c==a.document.documentElement?w:c;y[f]=b(g,d,y[f])},m.trust=function(a){return a=new String(a),a.$trusted=!0,a};var z,A={view:function(){}},B={},C=0,D=0,E=0;m.module=function(a,b){m.startComputation(),z=a,A=b,B=new b.controller,m.endComputation()},m.redraw=function(){m.render(z||a.document,A.view(B)),D=C};var F=0,G=null;m.startComputation=function(){F++},m.endComputation=function(){F=Math.max(F-1,0),0==F&&(g(),G&&(G(),G=null))},m.withAttr=function(a,b){return function(c){b(a in c.currentTarget?c.currentTarget[a]:c.currentTarget.getAttribute(a))}};var H={pathname:"",hash:"#",search:"?"},I=function(){},J={};m.route=function(){if(3==arguments.length){var b=arguments[0],c=arguments[1],d=arguments[2];I=function(a){var e=a.slice(H[m.route.mode].length);h(b,d,e)||m.route(c,!0)};var e="hash"==m.route.mode?"onhashchange":"onpopstate";a[e]=function(){I(a.location[m.route.mode])},G=j,a[e]()}else if(arguments[0].addEventListener){var f=arguments[0],g=arguments[1];g||(f.removeEventListener("click",i),f.addEventListener("click",i))}else if("string"==typeof arguments[0]){var k=arguments[0],l=arguments[1]===!0;a.history.pushState?(G=function(){a.history[l?"replaceState":"pushState"](null,a.document.title,H[m.route.mode]+k),j()},I(H[m.route.mode]+k)):a.location[m.route.mode]=k}},m.route.param=function(a){return J[a]},m.route.mode="search",m.prop=function(a){return function(){return arguments.length&&(a=arguments[0]),a}},m.deferred=function(){var a=[],b=[],c={resolve:function(b){for(var c=0;c8;s`<6ioNj33PM}t@6@wcXT&)b_B_}8cbg2E2drG2NZJ*&iB*tbabw8c2=ql l@MdHZVZh?l$?ts)umNQM9a delta 148 zcmdl!m+|QwM)3e|W)?065V*Xd(q*pPs<1p+28O(i;uf-#^JK$#fP!aJ&Z+SmFfj0M zz91XQxmjO*t{Qh_mQ#_dj;o`iYvm+AF^)Vx9d}2^;M~b_e&Qf4aC0U*`WeU}n*lNh SY#of4HM!qUiS3#%hz|hB^C#p0 diff --git a/mithril.js b/mithril.js index a986161a..52939e69 100644 --- a/mithril.js +++ b/mithril.js @@ -417,6 +417,8 @@ new function(window) { } } + if (window.module) window.module.exports = m + //testing API m.deps = function(mock) {return window = mock} }(this) \ No newline at end of file From 78c422448a32c1b87f5f7ca44ae6e061879132bd Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Sun, 30 Mar 2014 14:17:40 -0400 Subject: [PATCH 2/3] make commonjs api work with non-global `module`, expose amd api --- mithril.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index 52939e69..368196cf 100644 --- a/mithril.js +++ b/mithril.js @@ -417,7 +417,8 @@ new function(window) { } } - if (window.module) window.module.exports = m + if (typeof module != "undefined" && module !== null) module.exports = m + if (typeof define == "function" && define.amd) define(function() {return m}) //testing API m.deps = function(mock) {return window = mock} From 18dd5a1410d0ca30fa88ece51ba1ac935ee815f6 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Sun, 30 Mar 2014 22:30:08 -0400 Subject: [PATCH 3/3] add manifest files for npm and component --- Gruntfile.js | 1 + archive/v0.1.2/component.json | 10 ++++++++++ archive/v0.1.2/package.json | 11 +++++++++++ docs/layout/component.json | 10 ++++++++++ docs/layout/package.json | 11 +++++++++++ 5 files changed, 43 insertions(+) create mode 100644 archive/v0.1.2/component.json create mode 100644 archive/v0.1.2/package.json create mode 100644 docs/layout/component.json create mode 100644 docs/layout/package.json diff --git a/Gruntfile.js b/Gruntfile.js index f0c472a6..0cf23688 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -77,6 +77,7 @@ module.exports = function(grunt) { options: {force: true, patterns: [{match: /\.md/g, replacement: ".html"}, {match: /\$version/g, replacement: version}]}, links: {expand: true, flatten: true, src: [tempFolder + "/**/*.html"], dest: currentVersionArchiveFolder + "/"}, index: {src: inputFolder + "/layout/index.html", dest: currentVersionArchiveFolder + "/index.html"}, + commonjs: {expand: true, flatten: true, src: [inputFolder + "/layout/*.json"], dest: currentVersionArchiveFolder}, }, copy: { style: {src: inputFolder + "/layout/style.css", dest: currentVersionArchiveFolder + "/style.css"}, diff --git a/archive/v0.1.2/component.json b/archive/v0.1.2/component.json new file mode 100644 index 00000000..a7f3f3b5 --- /dev/null +++ b/archive/v0.1.2/component.json @@ -0,0 +1,10 @@ +{ + "name": "mithril", + "description": "A Javascript framework for building brilliant applications", + "keywords": ["mvc", "framework"], + "repo": "lhorie/mithril", + "main": "mithril.min.js", + "scripts": ["mithril.min.js"], + "version": "0.1.2", + "license": "MIT" +} \ No newline at end of file diff --git a/archive/v0.1.2/package.json b/archive/v0.1.2/package.json new file mode 100644 index 00000000..3870314d --- /dev/null +++ b/archive/v0.1.2/package.json @@ -0,0 +1,11 @@ +{ + "name": "mithril", + "description": "A Javascript Framework for building brilliant applications", + "keywords": ["mvc", "framework"], + "version": "0.1.2", + "author": "Leo Horie ", + "repository": {"type": "git", "url": "https://github.com/lhorie/mithril"}, + "main": "mithril.min.js", + "licenses": [{"type": "MIT", "url": "http://opensource.org/licenses/MIT"}] + "files": ["mithril.min.js", "mithril.min.map"] +} \ No newline at end of file diff --git a/docs/layout/component.json b/docs/layout/component.json new file mode 100644 index 00000000..484349e5 --- /dev/null +++ b/docs/layout/component.json @@ -0,0 +1,10 @@ +{ + "name": "mithril", + "description": "A Javascript framework for building brilliant applications", + "keywords": ["mvc", "framework"], + "repo": "lhorie/mithril", + "main": "mithril.min.js", + "scripts": ["mithril.min.js"], + "version": "$version", + "license": "MIT" +} \ No newline at end of file diff --git a/docs/layout/package.json b/docs/layout/package.json new file mode 100644 index 00000000..aca6234f --- /dev/null +++ b/docs/layout/package.json @@ -0,0 +1,11 @@ +{ + "name": "mithril", + "description": "A Javascript Framework for building brilliant applications", + "keywords": ["mvc", "framework"], + "version": "$version", + "author": "Leo Horie ", + "repository": {"type": "git", "url": "https://github.com/lhorie/mithril"}, + "main": "mithril.min.js", + "licenses": [{"type": "MIT", "url": "http://opensource.org/licenses/MIT"}] + "files": ["mithril.min.js", "mithril.min.map"] +} \ No newline at end of file