Comparing version 1.0.0-beta.3 to 1.0.0-beta.4
@@ -173,3 +173,3 @@ (function (global, factory) { | ||
var closeTag; | ||
var currentObj; | ||
var currentObj = false; | ||
while ((closeTag = parseCloseReg.exec(str))) { | ||
@@ -238,3 +238,3 @@ if (closeTag[1]) { | ||
else { | ||
ParseErr('unclosed tag', str, m.index); | ||
ParseErr('unclosed tag', str, m.index + precedingString.length); | ||
} | ||
@@ -241,0 +241,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Eta={})}(this,(function(e){"use strict";function t(e){var n,r,a=new Error(e);return n=a,r=t.prototype,Object.setPrototypeOf?Object.setPrototypeOf(n,r):n.__proto__=r,a}function n(e,n,r){var a=n.slice(0,r).split(/\n/),i=a.length,o=a[i-1].length+1;throw t(e+=" at line "+i+" col "+o+":\n\n "+n.split(/\n/)[i-1]+"\n "+Array(o).join(" ")+"^")}t.prototype=Object.create(Error.prototype,{name:{value:"Eta Error",enumerable:!1}});var r=new Function("return this;")().Promise;function a(e,t,n){for(var r in t)a=t,i=r,Object.prototype.hasOwnProperty.call(a,i)&&(e[r]=t[r]);var a,i;return e}var i={"&":"&","<":"<",'"':""","'":"'"};function o(e){return i[e]}var s=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,c=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,l=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function u(e,t){var r=[],a=!1,i=0;function o(e,n){e&&(e=function(e,t,n,r){var a,i;return Array.isArray(t.autoTrim)?(a=t.autoTrim[1],i=t.autoTrim[0]):a=i=t.autoTrim,(n||!1===n)&&(a=n),(r||!1===r)&&(i=r),i||a?"slurp"===a&&"slurp"===i?e.trim():("_"===a||"slurp"===a?e=String.prototype.trimLeft?e.trimLeft():e.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==a&&"nl"!==a||(e=e.replace(/^(?:\r\n|\n|\r)/,"")),"_"===i||"slurp"===i?e=String.prototype.trimRight?e.trimRight():e.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==i&&"nl"!==i||(e=e.replace(/(?:\r\n|\n|\r)$/,"")),e):e}(e,t,a,n))&&(e=e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),r.push(e))}s.lastIndex=0,c.lastIndex=0,l.lastIndex=0;for(var u,p=(t.parse.exec+t.parse.interpolate+t.parse.raw).split("").join("|"),f=new RegExp("([^]*?)"+t.tags[0]+"(-|_)?\\s*("+p+")?\\s*","g"),d=new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?"+t.tags[1]+")","g");u=f.exec(e);){i=u[0].length+u.index;var g,h,x=u[1],v=u[2],m=u[3]||"";for(o(x,v),d.lastIndex=i;g=d.exec(e);){if(g[1]){var y=e.slice(i,g.index);f.lastIndex=i=d.lastIndex,a=g[2];var w="";m===t.parse.exec?w="e":m===t.parse.raw?w="r":m===t.parse.interpolate&&(w="i"),h={t:w,val:y};break}var I=g[0];if("/*"===I){var E=e.indexOf("*/",d.lastIndex);-1===E&&n("unclosed comment",e,g.index),d.lastIndex=E}else if("'"===I){c.lastIndex=g.index,c.exec(e)?d.lastIndex=c.lastIndex:n("unclosed string",e,g.index)}else if('"'===I){l.lastIndex=g.index,l.exec(e)?d.lastIndex=l.lastIndex:n("unclosed string",e,g.index)}else if("`"===I){s.lastIndex=g.index,s.exec(e)?d.lastIndex=s.lastIndex:n("unclosed string",e,g.index)}}h?r.push(h):n("unclosed tag",e,u.index)}if(o(e.slice(i,e.length),!1),t.plugins)for(var b=0;b<t.plugins.length;b++){var F=t.plugins[b];F.processAST&&(r=F.processAST(r,t))}return r}function p(e,t){var n=u(e,t),r="var tR='';"+(t.useWith?"with("+t.varName+"||{}){":"")+function(e,t){var n=0,r=e.length,a="";for(;n<r;n++){var i=e[n];if("string"==typeof i){a+="tR+='"+i+"';"}else{var o=i.t,s=i.val||"";"r"===o?a+="tR+="+s+";":"i"===o?(t.autoEscape&&(s="E.e("+s+")"),a+="tR+="+s+";"):"e"===o&&(a+=s+"\n")}}return a}(n,t)+"if(cb){cb(null,tR)} return tR"+(t.useWith?"}":"");if(t.plugins)for(var a=0;a<t.plugins.length;a++){var i=t.plugins[a];i.processFnString&&(r=i.processFnString(r,t))}return r}var f=new(function(){function e(e){this.cache=e}return e.prototype.define=function(e,t){this.cache[e]=t},e.prototype.get=function(e){return this.cache[e]},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.reset=function(){this.cache={}},e.prototype.load=function(e){a(this.cache,e)},e}())({});function d(e,n){var r=this.templates.get(e);if(!r)throw t('Could not fetch template "'+e+'"');return r(n,this)}var g={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,tags:["<%","%>"],parse:{interpolate:"=",raw:"~",exec:""},async:!1,templates:f,cache:!1,plugins:[],useWith:!1,e:function(e){var t=String(e);return/[&<"']/.test(t)?t.replace(/[&<"']/g,o):t},include:d};function h(e,t){var n={};return a(n,g),t&&a(n,t),e&&a(n,e),n}function x(e,n){var r,a=h(n||{});if(a.async)try{r=new Function("return (async function(){}).constructor;")()}catch(e){throw e instanceof SyntaxError?t("This environment doesn't support async/await"):e}else r=Function;try{return new r(a.varName,"E","cb",p(e,a))}catch(n){throw n instanceof SyntaxError?t("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+p(e,a)):n}}function v(e,t){var n;return t.cache&&t.name&&t.templates.get(t.name)?t.templates.get(t.name):(n="function"==typeof e?e:x(e,t),t.cache&&t.name&&t.templates.define(t.name,n),n)}d.bind(g),e.compile=x,e.compileToString=p,e.defaultConfig=g,e.getConfig=h,e.parse=u,e.render=function(e,n,a,i){var o=h(a||{});if(!o.async)return v(e,o)(n,o);if(!i){if("function"==typeof r)return new r((function(t,r){try{t(v(e,o)(n,o))}catch(e){r(e)}}));throw t("Please provide a callback function, this env doesn't support Promises")}try{v(e,o)(n,o,i)}catch(e){return i(e)}},e.templates=f,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Eta={})}(this,(function(e){"use strict";function t(e){var n,r,a=new Error(e);return n=a,r=t.prototype,Object.setPrototypeOf?Object.setPrototypeOf(n,r):n.__proto__=r,a}function n(e,n,r){var a=n.slice(0,r).split(/\n/),i=a.length,o=a[i-1].length+1;throw t(e+=" at line "+i+" col "+o+":\n\n "+n.split(/\n/)[i-1]+"\n "+Array(o).join(" ")+"^")}t.prototype=Object.create(Error.prototype,{name:{value:"Eta Error",enumerable:!1}});var r=new Function("return this;")().Promise;function a(e,t,n){for(var r in t)a=t,i=r,Object.prototype.hasOwnProperty.call(a,i)&&(e[r]=t[r]);var a,i;return e}var i={"&":"&","<":"<",'"':""","'":"'"};function o(e){return i[e]}var s=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,c=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,l=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function u(e,t){var r=[],a=!1,i=0;function o(e,n){e&&(e=function(e,t,n,r){var a,i;return Array.isArray(t.autoTrim)?(a=t.autoTrim[1],i=t.autoTrim[0]):a=i=t.autoTrim,(n||!1===n)&&(a=n),(r||!1===r)&&(i=r),i||a?"slurp"===a&&"slurp"===i?e.trim():("_"===a||"slurp"===a?e=String.prototype.trimLeft?e.trimLeft():e.replace(/^[\s\uFEFF\xA0]+/,""):"-"!==a&&"nl"!==a||(e=e.replace(/^(?:\r\n|\n|\r)/,"")),"_"===i||"slurp"===i?e=String.prototype.trimRight?e.trimRight():e.replace(/[\s\uFEFF\xA0]+$/,""):"-"!==i&&"nl"!==i||(e=e.replace(/(?:\r\n|\n|\r)$/,"")),e):e}(e,t,a,n))&&(e=e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),r.push(e))}s.lastIndex=0,c.lastIndex=0,l.lastIndex=0;for(var u,p=(t.parse.exec+t.parse.interpolate+t.parse.raw).split("").join("|"),f=new RegExp("([^]*?)"+t.tags[0]+"(-|_)?\\s*("+p+")?\\s*","g"),d=new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?"+t.tags[1]+")","g");u=f.exec(e);){i=u[0].length+u.index;var g,h=u[1],x=u[2],v=u[3]||"";o(h,x),d.lastIndex=i;for(var m=!1;g=d.exec(e);){if(g[1]){var y=e.slice(i,g.index);f.lastIndex=i=d.lastIndex,a=g[2];var w="";v===t.parse.exec?w="e":v===t.parse.raw?w="r":v===t.parse.interpolate&&(w="i"),m={t:w,val:y};break}var I=g[0];if("/*"===I){var E=e.indexOf("*/",d.lastIndex);-1===E&&n("unclosed comment",e,g.index),d.lastIndex=E}else if("'"===I){c.lastIndex=g.index,c.exec(e)?d.lastIndex=c.lastIndex:n("unclosed string",e,g.index)}else if('"'===I){l.lastIndex=g.index,l.exec(e)?d.lastIndex=l.lastIndex:n("unclosed string",e,g.index)}else if("`"===I){s.lastIndex=g.index,s.exec(e)?d.lastIndex=s.lastIndex:n("unclosed string",e,g.index)}}m?r.push(m):n("unclosed tag",e,u.index+h.length)}if(o(e.slice(i,e.length),!1),t.plugins)for(var b=0;b<t.plugins.length;b++){var F=t.plugins[b];F.processAST&&(r=F.processAST(r,t))}return r}function p(e,t){var n=u(e,t),r="var tR='';"+(t.useWith?"with("+t.varName+"||{}){":"")+function(e,t){var n=0,r=e.length,a="";for(;n<r;n++){var i=e[n];if("string"==typeof i){a+="tR+='"+i+"';"}else{var o=i.t,s=i.val||"";"r"===o?a+="tR+="+s+";":"i"===o?(t.autoEscape&&(s="E.e("+s+")"),a+="tR+="+s+";"):"e"===o&&(a+=s+"\n")}}return a}(n,t)+"if(cb){cb(null,tR)} return tR"+(t.useWith?"}":"");if(t.plugins)for(var a=0;a<t.plugins.length;a++){var i=t.plugins[a];i.processFnString&&(r=i.processFnString(r,t))}return r}var f=new(function(){function e(e){this.cache=e}return e.prototype.define=function(e,t){this.cache[e]=t},e.prototype.get=function(e){return this.cache[e]},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.reset=function(){this.cache={}},e.prototype.load=function(e){a(this.cache,e)},e}())({});function d(e,n){var r=this.templates.get(e);if(!r)throw t('Could not fetch template "'+e+'"');return r(n,this)}var g={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,tags:["<%","%>"],parse:{interpolate:"=",raw:"~",exec:""},async:!1,templates:f,cache:!1,plugins:[],useWith:!1,e:function(e){var t=String(e);return/[&<"']/.test(t)?t.replace(/[&<"']/g,o):t},include:d};function h(e,t){var n={};return a(n,g),t&&a(n,t),e&&a(n,e),n}function x(e,n){var r,a=h(n||{});if(a.async)try{r=new Function("return (async function(){}).constructor;")()}catch(e){throw e instanceof SyntaxError?t("This environment doesn't support async/await"):e}else r=Function;try{return new r(a.varName,"E","cb",p(e,a))}catch(n){throw n instanceof SyntaxError?t("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+p(e,a)):n}}function v(e,t){var n;return t.cache&&t.name&&t.templates.get(t.name)?t.templates.get(t.name):(n="function"==typeof e?e:x(e,t),t.cache&&t.name&&t.templates.define(t.name,n),n)}d.bind(g),e.compile=x,e.compileToString=p,e.defaultConfig=g,e.getConfig=h,e.parse=u,e.render=function(e,n,a,i){var o=h(a||{});if(!o.async)return v(e,o)(n,o);if(!i){if("function"==typeof r)return new r((function(t,r){try{t(v(e,o)(n,o))}catch(e){r(e)}}));throw t("Please provide a callback function, this env doesn't support Promises")}try{v(e,o)(n,o,i)}catch(e){return i(e)}},e.templates=f,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=eta.min.js.map |
@@ -171,3 +171,3 @@ 'use strict'; | ||
var closeTag; | ||
var currentObj; | ||
var currentObj = false; | ||
while ((closeTag = parseCloseReg.exec(str))) { | ||
@@ -236,3 +236,3 @@ if (closeTag[1]) { | ||
else { | ||
ParseErr('unclosed tag', str, m.index); | ||
ParseErr('unclosed tag', str, m.index + precedingString.length); | ||
} | ||
@@ -239,0 +239,0 @@ } |
@@ -167,3 +167,3 @@ function setPrototypeOf(obj, proto) { | ||
var closeTag; | ||
var currentObj; | ||
var currentObj = false; | ||
while ((closeTag = parseCloseReg.exec(str))) { | ||
@@ -232,3 +232,3 @@ if (closeTag[1]) { | ||
else { | ||
ParseErr('unclosed tag', str, m.index); | ||
ParseErr('unclosed tag', str, m.index + precedingString.length); | ||
} | ||
@@ -235,0 +235,0 @@ } |
{ | ||
"name": "eta", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.4", | ||
"description": "Lightweight, fast, and powerful embedded JS template engine", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
223052