@kosatyi/ejs 0.0.9 → 0.0.10
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.
- package/dist/ejs.cjs +3 -1
- package/dist/ejs.js +3 -1
- package/dist/ejs.min.js +1 -1
- package/dist/ejs.mjs +3 -1
- package/package.json +1 -1
package/dist/ejs.cjs
CHANGED
|
@@ -734,7 +734,9 @@ var Scope = function Scope(config, methods) {
|
|
|
734
734
|
var macro = this.macro(callback);
|
|
735
735
|
|
|
736
736
|
if (this.getExtend()) {
|
|
737
|
-
blocks
|
|
737
|
+
if (hasProp(blocks, name) === false) {
|
|
738
|
+
blocks[name] = macro;
|
|
739
|
+
}
|
|
738
740
|
} else {
|
|
739
741
|
var block = blocks[name];
|
|
740
742
|
|
package/dist/ejs.js
CHANGED
package/dist/ejs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).ejs=t()}(this,(function(){"use strict";var n={},t={export:"ejs.precompiled",cache:!0,path:"views",resolver:null,extension:{template:"ejs",module:"mjs"},vars:{EXTEND:"$$$",BUFFER:"$$a",OUTPUT:"$$i",LAYOUT:"$$l",MACROS:"$$m",PRINT:"$$j",BLOCKS:"$$b",ERROR:"$$e",SCOPE:"$$s",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},e=function(){var n=[].slice.call(arguments),t=n.shift();return n.filter(t).pop()},r=function(n){return"function"==typeof n},o=function(n){return"string"==typeof n},i=function(n){return"boolean"==typeof n},u=new Function("try {return this===global;}catch(e){return false;}"),c={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},a={"&":"&","<":"<",">":">",'"':""","'":"'"},f=function(n){return new RegExp(["[",Object.keys(n).join(""),"]"].join(""),"g")},s=f(a),l=f(c),h=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(""+n).replace(s,(function(n){return a[n]}))},p=function(n,t,e){return null==(e=n)?"":t?h(e):e},v=function(n,t){var e=n,r=t.split("."),o=r.pop();return r.forEach((function(n){e=e[n]=e[n]||{}})),[e,o]},d=function(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];var r=t.shift();return t.filter((function(n){return n})).reduce((function(n,t){return Object.assign(n,t)}),r)},g=function(){},b=function(n,t){var e;for(e in n)w(n,e)&&t(n[e],e,n)},m=function(n,t){return function(n,t,e){var r=n instanceof Array,o=r?[]:{};return b(n,(function(n,e,i){var u=t(n,e,i);void 0!==u&&(r?o.push(u):o[e]=u)})),o}(n,(function(n,e){if(-1===t.indexOf(e))return n}))},w=function(n,t){return n&&n.hasOwnProperty(t)},x=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],E=" ",y='"',j="/",$="<",O=">";function k(n,t,e){var r=[],o=-1===x.indexOf(n),i=function(n,t,e){var r=[];return b(n,(function(n,e,o){var i=t(n,e,o);void 0!==i&&r.push(i)})),r}(t,(function(n,t){if(null!=n)return[h(t),[y,h(n),y].join("")].join("=")})).join(E);return r.push([$,n,E,i,O].join("")),e&&r.push(e instanceof Array?e.join(""):e),o&&r.push([$,j,n,O].join("")),r.join("")}var F=[{symbol:"-",format:function(n){return"'+\n".concat(this.SAFE,"(").concat(n,",1)+\n'")}},{symbol:"=",format:function(n){return"'+\n".concat(this.SAFE,"(").concat(n,")+\n'")}},{symbol:"#",format:function(n){return"'+\n/**".concat(n,"**/+\n'")}},{symbol:"",format:function(n){return"')\n".concat(n,"\n").concat(this.BUFFER,"('")}}],R=function(n){var t=n.token,e=n.vars,r=n.extension.module,o=[],i=[],u={match:"[ \\t]*",start:[t.start,"_"],end:["_",t.end]};F.forEach((function(n){o.push(t.start.concat(n.symbol).concat(t.regex).concat(t.end)),i.push(n.format.bind(e))}));var a=new RegExp(o.join("|").concat("|$"),"g"),f=new RegExp([u.match,u.start].join(""),"gm"),s=new RegExp([u.end,u.match].join(""),"gm");return function(n,o){var h=e.SCOPE,p=e.SAFE,v=e.BUFFER,d=o.split(".").pop();n=(n=n.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")).replace(f,u.start).replace(s,u.end),d===r&&(n=[t.start,n,t.end].join("\n"));var g="".concat(v,"('");!function(n,t,e){var r=0;t.replace(n,(function(){var n=[].slice.call(arguments,0,-1),t=n.pop(),o=n.shift();return e(n,r,t),r=t+o.length,o}))}(a,n,(function(t,e,r){g+=(""+n.slice(e,r)).replace(l,(function(n){return"\\"+c[n]})),t.forEach((function(n,t){n&&(g+=i[t](n))}))})),g+="');",g="with(".concat(h,"){").concat(g,"}"),g="".concat(v,".start();").concat(g,"return ").concat(v,".end();"),g+="\n//# sourceURL=".concat(o);var b=null;try{(b=new Function(h,v,p,g)).source="(function(".concat(h,",").concat(v,",").concat(p,"){\n").concat(g,"\n})")}catch(n){throw n.filename=o,n.source=g,n}return b}},B=function(n){return window.fetch(n).then((function(n){return n.text()}))},S=function(t){return new Promise((function(e,r){n.readFile(t,(function(n,t){n?r(n):e(t.toString())}))}))},A=function(t,e){return n.watch(".",{cwd:t}).on("change",(function(n){e.remove(n)})).on("error",(function(n){console.log("watcher error: "+n)}))},P=function(n,t,e){var o=n.path;n.token;var i=r(n.resolver)?n.resolver:u()?S:B,c=function(n){return i(function(n){return(n=[o,n].join("/")).replace(/\/\//g,"/")}(n))},a=function(n,e){return t.set(e,n),n};return n.watch&&u()&&A(o,t),function(n){if(t.exist(n))return t.resolve(n);var r=c(n).then((function(t){return a(e(t,n),n)}));return a(r,n)}};function L(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}var T=function(n){return Promise.all(n).then((function(n){return n.join("")}))},U=function(){var n=[],t=[];function e(n){t.push(n)}return e.start=function(){t=[]},e.backup=function(){n.push(t.concat()),t=[]},e.restore=function(){var e=t.concat();return t=n.pop(),T(e)},e.end=function(){return T(t)},e},q=function(n,t){var e,i=n.vars,u=i.EXTEND,c=i.MACROS,a=i.LAYOUT,f=i.BLOCKS,s=i.BUFFER;function l(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d(this,n)}return Object.defineProperties(l.prototype,(L(e={},s,{value:U(),writable:!1,configurable:!1,enumerable:!1}),L(e,f,{value:{},writable:!1,configurable:!1,enumerable:!1}),L(e,u,{value:!1,writable:!0,configurable:!1,enumerable:!1}),L(e,a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),L(e,"setBuffer",{value:function(n){this[s]=n},writable:!1,configurable:!1}),L(e,"getBuffer",{value:function(){return this[s]},writable:!1,configurable:!1}),L(e,"setBlocks",{value:function(n){this[f]=n},writable:!1,configurable:!1}),L(e,"getBlocks",{value:function(){return this[f]},writable:!1,configurable:!1}),L(e,"setExtend",{value:function(n){this[u]=n},writable:!1,configurable:!1}),L(e,"getExtend",{value:function(){return this[u]},writable:!1,configurable:!1}),L(e,"setLayout",{value:function(n){this[a]=n},writable:!1,configurable:!1}),L(e,"getLayout",{value:function(){return this[a]},writable:!1,configurable:!1}),e)),l.helpers=function(n){d(l.prototype,n)},l.helpers(t),l.helpers({clone:function(n){var t=[a,u,c,s];return!0===n&&t.push(f),m(this,t)},echo:function(){var n=this.getBuffer(),t=[].slice.call(arguments);t.forEach((function(t){n(t)}))},macro:function(n,t){var e=this.getBuffer(),o=function(){e.backup(),r(n)&&n.apply(this,arguments);var o=e.restore();return!0===t?this.echo(o):o}.bind(this);return o.ctx=this,o},resolve:function(n,t){return Promise.resolve(n).then(t.bind(this))},async:function(n,t){var e=this;this.echo(this.resolve(n,(function(n){return e.macro(t)(n)})))},node:k,element:function(n,t,e){r(e)&&(e=this.macro(e)()),this.echo(this.resolve(e,(function(e){return k(n,t,e)})))},component:function(n,t){t=function(n){var t=d({},n.props);return{element:k,create:n.create,render:function(n){return this.create(d({},t,n))}}}(t),this.set(n,function(n){this.echo(t.render(n))}.bind(this))},get:function(n,t){var e=v(this,n),r=e.shift(),o=e.pop();return w(r,o)?r[o]:t},set:function(n,t){var e=v(this,n),r=e.shift(),o=e.pop();if(this.getExtend()&&w(r,o))return r[o];r[o]=t},call:function(n){var t=[].slice.call(arguments,1),e=v(this,n),o=e.shift(),i=e.pop();if(r(o[i]))return o[i].apply(o,t)},each:function(n,t){o(n)&&(n=this.get(n,[])),b(n,t)},extend:function(n){this.setExtend(!0),this.setLayout(n)},block:function(n,t){var e=this.getBlocks(),r=this.macro(t);if(this.getExtend())e[n]=r;else{var o=e[n];if(o){var i=function(){this.echo(r())}.bind(o.ctx);this.echo(o(i))}else this.echo(r(g))}},include:function(n,t,e){var r=!1===e?{}:this.clone(!0),o=d(r,t||{}),i=this.render(n,o);this.echo(i)},use:function(n){var t=this,e=this.require(n);return this.echo(e),{as:function(n){return e.then((function(e){t.set(n,e)})),this}}},from:function(n){var t=this,e=this.require(n);return this.echo(e),{use:function(){var n=[].slice.call(arguments);return e.then((function(e){n.forEach((function(n){t.set(n,e[n])}))})),this}}}}),l};var C,N,_,D,K,M=(N={},_={},D=function(n,t){var e=n.split(".").pop();return e!==t&&(n=[n,t].join(".")),n},K={element:k,output:function(n,t){return K.template(n).then((function(n){return n.call(t,t,t.getBuffer(),p)}))},render:function(n,t){var e=D(n,N.extension.template),r=new K.scope(t);return K.output(e,r).then((function(n){if(r.getExtend()){r.setExtend(!1);var t=r.getLayout(),e=r.clone();return K.render(t,e)}return n}))},require:function(n){var t=D(n,N.extension.module),e=new K.scope({});return K.output(t,e).then((function(){return e.clone(!0)}))},helpers:function(n){d(_,n=n||{}),K.scope.helpers(n)},configure:function(n){return N.export=e(o,t.export,n.export),N.path=e(o,t.path,n.path),N.resolver=e(r,t.resolver,n.resolver),N.extension=d({},t.extension,n.extension),N.token=d({},t.token,n.token),N.vars=d({},t.vars,n.vars),K.scope=q(N,_),K.compile=R(N),K.wrapper=function(n){var t=n.export;return function(n){var e="(function(o){\n";return n.forEach((function(n){e+="o["+JSON.stringify(n.name)+"]="+String(n.content)+"\n"})),e+='})(window["'+t+'"] = window["'+t+'"] || {});\n'}}(N),K.cache=function(n){var t=n.export,e={};return{preload:function(){return!1===u()&&this.load(window[t]),this},exist:function(n){return w(e,n)},get:function(n){return e[n]},remove:function(n){delete e[n]},resolve:function(n){return Promise.resolve(this.get(n))},set:function(n,t){return e[n]=t,this},load:function(n){return d(e,n),this}}.preload()}(N),K.template=P(N,K.cache,K.compile),K},__express:function(u,c,a){r(c)&&(a=c,c={});var f=d({},(c=c||{}).settings),s=e(o,f.views,t.path),l=e(i,f["view cache"],t.cache),h=d({},f["view options"]),p=n.relative(s,u);return h.path=s,h.cache=l,K.configure(h),K.render(p,c).then((function(n){a(null,n)})).catch((function(n){a(n)}))}},K.configure(C||{}),K.helpers({require:function(n){return K.require(n,this)},render:function(n,t){return K.render(n,t)}}),K);return M}));
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n="undefined"!=typeof globalThis?globalThis:n||self).ejs=t()}(this,(function(){"use strict";var n={},t={export:"ejs.precompiled",cache:!0,path:"views",resolver:null,extension:{template:"ejs",module:"mjs"},vars:{EXTEND:"$$$",BUFFER:"$$a",OUTPUT:"$$i",LAYOUT:"$$l",MACROS:"$$m",PRINT:"$$j",BLOCKS:"$$b",ERROR:"$$e",SCOPE:"$$s",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},e=function(){var n=[].slice.call(arguments),t=n.shift();return n.filter(t).pop()},r=function(n){return"function"==typeof n},o=function(n){return"string"==typeof n},i=function(n){return"boolean"==typeof n},u=new Function("try {return this===global;}catch(e){return false;}"),c={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},a={"&":"&","<":"<",">":">",'"':""","'":"'"},f=function(n){return new RegExp(["[",Object.keys(n).join(""),"]"].join(""),"g")},s=f(a),l=f(c),h=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(""+n).replace(s,(function(n){return a[n]}))},p=function(n,t,e){return null==(e=n)?"":t?h(e):e},v=function(n,t){var e=n,r=t.split("."),o=r.pop();return r.forEach((function(n){e=e[n]=e[n]||{}})),[e,o]},d=function(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];var r=t.shift();return t.filter((function(n){return n})).reduce((function(n,t){return Object.assign(n,t)}),r)},g=function(){},b=function(n,t){var e;for(e in n)w(n,e)&&t(n[e],e,n)},m=function(n,t){return function(n,t,e){var r=n instanceof Array,o=r?[]:{};return b(n,(function(n,e,i){var u=t(n,e,i);void 0!==u&&(r?o.push(u):o[e]=u)})),o}(n,(function(n,e){if(-1===t.indexOf(e))return n}))},w=function(n,t){return n&&n.hasOwnProperty(t)},x=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],E=" ",y='"',j="/",$="<",O=">";function k(n,t,e){var r=[],o=-1===x.indexOf(n),i=function(n,t,e){var r=[];return b(n,(function(n,e,o){var i=t(n,e,o);void 0!==i&&r.push(i)})),r}(t,(function(n,t){if(null!=n)return[h(t),[y,h(n),y].join("")].join("=")})).join(E);return r.push([$,n,E,i,O].join("")),e&&r.push(e instanceof Array?e.join(""):e),o&&r.push([$,j,n,O].join("")),r.join("")}var F=[{symbol:"-",format:function(n){return"'+\n".concat(this.SAFE,"(").concat(n,",1)+\n'")}},{symbol:"=",format:function(n){return"'+\n".concat(this.SAFE,"(").concat(n,")+\n'")}},{symbol:"#",format:function(n){return"'+\n/**".concat(n,"**/+\n'")}},{symbol:"",format:function(n){return"')\n".concat(n,"\n").concat(this.BUFFER,"('")}}],R=function(n){var t=n.token,e=n.vars,r=n.extension.module,o=[],i=[],u={match:"[ \\t]*",start:[t.start,"_"],end:["_",t.end]};F.forEach((function(n){o.push(t.start.concat(n.symbol).concat(t.regex).concat(t.end)),i.push(n.format.bind(e))}));var a=new RegExp(o.join("|").concat("|$"),"g"),f=new RegExp([u.match,u.start].join(""),"gm"),s=new RegExp([u.end,u.match].join(""),"gm");return function(n,o){var h=e.SCOPE,p=e.SAFE,v=e.BUFFER,d=o.split(".").pop();n=(n=n.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")).replace(f,u.start).replace(s,u.end),d===r&&(n=[t.start,n,t.end].join("\n"));var g="".concat(v,"('");!function(n,t,e){var r=0;t.replace(n,(function(){var n=[].slice.call(arguments,0,-1),t=n.pop(),o=n.shift();return e(n,r,t),r=t+o.length,o}))}(a,n,(function(t,e,r){g+=(""+n.slice(e,r)).replace(l,(function(n){return"\\"+c[n]})),t.forEach((function(n,t){n&&(g+=i[t](n))}))})),g+="');",g="with(".concat(h,"){").concat(g,"}"),g="".concat(v,".start();").concat(g,"return ").concat(v,".end();"),g+="\n//# sourceURL=".concat(o);var b=null;try{(b=new Function(h,v,p,g)).source="(function(".concat(h,",").concat(v,",").concat(p,"){\n").concat(g,"\n})")}catch(n){throw n.filename=o,n.source=g,n}return b}},B=function(n){return window.fetch(n).then((function(n){return n.text()}))},S=function(t){return new Promise((function(e,r){n.readFile(t,(function(n,t){n?r(n):e(t.toString())}))}))},A=function(t,e){return n.watch(".",{cwd:t}).on("change",(function(n){e.remove(n)})).on("error",(function(n){console.log("watcher error: "+n)}))},P=function(n,t,e){var o=n.path;n.token;var i=r(n.resolver)?n.resolver:u()?S:B,c=function(n){return i(function(n){return(n=[o,n].join("/")).replace(/\/\//g,"/")}(n))},a=function(n,e){return t.set(e,n),n};return n.watch&&u()&&A(o,t),function(n){if(t.exist(n))return t.resolve(n);var r=c(n).then((function(t){return a(e(t,n),n)}));return a(r,n)}};function L(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}var T=function(n){return Promise.all(n).then((function(n){return n.join("")}))},U=function(){var n=[],t=[];function e(n){t.push(n)}return e.start=function(){t=[]},e.backup=function(){n.push(t.concat()),t=[]},e.restore=function(){var e=t.concat();return t=n.pop(),T(e)},e.end=function(){return T(t)},e},q=function(n,t){var e,i=n.vars,u=i.EXTEND,c=i.MACROS,a=i.LAYOUT,f=i.BLOCKS,s=i.BUFFER;function l(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d(this,n)}return Object.defineProperties(l.prototype,(L(e={},s,{value:U(),writable:!1,configurable:!1,enumerable:!1}),L(e,f,{value:{},writable:!1,configurable:!1,enumerable:!1}),L(e,u,{value:!1,writable:!0,configurable:!1,enumerable:!1}),L(e,a,{value:!1,writable:!0,configurable:!1,enumerable:!1}),L(e,"setBuffer",{value:function(n){this[s]=n},writable:!1,configurable:!1}),L(e,"getBuffer",{value:function(){return this[s]},writable:!1,configurable:!1}),L(e,"setBlocks",{value:function(n){this[f]=n},writable:!1,configurable:!1}),L(e,"getBlocks",{value:function(){return this[f]},writable:!1,configurable:!1}),L(e,"setExtend",{value:function(n){this[u]=n},writable:!1,configurable:!1}),L(e,"getExtend",{value:function(){return this[u]},writable:!1,configurable:!1}),L(e,"setLayout",{value:function(n){this[a]=n},writable:!1,configurable:!1}),L(e,"getLayout",{value:function(){return this[a]},writable:!1,configurable:!1}),e)),l.helpers=function(n){d(l.prototype,n)},l.helpers(t),l.helpers({clone:function(n){var t=[a,u,c,s];return!0===n&&t.push(f),m(this,t)},echo:function(){var n=this.getBuffer(),t=[].slice.call(arguments);t.forEach((function(t){n(t)}))},macro:function(n,t){var e=this.getBuffer(),o=function(){e.backup(),r(n)&&n.apply(this,arguments);var o=e.restore();return!0===t?this.echo(o):o}.bind(this);return o.ctx=this,o},resolve:function(n,t){return Promise.resolve(n).then(t.bind(this))},async:function(n,t){var e=this;this.echo(this.resolve(n,(function(n){return e.macro(t)(n)})))},node:k,element:function(n,t,e){r(e)&&(e=this.macro(e)()),this.echo(this.resolve(e,(function(e){return k(n,t,e)})))},component:function(n,t){t=function(n){var t=d({},n.props);return{element:k,create:n.create,render:function(n){return this.create(d({},t,n))}}}(t),this.set(n,function(n){this.echo(t.render(n))}.bind(this))},get:function(n,t){var e=v(this,n),r=e.shift(),o=e.pop();return w(r,o)?r[o]:t},set:function(n,t){var e=v(this,n),r=e.shift(),o=e.pop();if(this.getExtend()&&w(r,o))return r[o];r[o]=t},call:function(n){var t=[].slice.call(arguments,1),e=v(this,n),o=e.shift(),i=e.pop();if(r(o[i]))return o[i].apply(o,t)},each:function(n,t){o(n)&&(n=this.get(n,[])),b(n,t)},extend:function(n){this.setExtend(!0),this.setLayout(n)},block:function(n,t){var e=this.getBlocks(),r=this.macro(t);if(this.getExtend())!1===w(e,n)&&(e[n]=r);else{var o=e[n];if(o){var i=function(){this.echo(r())}.bind(o.ctx);this.echo(o(i))}else this.echo(r(g))}},include:function(n,t,e){var r=!1===e?{}:this.clone(!0),o=d(r,t||{}),i=this.render(n,o);this.echo(i)},use:function(n){var t=this,e=this.require(n);return this.echo(e),{as:function(n){return e.then((function(e){t.set(n,e)})),this}}},from:function(n){var t=this,e=this.require(n);return this.echo(e),{use:function(){var n=[].slice.call(arguments);return e.then((function(e){n.forEach((function(n){t.set(n,e[n])}))})),this}}}}),l};var C,N,_,D,K,M=(N={},_={},D=function(n,t){var e=n.split(".").pop();return e!==t&&(n=[n,t].join(".")),n},K={element:k,output:function(n,t){return K.template(n).then((function(n){return n.call(t,t,t.getBuffer(),p)}))},render:function(n,t){var e=D(n,N.extension.template),r=new K.scope(t);return K.output(e,r).then((function(n){if(r.getExtend()){r.setExtend(!1);var t=r.getLayout(),e=r.clone();return K.render(t,e)}return n}))},require:function(n){var t=D(n,N.extension.module),e=new K.scope({});return K.output(t,e).then((function(){return e.clone(!0)}))},helpers:function(n){d(_,n=n||{}),K.scope.helpers(n)},configure:function(n){return N.export=e(o,t.export,n.export),N.path=e(o,t.path,n.path),N.resolver=e(r,t.resolver,n.resolver),N.extension=d({},t.extension,n.extension),N.token=d({},t.token,n.token),N.vars=d({},t.vars,n.vars),K.scope=q(N,_),K.compile=R(N),K.wrapper=function(n){var t=n.export;return function(n){var e="(function(o){\n";return n.forEach((function(n){e+="o["+JSON.stringify(n.name)+"]="+String(n.content)+"\n"})),e+='})(window["'+t+'"] = window["'+t+'"] || {});\n'}}(N),K.cache=function(n){var t=n.export,e={};return{preload:function(){return!1===u()&&this.load(window[t]),this},exist:function(n){return w(e,n)},get:function(n){return e[n]},remove:function(n){delete e[n]},resolve:function(n){return Promise.resolve(this.get(n))},set:function(n,t){return e[n]=t,this},load:function(n){return d(e,n),this}}.preload()}(N),K.template=P(N,K.cache,K.compile),K},__express:function(u,c,a){r(c)&&(a=c,c={});var f=d({},(c=c||{}).settings),s=e(o,f.views,t.path),l=e(i,f["view cache"],t.cache),h=d({},f["view options"]),p=n.relative(s,u);return h.path=s,h.cache=l,K.configure(h),K.render(p,c).then((function(n){a(null,n)})).catch((function(n){a(n)}))}},K.configure(C||{}),K.helpers({require:function(n){return K.require(n,this)},render:function(n,t){return K.render(n,t)}}),K);return M}));
|
package/dist/ejs.mjs
CHANGED
|
@@ -711,7 +711,9 @@ const Scope = (config, methods) => {
|
|
|
711
711
|
const blocks = this.getBlocks();
|
|
712
712
|
const macro = this.macro(callback);
|
|
713
713
|
if (this.getExtend()) {
|
|
714
|
-
blocks
|
|
714
|
+
if (hasProp(blocks, name) === false) {
|
|
715
|
+
blocks[name] = macro;
|
|
716
|
+
}
|
|
715
717
|
} else {
|
|
716
718
|
const block = blocks[name];
|
|
717
719
|
if (block) {
|