@kosatyi/ejs 0.0.77 → 0.0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(){e=function(){return n};var t,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),u=new T(r||[]);return i(a,"_invoke",{value:F(t,n,u)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=f;var p="suspendedStart",v="suspendedYield",g="executing",b="completed",m={};function y(){}function d(){}function w(){}var x={};s(x,u,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(B([])));j&&j!==r&&o.call(j,u)&&(x=j);var O=w.prototype=y.prototype=Object.create(x);function L(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function n(r,i,a,u){var c=h(t[r],t,i);if("throw"!==c.type){var l=c.arg,s=l.value;return s&&"object"==typeof s&&o.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function F(e,n,r){var o=p;return function(i,a){if(o===g)throw new Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var c=P(u,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=b,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var l=h(e,n,r);if("normal"===l.type){if(o=r.done?b:v,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=b,r.method="throw",r.arg=l.arg)}}}function P(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,P(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=h(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function B(e){if(e||""===e){var n=e[u];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function n(){for(;++r<e.length;)if(o.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return d.prototype=w,i(O,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:d,configurable:!0}),d.displayName=s(w,l,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,s(t,l,"GeneratorFunction")),t.prototype=Object.create(O),t},n.awrap=function(t){return{__await:t}},L(k.prototype),s(k.prototype,c,(function(){return this})),n.AsyncIterator=k,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new k(f(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),s(O,l,"Generator"),s(O,u,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=B,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(N),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,o){return u.type="throw",u.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;N(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:B(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},n}function n(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function r(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},i=function(t){return Array.isArray(t)},a=function(t){return"function"==typeof t},u=function(t){return"string"==typeof t},c=function(t){return"boolean"==typeof t},l=function(t){return void 0===t},s="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),f=function(){return s},h={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},p={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},v=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},g=v(p),b=v(h),m=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(g,(function(t){return p[t]}))},y=function(t){return(""+t).replace(b,(function(t){return"\\"+h[t]}))},d=function(t,e){var n=t;return null==n?"":!0===e?m(n):n},w=function(t,e){return Boolean(t instanceof e)},x=function(t,e,n){for(var r=t,o=String(e).split("."),i=o.pop(),u=0;u<o.length;u++){var c=o[u];if(a(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(c)){r={};break}r=r[c]=r[c]||{}}return a(r.toJSON)&&(r=r.toJSON()),[r,i]},E=function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t},j=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},O=function(){},L=function(t,e){var n;for(n in t)P(t,n)&&e(t[n],n,t)},k=function(t,e){return function(t,e,n){var r=t instanceof Array,o=r?[]:{};return L(t,(function(t,n,i){var a=e(t,n,i);!1===l(a)&&(r?o.push(a):o[n]=a)})),o}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},F=function(t,e,n){return Promise.resolve(t).then(e.bind(n))},P=function(t,e){return t&&t.hasOwnProperty(e)},S={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},N=function(t,e){j(t,{path:o(u,S.path,t.path,e.path),export:o(u,S.export,t.export,e.export),resolver:o(a,S.resolver,t.resolver,e.resolver),extension:o(u,S.extension,t.extension,e.extension),withObject:o(c,S.withObject,t.withObject,e.withObject),rmWhitespace:o(c,S.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:o(c,S.cache,t.cache,e.cache),token:j({},S.token,t.token,e.token),vars:j({},S.vars,t.vars,e.vars),globalHelpers:o(i,S.globalHelpers,t.globalHelpers,e.globalHelpers)})},T="undefined"!=typeof globalThis?globalThis:window||self;function B(t){if(!1===w(this,B))return new B;var e={enabled:!0,list:{}};this.configure=function(t){e.enabled=t.cache,!1===f()&&this.load(T[t.export])},this.clear=function(){e.list={}},this.load=function(t){return e.enabled&&j(e.list,t||{}),this},this.get=function(t){if(e.enabled)return e.list[t]},this.set=function(t,n){return e.enabled&&(e.list[t]=n),this},this.resolve=function(t){return Promise.resolve(this.get(t))},this.remove=function(t){delete e.list[t]},this.exist=function(t){return P(e.list,t)}}var _=[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}];function R(t){if(!1===w(this,R))return new R(t);var e={};this.configure=function(t){e.withObject=t.withObject,e.rmWhitespace=t.rmWhitespace,e.token=t.token,e.vars=t.vars,e.globalHelpers=t.globalHelpers,e.matches=[],e.formats=[],e.slurp={match:"[ \\t]*",start:[e.token.start,"_"],end:["_",e.token.end]},_.forEach((function(t){e.matches.push(e.token.start.concat(t.symbol).concat(e.token.regex).concat(e.token.end)),e.formats.push(t.format.bind(e.vars))})),e.regex=new RegExp(e.matches.join("|").concat("|$"),"g"),e.slurpStart=new RegExp([e.slurp.match,e.slurp.start.join("")].join(""),"gm"),e.slurpEnd=new RegExp([e.slurp.end.join(""),e.slurp.match].join(""),"gm")},this.compile=function(t,n){var r=e.vars,o=r.SCOPE,i=r.SAFE,a=r.BUFFER,u=r.COMPONENT,c=e.globalHelpers;t=String(t),e.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=t.replace(e.slurpStart,e.token.start).replace(e.slurpEnd,e.token.end);var l,s,f,h="".concat(a,"('");l=e.regex,s=function(n,r,o){h+=y(t.slice(r,o)),n.forEach((function(t,n){t&&(h+=e.formats[n](t))}))},f=0,t.replace(l,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return s(t,f,e),f=e+n.length,n})),h="try{".concat(h+="');","}catch(e){console.info(e)}"),e.withObject&&(h="with(".concat(o,"){").concat(h,"}")),h="".concat(a,".start();").concat(h,"return ").concat(a,".end();"),h+="\n//# sourceURL=".concat(n);var p=null,v=[o,u,a,i].concat(c);try{(p=Function.apply(null,v.concat(h))).source="(function(".concat(v.join(","),"){\n").concat(h,"\n})")}catch(t){throw t.filename=n,t.source=h,t}return p},this.configure(t)}function A(t,e,n){if(!1===w(this,A))return new A(t,e,n);if(!1===w(e,B))throw new TypeError("cache is not instance of Cache");if(!1===w(n,R))throw new TypeError("compiler is not instance of Compiler");var r={},o=function(t){return r.resolver(r.path,t)};this.configure=function(t){r.path=t.path,r.cache=t.cache,a(t.resolver)&&(r.resolver=t.resolver)},this.get=function(t){return e.exist(t)?e.resolve(t):o(t).then((function(r){return function(t,n){return e.set(t,n),n}(t,function(t,e){return a(t)?t:n.compile(t,e)}(r,t))}))},this.configure(t)}var $=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],C=" ",U='"',M="/",H="<",G=">",W=function(t,e,n){var r=[],o=-1===$.indexOf(t),i=function(t,e,n){var r=[];return L(t,(function(t,n,o){var i=e(t,n,o);!1===l(i)&&r.push(i)})),r}(e,(function(t,e){if(null!=t)return[m(e),[U,m(t),U].join("")].join("=")})).join(C);return r.push([H,t,C,i,G].join("")),n&&r.push(n instanceof Array?n.join(""):n),o&&r.push([H,M,t,G].join("")),r.join("")};function J(t){return Promise.all(t||[]).then((function(t){return t.join("")}))}function Y(){var t=[],e=[];function n(t){e.push(t)}return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),J(n)},n.error=function(t){throw t},n.end=function(){return J(e)},n}function q(t){if(!1===w(this,q))return new q(t);this.configure=function(t,e){var n,o=t.vars,i=o.BLOCKS,c=o.MACRO,l=o.EXTEND,s=o.LAYOUT,f=o.BUFFER,h=o.COMPONENT;function p(t){this[i]={},this[c]={},j(this,t||{})}this.create=function(t){return new p(t)},this.helpers=function(t){j(p.prototype,t||{})},p.prototype=j({},e||{}),Object.defineProperties(p.prototype,(r(n={},f,{value:Y(),writable:!0,configurable:!1,enumerable:!1}),r(n,i,{value:{},writable:!0,configurable:!1,enumerable:!1}),r(n,c,{value:{},writable:!0,configurable:!1,enumerable:!1}),r(n,s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),r(n,l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),r(n,"getMacro",{value:function(){return this[c]},writable:!1,configurable:!1,enumerable:!1}),r(n,"getBuffer",{value:function(){return this[f]},writable:!1,configurable:!1,enumerable:!1}),r(n,"getComponent",{value:function(){var t=this;return h in t?function(){return t[h].apply(t,arguments)}:function(){console.log("%s function not defined",h)}},writable:!1,configurable:!1,enumerable:!1}),r(n,"getBlocks",{value:function(){return this[i]},writable:!1,configurable:!1,enumerable:!1}),r(n,"setExtend",{value:function(t){this[l]=t},writable:!1,configurable:!1,enumerable:!1}),r(n,"getExtend",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),r(n,"setLayout",{value:function(t){this[s]=t},writable:!1,configurable:!1,enumerable:!1}),r(n,"getLayout",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),r(n,"clone",{value:function(t){var e=[s,l,f];return!0===t&&e.push(i),k(this,e)},writable:!1,configurable:!1,enumerable:!1}),r(n,"extend",{value:function(t){this.setExtend(!0),this.setLayout(t)},writable:!1,configurable:!1,enumerable:!1}),r(n,"echo",{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)},writable:!1,configurable:!1,enumerable:!1}),r(n,"fn",{value:function(t){var e=this.getBuffer(),n=this;return function(){return e.backup(),a(t)&&t.apply(n,arguments),e.restore()}},writable:!1,configurable:!1,enumerable:!1}),r(n,"get",{value:function(t,e){var n=x(this,t,!0),r=n.shift(),o=n.pop();return P(r,o)?r[o]:e},writable:!1,configurable:!1,enumerable:!1}),r(n,"set",{value:function(t,e){var n=x(this,t,!1),r=n.shift(),o=n.pop();return this.getExtend()&&P(r,o)?r[o]:r[o]=e},writable:!1,configurable:!1,enumerable:!1}),r(n,"macro",{value:function(t,e){var n=this.getMacro(),r=this.fn(e),o=this;n[t]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),r(n,"call",{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(a(e))return e.apply(e,n)},writable:!1,configurable:!1,enumerable:!1}),r(n,"block",{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()};this.echo(i()(function t(){var e=i();return e?function(){n.echo(e(t()))}:O}()))}},writable:!1,configurable:!1,enumerable:!1}),r(n,"include",{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),o=j(r,e||{}),i=this.render(t,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),r(n,"use",{value:function(t,e){var n=this.require(t);this.echo(F(n,(function(t){var n=this.getMacro();L(t,(function(t,r){n[[e,r].join(".")]=t}))}),this))},writable:!1,configurable:!1,enumerable:!1}),r(n,"async",{value:function(t,e){this.echo(F(t,(function(t){return this.fn(e)(t)}),this))},writable:!1,configurable:!1,enumerable:!1}),r(n,"each",{value:function(t,e){u(t)&&(t=this.get(t,[])),L(t,e)},writable:!1,configurable:!1,enumerable:!1}),r(n,"element",{value:function(t,e,n){return W(t,e,n)},writable:!1,configurable:!1,enumerable:!1}),r(n,"el",{value:function(t,e,n){a(n)&&(n=this.fn(n)()),this.echo(F(n,(function(n){return this.element(t,e,n)}),this))},writable:!1,configurable:!1,enumerable:!1}),n))},this.configure(t)}var I={},D=new function t(e){if(!1===w(this,t))return new t(e);var n={},r={};N(r,e||{});var o=new q(r),i=new R(r),u=new B,c=new A(r,u,i),l=function(t,e){var n=[e,e.getComponent(),e.getBuffer(),d];return r.globalHelpers.forEach((function(t){a(e[t])&&n.push(e[t].bind(e))})),c.get(t).then((function(t){return t.apply(e,n)}))},s=function t(e,n){var i=E(e,r.extension),a=o.create(n);return l(i,a).then((function(e){if(a.getExtend()){a.setExtend(!1);var n=a.getLayout(),r=a.clone();return t(n,r)}return e}))};return this.configure=function(t){return N(r,t=t||{}),o.configure(r,n),i.configure(r),u.configure(r),c.configure(r),r},this.render=function(t,e){return s(t,e)},this.helpers=function(t){o.helpers(j(n,t))},this.preload=function(t){return u.load(t||{})},this.create=function(e){return new t(e)},this.compile=function(t,e){return i.compile(t,e)},this.context=function(t){return o.create(t)},this.helpers({require:function(t){var e=E(t,r.extension),n=o.create({});return l(e,n).then((function(){return n.getMacro()}))},render:s}),this}({cache:!1,withObject:!1,resolver:function(t,e){return e in I?Promise.resolve(I[e]):Promise.resolve(["template not found",e])}});function K(){var t;return t=e().mark((function t(n){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:Object.assign(I,n||{});case 1:case"end":return t.stop()}}),t)})),K=function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))},K.apply(this,arguments)}var X=D.render,z=D.context,Q=D.compile,V=D.helpers,Z=D.preload,tt=D.configure,et=D.create;t.compile=Q,t.configure=tt,t.context=z,t.create=et,t.helpers=V,t.preload=Z,t.render=X,t.useTemplates=function(t){return K.apply(this,arguments)}}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ejs={})}(this,(function(t){"use strict";function e(){e=function(){return n};var t,n={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof d?e:d,a=Object.create(o.prototype),c=new N(r||[]);return i(a,"_invoke",{value:P(t,n,c)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}n.wrap=f;var p="suspendedStart",v="suspendedYield",g="executing",b="completed",m={};function d(){}function y(){}function w(){}var x={};l(x,c,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(B([])));j&&j!==r&&o.call(j,c)&&(x=j);var O=w.prototype=d.prototype=Object.create(x);function L(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function n(r,i,a,c){var u=h(t[r],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var r;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,r){n(t,o,e,r)}))}return r=r?r.then(i,i):i()}})}function P(e,n,r){var o=p;return function(i,a){if(o===g)throw new Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=F(c,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=b,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=g;var s=h(e,n,r);if("normal"===s.type){if(o=r.done?b:v,s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=b,r.method="throw",r.arg=s.arg)}}}function F(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,F(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=h(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function B(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function n(){for(;++r<e.length;)if(o.call(e,r))return n.value=e[r],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return y.prototype=w,i(O,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:y,configurable:!0}),y.displayName=l(w,s,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},n.awrap=function(t){return{__await:t}},L(k.prototype),l(k.prototype,u,(function(){return this})),n.AsyncIterator=k,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new k(f(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),l(O,s,"Generator"),l(O,c,(function(){return this})),l(O,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},n.values=B,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function r(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;T(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:B(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},n}function n(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function r(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o=function(){var t=[].slice.call(arguments),e=t.shift();return t.filter(e).pop()},i=function(t){return Array.isArray(t)},a=function(t){return"function"==typeof t},c=function(t){return"string"==typeof t},u=function(t){return"boolean"==typeof t},s=function(t){return void 0===t},l="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),f={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},h={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},p=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},v=p(h),g=p(f),b=function(){return(""+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")).replace(v,(function(t){return h[t]}))},m=function(t,e){var n=t;return null==n?"":!0===e?b(n):n},d=function(t,e){return Boolean(t instanceof e)},y=function(t,e,n){for(var r=t,o=String(e).split("."),i=o.pop(),c=0;c<o.length;c++){var u=o[c];if(a(r.toJSON)&&(r=r.toJSON()),n&&!1===r.hasOwnProperty(u)){r={};break}r=r[u]=r[u]||{}}return a(r.toJSON)&&(r=r.toJSON()),[r,i]},w=function(t,e){var n=t.split(".").pop();return n!==e&&(t=[t,e].join(".")),t},x=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return n.filter((function(t){return t})).reduce((function(t,e){return Object.assign(t,e)}),t)},E=function(){},j=function(t,e){var n;for(n in t)k(t,n)&&e(t[n],n,t)},O=function(t,e){return function(t,e){var n=t instanceof Array,r=n?[]:{};return j(t,(function(t,o,i){var a=e(t,o,i);!1===s(a)&&(n?r.push(a):r[o]=a)})),r}(t,(function(t,n){if(-1===e.indexOf(n))return t}))},L=function(t,e,n){return Promise.resolve(t).then(e.bind(n))},k=function(t,e){return t&&t.hasOwnProperty(e)},P={export:"ejsPrecompiled",cache:!0,chokidar:null,path:"views",resolver:function(t,e){return Promise.resolve(["resolver is not defined",t,e].join(" "))},extension:"ejs",rmWhitespace:!0,withObject:!0,globalHelpers:[],vars:{SCOPE:"ejs",COMPONENT:"ui",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},F=function(t,e){x(t,{path:o(c,P.path,t.path,e.path),export:o(c,P.export,t.export,e.export),resolver:o(a,P.resolver,t.resolver,e.resolver),extension:o(c,P.extension,t.extension,e.extension),withObject:o(u,P.withObject,t.withObject,e.withObject),rmWhitespace:o(u,P.rmWhitespace,t.rmWhitespace,e.rmWhitespace),cache:o(u,P.cache,t.cache,e.cache),token:x({},P.token,t.token,e.token),vars:x({},P.vars,t.vars,e.vars),globalHelpers:o(i,P.globalHelpers,t.globalHelpers,e.globalHelpers)})},S="undefined"!=typeof globalThis?globalThis:window||self;function T(t){if(!1===d(this,T))return new T;var e={enabled:!0,list:{}};this.configure=function(t){e.enabled=t.cache,!1===l&&this.load(S[t.export])},this.clear=function(){e.list={}},this.load=function(t){return e.enabled&&x(e.list,t||{}),this},this.get=function(t){if(e.enabled)return e.list[t]},this.set=function(t,n){return e.enabled&&(e.list[t]=n),this},this.resolve=function(t){return Promise.resolve(this.get(t))},this.remove=function(t){delete e.list[t]},this.exist=function(t){return k(e.list,t)}}var N=[{symbol:"-",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,",1))\n").concat(this.BUFFER,"('")}},{symbol:"=",format:function(t){return"')\n".concat(this.BUFFER,"(").concat(this.SAFE,"(").concat(t,"))\n").concat(this.BUFFER,"('")}},{symbol:"#",format:function(t){return"')\n/**".concat(t,"**/\n").concat(this.BUFFER,"('")}},{symbol:"",format:function(t){return"')\n".concat(t.trim(),"\n").concat(this.BUFFER,"('")}}];function B(t){if(!1===d(this,B))return new B(t);var e={};this.configure=function(t){e.withObject=t.withObject,e.rmWhitespace=t.rmWhitespace,e.token=t.token,e.vars=t.vars,e.globalHelpers=t.globalHelpers,e.matches=[],e.formats=[],e.slurp={match:"[ \\t]*",start:[e.token.start,"_"],end:["_",e.token.end]},N.forEach((function(t){e.matches.push(e.token.start.concat(t.symbol).concat(e.token.regex).concat(e.token.end)),e.formats.push(t.format.bind(e.vars))})),e.regex=new RegExp(e.matches.join("|").concat("|$"),"g"),e.slurpStart=new RegExp([e.slurp.match,e.slurp.start.join("")].join(""),"gm"),e.slurpEnd=new RegExp([e.slurp.end.join(""),e.slurp.match].join(""),"gm")},this.compile=function(t,n){var r=e.vars,o=r.SCOPE,i=r.SAFE,a=r.BUFFER,c=r.COMPONENT,u=e.globalHelpers;t=String(t),e.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),t=t.replace(e.slurpStart,e.token.start).replace(e.slurpEnd,e.token.end);var s,l,h,p="".concat(a,"('");s=e.regex,l=function(n,r,o){p+=(""+t.slice(r,o)).replace(g,(function(t){return"\\"+f[t]})),n.forEach((function(t,n){t&&(p+=e.formats[n](t))}))},h=0,t.replace(s,(function(){var t=[].slice.call(arguments,0,-1),e=t.pop(),n=t.shift();return l(t,h,e),h=e+n.length,n})),p="try{".concat(p+="');","}catch(e){return ").concat(a,".error(e)}"),e.withObject&&(p="with(".concat(o,"){").concat(p,"}")),p="".concat(a,".start();").concat(p,"return ").concat(a,".end();"),p+="\n//# sourceURL=".concat(n);var v=null,b=[o,c,a,i].concat(u);try{(v=Function.apply(null,b.concat(p))).source="(function(".concat(b.join(","),"){\n").concat(p,"\n})")}catch(t){throw t.filename=n,t.source=p,t}return v},this.configure(t)}function R(t,e,n){if(!1===d(this,R))return new R(t,e,n);if(!1===d(e,T))throw new TypeError("cache is not instance of Cache");if(!1===d(n,B))throw new TypeError("compiler is not instance of Compiler");var r={},o=function(t){return r.resolver(r.path,t)};this.configure=function(t){r.path=t.path,r.cache=t.cache,a(t.resolver)&&(r.resolver=t.resolver)},this.get=function(t){return e.exist(t)?e.resolve(t):o(t).then((function(r){return function(t,n){return e.set(t,n),n}(t,function(t,e){return a(t)?t:n.compile(t,e)}(r,t))}))},this.configure(t)}var _=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],A=" ",$='"',C="/",U="<",M=">",H=function(t,e,n){var r=[],o=-1===_.indexOf(t),i=function(t,e){var n=[];return j(t,(function(t,r,o){var i=e(t,r,o);!1===s(i)&&n.push(i)})),n}(e,(function(t,e){if(null!=t)return[b(e),[$,b(t),$].join("")].join("=")})).join(A);return r.push([U,t,A,i,M].join("")),n&&r.push(n instanceof Array?n.join(""):n),o&&r.push([U,C,t,M].join("")),r.join("")};function G(t){this.code=1,this.name="TemplateError",this.message=t,Error.call(this)}function W(t){G.call(this),this.code=404,this.name="TemplateNotFound",this.message=t}function q(t){G.call(this),this.code=500,this.name="TemplateSyntaxError",this.message=t}function J(t){return Promise.all(t||[]).then((function(t){return t.join("")}))}function Y(){var t=[],e=[];function n(t){e.push(t)}return n.start=function(){e=[]},n.backup=function(){t.push(e.concat()),e=[]},n.restore=function(){var n=e.concat();return e=t.pop(),J(n)},n.error=function(t){return e=t,Promise.reject(new q(e.message));var e},n.end=function(){return J(e)},n}function I(t){if(!1===d(this,I))return new I(t);this.configure=function(t,e){var n,o=t.vars,i=o.BLOCKS,u=o.MACRO,s=o.EXTEND,l=o.LAYOUT,f=o.BUFFER,h=o.COMPONENT;function p(t){this[i]={},this[u]={},x(this,t||{})}this.create=function(t){return new p(t)},this.helpers=function(t){x(p.prototype,t||{})},p.prototype=x({},e||{}),Object.defineProperties(p.prototype,(r(n={},f,{value:Y(),writable:!0,configurable:!1,enumerable:!1}),r(n,i,{value:{},writable:!0,configurable:!1,enumerable:!1}),r(n,u,{value:{},writable:!0,configurable:!1,enumerable:!1}),r(n,l,{value:!1,writable:!0,configurable:!1,enumerable:!1}),r(n,s,{value:!1,writable:!0,configurable:!1,enumerable:!1}),r(n,"getMacro",{value:function(){return this[u]},writable:!1,configurable:!1,enumerable:!1}),r(n,"getBuffer",{value:function(){return this[f]},writable:!1,configurable:!1,enumerable:!1}),r(n,"getComponent",{value:function(){var t=this;return h in t?function(){return t[h].apply(t,arguments)}:function(){console.log("%s function not defined",h)}},writable:!1,configurable:!1,enumerable:!1}),r(n,"getBlocks",{value:function(){return this[i]},writable:!1,configurable:!1,enumerable:!1}),r(n,"setExtend",{value:function(t){this[s]=t},writable:!1,configurable:!1,enumerable:!1}),r(n,"getExtend",{value:function(){return this[s]},writable:!1,configurable:!1,enumerable:!1}),r(n,"setLayout",{value:function(t){this[l]=t},writable:!1,configurable:!1,enumerable:!1}),r(n,"getLayout",{value:function(){return this[l]},writable:!1,configurable:!1,enumerable:!1}),r(n,"clone",{value:function(t){var e=[l,s,f];return!0===t&&e.push(i),O(this,e)},writable:!1,configurable:!1,enumerable:!1}),r(n,"extend",{value:function(t){this.setExtend(!0),this.setLayout(t)},writable:!1,configurable:!1,enumerable:!1}),r(n,"echo",{value:function(t){var e=this.getBuffer();[].slice.call(arguments).forEach(e)},writable:!1,configurable:!1,enumerable:!1}),r(n,"fn",{value:function(t){var e=this.getBuffer(),n=this;return function(){return e.backup(),a(t)&&t.apply(n,arguments),e.restore()}},writable:!1,configurable:!1,enumerable:!1}),r(n,"get",{value:function(t,e){var n=y(this,t,!0),r=n.shift(),o=n.pop();return k(r,o)?r[o]:e},writable:!0,configurable:!0,enumerable:!1}),r(n,"set",{value:function(t,e){var n=y(this,t,!1),r=n.shift(),o=n.pop();return this.getExtend()&&k(r,o)?r[o]:r[o]=e},writable:!1,configurable:!1,enumerable:!1}),r(n,"macro",{value:function(t,e){var n=this.getMacro(),r=this.fn(e),o=this;n[t]=function(){return o.echo(r.apply(void 0,arguments))}},writable:!1,configurable:!1,enumerable:!1}),r(n,"call",{value:function(t){var e=this.getMacro()[t],n=[].slice.call(arguments,1);if(a(e))return e.apply(e,n)},writable:!1,configurable:!1,enumerable:!1}),r(n,"block",{value:function(t,e){var n=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(e)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()};this.echo(i()(function t(){var e=i();return e?function(){n.echo(e(t()))}:E}()))}},writable:!1,configurable:!1,enumerable:!1}),r(n,"hasBlock",{value:function(t){return this.getBlocks().hasOwnProperty(t)},writable:!1,configurable:!1,enumerable:!1}),r(n,"include",{value:function(t,e,n){var r=!1===n?{}:this.clone(!0),o=x(r,e||{}),i=this.render(t,o);this.echo(i)},writable:!1,configurable:!1,enumerable:!1}),r(n,"use",{value:function(t,e){var n=this.require(t);this.echo(L(n,(function(t){var n=this.getMacro();j(t,(function(t,r){n[[e,r].join(".")]=t}))}),this))},writable:!1,configurable:!1,enumerable:!1}),r(n,"async",{value:function(t,e){this.echo(L(t,(function(t){return this.fn(e)(t)}),this))},writable:!1,configurable:!1,enumerable:!1}),r(n,"each",{value:function(t,e){c(t)&&(t=this.get(t,[])),j(t,e)},writable:!1,configurable:!1,enumerable:!1}),r(n,"element",{value:function(t,e,n){return H(t,e,n)},writable:!1,configurable:!1,enumerable:!1}),r(n,"el",{value:function(t,e,n){a(n)&&(n=this.fn(n)()),this.echo(L(n,(function(n){return this.element(t,e,n)}),this))},writable:!1,configurable:!1,enumerable:!1}),n))},this.configure(t)}Object.setPrototypeOf(W.prototype,Error.prototype),Object.setPrototypeOf(W.prototype,G.prototype),Object.setPrototypeOf(q.prototype,G.prototype);var D={},K=new function t(e){if(!1===d(this,t))return new t(e);var n={},r={};F(r,e||{});var o=new I(r),i=new B(r),c=new T,u=new R(r,c,i),s=function(t,e){var n=r.globalHelpers,o=[e,e.getComponent(),e.getBuffer(),m].concat(n.filter((function(t){return a(e[t])})).map((function(t){return e[t].bind(e)})));return u.get(t).then((function(t){return t.apply(e,o)}))},l=function t(e,n){var i=w(e,r.extension),a=o.create(n);return s(i,a).then((function(e){if(a.getExtend()){a.setExtend(!1);var n=a.getLayout(),r=a.clone();return t(n,r)}return e}))};return this.configure=function(t){return F(r,t=t||{}),o.configure(r,n),i.configure(r),c.configure(r),u.configure(r),r},this.render=function(t,e){return l(t,e)},this.helpers=function(t){o.helpers(x(n,t))},this.preload=function(t){return c.load(t||{})},this.create=function(e){return new t(e)},this.compile=function(t,e){return i.compile(t,e)},this.context=function(t){return o.create(t)},this.helpers({require:function(t){var e=w(t,r.extension),n=o.create({});return s(e,n).then((function(){return n.getMacro()}))},render:l}),this}({cache:!1,withObject:!1,resolver:function(t,e){return new Promise((function(t,n){D.hasOwnProperty(e)?t(D[e]):n(new W("template ".concat(e," not found")))}))}}),X=function(t,e){return t=new URL(t),e&&(t.protocol="https:"),t.origin};var z=K.render,Q=K.context,V=K.compile,Z=K.helpers,tt=K.preload,et=K.configure,nt=K.create;t.compile=V,t.configure=et,t.context=Q,t.create=nt,t.helpers=Z,t.preload=tt,t.render=z,t.setRenderer=function(t){var r=t.secure,o=void 0===r||r,i=t.version,a=void 0===i?"1.0":i;return function(){var t,r=(t=e().mark((function t(n,r){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.data=Q({}),n.data.set("version",a),n.data.set("origin",X(n.req.url,o)),n.ejs=function(t,e){return z(t,Object.assign({},n.data,e))},n.render=function(t,e){return n.html(n.ejs(t,e))},t.next=7,r();case 7:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(t,e){return r.apply(this,arguments)}}()},t.setTemplates=function(t){Object.assign(D,t||{})}}));
package/package.json CHANGED
@@ -3,12 +3,15 @@
3
3
  "description": "EJS Templates",
4
4
  "homepage": "https://github.com/kosatyi/ejs",
5
5
  "type": "module",
6
- "version": "0.0.77",
6
+ "version": "0.0.79",
7
7
  "main": "dist/cjs/index.js",
8
8
  "module": "dist/esm/index.js",
9
9
  "browser": "dist/umd/browser.js",
10
10
  "minified": "dist/umd/browser.min.js",
11
11
  "author": "Stepan Kosatyi (https://kosatyi.com)",
12
+ "bin": {
13
+ "ejs-bundler": "bin/bundler.js"
14
+ },
12
15
  "exports": {
13
16
  ".": {
14
17
  "import": "./dist/esm/index.js",
@@ -25,9 +28,15 @@
25
28
  "./element": {
26
29
  "import": "./dist/esm/element.js",
27
30
  "require": "./dist/cjs/element.js"
31
+ },
32
+ "./bundler": {
33
+ "import": "./dist/esm/bundler.js",
34
+ "require": "./dist/cjs/bundler.js",
35
+ "types": "./types/bundler.d.ts"
28
36
  }
29
37
  },
30
38
  "files": [
39
+ "bin",
31
40
  "dist",
32
41
  "types"
33
42
  ],
@@ -38,11 +47,6 @@
38
47
  "prepublishOnly": "npm i && rollup -c",
39
48
  "postversion": "git push && git push --tags"
40
49
  },
41
- "devDependencies": {
42
- "@babel/core": "^7.20.12",
43
- "@babel/preset-env": "^7.20.2",
44
- "@kosatyi/rollup": "^0.0.23"
45
- },
46
50
  "license": "MIT",
47
51
  "bugs": {
48
52
  "url": "https://github.com/kosatyi/ejs/issues"
@@ -55,5 +59,13 @@
55
59
  "ejs",
56
60
  "template-engine",
57
61
  "nodejs"
58
- ]
62
+ ],
63
+ "peerDependencies": {
64
+ "@kosatyi/rollup": "0.0.x",
65
+ "@babel/core": "7.x",
66
+ "@babel/preset-env": "7.x",
67
+ "glob": "11.x",
68
+ "process.argv": "0.x",
69
+ "terser": "5.x"
70
+ }
59
71
  }
@@ -0,0 +1,30 @@
1
+ import type { Plugin } from 'rollup'
2
+
3
+ export interface EjsConfig {
4
+ path?: string
5
+ export?: string | 'ejsPrecompiled'
6
+ extension?: 'ejs'
7
+ withObject?: false
8
+ [key: string]: any
9
+ }
10
+
11
+ export interface BundlerOptions {
12
+ target: string[] | string
13
+ transform?: boolean
14
+ timestamp?: boolean
15
+ minify?: boolean
16
+ }
17
+
18
+ export interface WatcherOptions {
19
+ dir: string
20
+ pattern?: string
21
+ }
22
+
23
+ export function ejsBundle(
24
+ options: BundlerOptions | object,
25
+ config: EjsConfig | object
26
+ ): Plugin
27
+
28
+ export class Bundler {
29
+ new(options: BundlerOptions, config: EjsConfig): Bundler
30
+ }
package/types/ejs.d.ts ADDED
@@ -0,0 +1,91 @@
1
+ export interface EJS {
2
+ /**
3
+ * extend layout with blocks in current template file
4
+ * @param layout
5
+ */
6
+ extend(layout: string): any
7
+ /**
8
+ * define block with custom **name** and callback
9
+ * @param name
10
+ * @param [callback]
11
+ */
12
+ block(name: string, callback?: Function): any
13
+ /**
14
+ * check if block with `name` exists
15
+ * @param name
16
+ */
17
+ hasBlock(name: string): boolean
18
+ /**
19
+ * set property in current scope
20
+ * @param path
21
+ * @param value
22
+ */
23
+ set(path: string, value: any): any
24
+ /**
25
+ * get property in current scope
26
+ * @param path
27
+ * @param defaults
28
+ */
29
+ get(path: string, defaults?: any): any
30
+ /**
31
+ * import macro from file **path** and set to current scope **name** property
32
+ * @param path
33
+ * @param name
34
+ */
35
+ use(path: string, name: string): any
36
+ /**
37
+ * define macro function with custom **name**
38
+ * @param name
39
+ * @param callback
40
+ */
41
+ macro(name: string, callback: any): any
42
+ /**
43
+ * call macro function
44
+ * @param name
45
+ * @param props
46
+ * @param callback
47
+ */
48
+ call(name: string, props?: object, callback?: any): any
49
+ /**
50
+ * asynchronous template execution
51
+ * @param promise
52
+ * @param callback
53
+ */
54
+ async(promise: Promise<any>, callback?: any): any
55
+ /**
56
+ * asynchronous template execution
57
+ * @param callback
58
+ */
59
+ fn(callback: Function): any
60
+ /**
61
+ *
62
+ * @param {string} tag
63
+ * @param {object} attrs
64
+ * @param {function} content
65
+ */
66
+ el(tag: string, attrs?: object, content?: any): any
67
+ /**
68
+ * buffer output
69
+ * @param args
70
+ */
71
+ echo(...args: any[]): any
72
+ /**
73
+ * append rendered template from file
74
+ * @param path
75
+ * @param data
76
+ * @param cx
77
+ */
78
+ include(path: string, data?: object, cx?: boolean): any
79
+ /**
80
+ *
81
+ * @param value
82
+ * @param callback
83
+ */
84
+ each(value: any, callback: Function): any
85
+ /**
86
+ * define block with custom **name** and callback
87
+ * @param {string} name
88
+ * @param {object} [props]
89
+ */
90
+ ui(name: string, props?: object): any
91
+ }
package/types/global.d.ts CHANGED
@@ -1,91 +1,6 @@
1
- declare global {
2
- interface EJS {
3
- /**
4
- * extend layout with blocks in current template file
5
- * @param layout
6
- */
7
- extend(layout: string): any
8
- /**
9
- * define block with custom **name** and callback
10
- * @param name
11
- * @param [callback]
12
- */
13
- block(name: string, callback?: Function): any
14
- /**
15
- * set property in current scope
16
- * @param path
17
- * @param value
18
- */
19
- set(path: string, value: any): any
20
- /**
21
- * get property in current scope
22
- * @param path
23
- * @param defaults
24
- */
25
- get(path: string, defaults?: any): any
26
- /**
27
- * import macro from file **path** and set to current scope **name** property
28
- * @param path
29
- * @param name
30
- */
31
- use(path: string, name: string): any
32
- /**
33
- * define macro function with custom **name**
34
- * @param name
35
- * @param callback
36
- */
37
- macro(name: string, callback: any): any
38
- /**
39
- * call macro function
40
- * @param name
41
- * @param props
42
- * @param callback
43
- */
44
- call(name: string, props?: object, callback?: any): any
45
- /**
46
- * asynchronous template execution
47
- * @param promise
48
- * @param callback
49
- */
50
- async(promise: Promise<any>, callback?: any): any
51
- /**
52
- * asynchronous template execution
53
- * @param callback
54
- */
55
- fn(callback: Function): any
56
- /**
57
- *
58
- * @param {string} tag
59
- * @param {object} attrs
60
- * @param {function} content
61
- */
62
- el(tag: string, attrs?: object, content?: any): any
63
- /**
64
- * buffer output
65
- * @param args
66
- */
67
- echo(...args: any[]): any
68
- /**
69
- * append rendered template from file
70
- * @param path
71
- * @param data
72
- * @param cx
73
- */
74
- include(path: string, data?: object, cx?: boolean): any
75
- /**
76
- *
77
- * @param value
78
- * @param callback
79
- */
80
- each(value: any, callback: Function): any
81
- /**
82
- * define block with custom **name** and callback
83
- * @param {string} name
84
- * @param {object} [props]
85
- */
86
- ui(name: string, props?: object): any
87
- }
1
+ import type { EJS } from './ejs'
88
2
 
3
+ declare global {
89
4
  const ejs: EJS
90
5
  }
91
6