@kosatyi/ejs 0.0.25 → 0.0.26
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 +1 -1
- package/dist/ejs.js +1 -1
- package/dist/ejs.min.js +1 -1
- package/dist/ejs.mjs +1 -1
- package/package.json +1 -1
package/dist/ejs.cjs
CHANGED
|
@@ -271,7 +271,7 @@ var configureCompiler = function configureCompiler(ejs, config) {
|
|
|
271
271
|
|
|
272
272
|
var configureWrapper = function configureWrapper(config) {
|
|
273
273
|
var name = config["export"];
|
|
274
|
-
var useStrict = config.withObject
|
|
274
|
+
var useStrict = config.withObject === false;
|
|
275
275
|
return function Wrapper(list) {
|
|
276
276
|
var out = '';
|
|
277
277
|
out += '(function(global,factory){';
|
package/dist/ejs.js
CHANGED
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
|
|
268
268
|
var configureWrapper = function configureWrapper(config) {
|
|
269
269
|
var name = config["export"];
|
|
270
|
-
var useStrict = config.withObject
|
|
270
|
+
var useStrict = config.withObject === false;
|
|
271
271
|
return function Wrapper(list) {
|
|
272
272
|
var out = '';
|
|
273
273
|
out += '(function(global,factory){';
|
package/dist/ejs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).ejs=n()}(this,(function(){"use strict";var t={},n={export:"ejs.precompiled",cache:!0,path:"views",resolver:null,extension:"ejs",withObject:!0,vars:{SCOPE:"ejs",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},e=function(){var t=[].slice.call(arguments),n=t.shift();return t.filter(n).pop()},r=function(t){return"function"==typeof t},o=function(t){return"string"==typeof t},i=function(t){return"boolean"==typeof t},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),u=function(){return c},a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},f={"&":"&","<":"<",">":">",'"':""","'":"'"},s=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},h=s(f),l=s(a),p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(""+t).replace(h,(function(t){return f[t]}))},d=function(t,n,e){return null==(e=t)?"":n?p(e):e},v=function(t,n){var e=t,r=n.split("."),o=r.pop();return r.forEach((function(t){e=e[t]=e[t]||{}})),[e,o]},m=function(t,n){var e=t.split(".").pop();return e!==n&&(t=[t,n].join(".")),t},g=function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];var r=n.shift();return n.filter((function(t){return t})).reduce((function(t,n){return Object.assign(t,n)}),r)},b=function(){},y=function(t,n){var e;for(e in t)j(t,e)&&n(t[e],e,t)},w=function(t,n){return function(t,n,e){var r=t instanceof Array,o=r?[]:{};return y(t,(function(t,e,i){var c=n(t,e,i);void 0!==c&&(r?o.push(c):o[e]=c)})),o}(t,(function(t,e){if(-1===n.indexOf(e))return t}))},x=function(t,n,e){return Promise.resolve(t).then(n.bind(e))},j=function(t,n){return t&&t.hasOwnProperty(n)},E=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],F=" ",O='"',B="/",R="<",k=">";function $(t,n,e){var r=[],o=-1===E.indexOf(t),i=function(t,n,e){var r=[];return y(t,(function(t,e,o){var i=n(t,e,o);void 0!==i&&r.push(i)})),r}(n,(function(t,n){if(null!=t)return[p(n),[O,p(t),O].join("")].join("=")})).join(F);return r.push([R,t,F,i,k].join("")),e&&r.push(e instanceof Array?e.join(""):e),o&&r.push([R,B,t,k].join("")),r.join("")}var S=[{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,"('")}}],U=function(t,n){var e=n.withObject,r=n.token,o=n.vars,i=[],c=[],u={match:"[ \\t]*",start:[r.start,"_"],end:["_",r.end]};S.forEach((function(t){i.push(r.start.concat(t.symbol).concat(r.regex).concat(r.end)),c.push(t.format.bind(o))}));var f=new RegExp(i.join("|").concat("|$"),"g"),s=new RegExp([u.match,u.start].join(""),"gm"),h=new RegExp([u.end,u.match].join(""),"gm");return function(t,n){var r=o.SCOPE,i=o.SAFE,p=o.BUFFER;t=(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")).replace(s,u.start).replace(h,u.end);var d="".concat(p,"('");!function(t,n,e){var r=0;n.replace(t,(function(){var t=[].slice.call(arguments,0,-1),n=t.pop(),o=t.shift();return e(t,r,n),r=n+o.length,o}))}(f,t,(function(n,e,r){d+=(""+t.slice(e,r)).replace(l,(function(t){return"\\"+a[t]})),n.forEach((function(t,n){t&&(d+=c[n](t))}))})),d="try{".concat(d+="');","}catch(e){console.info(e)}"),e&&(d="with(".concat(r,"){").concat(d,"}")),d="".concat(p,".start();").concat(d,"return ").concat(p,".end();"),d+="\n//# sourceURL=".concat(n);var v=null;try{(v=new Function(r,p,i,d)).source="(function(".concat(r,",").concat(p,",").concat(i,"){\n").concat(d,"\n})")}catch(t){throw t.filename=n,t.source=d,t}return v}},A=function(t){return fetch(t).then((function(t){return t.text()}))},T=function(n){return new Promise((function(e,r){t.readFile(n,(function(t,n){t?r(t):e(n.toString())}))}))},L=function(n,e){return t.watch(".",{cwd:n}).on("change",(function(t){e.remove(t)})).on("error",(function(t){console.log("watcher error: "+t)}))},M=function(t,n){var e=n.path,o=t.cache,i=t.compile,c=r(n.resolver)?n.resolver:u()?T:A,a=function(t){return c(function(t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(t))},f=function(t,n){return o.set(n,t),t};return n.watch&&u()&&L(e,o),function(t){if(o.exist(t))return o.resolve(t);var n=a(t).then((function(n){return f(i(n,t),t)}));return f(n,t)}},P=function(t){return Promise.all(t).then((function(t){return t.join("")}))},C=function(){var t=[],n=[];function e(t){n.push(t)}return e.start=function(){n=[]},e.backup=function(){t.push(n.concat()),n=[]},e.restore=function(){var e=n.concat();return n=t.pop(),P(e)},e.error=function(t){throw t},e.end=function(){return P(n)},e},q="undefined"!=typeof globalThis?globalThis:window||self;function _(c){var a={},f={safeValue:d,element:$,output:function(t,n){return f.template(t).then((function(t){return t.call(n,n,n.getBuffer(),d)}))},render:function(t,n){var e=m(t,a.extension),r=new f.scope(n);return f.output(e,r).then((function(t){if(r.getExtend()){r.setExtend(!1);var n=r.getLayout(),e=r.clone();return f.render(n,e)}return t}))},require:function(t){var n=m(t,a.extension),e=new f.scope({});return f.output(n,e).then((function(){return e.getMacro()}))},helpers:function(t){f.scope.helpers(t)},configure:function(t){return a.export=e(o,n.export,t.export),a.path=e(o,n.path,t.path),a.resolver=e(r,n.resolver,t.resolver),a.extension=e(o,n.extension,t.extension),a.withObject=e(i,n.withObject,t.withObject),a.token=g({},n.token,t.token),a.vars=g({},n.vars,t.vars),f.scope=function(t,n){var e=n.vars,i=e.EXTEND,c=e.LAYOUT,u=e.BLOCKS,a=e.BUFFER,f=e.MACRO;function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.initBlocks(),this.initMacro(),g(this,t)}return s.helpers=function(t){g(s.prototype,t)},s.property=function(t,n){Object.defineProperty(s.prototype,t,n)},s.method=function(t,n){Object.defineProperty(s.prototype,t,{value:n,writable:!1,configurable:!1,enumerable:!1})},s.property(a,{value:C(),writable:!1,configurable:!1,enumerable:!1}),s.property(u,{value:{},writable:!0,configurable:!1,enumerable:!1}),s.property(f,{value:{},writable:!0,configurable:!1,enumerable:!1}),s.property(c,{value:!1,writable:!0,configurable:!1,enumerable:!1}),s.property(i,{value:!1,writable:!0,configurable:!1,enumerable:!1}),s.method("initBlocks",(function(){this[u]={}})),s.method("initMacro",(function(){this[f]={}})),s.method("getMacro",(function(){return this[f]})),s.method("getBuffer",(function(){return this[a]})),s.method("getBlocks",(function(){return this[u]})),s.method("setExtend",(function(t){this[i]=t})),s.method("getExtend",(function(){return this[i]})),s.method("setLayout",(function(t){this[c]=t})),s.method("getLayout",(function(){return this[c]})),s.method("clone",(function(t){var n=[c,i,a];return!0===t&&n.push(u),w(this,n)})),s.method("extend",(function(t){this.setExtend(!0),this.setLayout(t)})),s.method("echo",(function(){var t=this.getBuffer();[].slice.call(arguments).forEach((function(n){t(n)}))})),s.method("fn",(function(t){var n=this.getBuffer(),e=this;return function(){return n.backup(),r(t)&&t.apply(e,arguments),n.restore()}})),s.method("get",(function(t,n){var e=v(this,t),r=e.shift(),o=e.pop();return j(r,o)?r[o]:n})),s.method("set",(function(t,n){var e=v(this,t),r=e.shift(),o=e.pop();return this.getExtend()&&j(r,o)?r[o]:r[o]=n})),s.method("macro",(function(t,n){var e=this.getMacro(),r=this.fn(n),o=this;e[t]=function(){return o.echo(r.apply(void 0,arguments))}})),s.method("call",(function(t){var n=this.getMacro()[t],e=[].slice.call(arguments,1);if(r(n))return n.apply(n,e)})),s.method("block",(function(t,n){var e=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(n)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()};this.echo(i()(function t(){var n=i();return n?function(){e.echo(n(t()))}:b}()))}})),s.method("include",(function(t,n,e){var r=!1===e?{}:this.clone(!0),o=g(r,n||{}),i=this.render(t,o);this.echo(i)})),s.method("use",(function(t,n){var e=this.require(t);this.echo(x(e,(function(t){var e=this.getMacro();y(t,(function(t,r){e[[n,r].join(".")]=t}))}),this))})),s.method("async",(function(t,n){this.echo(x(t,(function(t){return this.fn(n)(t)}),this))})),s.method("el",(function(t,n,e){r(e)&&(e=this.fn(e)()),this.echo(x(e,(function(e){return $(t,n,e)}),this))})),s.method("each",(function(t,n){o(t)&&(t=this.get(t,[])),y(t,n)})),s}(0,a),f.compile=U(0,a),f.wrapper=function(t){var n=t.export,e=!0!==t.withObject;return function(t){var r="";return r+="(function(global,factory){",r+='typeof exports === "object" && typeof module !== "undefined" ?',r+="module.exports = factory():",r+='typeof define === "function" && define.amd ? define(factory):',r+='(global = typeof globalThis !== "undefined" ? globalThis:',r+='global || self,global["'+n+'"] = factory())',r+="})(this,(function(){",e&&(r+="'use strict';\n"),r+="var list = {};\n",t.forEach((function(t){r+="list["+JSON.stringify(t.name)+"]="+String(t.content)+";\n"})),r+="return list;}));\n"}}(f),f.cache=function(t){var n=t.export,e={};return{preload:function(){return!1===u()&&this.load(q[n]),this},exist:function(t){return j(e,t)},get:function(t){return e[t]},remove:function(t){delete e[t]},resolve:function(t){return Promise.resolve(this.get(t))},set:function(t,n){return e[t]=n,this},load:function(t){return g(e,t),this}}.preload()}(f),f.template=M(f,a),f},__express:function(c,u,a){r(u)&&(a=u,u={});var s=g({},(u=u||{}).settings),h=e(o,s.views,n.path),l=e(i,s["view cache"],n.cache),p=g({},s["view options"]),d=t.relative(h,c);return p.path=h,p.cache=l,f.configure(p),f.render(d,u).then((function(t){a(null,t)})).catch((function(t){a(t)}))}};return f.configure(c||{}),f.helpers({require:function(t){return f.require(t,this)},render:function(t,n){return f.render(t,n)}}),f}var N=_();return N.create=_,N}));
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).ejs=n()}(this,(function(){"use strict";var t={},n={export:"ejs.precompiled",cache:!0,path:"views",resolver:null,extension:"ejs",withObject:!0,vars:{SCOPE:"ejs",EXTEND:"$$e",BUFFER:"$$a",LAYOUT:"$$l",BLOCKS:"$$b",MACRO:"$$m",SAFE:"$$v"},token:{start:"<%",end:"%>",regex:"([\\s\\S]+?)"}},e=function(){var t=[].slice.call(arguments),n=t.shift();return t.filter(n).pop()},r=function(t){return"function"==typeof t},o=function(t){return"string"==typeof t},i=function(t){return"boolean"==typeof t},c="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0),u=function(){return c},a={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},f={"&":"&","<":"<",">":">",'"':""","'":"'"},s=function(t){return new RegExp(["[",Object.keys(t).join(""),"]"].join(""),"g")},h=s(f),l=s(a),p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(""+t).replace(h,(function(t){return f[t]}))},d=function(t,n,e){return null==(e=t)?"":n?p(e):e},v=function(t,n){var e=t,r=n.split("."),o=r.pop();return r.forEach((function(t){e=e[t]=e[t]||{}})),[e,o]},m=function(t,n){var e=t.split(".").pop();return e!==n&&(t=[t,n].join(".")),t},g=function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];var r=n.shift();return n.filter((function(t){return t})).reduce((function(t,n){return Object.assign(t,n)}),r)},b=function(){},y=function(t,n){var e;for(e in t)j(t,e)&&n(t[e],e,t)},w=function(t,n){return function(t,n,e){var r=t instanceof Array,o=r?[]:{};return y(t,(function(t,e,i){var c=n(t,e,i);void 0!==c&&(r?o.push(c):o[e]=c)})),o}(t,(function(t,e){if(-1===n.indexOf(e))return t}))},x=function(t,n,e){return Promise.resolve(t).then(n.bind(e))},j=function(t,n){return t&&t.hasOwnProperty(n)},E=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],F=" ",O='"',B="/",R="<",k=">";function $(t,n,e){var r=[],o=-1===E.indexOf(t),i=function(t,n,e){var r=[];return y(t,(function(t,e,o){var i=n(t,e,o);void 0!==i&&r.push(i)})),r}(n,(function(t,n){if(null!=t)return[p(n),[O,p(t),O].join("")].join("=")})).join(F);return r.push([R,t,F,i,k].join("")),e&&r.push(e instanceof Array?e.join(""):e),o&&r.push([R,B,t,k].join("")),r.join("")}var S=[{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,"('")}}],U=function(t,n){var e=n.withObject,r=n.token,o=n.vars,i=[],c=[],u={match:"[ \\t]*",start:[r.start,"_"],end:["_",r.end]};S.forEach((function(t){i.push(r.start.concat(t.symbol).concat(r.regex).concat(r.end)),c.push(t.format.bind(o))}));var f=new RegExp(i.join("|").concat("|$"),"g"),s=new RegExp([u.match,u.start].join(""),"gm"),h=new RegExp([u.end,u.match].join(""),"gm");return function(t,n){var r=o.SCOPE,i=o.SAFE,p=o.BUFFER;t=(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")).replace(s,u.start).replace(h,u.end);var d="".concat(p,"('");!function(t,n,e){var r=0;n.replace(t,(function(){var t=[].slice.call(arguments,0,-1),n=t.pop(),o=t.shift();return e(t,r,n),r=n+o.length,o}))}(f,t,(function(n,e,r){d+=(""+t.slice(e,r)).replace(l,(function(t){return"\\"+a[t]})),n.forEach((function(t,n){t&&(d+=c[n](t))}))})),d="try{".concat(d+="');","}catch(e){console.info(e)}"),e&&(d="with(".concat(r,"){").concat(d,"}")),d="".concat(p,".start();").concat(d,"return ").concat(p,".end();"),d+="\n//# sourceURL=".concat(n);var v=null;try{(v=new Function(r,p,i,d)).source="(function(".concat(r,",").concat(p,",").concat(i,"){\n").concat(d,"\n})")}catch(t){throw t.filename=n,t.source=d,t}return v}},A=function(t){return fetch(t).then((function(t){return t.text()}))},T=function(n){return new Promise((function(e,r){t.readFile(n,(function(t,n){t?r(t):e(n.toString())}))}))},L=function(n,e){return t.watch(".",{cwd:n}).on("change",(function(t){e.remove(t)})).on("error",(function(t){console.log("watcher error: "+t)}))},M=function(t,n){var e=n.path,o=t.cache,i=t.compile,c=r(n.resolver)?n.resolver:u()?T:A,a=function(t){return c(function(t){return(t=[e,t].join("/")).replace(/\/\//g,"/")}(t))},f=function(t,n){return o.set(n,t),t};return n.watch&&u()&&L(e,o),function(t){if(o.exist(t))return o.resolve(t);var n=a(t).then((function(n){return f(i(n,t),t)}));return f(n,t)}},P=function(t){return Promise.all(t).then((function(t){return t.join("")}))},C=function(){var t=[],n=[];function e(t){n.push(t)}return e.start=function(){n=[]},e.backup=function(){t.push(n.concat()),n=[]},e.restore=function(){var e=n.concat();return n=t.pop(),P(e)},e.error=function(t){throw t},e.end=function(){return P(n)},e},q="undefined"!=typeof globalThis?globalThis:window||self;function _(c){var a={},f={safeValue:d,element:$,output:function(t,n){return f.template(t).then((function(t){return t.call(n,n,n.getBuffer(),d)}))},render:function(t,n){var e=m(t,a.extension),r=new f.scope(n);return f.output(e,r).then((function(t){if(r.getExtend()){r.setExtend(!1);var n=r.getLayout(),e=r.clone();return f.render(n,e)}return t}))},require:function(t){var n=m(t,a.extension),e=new f.scope({});return f.output(n,e).then((function(){return e.getMacro()}))},helpers:function(t){f.scope.helpers(t)},configure:function(t){return a.export=e(o,n.export,t.export),a.path=e(o,n.path,t.path),a.resolver=e(r,n.resolver,t.resolver),a.extension=e(o,n.extension,t.extension),a.withObject=e(i,n.withObject,t.withObject),a.token=g({},n.token,t.token),a.vars=g({},n.vars,t.vars),f.scope=function(t,n){var e=n.vars,i=e.EXTEND,c=e.LAYOUT,u=e.BLOCKS,a=e.BUFFER,f=e.MACRO;function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.initBlocks(),this.initMacro(),g(this,t)}return s.helpers=function(t){g(s.prototype,t)},s.property=function(t,n){Object.defineProperty(s.prototype,t,n)},s.method=function(t,n){Object.defineProperty(s.prototype,t,{value:n,writable:!1,configurable:!1,enumerable:!1})},s.property(a,{value:C(),writable:!1,configurable:!1,enumerable:!1}),s.property(u,{value:{},writable:!0,configurable:!1,enumerable:!1}),s.property(f,{value:{},writable:!0,configurable:!1,enumerable:!1}),s.property(c,{value:!1,writable:!0,configurable:!1,enumerable:!1}),s.property(i,{value:!1,writable:!0,configurable:!1,enumerable:!1}),s.method("initBlocks",(function(){this[u]={}})),s.method("initMacro",(function(){this[f]={}})),s.method("getMacro",(function(){return this[f]})),s.method("getBuffer",(function(){return this[a]})),s.method("getBlocks",(function(){return this[u]})),s.method("setExtend",(function(t){this[i]=t})),s.method("getExtend",(function(){return this[i]})),s.method("setLayout",(function(t){this[c]=t})),s.method("getLayout",(function(){return this[c]})),s.method("clone",(function(t){var n=[c,i,a];return!0===t&&n.push(u),w(this,n)})),s.method("extend",(function(t){this.setExtend(!0),this.setLayout(t)})),s.method("echo",(function(){var t=this.getBuffer();[].slice.call(arguments).forEach((function(n){t(n)}))})),s.method("fn",(function(t){var n=this.getBuffer(),e=this;return function(){return n.backup(),r(t)&&t.apply(e,arguments),n.restore()}})),s.method("get",(function(t,n){var e=v(this,t),r=e.shift(),o=e.pop();return j(r,o)?r[o]:n})),s.method("set",(function(t,n){var e=v(this,t),r=e.shift(),o=e.pop();return this.getExtend()&&j(r,o)?r[o]:r[o]=n})),s.method("macro",(function(t,n){var e=this.getMacro(),r=this.fn(n),o=this;e[t]=function(){return o.echo(r.apply(void 0,arguments))}})),s.method("call",(function(t){var n=this.getMacro()[t],e=[].slice.call(arguments,1);if(r(n))return n.apply(n,e)})),s.method("block",(function(t,n){var e=this,r=this.getBlocks();if(r[t]=r[t]||[],r[t].push(this.fn(n)),!this.getExtend()){var o=Object.assign([],r[t]),i=function(){return o.shift()};this.echo(i()(function t(){var n=i();return n?function(){e.echo(n(t()))}:b}()))}})),s.method("include",(function(t,n,e){var r=!1===e?{}:this.clone(!0),o=g(r,n||{}),i=this.render(t,o);this.echo(i)})),s.method("use",(function(t,n){var e=this.require(t);this.echo(x(e,(function(t){var e=this.getMacro();y(t,(function(t,r){e[[n,r].join(".")]=t}))}),this))})),s.method("async",(function(t,n){this.echo(x(t,(function(t){return this.fn(n)(t)}),this))})),s.method("el",(function(t,n,e){r(e)&&(e=this.fn(e)()),this.echo(x(e,(function(e){return $(t,n,e)}),this))})),s.method("each",(function(t,n){o(t)&&(t=this.get(t,[])),y(t,n)})),s}(0,a),f.compile=U(0,a),f.wrapper=function(t){var n=t.export,e=!1===t.withObject;return function(t){var r="";return r+="(function(global,factory){",r+='typeof exports === "object" && typeof module !== "undefined" ?',r+="module.exports = factory():",r+='typeof define === "function" && define.amd ? define(factory):',r+='(global = typeof globalThis !== "undefined" ? globalThis:',r+='global || self,global["'+n+'"] = factory())',r+="})(this,(function(){",e&&(r+="'use strict';\n"),r+="var list = {};\n",t.forEach((function(t){r+="list["+JSON.stringify(t.name)+"]="+String(t.content)+";\n"})),r+="return list;}));\n"}}(f),f.cache=function(t){var n=t.export,e={};return{preload:function(){return!1===u()&&this.load(q[n]),this},exist:function(t){return j(e,t)},get:function(t){return e[t]},remove:function(t){delete e[t]},resolve:function(t){return Promise.resolve(this.get(t))},set:function(t,n){return e[t]=n,this},load:function(t){return g(e,t),this}}.preload()}(f),f.template=M(f,a),f},__express:function(c,u,a){r(u)&&(a=u,u={});var s=g({},(u=u||{}).settings),h=e(o,s.views,n.path),l=e(i,s["view cache"],n.cache),p=g({},s["view options"]),d=t.relative(h,c);return p.path=h,p.cache=l,f.configure(p),f.render(d,u).then((function(t){a(null,t)})).catch((function(t){a(t)}))}};return f.configure(c||{}),f.helpers({require:function(t){return f.require(t,this)},render:function(t,n){return f.render(t,n)}}),f}var N=_();return N.create=_,N}));
|
package/dist/ejs.mjs
CHANGED
|
@@ -314,7 +314,7 @@ const configureCompiler = (ejs, config) => {
|
|
|
314
314
|
|
|
315
315
|
const configureWrapper = (config) => {
|
|
316
316
|
const name = config.export;
|
|
317
|
-
const useStrict = config.withObject
|
|
317
|
+
const useStrict = config.withObject === false;
|
|
318
318
|
return function Wrapper(list) {
|
|
319
319
|
let out = '';
|
|
320
320
|
out += '(function(global,factory){';
|