UNPKG

@sap/generator-fiori

Version:

Create an SAPUI5 application using SAP Fiori elements or a freestyle approach

67 lines (63 loc) 13 kB
const __esmImportMetaUrl = require('node:url').pathToFileURL(__filename).href; "use strict";var H=Object.defineProperty;var i=(t,n)=>H(t,"name",{value:n,configurable:!0});var x=(t,n)=>()=>{try{return n||t((n={exports:{}}).exports,n),n.exports}catch(e){throw n=0,e}};var A=x(f=>{"use strict";var U=/[|\\{}()[\]^$+*?.]/g,X=Object.prototype.hasOwnProperty,E=i(function(t,n){return X.apply(t,[n])},"hasOwn");f.escapeRegExpChars=function(t){return t?String(t).replace(U,"\\$&"):""};var $={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},z=/[&<>'"]/g;function V(t){return $[t]||t}i(V,"encode_char");var q=`var _ENCODE_HTML_RULES = { "&": "&amp;" , "<": "&lt;" , ">": "&gt;" , '"': "&#34;" , "'": "&#39;" } , _MATCH_HTML = /[&<>'"]/g; function encode_char(c) { return _ENCODE_HTML_RULES[c] || c; }; `;f.escapeXML=function(t){return t==null?"":String(t).replace(z,V)};function T(){return Function.prototype.toString.call(this)+`; `+q}i(T,"escapeXMLToString");try{typeof Object.defineProperty=="function"?Object.defineProperty(f.escapeXML,"toString",{value:T}):f.escapeXML.toString=T}catch{console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)")}f.shallowCopy=function(t,n){if(n=n||{},t!=null)for(var e in n)E(n,e)&&(e==="__proto__"||e==="constructor"||(t[e]=n[e]));return t};f.shallowCopyFromList=function(t,n,e){if(e=e||[],n=n||{},t!=null)for(var r=0;r<e.length;r++){var a=e[r];if(typeof n[a]<"u"){if(!E(n,a)||a==="__proto__"||a==="constructor")continue;t[a]=n[a]}}return t};f.cache={_data:{},set:i(function(t,n){this._data[t]=n},"set"),get:i(function(t){return this._data[t]},"get"),remove:i(function(t){delete this._data[t]},"remove"),reset:i(function(){this._data={}},"reset")};f.hyphenToCamel=function(t){return t.replace(/-[a-z]/g,function(n){return n[1].toUpperCase()})};f.createNullProtoObjWherePossible=(function(){return typeof Object.create=="function"?function(){return Object.create(null)}:{__proto__:null}instanceof Object?function(){return{}}:function(){return{__proto__:null}}})();f.hasOwnOnlyObject=function(t){var n=f.createNullProtoObjWherePossible();for(var e in t)E(t,e)&&(n[e]=t[e]);return n}});var P=x((oe,Z)=>{Z.exports={name:"ejs",description:"Embedded JavaScript templates",keywords:["template","engine","ejs"],version:"3.1.10",author:"Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",license:"Apache-2.0",bin:{ejs:"./bin/cli.js"},main:"./lib/ejs.js",jsdelivr:"ejs.min.js",unpkg:"ejs.min.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{jake:"^10.8.5"},devDependencies:{browserify:"^16.5.1",eslint:"^6.8.0","git-directory-deploy":"^1.5.1",jsdoc:"^4.0.2","lru-cache":"^4.0.1",mocha:"^10.2.0","uglify-js":"^3.3.16"},engines:{node:">=0.10.0"},scripts:{test:"npx jake test"}}});var L=require("fs"),_=require("path"),c=A(),j=!1,B=P().version,G="<",K=">",Q="%",M="locals",Y="ejs",ee="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)",R=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"],te=R.concat("cache"),N=/^\uFEFF/,b=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;exports.cache=c.cache;exports.fileLoader=L.readFileSync;exports.localsName=M;exports.promiseImpl=new Function("return this;")().Promise;exports.resolveInclude=function(t,n,e){var r=_.dirname,a=_.extname,s=_.resolve,l=s(e?n:r(n),t),h=a(t);return h||(l+=".ejs"),l};function F(t,n){var e;if(n.some(function(r){return e=exports.resolveInclude(t,r,!0),L.existsSync(e)}))return e}i(F,"resolvePaths");function re(t,n){var e,r,a=n.views,s=/^[A-Za-z]+:\\|^\//.exec(t);if(s&&s.length)t=t.replace(/^\/*/,""),Array.isArray(n.root)?e=F(t,n.root):e=exports.resolveInclude(t,n.root||"/",!0);else if(n.filename&&(r=exports.resolveInclude(t,n.filename),L.existsSync(r)&&(e=r)),!e&&Array.isArray(a)&&(e=F(t,a)),!e&&typeof n.includer!="function")throw new Error('Could not find the include file "'+n.escapeFunction(t)+'"');return e}i(re,"getIncludePath");function g(t,n){var e,r=t.filename,a=arguments.length>1;if(t.cache){if(!r)throw new Error("cache option requires a filename");if(e=exports.cache.get(r),e)return e;a||(n=C(r).toString().replace(N,""))}else if(!a){if(!r)throw new Error("Internal EJS error: no file name or template provided");n=C(r).toString().replace(N,"")}return e=exports.compile(n,t),t.cache&&exports.cache.set(r,e),e}i(g,"handleCache");function ne(t,n,e){var r;if(e){try{r=g(t)(n)}catch(a){return e(a)}e(null,r)}else{if(typeof exports.promiseImpl=="function")return new exports.promiseImpl(function(a,s){try{r=g(t)(n),a(r)}catch(l){s(l)}});throw new Error("Please provide a callback function")}}i(ne,"tryHandleCache");function C(t){return exports.fileLoader(t)}i(C,"fileLoader");function ae(t,n){var e=c.shallowCopy(c.createNullProtoObjWherePossible(),n);if(e.filename=re(t,e),typeof n.includer=="function"){var r=n.includer(t,e.filename);if(r&&(r.filename&&(e.filename=r.filename),r.template))return g(e,r.template)}return g(e)}i(ae,"includeFile");function D(t,n,e,r,a){var s=n.split(` `),l=Math.max(r-3,0),h=Math.min(s.length,r+3),p=a(e),d=s.slice(l,h).map(function(m,w){var v=w+l+1;return(v==r?" >> ":" ")+v+"| "+m}).join(` `);throw t.path=p,t.message=(p||"ejs")+":"+r+` `+d+` `+t.message,t}i(D,"rethrow");function I(t){return t.replace(/;(\s*$)/,"$1")}i(I,"stripSemi");exports.compile=i(function(n,e){var r;return e&&e.scope&&(j||(console.warn("`scope` option is deprecated and will be removed in EJS 3"),j=!0),e.context||(e.context=e.scope),delete e.scope),r=new o(n,e),r.compile()},"compile");exports.render=function(t,n,e){var r=n||c.createNullProtoObjWherePossible(),a=e||c.createNullProtoObjWherePossible();return arguments.length==2&&c.shallowCopyFromList(a,r,R),g(a,t)(r)};exports.renderFile=function(){var t=Array.prototype.slice.call(arguments),n=t.shift(),e,r={filename:n},a,s;return typeof arguments[arguments.length-1]=="function"&&(e=t.pop()),t.length?(a=t.shift(),t.length?c.shallowCopy(r,t.pop()):(a.settings&&(a.settings.views&&(r.views=a.settings.views),a.settings["view cache"]&&(r.cache=!0),s=a.settings["view options"],s&&c.shallowCopy(r,s)),c.shallowCopyFromList(r,a,te)),r.filename=n):a=c.createNullProtoObjWherePossible(),ne(r,a,e)};exports.Template=o;exports.clearCache=function(){exports.cache.reset()};function o(t,n){var e=c.hasOwnOnlyObject(n),r=c.createNullProtoObjWherePossible();this.templateText=t,this.mode=null,this.truncate=!1,this.currentLine=1,this.source="",r.client=e.client||!1,r.escapeFunction=e.escape||e.escapeFunction||c.escapeXML,r.compileDebug=e.compileDebug!==!1,r.debug=!!e.debug,r.filename=e.filename,r.openDelimiter=e.openDelimiter||exports.openDelimiter||G,r.closeDelimiter=e.closeDelimiter||exports.closeDelimiter||K,r.delimiter=e.delimiter||exports.delimiter||Q,r.strict=e.strict||!1,r.context=e.context,r.cache=e.cache||!1,r.rmWhitespace=e.rmWhitespace,r.root=e.root,r.includer=e.includer,r.outputFunctionName=e.outputFunctionName,r.localsName=e.localsName||exports.localsName||M,r.views=e.views,r.async=e.async,r.destructuredLocals=e.destructuredLocals,r.legacyInclude=typeof e.legacyInclude<"u"?!!e.legacyInclude:!0,r.strict?r._with=!1:r._with=typeof e._with<"u"?e._with:!0,this.opts=r,this.regex=this.createRegex()}i(o,"Template");o.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"};o.prototype={createRegex:i(function(){var t=ee,n=c.escapeRegExpChars(this.opts.delimiter),e=c.escapeRegExpChars(this.opts.openDelimiter),r=c.escapeRegExpChars(this.opts.closeDelimiter);return t=t.replace(/%/g,n).replace(/</g,e).replace(/>/g,r),new RegExp(t)},"createRegex"),compile:i(function(){var t,n,e=this.opts,r="",a="",s=e.escapeFunction,l,h=e.filename?JSON.stringify(e.filename):"undefined";if(!this.source){if(this.generateSource(),r+=` var __output = ""; function __append(s) { if (s !== undefined && s !== null) __output += s } `,e.outputFunctionName){if(!b.test(e.outputFunctionName))throw new Error("outputFunctionName is not a valid JS identifier.");r+=" var "+e.outputFunctionName+` = __append; `}if(e.localsName&&!b.test(e.localsName))throw new Error("localsName is not a valid JS identifier.");if(e.destructuredLocals&&e.destructuredLocals.length){for(var p=" var __locals = ("+e.localsName+` || {}), `,d=0;d<e.destructuredLocals.length;d++){var m=e.destructuredLocals[d];if(!b.test(m))throw new Error("destructuredLocals["+d+"] is not a valid JS identifier.");d>0&&(p+=`, `),p+=m+" = __locals."+m}r+=p+`; `}e._with!==!1&&(r+=" with ("+e.localsName+` || {}) { `,a+=` } `),a+=` return __output; `,this.source=r+this.source+a}e.compileDebug?t=`var __line = 1 , __lines = `+JSON.stringify(this.templateText)+` , __filename = `+h+`; try { `+this.source+`} catch (e) { rethrow(e, __lines, __filename, __line, escapeFn); } `:t=this.source,e.client&&(t="escapeFn = escapeFn || "+s.toString()+`; `+t,e.compileDebug&&(t="rethrow = rethrow || "+D.toString()+`; `+t)),e.strict&&(t=`"use strict"; `+t),e.debug&&console.log(t),e.compileDebug&&e.filename&&(t=t+` //# sourceURL=`+h+` `);try{if(e.async)try{l=new Function("return (async function(){}).constructor;")()}catch(u){throw u instanceof SyntaxError?new Error("This environment does not support async/await"):u}else l=Function;n=new l(e.localsName+", escapeFn, include, rethrow",t)}catch(u){throw u instanceof SyntaxError&&(e.filename&&(u.message+=" in "+e.filename),u.message+=` while compiling ejs `,u.message+=`If the above error is not helpful, you may want to try EJS-Lint: `,u.message+="https://github.com/RyanZim/EJS-Lint",e.async||(u.message+=` `,u.message+="Or, if you meant to create an async function, pass `async: true` as an option.")),u}var w=e.client?n:i(function(O){var k=i(function(J,S){var y=c.shallowCopy(c.createNullProtoObjWherePossible(),O);return S&&(y=c.shallowCopy(y,S)),ae(J,e)(y)},"include");return n.apply(e.context,[O||c.createNullProtoObjWherePossible(),s,k,D])},"anonymous");if(e.filename&&typeof Object.defineProperty=="function"){var v=e.filename,W=_.basename(v,_.extname(v));try{Object.defineProperty(w,"name",{value:W,writable:!1,enumerable:!1,configurable:!0})}catch{}}return w},"compile"),generateSource:i(function(){var t=this.opts;t.rmWhitespace&&(this.templateText=this.templateText.replace(/[\r\n]+/g,` `).replace(/^\s+|\s+$/gm,"")),this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var n=this,e=this.parseTemplateText(),r=this.opts.delimiter,a=this.opts.openDelimiter,s=this.opts.closeDelimiter;e&&e.length&&e.forEach(function(l,h){var p;if(l.indexOf(a+r)===0&&l.indexOf(a+r+r)!==0&&(p=e[h+2],!(p==r+s||p=="-"+r+s||p=="_"+r+s)))throw new Error('Could not find matching close tag for "'+l+'".');n.scanLine(l)})},"generateSource"),parseTemplateText:i(function(){for(var t=this.templateText,n=this.regex,e=n.exec(t),r=[],a;e;)a=e.index,a!==0&&(r.push(t.substring(0,a)),t=t.slice(a)),r.push(e[0]),t=t.slice(e[0].length),e=n.exec(t);return t&&r.push(t),r},"parseTemplateText"),_addOutput:i(function(t){if(this.truncate&&(t=t.replace(/^(?:\r\n|\r|\n)/,""),this.truncate=!1),!t)return t;t=t.replace(/\\/g,"\\\\"),t=t.replace(/\n/g,"\\n"),t=t.replace(/\r/g,"\\r"),t=t.replace(/"/g,'\\"'),this.source+=' ; __append("'+t+`") `},"_addOutput"),scanLine:i(function(t){var n=this,e=this.opts.delimiter,r=this.opts.openDelimiter,a=this.opts.closeDelimiter,s=0;switch(s=t.split(` `).length-1,t){case r+e:case r+e+"_":this.mode=o.modes.EVAL;break;case r+e+"=":this.mode=o.modes.ESCAPED;break;case r+e+"-":this.mode=o.modes.RAW;break;case r+e+"#":this.mode=o.modes.COMMENT;break;case r+e+e:this.mode=o.modes.LITERAL,this.source+=' ; __append("'+t.replace(r+e+e,r+e)+`") `;break;case e+e+a:this.mode=o.modes.LITERAL,this.source+=' ; __append("'+t.replace(e+e+a,e+a)+`") `;break;case e+a:case"-"+e+a:case"_"+e+a:this.mode==o.modes.LITERAL&&this._addOutput(t),this.mode=null,this.truncate=t.indexOf("-")===0||t.indexOf("_")===0;break;default:if(this.mode){switch(this.mode){case o.modes.EVAL:case o.modes.ESCAPED:case o.modes.RAW:t.lastIndexOf("//")>t.lastIndexOf(` `)&&(t+=` `)}switch(this.mode){case o.modes.EVAL:this.source+=" ; "+t+` `;break;case o.modes.ESCAPED:this.source+=" ; __append(escapeFn("+I(t)+`)) `;break;case o.modes.RAW:this.source+=" ; __append("+I(t)+`) `;break;case o.modes.COMMENT:break;case o.modes.LITERAL:this._addOutput(t);break}}else this._addOutput(t)}n.opts.compileDebug&&s&&(this.currentLine+=s,this.source+=" ; __line = "+this.currentLine+` `)},"scanLine")};exports.escapeXML=c.escapeXML;exports.__express=exports.renderFile;exports.VERSION=B;exports.name=Y;typeof window<"u"&&(window.ejs=exports); /*! Bundled license information: ejs/lib/ejs.js: (** * @file Embedded JavaScript templating engine. {@link http://ejs.co} * @author Matthew Eernisse <mde@fleegix.org> * @author Tiancheng "Timothy" Gu <timothygu99@gmail.com> * @project EJS * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0} *) */