diff --git a/build.sh b/build.sh index f94e556..8f93cba 100755 --- a/build.sh +++ b/build.sh @@ -5,6 +5,9 @@ set -e export OPTIMIZE="-O3" echo "1/2 Compiling pugixml" + +cp src/pugiconfig.hpp node_modules/pugixml/src/pugiconfig.hpp + ( emcc \ --bind \ diff --git a/dist/camaro.js b/dist/camaro.js index 9546806..fa053df 100644 --- a/dist/camaro.js +++ b/dist/camaro.js @@ -5,56 +5,55 @@ var camaro = (function() { function(camaro) { camaro = camaro || {}; -var d;d||(d=typeof camaro !== 'undefined' ? camaro : {});var p={},q;for(q in d)d.hasOwnProperty(q)&&(p[q]=d[q]);d.arguments=[];d.thisProgram="./this.program";d.quit=function(a,b){throw b;};d.preRun=[];d.postRun=[];var t=!1,u=!1,aa=!1,ba=!1;t="object"===typeof window;u="function"===typeof importScripts;aa="object"===typeof process&&"function"===typeof require&&!t&&!u;ba=!t&&!aa&&!u;var v=""; -if(aa){v=__dirname+"/";var ca,fa;d.read=function(a,b){ca||(ca=require("fs"));fa||(fa=require("path"));a=fa.normalize(a);a=ca.readFileSync(a);return b?a:a.toString()};d.readBinary=function(a){a=d.read(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||w("Assertion failed: undefined");return a};1=e);)++c;if(16f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e} -function ma(a,b,c){var e=B;if(0=h){var k=a.charCodeAt(++f);h=65536+((h&1023)<<10)|k&1023}if(127>=h){if(b>=c)break;e[b++]=h}else{if(2047>=h){if(b+1>=c)break;e[b++]=192|h>>6}else{if(65535>=h){if(b+2>=c)break;e[b++]=224|h>>12}else{if(b+3>=c)break;e[b++]=240|h>>18;e[b++]=128|h>>12&63}e[b++]=128|h>>6&63}e[b++]=128|h&63}}e[b]=0}}"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le"); -function na(a){0F&&z("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+F+"! (TOTAL_STACK=5242880)"); -d.buffer?buffer=d.buffer:"object"===typeof WebAssembly&&"function"===typeof WebAssembly.Memory?(A=new WebAssembly.Memory({initial:F/65536}),buffer=A.buffer):buffer=new ArrayBuffer(F);sa();D[3408]=5256544;function G(a){for(;0>2]}var Ia={},P={};function Ja(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Q(a){return this.fromWireType(E[a>>2])}var R={},S={},Ka={}; -function La(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ma(a,b){a=La(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)} -function Na(a){var b=Error,c=Ma(a,function(b){this.name=a;this.message=b;b=Error(b).stack;void 0!==b&&(this.stack=this.toString()+"\n"+b.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Oa=void 0; -function Pa(a,b,c){function e(b){b=c(b);if(b.length!==a.length)throw new Oa("Mismatched type converter count");for(var e=0;e>2])};case 3:return function(a){return this.fromWireType(ra[a>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Xa(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ma(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c} -function Ya(a,b){var c=d;if(void 0===c[a].$){var e=c[a];c[a]=function(){c[a].$.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].$+")!");return c[a].$[arguments.length].apply(this,arguments)};c[a].$=[];c[a].$[e.ia]=e}} -function Za(a,b,c){d.hasOwnProperty(a)?((void 0===c||void 0!==d[a].$&&void 0!==d[a].$[c])&&V("Cannot register public name '"+a+"' twice"),Ya(a,a),d.hasOwnProperty(c)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),d[a].$[c]=b):(d[a]=b,void 0!==c&&(d[a].wa=c))}function ab(a,b){for(var c=[],e=0;e>2)+e]);return c} -function Y(a,b){a=U(a);if(void 0!==d["FUNCTION_TABLE_"+a])var c=d["FUNCTION_TABLE_"+a][b];else if("undefined"!==typeof FUNCTION_TABLE)c=FUNCTION_TABLE[b];else{c=d["dynCall_"+a];void 0===c&&(c=d["dynCall_"+a.replace(/f/g,"d")],void 0===c&&V("No dynCall invoker for signature: "+a));for(var e=[],f=1;f>1]}:function(a){return pa[a>>1]};case 2:return c?function(a){return D[a>>2]}:function(a){return E[a>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var gb={};function hb(a){var b=gb[a];return void 0===b?U(a):b}var ib=[];function jb(a){a||V("Cannot use deleted val. handle = "+a);return W[a].value}function kb(a){var b=ib.length;ib.push(a);return b} -function lb(a,b){var c=S[a];void 0===c&&V(b+" has unknown type "+cb(a));return c}function mb(a,b){for(var c=Array(a),e=0;e>2)+e],"parameter "+e);return c}function nb(){return C.length}function ob(a){a=na(a);var b=buffer.byteLength;try{return-1!==A.grow((a-b)/65536)?(buffer=A.buffer,!0):!1}catch(c){return!1}}Oa=d.InternalError=Na("InternalError");for(var pb=Array(256),qb=0;256>qb;++qb)pb[qb]=String.fromCharCode(qb);Ra=pb;Sa=d.BindingError=Na("BindingError"); -d.count_emval_handles=function(){for(var a=0,b=5;b>2]=a);return a},z:function(a,b){N=b;try{return Ia.la(),O(),O(),O(),O(),0}catch(c){return"undefined"!==typeof FS&&c instanceof FS.fa||w(c),-c.ga}},r:function(a,b){N=b;try{var c=O(),e=O(),f=O();for(b=a=0;b>2],k=D[e+(8*b+4)>>2],g=0;g>h])},aa:null})},v:function(a,b){b=U(b);T(a,{name:b,fromWireType:function(a){var b=W[a].value;Ua(a);return b},toWireType:function(a,b){return X(b)},argPackAdvance:8,readValueFromPointer:Q,aa:null})},u:function(a,b,c){c=Qa(c);b=U(b);T(a,{name:b,fromWireType:function(a){return a},toWireType:function(a,b){if("number"!== -typeof b&&"boolean"!==typeof b)throw new TypeError('Cannot convert "'+Va(b)+'" to '+this.name);return b},argPackAdvance:8,readValueFromPointer:Wa(b,c),aa:null})},q:function(a,b,c,e,f,h){var k=ab(b,c);a=U(a);f=Y(e,f);Za(a,function(){eb("Cannot call "+a+" due to unbound types",k)},b-1);Pa([],k,function(c){var e=[c[0],null].concat(c.slice(1)),g=c=a,k=f,r=e.length;2>r&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var wa=null!==e[1]&&!1,da=!1,l=1;l>>g}}var m=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:h,toWireType:function(a, -c){if("number"!==typeof c&&"boolean"!==typeof c)throw new TypeError('Cannot convert "'+Va(c)+'" to '+this.name);if(cf)throw new TypeError('Passing a number "'+Va(c)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+e+", "+f+"]!");return m?c>>>0:c|0},argPackAdvance:8,readValueFromPointer:fb(b,k,0!==e),aa:null})},f:function(a,b,c){function e(a){a>>=2;var b=E;return new f(b.buffer,b[a+1],b[a])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array, -Uint32Array,Float32Array,Float64Array][b];c=U(c);T(a,{name:c,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{pa:!0})},t:function(a,b){b=U(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(a){var b=E[a>>2];if(c){var e=B[a+4+b],k=0;0!=e&&(k=e,B[a+4+b]=0);var g=a+4;for(e=0;e<=b;++e){var m=a+4+e;if(0==B[m]){g=g?la(B,g,void 0):"";if(void 0===n)var n=g;else n+=String.fromCharCode(0),n+=g;g=m+1}}0!=k&&(B[a+4+b]=k)}else{n=Array(b);for(e=0;e=e&&(e=65536+((e&1023)<<10)|b.charCodeAt(++c)&1023);127>=e?++a:a=2047>=e?a+2:65535>=e?a+3:a+4}return a}:function(){return b.length})(),g=rb(4+f+1);E[g>>2]=f;if(c&&e)ma(b,g+ -4,f+1);else if(e)for(e=0;e>2],h=Array(c),n=a+4>>f,y=0;y>2]=h;for(var y=k+4>>f,r=0;r=b?b=na(2*b):b=Math.min(na((3*b+2147483648)/4),2147418112);if(!ob(b))return!1;sa();return!0},B:function(){w("OOM")},a:13632},buffer);d.asm=sb;d.___errno_location=function(){return d.asm.J.apply(null,arguments)}; -var db=d.___getTypeName=function(){return d.asm.K.apply(null,arguments)},Z=d._free=function(){return d.asm.L.apply(null,arguments)},rb=d._malloc=function(){return d.asm.M.apply(null,arguments)},Ga=d.globalCtors=function(){return d.asm._.apply(null,arguments)};d.dynCall_i=function(){return d.asm.N.apply(null,arguments)};d.dynCall_ii=function(){return d.asm.O.apply(null,arguments)};d.dynCall_iii=function(){return d.asm.P.apply(null,arguments)};d.dynCall_iiii=function(){return d.asm.Q.apply(null,arguments)}; -d.dynCall_iiiii=function(){return d.asm.R.apply(null,arguments)};d.dynCall_jiji=function(){return d.asm.S.apply(null,arguments)};d.dynCall_v=function(){return d.asm.T.apply(null,arguments)};d.dynCall_vi=function(){return d.asm.U.apply(null,arguments)};d.dynCall_vii=function(){return d.asm.V.apply(null,arguments)};d.dynCall_viii=function(){return d.asm.W.apply(null,arguments)};d.dynCall_viiii=function(){return d.asm.X.apply(null,arguments)};d.dynCall_viiiii=function(){return d.asm.Y.apply(null,arguments)}; -d.dynCall_viiiiii=function(){return d.asm.Z.apply(null,arguments)};d.asm=sb;d.then=function(a){if(d.calledRun)a(d);else{var b=d.onRuntimeInitialized;d.onRuntimeInitialized=function(){b&&b();a(d)}}return d};function x(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}x.prototype=Error();x.prototype.constructor=x;I=function tb(){d.calledRun||ub();d.calledRun||(I=tb)}; -function ub(){function a(){if(!d.calledRun&&(d.calledRun=!0,!ja)){ya||(ya=!0,G(ua));G(va);if(d.onRuntimeInitialized)d.onRuntimeInitialized();if(d.postRun)for("function"==typeof d.postRun&&(d.postRun=[d.postRun]);d.postRun.length;){var a=d.postRun.shift();xa.unshift(a)}G(xa)}}if(!(0=d);)++c;if(16f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d} +function na(a,b,c){var d=D;if(0=h){var k=a.charCodeAt(++f);h=65536+((h&1023)<<10)|k&1023}if(127>=h){if(b>=c)break;d[b++]=h}else{if(2047>=h){if(b+1>=c)break;d[b++]=192|h>>6}else{if(65535>=h){if(b+2>=c)break;d[b++]=224|h>>12}else{if(b+3>=c)break;d[b++]=240|h>>18;d[b++]=128|h>>12&63}d[b++]=128|h>>6&63}d[b++]=128|h&63}}d[b]=0}}"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le"); +function oa(a){0>2]}var Ja={},P={};function Ka(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function La(a){return this.fromWireType(G[a>>2])}var Q={},R={},Ma={}; +function Na(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Oa(a,b){a=Na(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)} +function Pa(a){var b=Error,c=Oa(a,function(b){this.name=a;this.message=b;b=Error(b).stack;void 0!==b&&(this.stack=this.toString()+"\n"+b.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Qa=void 0; +function Ra(a,b,c){function d(b){b=c(b);if(b.length!==a.length)throw new Qa("Mismatched type converter count");for(var d=0;d>2])};case 3:return function(a){return this.fromWireType(sa[a>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Za(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Oa(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c} +function $a(a,b){var c=e;if(void 0===c[a].da){var d=c[a];c[a]=function(){c[a].da.hasOwnProperty(arguments.length)||U("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].da+")!");return c[a].da[arguments.length].apply(this,arguments)};c[a].da=[];c[a].da[d.la]=d}} +function ab(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].da&&void 0!==e[a].da[c])&&U("Cannot register public name '"+a+"' twice"),$a(a,a),e.hasOwnProperty(c)&&U("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].da[c]=b):(e[a]=b,void 0!==c&&(e[a].za=c))}function cb(a,b){for(var c=[],d=0;d>2)+d]);return c} +function X(a,b){a=T(a);if(void 0!==e["FUNCTION_TABLE_"+a])var c=e["FUNCTION_TABLE_"+a][b];else if("undefined"!==typeof FUNCTION_TABLE)c=FUNCTION_TABLE[b];else{c=e["dynCall_"+a];void 0===c&&(c=e["dynCall_"+a.replace(/f/g,"d")],void 0===c&&U("No dynCall invoker for signature: "+a));for(var d=[],f=1;f>1]}:function(a){return qa[a>>1]};case 2:return c?function(a){return F[a>>2]}:function(a){return G[a>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var ib={};function jb(a){var b=ib[a];return void 0===b?T(a):b}var kb=[];function lb(a){a||U("Cannot use deleted val. handle = "+a);return V[a].value}function mb(a){var b=kb.length;kb.push(a);return b} +function nb(a,b){var c=R[a];void 0===c&&U(b+" has unknown type "+eb(a));return c}function ob(a,b){for(var c=Array(a),d=0;d>2)+d],"parameter "+d);return c}function pb(){return E.length}Qa=e.InternalError=Pa("InternalError");for(var qb=Array(256),rb=0;256>rb;++rb)qb[rb]=String.fromCharCode(rb);Ta=qb;Ua=e.BindingError=Pa("BindingError");e.count_emval_handles=function(){for(var a=0,b=5;b>2]=a);return a},w:function(a,b){N=b;try{return Ja.oa(),O(),O(),O(),O(),0}catch(c){return"undefined"!==typeof FS&&c instanceof FS.ha||z(c),-c.ja}},p:function(a,b){N=b;try{var c=O(),d=O(),f=O();for(b=a=0;b>2],k=F[d+(8*b+4)>>2],g=0;g>h])},ea:null})},J:function(a,b){b=T(b);S(a,{name:b,fromWireType:function(a){var b=V[a].value;Wa(a);return b},toWireType:function(a,b){return W(b)},argPackAdvance:8,readValueFromPointer:La,ea:null})},s:function(a,b,c){c=Sa(c);b=T(b);S(a,{name:b,fromWireType:function(a){return a}, +toWireType:function(a,b){if("number"!==typeof b&&"boolean"!==typeof b)throw new TypeError('Cannot convert "'+Xa(b)+'" to '+this.name);return b},argPackAdvance:8,readValueFromPointer:Ya(b,c),ea:null})},o:function(a,b,c,d,f,h){var k=cb(b,c);a=T(a);f=X(d,f);ab(a,function(){gb("Cannot call "+a+" due to unbound types",k)},b-1);Ra([],k,function(c){var d=[c[0],null].concat(c.slice(1)),g=c=a,k=f,r=d.length;2>r&&U("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var wa= +null!==d[1]&&!1,fa=!1,l=1;l>>g}}var m=-1!=b.indexOf("unsigned");S(a,{name:b,fromWireType:h,toWireType:function(a, +c){if("number"!==typeof c&&"boolean"!==typeof c)throw new TypeError('Cannot convert "'+Xa(c)+'" to '+this.name);if(cf)throw new TypeError('Passing a number "'+Xa(c)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return m?c>>>0:c|0},argPackAdvance:8,readValueFromPointer:hb(b,k,0!==d),ea:null})},h:function(a,b,c){function d(a){a>>=2;var b=G;return new f(b.buffer,b[a+1],b[a])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array, +Uint32Array,Float32Array,Float64Array][b];c=T(c);S(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{sa:!0})},r:function(a,b){b=T(b);var c="std::string"===b;S(a,{name:b,fromWireType:function(a){var b=G[a>>2];if(c){var d=D[a+4+b],k=0;0!=d&&(k=d,D[a+4+b]=0);var g=a+4;for(d=0;d<=b;++d){var m=a+4+d;if(0==D[m]){g=g?ma(D,g,void 0):"";if(void 0===n)var n=g;else n+=String.fromCharCode(0),n+=g;g=m+1}}0!=k&&(D[a+4+b]=k)}else{n=Array(b);for(d=0;d=d&&(d=65536+((d&1023)<<10)|b.charCodeAt(++c)&1023);127>=d?++a:a=2047>=d?a+2:65535>=d?a+3:a+4}return a}:function(){return b.length})(),g=sb(4+f+1);G[g>>2]=f;if(c&&d)na(b,g+ +4,f+1);else if(d)for(d=0;d>2],h=Array(c),n=a+4>>f,y=0;y>2]=h;for(var y=k+4>>f,r=0;r=b?b=oa(2*b):b=Math.min(oa((3*b+2147483648)/4),2147418112);a:{try{C.grow(b-buffer.byteLength+65535>>16);ta(C.buffer);var c=1;break a}catch(d){}c=void 0}return c?!0:!1},y:function(){z("OOM")},a:13488},buffer);e.asm=ub;var tb=e.__ZSt18uncaught_exceptionv=function(){return e.asm.K.apply(null,arguments)}; +e.___embind_register_native_and_builtin_types=function(){return e.asm.L.apply(null,arguments)};e.___errno_location=function(){return e.asm.M.apply(null,arguments)};var fb=e.___getTypeName=function(){return e.asm.N.apply(null,arguments)},Y=e._free=function(){return e.asm.O.apply(null,arguments)},sb=e._malloc=function(){return e.asm.P.apply(null,arguments)},Ha=e.globalCtors=function(){return e.asm.ba.apply(null,arguments)};e.dynCall_i=function(){return e.asm.Q.apply(null,arguments)}; +e.dynCall_ii=function(){return e.asm.R.apply(null,arguments)};e.dynCall_iii=function(){return e.asm.S.apply(null,arguments)};e.dynCall_iiii=function(){return e.asm.T.apply(null,arguments)};e.dynCall_iiiii=function(){return e.asm.U.apply(null,arguments)};e.dynCall_jiji=function(){return e.asm.V.apply(null,arguments)};e.dynCall_v=function(){return e.asm.W.apply(null,arguments)};e.dynCall_vi=function(){return e.asm.X.apply(null,arguments)};e.dynCall_vii=function(){return e.asm.Y.apply(null,arguments)}; +e.dynCall_viii=function(){return e.asm.Z.apply(null,arguments)};e.dynCall_viiii=function(){return e.asm._.apply(null,arguments)};e.dynCall_viiiii=function(){return e.asm.$.apply(null,arguments)};e.dynCall_viiiiii=function(){return e.asm.aa.apply(null,arguments)};e.asm=ub;var Z;e.then=function(a){if(Z)a(e);else{var b=e.onRuntimeInitialized;e.onRuntimeInitialized=function(){b&&b();a(e)}}return e};J=function vb(){Z||wb();Z||(J=vb)}; +function wb(){function a(){if(!Z&&(Z=!0,!ka)){H(xa);H(ya);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var a=e.postRun.shift();za.unshift(a)}H(za)}}if(!(0 { + const xml = fs.readFileSync('examples/ean.xml', 'utf-8') + const template = { + invalidXPath: 'concat()' + } + + const result = await transform(xml, template) + t.equal(result.invalidXPath, '') + t.end() +})