diff --git a/package.json b/package.json index 71291553..1f068e51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moon-root", - "version": "1.0.0-beta.4", + "version": "1.0.0-beta.5", "description": "The minimal & fast library for functional user interfaces", "private": true, "scripts": { diff --git a/packages/moon-browser/dist/moon-browser.js b/packages/moon-browser/dist/moon-browser.js index b3d8237f..ad488318 100644 --- a/packages/moon-browser/dist/moon-browser.js +++ b/packages/moon-browser/dist/moon-browser.js @@ -1,5 +1,5 @@ /** - * Moon Browser v1.0.0-beta.4 + * Moon Browser v1.0.0-beta.5 * Copyright 2016-2019 Kabir Shah * Released under the MIT License * https://kbrsh.github.io/moon @@ -456,7 +456,7 @@ compile: compile, generate: generate, parse: parse, - version: "1.0.0-beta.4" + version: "1.0.0-beta.5" }; /** diff --git a/packages/moon-browser/dist/moon-browser.min.js b/packages/moon-browser/dist/moon-browser.min.js index c0e37166..e59d2346 100644 --- a/packages/moon-browser/dist/moon-browser.min.js +++ b/packages/moon-browser/dist/moon-browser.min.js @@ -1,7 +1,7 @@ /** - * Moon Browser v1.0.0-beta.4 + * Moon Browser v1.0.0-beta.5 * Copyright 2016-2019 Kabir Shah * Released under the MIT License * https://kbrsh.github.io/moon */ -!function(){"use strict";var t=/[@$\w.]/;function n(t,n){this.expected=t,this.index=n}var e=function(t,e){return function(r,o){var a=e(r,o);return a instanceof n?a:[{type:t,value:a[0]},a[1]]}},r=function(t,e){return e===t.length?["EOF",e]:new n("EOF",e)},o=function(t,e){return ei.index?a:i}return a}},f=function(t,e){return function(r,o){var a=t(r,o);if(a instanceof n)return a;var i=e(r,a[1]);return i instanceof n?i:[[a[0],i[0]],i[1]]}},p=function(t){return function(e,r){for(var o=[],a=0;ao.index&&(o=i)}return o}},v=function(t){return function(e,r){for(var o,a=[];!((o=t(e,r))instanceof n);)a.push(o[0]),r=o[1];return[a,r]}},d=function(t){return function(e,r){var o=[],a=t(e,r);if(a instanceof n)return a;for(o.push(a[0]),r=a[1];!((a=t(e,r))instanceof n);)o.push(a[0]),r=a[1];return[o,r]}},h={whitespace:l([a(" "),a("\t"),a("\n")]),comment:e("comment",p([a("#"),v(c(f(a("\\"),o),s(["#"]))),a("#")])),separator:function(t,n){return v(c(h.whitespace,h.comment))(t,n)},value:function(n,e){return l([d(i(t)),p([a('"'),v(c(f(a("\\"),o),s(['"']))),a('"')]),p([a("'"),v(c(f(a("\\"),o),s(["'"]))),a("'")]),p([a("`"),v(c(f(a("\\"),o),s(["`"]))),a("`")]),p([a("("),h.expression,a(")")]),p([a("["),h.expression,a("]")]),p([a("{"),h.expression,a("}")])])(n,e)},attributes:function(t,n){return e("attributes",v(p([h.value,a("="),h.value,h.separator])))(t,n)},text:e("text",d(c(f(a("\\"),o),s(["{","<"])))),interpolation:function(t,n){return e("interpolation",p([a("{"),h.expression,a("}")]))(t,n)},node:function(t,n){return e("node",p([a("<"),h.separator,h.value,h.separator,u("*>")]))(t,n)},nodeData:function(t,n){return e("nodeData",p([a("<"),h.separator,h.value,h.separator,c(f(h.value,u("/>")),f(h.attributes,u("/>")))]))(t,n)},nodeDataChildren:function(t,n){return e("nodeDataChildren",p([a("<"),h.separator,h.value,h.separator,h.attributes,a(">"),v(l([h.node,h.nodeData,h.nodeDataChildren,h.text,h.interpolation])),u(""])),a(">")]))(t,n)},expression:function(t,n){return v(l([p([u("//"),v(s(["\n"]))]),p([u("/*"),v(s(["*/"])),u("*/")]),p([a("/"),d(c(f(a("\\"),s(["\n"])),s(["/","\n"]))),a("/")]),h.comment,h.value,h.node,h.nodeData,h.nodeDataChildren,a("/"),a("<"),d(s(["/","#",'"',"'","`","(",")","[","]","{","}","<"]))]))(t,n)},main:function(t,n){return f(h.expression,r)(t,n)}};function x(t){return h.main(t,0)}x.Error=n;var m=/^\s+$/,g=/(^|[^\\])("|\n)/g;function w(t){var n=t.type;if("string"==typeof t)return t;if(Array.isArray(t)){for(var e="",r=0;ri.index?a:i}return a}},f=function(t,e){return function(r,o){var a=t(r,o);if(a instanceof n)return a;var i=e(r,a[1]);return i instanceof n?i:[[a[0],i[0]],i[1]]}},p=function(t){return function(e,r){for(var o=[],a=0;ao.index&&(o=i)}return o}},v=function(t){return function(e,r){for(var o,a=[];!((o=t(e,r))instanceof n);)a.push(o[0]),r=o[1];return[a,r]}},d=function(t){return function(e,r){var o=[],a=t(e,r);if(a instanceof n)return a;for(o.push(a[0]),r=a[1];!((a=t(e,r))instanceof n);)o.push(a[0]),r=a[1];return[o,r]}},h={whitespace:l([a(" "),a("\t"),a("\n")]),comment:e("comment",p([a("#"),v(c(f(a("\\"),o),s(["#"]))),a("#")])),separator:function(t,n){return v(c(h.whitespace,h.comment))(t,n)},value:function(n,e){return l([d(i(t)),p([a('"'),v(c(f(a("\\"),o),s(['"']))),a('"')]),p([a("'"),v(c(f(a("\\"),o),s(["'"]))),a("'")]),p([a("`"),v(c(f(a("\\"),o),s(["`"]))),a("`")]),p([a("("),h.expression,a(")")]),p([a("["),h.expression,a("]")]),p([a("{"),h.expression,a("}")])])(n,e)},attributes:function(t,n){return e("attributes",v(p([h.value,a("="),h.value,h.separator])))(t,n)},text:e("text",d(c(f(a("\\"),o),s(["{","<"])))),interpolation:function(t,n){return e("interpolation",p([a("{"),h.expression,a("}")]))(t,n)},node:function(t,n){return e("node",p([a("<"),h.separator,h.value,h.separator,u("*>")]))(t,n)},nodeData:function(t,n){return e("nodeData",p([a("<"),h.separator,h.value,h.separator,c(f(h.value,u("/>")),f(h.attributes,u("/>")))]))(t,n)},nodeDataChildren:function(t,n){return e("nodeDataChildren",p([a("<"),h.separator,h.value,h.separator,h.attributes,a(">"),v(l([h.node,h.nodeData,h.nodeDataChildren,h.text,h.interpolation])),u(""])),a(">")]))(t,n)},expression:function(t,n){return v(l([p([u("//"),v(s(["\n"]))]),p([u("/*"),v(s(["*/"])),u("*/")]),p([a("/"),d(c(f(a("\\"),s(["\n"])),s(["/","\n"]))),a("/")]),h.comment,h.value,h.node,h.nodeData,h.nodeDataChildren,a("/"),a("<"),d(s(["/","#",'"',"'","`","(",")","[","]","{","}","<"]))]))(t,n)},main:function(t,n){return f(h.expression,r)(t,n)}};function x(t){return h.main(t,0)}x.Error=n;var m=/^\s+$/,g=/(^|[^\\])("|\n)/g;function w(t){var n=t.type;if("string"==typeof t)return t;if(Array.isArray(t)){for(var e="",r=0;r/g,i=/(?:^|\s)(?:\[\w+\]|--?\w+)/g,c={version:{usage:"moon version",description:"output Moon CLI version"},help:{usage:"moon help ",description:"output help message for command",parameters:{"":"name of Moon CLI command"}},create:{usage:"moon create [options]",description:"create application in new directory",parameters:{"":"name of application and directory"},options:{"-t, --template /":"GitHub repository to use as template"}}};function s(e,n){console.log("\x1b[34m"+e+"\x1b[0m "+n)}function d(e){console.log(e.replace(r,"\x1b[33m$&\x1b[0m").replace(i,"\x1b[36m$&\x1b[0m"))}function l(e){console.log("\x1b[31merror\x1b[0m "+e)}function m(n){var t="",o="",a=0;for(var r in n){var i=r.length;i>a&&(a=i)}for(var c in n){var s=n[c];t+=o+"\t"+c+e(s,a-c.length+s.length+3),o="\n"}return t}function p(e,n,t){var o=e.indexOf(n);if(-1===o)return e;var a=e.slice(0,o),r=p(e.slice(o+n.length),n,t),i=Buffer.from(t);return Buffer.concat([a,i,r],a.length+i.length+r.length)}for(var u=2===process.argv.length?["help"]:process.argv.slice(2),v=u[0],f=[],h={},g=1;g [options]\n\nCommands:\n"+m(R))}break;case"create":var E=f[0],H=h["-t"]||h["--template"]||"kbrsh/moon-template";void 0!==E&&0!==E.length||l("Invalid or unknown name.\n\nAttempted to create an application.\n\nReceived an invalid or unknown name.\n\nExpected a valid name. Run \x1b[35mmoon help create\x1b[0m to see usage information."),!0===H&&l("Invalid or unknown template.\n\nAttempted to create an application.\n\nReceived an invalid or unknown template.\n\nExpected a valid template. Run \x1b[35mmoon help create\x1b[0m to see usage information."),s("Moon","creating application"),function(e,r){var i={method:"GET",host:"api.github.com",path:"/repos/"+r+"/tarball/master",headers:{"User-Agent":"Moon"}};o.get(i,(function(c){302===c.statusCode?o.get(c.headers.location,(function(o){if(200===o.statusCode){var i=t.join(__dirname,"moon-template.tar.gz"),d=n.createWriteStream(i);o.on("data",(function(e){d.write(e)})),o.on("end",(function(){d.end(),s("downloaded",r),function(e,o){var r=t.join(process.cwd(),e);a("mkdir "+r,(function(i){null!==i&&l("Failed directory creation.\n\nAttempted to create directory:\n\t"+r+"\n\nReceived error:\n\t"+i+"\n\nExpected successful directory creation."),a("tar -xzf "+o+" -C "+r+" --strip=1",(function(a){null!==a&&l("Failed archive extraction.\n\nAttempted to extract archive to target:\n\t"+o+" -> "+r+"\n\nReceived error:\n\t"+a+"\n\nExpected successful archive extraction."),s("installed",r),function(e,o,a){n.unlink(o,(function(r){null!==r&&l("Failed archive deletion.\n\nAttempted to delete archive:\n\t"+o+"\n\nReceived error:\n\t"+r+"\n\nExpected successful archive deletion."),s("cleaned",o),function e(o,a,r){for(var i=n.readdirSync(a),c=0;c/g,i=/(?:^|\s)(?:\[\w+\]|--?\w+)/g,c={version:{usage:"moon version",description:"output Moon CLI version"},help:{usage:"moon help ",description:"output help message for command",parameters:{"":"name of Moon CLI command"}},create:{usage:"moon create [options]",description:"create application in new directory",parameters:{"":"name of application and directory"},options:{"-t, --template /":"GitHub repository to use as template"}}};function s(e,n){console.log("\x1b[34m"+e+"\x1b[0m "+n)}function d(e){console.log(e.replace(r,"\x1b[33m$&\x1b[0m").replace(i,"\x1b[36m$&\x1b[0m"))}function l(e){console.log("\x1b[31merror\x1b[0m "+e)}function m(n){var t="",o="",a=0;for(var r in n){var i=r.length;i>a&&(a=i)}for(var c in n){var s=n[c];t+=o+"\t"+c+e(s,a-c.length+s.length+3),o="\n"}return t}function p(e,n,t){var o=e.indexOf(n);if(-1===o)return e;var a=e.slice(0,o),r=p(e.slice(o+n.length),n,t),i=Buffer.from(t);return Buffer.concat([a,i,r],a.length+i.length+r.length)}for(var u=2===process.argv.length?["help"]:process.argv.slice(2),v=u[0],f=[],h={},g=1;g [options]\n\nCommands:\n"+m(R))}break;case"create":var E=f[0],H=h["-t"]||h["--template"]||"kbrsh/moon-template";void 0!==E&&0!==E.length||l("Invalid or unknown name.\n\nAttempted to create an application.\n\nReceived an invalid or unknown name.\n\nExpected a valid name. Run \x1b[35mmoon help create\x1b[0m to see usage information."),!0===H&&l("Invalid or unknown template.\n\nAttempted to create an application.\n\nReceived an invalid or unknown template.\n\nExpected a valid template. Run \x1b[35mmoon help create\x1b[0m to see usage information."),s("Moon","creating application"),function(e,r){var i={method:"GET",host:"api.github.com",path:"/repos/"+r+"/tarball/master",headers:{"User-Agent":"Moon"}};o.get(i,(function(c){302===c.statusCode?o.get(c.headers.location,(function(o){if(200===o.statusCode){var i=t.join(__dirname,"moon-template.tar.gz"),d=n.createWriteStream(i);o.on("data",(function(e){d.write(e)})),o.on("end",(function(){d.end(),s("downloaded",r),function(e,o){var r=t.join(process.cwd(),e);a("mkdir "+r,(function(i){null!==i&&l("Failed directory creation.\n\nAttempted to create directory:\n\t"+r+"\n\nReceived error:\n\t"+i+"\n\nExpected successful directory creation."),a("tar -xzf "+o+" -C "+r+" --strip=1",(function(a){null!==a&&l("Failed archive extraction.\n\nAttempted to extract archive to target:\n\t"+o+" -> "+r+"\n\nReceived error:\n\t"+a+"\n\nExpected successful archive extraction."),s("installed",r),function(e,o,a){n.unlink(o,(function(r){null!==r&&l("Failed archive deletion.\n\nAttempted to delete archive:\n\t"+o+"\n\nReceived error:\n\t"+r+"\n\nExpected successful archive deletion."),s("cleaned",o),function e(o,a,r){for(var i=n.readdirSync(a),c=0;cu.index?a:u}return a}},s=function(n,e){return function(r,o){var a=n(r,o);if(a instanceof t)return a;var u=e(r,a[1]);return u instanceof t?u:[[a[0],u[0]],u[1]]}},v=function(n){return function(e,r){for(var o=[],a=0;ao.index&&(o=u)}return o}},p=function(n){return function(e,r){for(var o,a=[];!((o=n(e,r))instanceof t);)a.push(o[0]),r=o[1];return[a,r]}},d=function(n){return function(e,r){var o=[],a=n(e,r);if(a instanceof t)return a;for(o.push(a[0]),r=a[1];!((a=n(e,r))instanceof t);)o.push(a[0]),r=a[1];return[o,r]}},h={whitespace:l([a(" "),a("\t"),a("\n")]),comment:e("comment",v([a("#"),p(c(s(a("\\"),o),f(["#"]))),a("#")])),separator:function(n,t){return p(c(h.whitespace,h.comment))(n,t)},value:function(t,e){return l([d(u(n)),v([a('"'),p(c(s(a("\\"),o),f(['"']))),a('"')]),v([a("'"),p(c(s(a("\\"),o),f(["'"]))),a("'")]),v([a("`"),p(c(s(a("\\"),o),f(["`"]))),a("`")]),v([a("("),h.expression,a(")")]),v([a("["),h.expression,a("]")]),v([a("{"),h.expression,a("}")])])(t,e)},attributes:function(n,t){return e("attributes",p(v([h.value,a("="),h.value,h.separator])))(n,t)},text:e("text",d(c(s(a("\\"),o),f(["{","<"])))),interpolation:function(n,t){return e("interpolation",v([a("{"),h.expression,a("}")]))(n,t)},node:function(n,t){return e("node",v([a("<"),h.separator,h.value,h.separator,i("*>")]))(n,t)},nodeData:function(n,t){return e("nodeData",v([a("<"),h.separator,h.value,h.separator,c(s(h.value,i("/>")),s(h.attributes,i("/>")))]))(n,t)},nodeDataChildren:function(n,t){return e("nodeDataChildren",v([a("<"),h.separator,h.value,h.separator,h.attributes,a(">"),p(l([h.node,h.nodeData,h.nodeDataChildren,h.text,h.interpolation])),i(""])),a(">")]))(n,t)},expression:function(n,t){return p(l([v([i("//"),p(f(["\n"]))]),v([i("/*"),p(f(["*/"])),i("*/")]),v([a("/"),d(c(s(a("\\"),f(["\n"])),f(["/","\n"]))),a("/")]),h.comment,h.value,h.node,h.nodeData,h.nodeDataChildren,a("/"),a("<"),d(f(["/","#",'"',"'","`","(",")","[","]","{","}","<"]))]))(n,t)},main:function(n,t){return s(h.expression,r)(n,t)}};function x(n){return h.main(n,0)}x.Error=t;var g=/^\s+$/,m=/(^|[^\\])("|\n)/g;function w(n){var t=n.type;if("string"==typeof n)return n;if(Array.isArray(n)){for(var e="",r=0;ru.index?a:u}return a}},s=function(n,e){return function(r,o){var a=n(r,o);if(a instanceof t)return a;var u=e(r,a[1]);return u instanceof t?u:[[a[0],u[0]],u[1]]}},v=function(n){return function(e,r){for(var o=[],a=0;ao.index&&(o=u)}return o}},p=function(n){return function(e,r){for(var o,a=[];!((o=n(e,r))instanceof t);)a.push(o[0]),r=o[1];return[a,r]}},d=function(n){return function(e,r){var o=[],a=n(e,r);if(a instanceof t)return a;for(o.push(a[0]),r=a[1];!((a=n(e,r))instanceof t);)o.push(a[0]),r=a[1];return[o,r]}},h={whitespace:l([a(" "),a("\t"),a("\n")]),comment:e("comment",v([a("#"),p(c(s(a("\\"),o),f(["#"]))),a("#")])),separator:function(n,t){return p(c(h.whitespace,h.comment))(n,t)},value:function(t,e){return l([d(u(n)),v([a('"'),p(c(s(a("\\"),o),f(['"']))),a('"')]),v([a("'"),p(c(s(a("\\"),o),f(["'"]))),a("'")]),v([a("`"),p(c(s(a("\\"),o),f(["`"]))),a("`")]),v([a("("),h.expression,a(")")]),v([a("["),h.expression,a("]")]),v([a("{"),h.expression,a("}")])])(t,e)},attributes:function(n,t){return e("attributes",p(v([h.value,a("="),h.value,h.separator])))(n,t)},text:e("text",d(c(s(a("\\"),o),f(["{","<"])))),interpolation:function(n,t){return e("interpolation",v([a("{"),h.expression,a("}")]))(n,t)},node:function(n,t){return e("node",v([a("<"),h.separator,h.value,h.separator,i("*>")]))(n,t)},nodeData:function(n,t){return e("nodeData",v([a("<"),h.separator,h.value,h.separator,c(s(h.value,i("/>")),s(h.attributes,i("/>")))]))(n,t)},nodeDataChildren:function(n,t){return e("nodeDataChildren",v([a("<"),h.separator,h.value,h.separator,h.attributes,a(">"),p(l([h.node,h.nodeData,h.nodeDataChildren,h.text,h.interpolation])),i(""])),a(">")]))(n,t)},expression:function(n,t){return p(l([v([i("//"),p(f(["\n"]))]),v([i("/*"),p(f(["*/"])),i("*/")]),v([a("/"),d(c(s(a("\\"),f(["\n"])),f(["/","\n"]))),a("/")]),h.comment,h.value,h.node,h.nodeData,h.nodeDataChildren,a("/"),a("<"),d(f(["/","#",'"',"'","`","(",")","[","]","{","}","<"]))]))(n,t)},main:function(n,t){return s(h.expression,r)(n,t)}};function x(n){return h.main(n,0)}x.Error=t;var g=/^\s+$/,m=/(^|[^\\])("|\n)/g;function w(n){var t=n.type;if("string"==typeof n)return n;if(Array.isArray(n)){for(var e="",r=0;rw){for(var F=t.MoonChildren,H=0;Hw){for(var F=t.MoonChildren,H=0;H