@umijs/deps
Version:
[](https://packagephobia.now.sh/result?p=@umijs/deps)
1 lines • 11.3 kB
JavaScript
module.exports=(()=>{"use strict";var e={431:(e,n,t)=>{var r=t(747);var i=t(622);var a=t(356);var c=false;var s=t(499).i8;var o="<";var l=">";var f="%";var u="locals";var m="ejs";var h="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)";var p=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"];var d=p.concat("cache");var v=/^\uFEFF/;n.cache=a.cache;n.fileLoader=r.readFileSync;n.localsName=u;n.promiseImpl=new Function("return this;")().Promise;n.resolveInclude=function(e,n,t){var r=i.dirname;var a=i.extname;var c=i.resolve;var s=c(t?n:r(n),e);var o=a(e);if(!o){s+=".ejs"}return s};function resolvePaths(e,t){var i;if(t.some(function(t){i=n.resolveInclude(e,t,true);return r.existsSync(i)})){return i}}function getIncludePath(e,t){var i;var a;var c=t.views;var s=/^[A-Za-z]+:\\|^\//.exec(e);if(s&&s.length){e=e.replace(/^\/*/,"");if(Array.isArray(t.root)){i=resolvePaths(e,t.root)}else{i=n.resolveInclude(e,t.root||"/",true)}}else{if(t.filename){a=n.resolveInclude(e,t.filename);if(r.existsSync(a)){i=a}}if(!i&&Array.isArray(c)){i=resolvePaths(e,c)}if(!i&&typeof t.includer!=="function"){throw new Error('Could not find the include file "'+t.escapeFunction(e)+'"')}}return i}function handleCache(e,t){var r;var i=e.filename;var a=arguments.length>1;if(e.cache){if(!i){throw new Error("cache option requires a filename")}r=n.cache.get(i);if(r){return r}if(!a){t=fileLoader(i).toString().replace(v,"")}}else if(!a){if(!i){throw new Error("Internal EJS error: no file name or template "+"provided")}t=fileLoader(i).toString().replace(v,"")}r=n.compile(t,e);if(e.cache){n.cache.set(i,r)}return r}function tryHandleCache(e,t,r){var i;if(!r){if(typeof n.promiseImpl=="function"){return new n.promiseImpl(function(n,r){try{i=handleCache(e)(t);n(i)}catch(e){r(e)}})}else{throw new Error("Please provide a callback function")}}else{try{i=handleCache(e)(t)}catch(e){return r(e)}r(null,i)}}function fileLoader(e){return n.fileLoader(e)}function includeFile(e,n){var t=a.shallowCopy({},n);t.filename=getIncludePath(e,t);if(typeof n.includer==="function"){var r=n.includer(e,t.filename);if(r){if(r.filename){t.filename=r.filename}if(r.template){return handleCache(t,r.template)}}}return handleCache(t)}function rethrow(e,n,t,r,i){var a=n.split("\n");var c=Math.max(r-3,0);var s=Math.min(a.length,r+3);var o=i(t);var l=a.slice(c,s).map(function(e,n){var t=n+c+1;return(t==r?" >> ":" ")+t+"| "+e}).join("\n");e.path=o;e.message=(o||"ejs")+":"+r+"\n"+l+"\n\n"+e.message;throw e}function stripSemi(e){return e.replace(/;(\s*$)/,"$1")}n.compile=function compile(e,n){var t;if(n&&n.scope){if(!c){console.warn("`scope` option is deprecated and will be removed in EJS 3");c=true}if(!n.context){n.context=n.scope}delete n.scope}t=new Template(e,n);return t.compile()};n.render=function(e,n,t){var r=n||{};var i=t||{};if(arguments.length==2){a.shallowCopyFromList(i,r,p)}return handleCache(i,e)(r)};n.renderFile=function(){var e=Array.prototype.slice.call(arguments);var n=e.shift();var t;var r={filename:n};var i;var c;if(typeof arguments[arguments.length-1]=="function"){t=e.pop()}if(e.length){i=e.shift();if(e.length){a.shallowCopy(r,e.pop())}else{if(i.settings){if(i.settings.views){r.views=i.settings.views}if(i.settings["view cache"]){r.cache=true}c=i.settings["view options"];if(c){a.shallowCopy(r,c)}}a.shallowCopyFromList(r,i,d)}r.filename=n}else{i={}}return tryHandleCache(r,i,t)};n.Template=Template;n.clearCache=function(){n.cache.reset()};function Template(e,t){t=t||{};var r={};this.templateText=e;this.mode=null;this.truncate=false;this.currentLine=1;this.source="";r.client=t.client||false;r.escapeFunction=t.escape||t.escapeFunction||a.escapeXML;r.compileDebug=t.compileDebug!==false;r.debug=!!t.debug;r.filename=t.filename;r.openDelimiter=t.openDelimiter||n.openDelimiter||o;r.closeDelimiter=t.closeDelimiter||n.closeDelimiter||l;r.delimiter=t.delimiter||n.delimiter||f;r.strict=t.strict||false;r.context=t.context;r.cache=t.cache||false;r.rmWhitespace=t.rmWhitespace;r.root=t.root;r.includer=t.includer;r.outputFunctionName=t.outputFunctionName;r.localsName=t.localsName||n.localsName||u;r.views=t.views;r.async=t.async;r.destructuredLocals=t.destructuredLocals;r.legacyInclude=typeof t.legacyInclude!="undefined"?!!t.legacyInclude:true;if(r.strict){r._with=false}else{r._with=typeof t._with!="undefined"?t._with:true}this.opts=r;this.regex=this.createRegex()}Template.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"};Template.prototype={createRegex:function(){var e=h;var n=a.escapeRegExpChars(this.opts.delimiter);var t=a.escapeRegExpChars(this.opts.openDelimiter);var r=a.escapeRegExpChars(this.opts.closeDelimiter);e=e.replace(/%/g,n).replace(/</g,t).replace(/>/g,r);return new RegExp(e)},compile:function(){var e;var n;var t=this.opts;var r="";var c="";var s=t.escapeFunction;var o;if(!this.source){this.generateSource();r+=' var __output = "";\n'+" function __append(s) { if (s !== undefined && s !== null) __output += s }\n";if(t.outputFunctionName){r+=" var "+t.outputFunctionName+" = __append;"+"\n"}if(t.destructuredLocals&&t.destructuredLocals.length){var l=" var __locals = ("+t.localsName+" || {}),\n";for(var f=0;f<t.destructuredLocals.length;f++){var u=t.destructuredLocals[f];if(f>0){l+=",\n "}l+=u+" = __locals."+u}r+=l+";\n"}if(t._with!==false){r+=" with ("+t.localsName+" || {}) {"+"\n";c+=" }"+"\n"}c+=" return __output;"+"\n";this.source=r+this.source+c}if(t.compileDebug){e="var __line = 1"+"\n"+" , __lines = "+JSON.stringify(this.templateText)+"\n"+" , __filename = "+(t.filename?JSON.stringify(t.filename):"undefined")+";"+"\n"+"try {"+"\n"+this.source+"} catch (e) {"+"\n"+" rethrow(e, __lines, __filename, __line, escapeFn);"+"\n"+"}"+"\n"}else{e=this.source}if(t.client){e="escapeFn = escapeFn || "+s.toString()+";"+"\n"+e;if(t.compileDebug){e="rethrow = rethrow || "+rethrow.toString()+";"+"\n"+e}}if(t.strict){e='"use strict";\n'+e}if(t.debug){console.log(e)}if(t.compileDebug&&t.filename){e=e+"\n"+"//# sourceURL="+t.filename+"\n"}try{if(t.async){try{o=new Function("return (async function(){}).constructor;")()}catch(e){if(e instanceof SyntaxError){throw new Error("This environment does not support async/await")}else{throw e}}}else{o=Function}n=new o(t.localsName+", escapeFn, include, rethrow",e)}catch(e){if(e instanceof SyntaxError){if(t.filename){e.message+=" in "+t.filename}e.message+=" while compiling ejs\n\n";e.message+="If the above error is not helpful, you may want to try EJS-Lint:\n";e.message+="https://github.com/RyanZim/EJS-Lint";if(!t.async){e.message+="\n";e.message+="Or, if you meant to create an async function, pass `async: true` as an option."}}throw e}var m=t.client?n:function anonymous(e){var r=function(n,r){var i=a.shallowCopy({},e);if(r){i=a.shallowCopy(i,r)}return includeFile(n,t)(i)};return n.apply(t.context,[e||{},s,r,rethrow])};if(t.filename&&typeof Object.defineProperty==="function"){var h=t.filename;var p=i.basename(h,i.extname(h));try{Object.defineProperty(m,"name",{value:p,writable:false,enumerable:false,configurable:true})}catch(e){}}return m},generateSource:function(){var e=this.opts;if(e.rmWhitespace){this.templateText=this.templateText.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")}this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var n=this;var t=this.parseTemplateText();var r=this.opts.delimiter;var i=this.opts.openDelimiter;var a=this.opts.closeDelimiter;if(t&&t.length){t.forEach(function(e,c){var s;if(e.indexOf(i+r)===0&&e.indexOf(i+r+r)!==0){s=t[c+2];if(!(s==r+a||s=="-"+r+a||s=="_"+r+a)){throw new Error('Could not find matching close tag for "'+e+'".')}}n.scanLine(e)})}},parseTemplateText:function(){var e=this.templateText;var n=this.regex;var t=n.exec(e);var r=[];var i;while(t){i=t.index;if(i!==0){r.push(e.substring(0,i));e=e.slice(i)}r.push(t[0]);e=e.slice(t[0].length);t=n.exec(e)}if(e){r.push(e)}return r},_addOutput:function(e){if(this.truncate){e=e.replace(/^(?:\r\n|\r|\n)/,"");this.truncate=false}if(!e){return e}e=e.replace(/\\/g,"\\\\");e=e.replace(/\n/g,"\\n");e=e.replace(/\r/g,"\\r");e=e.replace(/"/g,'\\"');this.source+=' ; __append("'+e+'")'+"\n"},scanLine:function(e){var n=this;var t=this.opts.delimiter;var r=this.opts.openDelimiter;var i=this.opts.closeDelimiter;var a=0;a=e.split("\n").length-1;switch(e){case r+t:case r+t+"_":this.mode=Template.modes.EVAL;break;case r+t+"=":this.mode=Template.modes.ESCAPED;break;case r+t+"-":this.mode=Template.modes.RAW;break;case r+t+"#":this.mode=Template.modes.COMMENT;break;case r+t+t:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+e.replace(r+t+t,r+t)+'")'+"\n";break;case t+t+i:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+e.replace(t+t+i,t+i)+'")'+"\n";break;case t+i:case"-"+t+i:case"_"+t+i:if(this.mode==Template.modes.LITERAL){this._addOutput(e)}this.mode=null;this.truncate=e.indexOf("-")===0||e.indexOf("_")===0;break;default:if(this.mode){switch(this.mode){case Template.modes.EVAL:case Template.modes.ESCAPED:case Template.modes.RAW:if(e.lastIndexOf("//")>e.lastIndexOf("\n")){e+="\n"}}switch(this.mode){case Template.modes.EVAL:this.source+=" ; "+e+"\n";break;case Template.modes.ESCAPED:this.source+=" ; __append(escapeFn("+stripSemi(e)+"))"+"\n";break;case Template.modes.RAW:this.source+=" ; __append("+stripSemi(e)+")"+"\n";break;case Template.modes.COMMENT:break;case Template.modes.LITERAL:this._addOutput(e);break}}else{this._addOutput(e)}}if(n.opts.compileDebug&&a){this.currentLine+=a;this.source+=" ; __line = "+this.currentLine+"\n"}}};n.escapeXML=a.escapeXML;n.__express=n.renderFile;n.VERSION=s;n.name=m;if(typeof window!="undefined"){window.ejs=n}},356:(e,n)=>{var t=/[|\\{}()[\]^$+*?.]/g;n.escapeRegExpChars=function(e){if(!e){return""}return String(e).replace(t,"\\$&")};var r={"&":"&","<":"<",">":">",'"':""","'":"'"};var i=/[&<>'"]/g;function encode_char(e){return r[e]||e}var a="var _ENCODE_HTML_RULES = {\n"+' "&": "&"\n'+' , "<": "<"\n'+' , ">": ">"\n'+' , \'"\': """\n'+' , "\'": "'"\n'+" }\n"+" , _MATCH_HTML = /[&<>'\"]/g;\n"+"function encode_char(c) {\n"+" return _ENCODE_HTML_RULES[c] || c;\n"+"};\n";n.escapeXML=function(e){return e==undefined?"":String(e).replace(i,encode_char)};n.escapeXML.toString=function(){return Function.prototype.toString.call(this)+";\n"+a};n.shallowCopy=function(e,n){n=n||{};for(var t in n){e[t]=n[t]}return e};n.shallowCopyFromList=function(e,n,t){for(var r=0;r<t.length;r++){var i=t[r];if(typeof n[i]!="undefined"){e[i]=n[i]}}return e};n.cache={_data:{},set:function(e,n){this._data[e]=n},get:function(e){return this._data[e]},remove:function(e){delete this._data[e]},reset:function(){this._data={}}};n.hyphenToCamel=function(e){return e.replace(/-[a-z]/g,function(e){return e[1].toUpperCase()})}},499:e=>{e.exports={i8:"3.1.5"}},747:e=>{e.exports=require("fs")},622:e=>{e.exports=require("path")}};var n={};function __nccwpck_require__(t){if(n[t]){return n[t].exports}var r=n[t]={exports:{}};var i=true;try{e[t](r,r.exports,__nccwpck_require__);i=false}finally{if(i)delete n[t]}return r.exports}__nccwpck_require__.ab=__dirname+"/";return __nccwpck_require__(431)})();