@zuplo/core 5.2429.0 → 5.2430.0
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/index.minified.js +17 -15
- package/package.json +5 -5
package/index.minified.js
CHANGED
|
@@ -706,21 +706,23 @@ export default environment;`;function fut(s){return{name:"environment",setup(a){
|
|
|
706
706
|
}`}t(O0t,"buildRewriteFunction");var ij="x-zuplo-path",sj="x-zuplo-route",b7e="url-pattern",Vue="open-api";var $vr=R0t.default.compile(`
|
|
707
707
|
import { environment } from "@zuplo/runtime";
|
|
708
708
|
import rawRouteData from "./raw.json";
|
|
709
|
-
{
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
709
|
+
const routes = async () => {
|
|
710
|
+
{{#each imports}}
|
|
711
|
+
const {{{name}}} = await import("{{{path}}}");
|
|
712
|
+
{{/each}}
|
|
713
|
+
return {
|
|
714
|
+
routes: [
|
|
715
|
+
{{#each routes}}
|
|
716
|
+
{{{this}}},
|
|
717
|
+
{{/each}}
|
|
718
|
+
],
|
|
719
|
+
{{{policies}}},
|
|
720
|
+
{{{corsPolicies}}},
|
|
721
|
+
versions: [
|
|
722
|
+
{ name: "none", pathPrefix: "" },
|
|
723
|
+
],
|
|
724
|
+
};
|
|
725
|
+
}
|
|
724
726
|
export default routes;
|
|
725
727
|
`);async function x7e(s,a){let u=[],p=[],g=[],b=new zue,k=new Uue,N=JSON.parse(a.content),M=k.validate(N);if(!M.isValid)return{content:"",errors:[{text:JSON.stringify(M.errors),location:{line:0,column:0,file:"/config/policies.json"}}]};let U=new dG().parse(JSON.stringify(N)),Q=[],te=[],z=new mG,Se,Me,xe=U.children.find(er=>er.name.value==="policies");if(xe){let er=b.transform(xe);Se=z.generate(er),Q=N.policies.map(({name:fn})=>fn)}let Le=U.children.find(er=>er.name.value==="corsPolicies");if(Le){let er=b.transform(Le);Me=z.generate(er),te=N.corsPolicies.map(({name:fn})=>fn)}let kt=[];for(let er=0;er<s.length;er++){let fn=[],mr=s[er],tr=pG(mr.content,fn);if(fn.length>0)return{content:"",errors:fn.map(Ma=>({text:Uvr(Ma.error),location:{file:mr.fileName,line:Ma.line,column:Ma.column}}))};if(tr){kt.push(tr);let Ma=GG(tr,["paths"]);if(Ma&&Ma.children){for(let fi of Ma.children)if(fi.children){let jl=Wue(fi),Bu=jl[ij]?.pathMode;if(Bu){if(Bu!==Vue&&Bu!==b7e)return{content:"",errors:[{text:`Unknown path mode ${Bu}`,location:{line:0,column:0,file:mr.fileName}}]}}else Bu=Vue;for(let[sl,$n]of Object.entries(jl))if(sl!==ij){let wy=sl,H_=$n,Nr=H_[sj];if(Nr){let ac=new $ue().validate(Nr);if(ac.isValid){let Uu=S7e(fi),ya=F0t(fi,[Uu,wy,sj]),IS=await Yvr(ya,mr);if(!IS.valid)return{content:"",errors:[{text:IS.errorMsg??`Unknown error on handler for path '${Uu}'`,location:{line:IS.line??0,column:IS.column??0,file:mr.fileName}}]};let ew=Qvr(ya,mr);if(!ew.valid)return{content:"",errors:ew.errors};ew.warnings&&g.push(...ew.warnings),u.push({path:Uu,pathPattern:Uu,pathMode:Bu,httpMethod:wy,rawOpenAPI:H_,config:F0t(fi,[Uu,wy,sj])})}else return{content:"",errors:[{text:JSON.stringify(ac.errors),location:{line:0,column:0,file:mr.fileName}}]}}else{let Jm=S7e(fi),ac={corsPolicy:"none",handler:Kvr(Jm,tr)};u.push({path:Jm,pathPattern:Jm,pathMode:Vue,rawOpenAPI:H_,httpMethod:wy,config:pG(JSON.stringify(ac))})}}}}}let kr=[];for(let Ma=0;Ma<s.length;Ma++){let fi=s[Ma],jl=kt.at(Ma);if(jl){let Bu=GG(jl,["paths"]);if(Bu&&Bu.children){for(let sl of Bu.children)if(sl.children){let $n=Wue(sl);for(let[wy,H_]of Object.entries($n))if(wy!==ij){let Jm=H_[sj];if(Jm&&"policies"in Jm){let ac=Jm.policies;ac.inbound?.forEach(Uu=>{Q.includes(Uu)||kr.push({text:`Policy '${Uu}' does not exist in policies.json. Please add it and rebuild.`,location:{line:$n.line,column:$n.column,file:fi.fileName}})}),ac.outbound?.forEach(Uu=>{Q.includes(Uu)||kr.push({text:`Policy '${Uu}' does not exist in policies.json. Please add it and rebuild.`,location:{line:$n.line,column:$n.column,file:fi.fileName}})})}}}}}}if(kr.length>0)return{content:"",errors:kr};let In=[],ns=["none","anything-goes"];for(let Ma=0;Ma<s.length;Ma++){let fi=s[Ma],jl=kt.at(Ma);if(jl){let Bu=GG(jl,["paths"]);if(Bu&&Bu.children){for(let sl of Bu.children)if(sl.children){let $n=Wue(sl);for(let[wy,H_]of Object.entries($n))if(wy!==ij){let Jm=H_[sj];if(Jm&&"corsPolicy"in Jm){let ac=Jm.corsPolicy;if(ns.includes(ac))continue;te.includes(ac)||In.push({text:`Cors policy '${ac}' does not exist in policies.json. Please add it and rebuild.`,location:{line:$n.line,column:$n.column,file:fi.fileName}})}}}}}}if(In.length>0)return{content:"",errors:In};for(let Ma of u){let fi=new dG().convert(Ma.config);zvr(fi,Ma),Vvr(fi,Ma),Wvr(fi,Ma),Hvr(fi),Gvr(T7e.basename(s[er].fileName,".oas.json"),Ma.path,Ma.httpMethod,fi);let jl=b.transform(fi),Bu=b.errors;if(Bu.length>0)return{content:"",errors:[{text:JSON.stringify(Bu),location:{line:0,column:0,file:mr.fileName}}]};let $n=new mG().generate(jl);p.push($n)}}let Bt=new Map,ur=[];for(let er=0;er<s.length;er++){let fn=s[er],mr=kt.at(er);if(mr){let tr=GG(mr,["paths"]);if(tr&&tr.children){for(let kr of tr.children)if(kr.children){let In=Wue(kr);for(let ns of Object.keys(In)){if(ns===ij)continue;let Ma=ns,fi=S7e(kr),jl=Ma.replace(/\s+/g,"").split(",");if(Bt.has(fi)){let Bu=Bt.get(fi)?.methods??[];jl.forEach(sl=>{Bu?.includes(sl)?ur.push({text:`Cannot have duplicate routes declared. Route '${sl.toUpperCase()} ${fi}' declared more than once.`,location:{line:kr.line,column:kr.column,file:fn.fileName}}):Bu.push(sl)}),Bt.set(fi,{methods:Bu})}else{try{new URLPattern({pathname:fi})}catch{ur.push({text:`Path ${fi} contains invalid characters.`,location:{line:kr.line,column:kr.column,file:fn.fileName}})}Bt.set(fi,{methods:jl})}}}}}}return ur.length>0?{content:"",errors:ur}:{content:$vr({routes:p,imports:b.getImports(),policies:Se??"policies: []",corsPolicies:Me??"corsPolicies: []"}),errors:[],warnings:g}}t(x7e,"compileRoutes");var Jvr=0,qvr=1;function zvr(s,a){let u={type:hc.Property,parent:s,name:null,value:null};u.name={value:"path",type:hc.Identifier,parent:u},u.value=ET.createLiteral(a.path,u),s.children.unshift(u)}t(zvr,"embellishWithPath");function Vvr(s,a){let u={type:hc.Property,parent:s,name:null,value:null};if(u.name={value:"pathPattern",type:hc.Identifier,parent:u},a.pathMode===b7e)u.value=ET.createLiteral(a.path,u);else{let p=/{(\S+?)}/gm,b=a.path.replace(p,":$1");a.path.endsWith("/")||(b=b+"{/}?"),u.value=ET.createLiteral(b,u)}s.children.unshift(u)}t(Vvr,"embellishWithPathPattern");function Wvr(s,a){let u={type:hc.Property,parent:s,name:null,value:null};u.name={value:"methods",type:hc.Identifier,parent:u};let p=a.httpMethod.split(/,/).map(g=>g.trim().toUpperCase());u.value=ET.createArrayOfLiterals(p,u),s.children.unshift(u)}t(Wvr,"embellishWithMethods");function Hvr(s){let a={type:hc.Property,parent:s,name:null,value:null};a.name={value:"version",type:hc.Identifier,parent:a},a.value=ET.createLiteral("none",a),s.children.unshift(a)}t(Hvr,"embellishWithVersion");function Gvr(s,a,u,p){let g={type:hc.Property,parent:p,name:null,value:null};g.name={value:"raw",type:hc.Identifier,parent:p};let b=Bvr(s,a,u);g.value={type:hc.FunctionBody,parent:g,value:`() => {return rawRouteData.${b};}`},p.children.unshift(g)}t(Gvr,"embellishWithRawOpenApi");function Wue(s){return zO(s.type==="property"),zO(Array.isArray(s.children)),Hue(s.children[qvr])}t(Wue,"evaluatePathItem");function S7e(s){return zO(s.type==="property"),zO(Array.isArray(s.children)),Hue(s.children[Jvr])}t(S7e,"evaluatePath");function F0t(s,a){return GG(s.parent,a)}t(F0t,"extractZuploRouteNode");function M0t(s){return Hue(s)}t(M0t,"evaluateZuploRouteNode");function Kvr(s,a){let u=/{(\S+?)}/gm,g=s.replace(u,"${params.$1}"),b=Hue(a);return{export:"urlRewriteHandler",module:"$import(@zuplo/runtime)",options:{rewritePattern:`${b.servers&&b.servers.length>0?b.servers[0].url:"http://example.com"}${g}`,forwardSearch:!0}}}t(Kvr,"addDefaultUrlRewriteHandler");async function Yvr(s,a){let u=M0t(s),p=u.handler.module.replace(/^\$import\(/,"").replace(/\)$/,""),g=T7e.join(T7e.dirname(a.fileName),"..",`${p}.ts`),b=u.handler.export;if(p==="@zuplo/runtime")return{valid:!0};if(await pc.fileExists(g)){let k=await dmt(g);if(k===null)return{valid:!1,errorMsg:`Could not find any export due to a compile error in '${pc.getParentDirFilename(g)}'`};if(!k.has(b)){let N=`Could not find export "${b}" in '${pc.getParentDirFilename(g)}'`,M=0,U=0;if(s.children)for(let Q of s.children)Q.children&&Q.children.forEach(te=>{te.value==="handler"&&(M=te.line,U=te.column)});return{valid:!1,errorMsg:N,line:M,column:U}}return{valid:!0}}else return{valid:!1,errorMsg:`Could not find module '${p}'`}}t(Yvr,"checkModuleIsValid");var L0t=t((s,a)=>{let u=0,p=0;if(s.children)for(let g of s.children)g.children&&g.children.forEach(b=>{b.value==="options"&&b.children?.forEach(k=>{b.value===a&&(u=k.line,p=k.column)})});return{line:u,column:p}},"getHandlerOptionLocation"),Xvr="$env(";function Qvr(s,a){let u=M0t(s),p=u.handler.export;if(p!=="urlForwardHandler"&&p!=="urlRewriteHandler")return{valid:!0};let g="rewritePattern";p==="urlForwardHandler"&&(g="baseUrl");let b=u.handler.options[g];if(!b){let k=L0t(s,g);return{valid:!1,errors:[{text:`Invalid request handler configuration. handler.options.${g} is required but was not provided.`,location:{file:a.fileName,line:k.line,column:k.column}}]}}if(b.includes(Xvr)){let k=L0t(s,g);return{valid:!0,warnings:[{text:`Invalid environment variable access syntax detected. Use \${env.VAR_NAME} instead of $env(VAR_NAME) for handler.options.${g}.`,location:{file:a.fileName,line:k.line,column:k.column}}]}}return{valid:!0}}t(Qvr,"checkHandlerIsValid");import FFe from"fs/promises";import jE from"path";var YG=sm(L1t(),1),j1t=sm(R1t(),1);function M1t(s){let a=s.raw.url??"",u={};try{let p=s.headers["zuplo-user"]??s.user?.sub;p&&(u.userSub=`${p}`);let g=a.match(/(deployments)\/([a-zA-Z-0-9]*)/);g&&g!==null&&g.length>=2&&(u.deployment=g[2]);let b=a.match(/(accounts)\/([a-zA-Z-0-9]*)/);b&&b!==null&&b.length>=2&&(u.account=b[2]);let k=a.match(/(projects)\/([a-zA-Z-0-9]*)/);k&&k!==null&&k.length>=2&&(u.project=k[2])}catch{}return u}t(M1t,"getLoggerContext");var _Fe="logging.googleapis.com/trace",Ixr="logging.googleapis.com/labels",B1t="zuplo-production",ofe=a7();function Oxr(s){return JSON.stringify(s).replace(/^{/,"").replace(/}$/,"")}t(Oxr,"flatJSONString");function Fxr(s,a,u){if(s.length===2&&typeof s[1]=="object"&&s[1]!==null&&(s[0]=`${s[0]} ${JSON.stringify(s[1])}`),s.length>1&&typeof s[0]=="object"&&typeof s[1]=="string"){let g=s[0];g.err instanceof Error&&g.err.stack&&(s[1]=g.err.stack,delete g.err.stack)}let p;try{let g=`{${this?.[YG.pino.symbols.chindingsSym]?.slice(1)||""}}`;if(p=JSON.parse(g),p){if(p.trace&&(p[_Fe]=`projects/${B1t}/traces/${p.trace}`),!p.trace&&p[_Fe]&&delete p[_Fe],u>=50){let N=Error().stack?.split(`
|
|
726
728
|
`).slice(2).filter(M=>!M.includes("node_modules/pino")&&!M.includes("node_modules\\pino")&&!M.includes("node_modules/launchdarkly-node-server-sdk")&&!M.includes("node_modules\\launchdarkly-node-server-sdk"))[0].substr(7);p.caller=N}return p.caller&&u<50&&delete p.caller,this[YG.pino.symbols.chindingsSym]=`,${Oxr(p)}`,a.apply(this,s)}}catch{}return a.apply(this,s)}t(Fxr,"logMethod");function a7({defaultLabels:s={},logStream:a,loggerOptions:u}={}){let p={level:u?.level??process.env.LOG_LEVEL??"info",redact:['requestHeaders["authorization"]','requestHeaders["cookie"]','requestHeaders["cf-access-jwt-assertion"]','requestHeaders["cf-access-client-secret"]','requestHeaders["cf-access-client-id"]','responseHeaders["authorization"]','responseHeaders["cookie"]','responseHeaders["cf-access-jwt-assertion"]','responseHeaders["cf-access-client-secret"]','responseHeaders["cf-access-client-id"]',"cookie"]},g={project_id:B1t};return p.hooks=u?.hooks??{logMethod:Fxr},p.formatters={bindings(b){return g.pid=b.pid,g.hostname=b.hostname,g}},process.env.LOG_FORMAT===void 0||process.env.LOG_FORMAT==="pretty"?p.transport={target:"@zuplo/pino-pretty-configurations"}:process.env.LOG_FORMAT==="gcp"&&(p.messageKey="message",p.formatters={level(b,k){return{severity:Lxr(k)}},log(b){let k=s;if(b.err&&b.err.stack)try{let N=(0,j1t.parse)(b.err.stack);N.length>0&&(b["logging.googleapis.com/sourceLocation"]={file:N[0].file,line:N[0].lineNumber,function:N[0].methodName})}catch{}if(b.req){let N=b.req;b.requestHeaders=N.raw.headers,b.httpRequest={...(b.httpRequest,{requestMethod:N.method,requestUrl:N.url,userAgent:N.headers["user-agent"],remoteIp:N.ip,protocol:N.protocol})};let M=N.headers["zp-rid"]??b.trace;k.requestId=M,N.headers["cf-ray"]&&(k.rayId=N.headers["cf-ray"]),N.headers["cf-worker"]&&(k.worker=N.headers["cf-worker"]);let U=M1t(N);U&&(b={...b,...U})}if(b.res){let N=b.res;b.responseHeaders=N.getHeaders(),b.httpRequest={...(b.httpRequest,{requestMethod:N.request?N.request.method:"",requestUrl:N.request?N.request.url:"",status:N.statusCode,userAgent:N.request?N.request.headers["user-agent"]:"",latency:`${Rxr(N.getResponseTime()/1e3,9)}s`,remoteIp:N.request?N.request.ip:"",protocol:N.request?N.request.protocol:""})}}return b[Ixr]=k,b}},p.serializers={req(b){},res(b){},responseTime:t(function(b){},"responseTime")}),a?(0,YG.pino)(p,a):(0,YG.pino)(p)}t(a7,"createNewLogger");function Lxr(s){return s===10||s===20?"debug":s===30?"info":s===40?"warning":s===50?"error":s===5?"internal":s>=60?"critical":"default"}t(Lxr,"pinoLevelToStackDriverSeverity");function Rxr(s,a){return Math.trunc(s*Math.pow(10,a))/Math.pow(10,a)}t(Rxr,"truncateToDecimalPlace");var avt=sm(Q1t(),1);var QG=t(s=>{if(typeof s!="string")throw new TypeError("invalid pattern");if(s.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var zxr={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},ZG=t(s=>s.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Vxr=t(s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),Z1t=t(s=>s.join(""),"rangesToString"),evt=t((s,a)=>{let u=a;if(s.charAt(u)!=="[")throw new Error("not in a brace expression");let p=[],g=[],b=u+1,k=!1,N=!1,M=!1,U=!1,Q=u,te="";e:for(;b<s.length;){let xe=s.charAt(b);if((xe==="!"||xe==="^")&&b===u+1){U=!0,b++;continue}if(xe==="]"&&k&&!M){Q=b+1;break}if(k=!0,xe==="\\"&&!M){M=!0,b++;continue}if(xe==="["&&!M){for(let[Le,[kt,Bt,ur]]of Object.entries(zxr))if(s.startsWith(Le,b)){if(te)return["$.",!1,s.length-u,!0];b+=Le.length,ur?g.push(kt):p.push(kt),N=N||Bt;continue e}}if(M=!1,te){xe>te?p.push(ZG(te)+"-"+ZG(xe)):xe===te&&p.push(ZG(xe)),te="",b++;continue}if(s.startsWith("-]",b+1)){p.push(ZG(xe+"-")),b+=2;continue}if(s.startsWith("-",b+1)){te=xe,b+=2;continue}p.push(ZG(xe)),b++}if(Q<b)return["",!1,0,!1];if(!p.length&&!g.length)return["$.",!1,s.length-u,!0];if(g.length===0&&p.length===1&&/^\\?.$/.test(p[0])&&!U){let xe=p[0].length===2?p[0].slice(-1):p[0];return[Vxr(xe),!1,Q-u,!1]}let z="["+(U?"^":"")+Z1t(p)+"]",Se="["+(U?"":"^")+Z1t(g)+"]";return[p.length&&g.length?"("+z+"|"+Se+")":p.length?z:Se,N,Q-u,!0]},"parseClass");var FE=t((s,{windowsPathsNoEscape:a=!1}={})=>a?s.replace(/\[([^\/\\])\]/g,"$1"):s.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),"unescape");var Wxr=new Set(["!","?","+","*","@"]),tvt=t(s=>Wxr.has(s),"isExtglobType"),Hxr="(?!(?:^|/)\\.\\.?(?:$|/))",cfe="(?!\\.)",Gxr=new Set(["[","."]),Kxr=new Set(["..","."]),Yxr=new Set("().*{}+?[]^$\\!"),Xxr=t(s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),mFe="[^/]",rvt=mFe+"*?",nvt=mFe+"+?",cj=class s{static{t(this,"AST")}type;#t;#r;#n=!1;#e=[];#s;#l;#f;#u=!1;#o;#i;#c=!1;constructor(a,u,p={}){this.type=a,a&&(this.#r=!0),this.#s=u,this.#t=this.#s?this.#s.#t:this,this.#o=this.#t===this?p:this.#t.#o,this.#f=this.#t===this?[]:this.#t.#f,a==="!"&&!this.#t.#u&&this.#f.push(this),this.#l=this.#s?this.#s.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let a of this.#e)if(typeof a!="string"&&(a.type||a.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#i!==void 0?this.#i:this.type?this.#i=this.type+"("+this.#e.map(a=>String(a)).join("|")+")":this.#i=this.#e.map(a=>String(a)).join("")}#v(){if(this!==this.#t)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let a;for(;a=this.#f.pop();){if(a.type!=="!")continue;let u=a,p=u.#s;for(;p;){for(let g=u.#l+1;!p.type&&g<p.#e.length;g++)for(let b of a.#e){if(typeof b=="string")throw new Error("string part in extglob AST??");b.copyIn(p.#e[g])}u=p,p=u.#s}}return this}push(...a){for(let u of a)if(u!==""){if(typeof u!="string"&&!(u instanceof s&&u.#s===this))throw new Error("invalid part: "+u);this.#e.push(u)}}toJSON(){let a=this.type===null?this.#e.slice().map(u=>typeof u=="string"?u:u.toJSON()):[this.type,...this.#e.map(u=>u.toJSON())];return this.isStart()&&!this.type&&a.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#u&&this.#s?.type==="!")&&a.push({}),a}isStart(){if(this.#t===this)return!0;if(!this.#s?.isStart())return!1;if(this.#l===0)return!0;let a=this.#s;for(let u=0;u<this.#l;u++){let p=a.#e[u];if(!(p instanceof s&&p.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#s?.type==="!")return!0;if(!this.#s?.isEnd())return!1;if(!this.type)return this.#s?.isEnd();let a=this.#s?this.#s.#e.length:0;return this.#l===a-1}copyIn(a){typeof a=="string"?this.push(a):this.push(a.clone(this))}clone(a){let u=new s(this.type,a);for(let p of this.#e)u.copyIn(p);return u}static#h(a,u,p,g){let b=!1,k=!1,N=-1,M=!1;if(u.type===null){let Se=p,Me="";for(;Se<a.length;){let xe=a.charAt(Se++);if(b||xe==="\\"){b=!b,Me+=xe;continue}if(k){Se===N+1?(xe==="^"||xe==="!")&&(M=!0):xe==="]"&&!(Se===N+2&&M)&&(k=!1),Me+=xe;continue}else if(xe==="["){k=!0,N=Se,M=!1,Me+=xe;continue}if(!g.noext&&tvt(xe)&&a.charAt(Se)==="("){u.push(Me),Me="";let Le=new s(xe,u);Se=s.#h(a,Le,Se,g),u.push(Le);continue}Me+=xe}return u.push(Me),Se}let U=p+1,Q=new s(null,u),te=[],z="";for(;U<a.length;){let Se=a.charAt(U++);if(b||Se==="\\"){b=!b,z+=Se;continue}if(k){U===N+1?(Se==="^"||Se==="!")&&(M=!0):Se==="]"&&!(U===N+2&&M)&&(k=!1),z+=Se;continue}else if(Se==="["){k=!0,N=U,M=!1,z+=Se;continue}if(tvt(Se)&&a.charAt(U)==="("){Q.push(z),z="";let Me=new s(Se,Q);Q.push(Me),U=s.#h(a,Me,U,g);continue}if(Se==="|"){Q.push(z),z="",te.push(Q),Q=new s(null,u);continue}if(Se===")")return z===""&&u.#e.length===0&&(u.#c=!0),Q.push(z),z="",u.push(...te,Q),U;z+=Se}return u.type=null,u.#r=void 0,u.#e=[a.substring(p-1)],U}static fromGlob(a,u={}){let p=new s(null,void 0,u);return s.#h(a,p,0,u),p}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let a=this.toString(),[u,p,g,b]=this.toRegExpSource();if(!(g||this.#r||this.#o.nocase&&!this.#o.nocaseMagicOnly&&a.toUpperCase()!==a.toLowerCase()))return p;let N=(this.#o.nocase?"i":"")+(b?"u":"");return Object.assign(new RegExp(`^${u}$`,N),{_src:u,_glob:a})}toRegExpSource(a){let u=a??!!this.#o.dot;if(this.#t===this&&this.#v(),!this.type){let M=this.isStart()&&this.isEnd(),U=this.#e.map(Se=>{let[Me,xe,Le,kt]=typeof Se=="string"?s.#b(Se,this.#r,M):Se.toRegExpSource(a);return this.#r=this.#r||Le,this.#n=this.#n||kt,Me}).join(""),Q="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&Kxr.has(this.#e[0]))){let Me=Gxr,xe=u&&Me.has(U.charAt(0))||U.startsWith("\\.")&&Me.has(U.charAt(2))||U.startsWith("\\.\\.")&&Me.has(U.charAt(4)),Le=!u&&!a&&Me.has(U.charAt(0));Q=xe?Hxr:Le?cfe:""}let te="";return this.isEnd()&&this.#t.#u&&this.#s?.type==="!"&&(te="(?:$|\\/)"),[Q+U+te,FE(U),this.#r=!!this.#r,this.#n]}let p=this.type==="*"||this.type==="+",g=this.type==="!"?"(?:(?!(?:":"(?:",b=this.#p(u);if(this.isStart()&&this.isEnd()&&!b&&this.type!=="!"){let M=this.toString();return this.#e=[M],this.type=null,this.#r=void 0,[M,FE(this.toString()),!1,!1]}let k=!p||a||u||!cfe?"":this.#p(!0);k===b&&(k=""),k&&(b=`(?:${b})(?:${k})*?`);let N="";if(this.type==="!"&&this.#c)N=(this.isStart()&&!u?cfe:"")+nvt;else{let M=this.type==="!"?"))"+(this.isStart()&&!u&&!a?cfe:"")+rvt+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&k?")":this.type==="*"&&k?")?":`)${this.type}`;N=g+b+M}return[N,FE(b),this.#r=!!this.#r,this.#n]}#p(a){return this.#e.map(u=>{if(typeof u=="string")throw new Error("string type in extglob ast??");let[p,g,b,k]=u.toRegExpSource(a);return this.#n=this.#n||k,p}).filter(u=>!(this.isStart()&&this.isEnd())||!!u).join("|")}static#b(a,u,p=!1){let g=!1,b="",k=!1;for(let N=0;N<a.length;N++){let M=a.charAt(N);if(g){g=!1,b+=(Yxr.has(M)?"\\":"")+M;continue}if(M==="\\"){N===a.length-1?b+="\\\\":g=!0;continue}if(M==="["){let[U,Q,te,z]=evt(a,N);if(te){b+=U,k=k||Q,N+=te-1,u=u||z;continue}}if(M==="*"){p&&a==="*"?b+=nvt:b+=rvt,u=!0;continue}if(M==="?"){b+=mFe,u=!0;continue}b+=Xxr(M)}return[b,FE(a),!!u,k]}};var lj=t((s,{windowsPathsNoEscape:a=!1}={})=>a?s.replace(/[?*()[\]]/g,"[$&]"):s.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var F1=t((s,a,u={})=>(QG(a),!u.nocomment&&a.charAt(0)==="#"?!1:new wS(a,u).match(s)),"minimatch"),Qxr=/^\*+([^+@!?\*\[\(]*)$/,Zxr=t(s=>a=>!a.startsWith(".")&&a.endsWith(s),"starDotExtTest"),eEr=t(s=>a=>a.endsWith(s),"starDotExtTestDot"),tEr=t(s=>(s=s.toLowerCase(),a=>!a.startsWith(".")&&a.toLowerCase().endsWith(s)),"starDotExtTestNocase"),rEr=t(s=>(s=s.toLowerCase(),a=>a.toLowerCase().endsWith(s)),"starDotExtTestNocaseDot"),nEr=/^\*+\.\*+$/,iEr=t(s=>!s.startsWith(".")&&s.includes("."),"starDotStarTest"),sEr=t(s=>s!=="."&&s!==".."&&s.includes("."),"starDotStarTestDot"),aEr=/^\.\*+$/,oEr=t(s=>s!=="."&&s!==".."&&s.startsWith("."),"dotStarTest"),cEr=/^\*+$/,lEr=t(s=>s.length!==0&&!s.startsWith("."),"starTest"),uEr=t(s=>s.length!==0&&s!=="."&&s!=="..","starTestDot"),fEr=/^\?+([^+@!?\*\[\(]*)?$/,_Er=t(([s,a=""])=>{let u=ovt([s]);return a?(a=a.toLowerCase(),p=>u(p)&&p.toLowerCase().endsWith(a)):u},"qmarksTestNocase"),pEr=t(([s,a=""])=>{let u=cvt([s]);return a?(a=a.toLowerCase(),p=>u(p)&&p.toLowerCase().endsWith(a)):u},"qmarksTestNocaseDot"),dEr=t(([s,a=""])=>{let u=cvt([s]);return a?p=>u(p)&&p.endsWith(a):u},"qmarksTestDot"),mEr=t(([s,a=""])=>{let u=ovt([s]);return a?p=>u(p)&&p.endsWith(a):u},"qmarksTest"),ovt=t(([s])=>{let a=s.length;return u=>u.length===a&&!u.startsWith(".")},"qmarksTestNoExt"),cvt=t(([s])=>{let a=s.length;return u=>u.length===a&&u!=="."&&u!==".."},"qmarksTestNoExtDot"),lvt=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",ivt={win32:{sep:"\\"},posix:{sep:"/"}},hEr=lvt==="win32"?ivt.win32.sep:ivt.posix.sep;F1.sep=hEr;var O0=Symbol("globstar **");F1.GLOBSTAR=O0;var gEr="[^/]",yEr=gEr+"*?",vEr="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",bEr="(?:(?!(?:\\/|^)\\.).)*?",SEr=t((s,a={})=>u=>F1(u,s,a),"filter");F1.filter=SEr;var NT=t((s,a={})=>Object.assign({},s,a),"ext"),TEr=t(s=>{if(!s||typeof s!="object"||!Object.keys(s).length)return F1;let a=F1;return Object.assign(t((p,g,b={})=>a(p,g,NT(s,b)),"m"),{Minimatch:class extends a.Minimatch{static{t(this,"Minimatch")}constructor(g,b={}){super(g,NT(s,b))}static defaults(g){return a.defaults(NT(s,g)).Minimatch}},AST:class extends a.AST{static{t(this,"AST")}constructor(g,b,k={}){super(g,b,NT(s,k))}static fromGlob(g,b={}){return a.AST.fromGlob(g,NT(s,b))}},unescape:t((p,g={})=>a.unescape(p,NT(s,g)),"unescape"),escape:t((p,g={})=>a.escape(p,NT(s,g)),"escape"),filter:t((p,g={})=>a.filter(p,NT(s,g)),"filter"),defaults:t(p=>a.defaults(NT(s,p)),"defaults"),makeRe:t((p,g={})=>a.makeRe(p,NT(s,g)),"makeRe"),braceExpand:t((p,g={})=>a.braceExpand(p,NT(s,g)),"braceExpand"),match:t((p,g,b={})=>a.match(p,g,NT(s,b)),"match"),sep:a.sep,GLOBSTAR:O0})},"defaults");F1.defaults=TEr;var uvt=t((s,a={})=>(QG(s),a.nobrace||!/\{(?:(?!\{).)*\}/.test(s)?[s]:(0,avt.default)(s)),"braceExpand");F1.braceExpand=uvt;var xEr=t((s,a={})=>new wS(s,a).makeRe(),"makeRe");F1.makeRe=xEr;var EEr=t((s,a,u={})=>{let p=new wS(a,u);return s=s.filter(g=>p.match(g)),p.options.nonull&&!s.length&&s.push(a),s},"match");F1.match=EEr;var svt=/[?*]|[+@!]\(.*?\)|\[|\]/,CEr=t(s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),wS=class{static{t(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(a,u={}){QG(a),u=u||{},this.options=u,this.pattern=a,this.platform=u.platform||lvt,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!u.windowsPathsNoEscape||u.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!u.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!u.nonegate,this.comment=!1,this.empty=!1,this.partial=!!u.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=u.windowsNoMagicRoot!==void 0?u.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let a of this.set)for(let u of a)if(typeof u!="string")return!0;return!1}debug(...a){}make(){let a=this.pattern,u=this.options;if(!u.nocomment&&a.charAt(0)==="#"){this.comment=!0;return}if(!a){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],u.debug&&(this.debug=(...b)=>console.error(...b)),this.debug(this.pattern,this.globSet);let p=this.globSet.map(b=>this.slashSplit(b));this.globParts=this.preprocess(p),this.debug(this.pattern,this.globParts);let g=this.globParts.map((b,k,N)=>{if(this.isWindows&&this.windowsNoMagicRoot){let M=b[0]===""&&b[1]===""&&(b[2]==="?"||!svt.test(b[2]))&&!svt.test(b[3]),U=/^[a-z]:/i.test(b[0]);if(M)return[...b.slice(0,4),...b.slice(4).map(Q=>this.parse(Q))];if(U)return[b[0],...b.slice(1).map(Q=>this.parse(Q))]}return b.map(M=>this.parse(M))});if(this.debug(this.pattern,g),this.set=g.filter(b=>b.indexOf(!1)===-1),this.isWindows)for(let b=0;b<this.set.length;b++){let k=this.set[b];k[0]===""&&k[1]===""&&this.globParts[b][2]==="?"&&typeof k[3]=="string"&&/^[a-z]:$/i.test(k[3])&&(k[2]="?")}this.debug(this.pattern,this.set)}preprocess(a){if(this.options.noglobstar)for(let p=0;p<a.length;p++)for(let g=0;g<a[p].length;g++)a[p][g]==="**"&&(a[p][g]="*");let{optimizationLevel:u=1}=this.options;return u>=2?(a=this.firstPhasePreProcess(a),a=this.secondPhasePreProcess(a)):u>=1?a=this.levelOneOptimize(a):a=this.adjascentGlobstarOptimize(a),a}adjascentGlobstarOptimize(a){return a.map(u=>{let p=-1;for(;(p=u.indexOf("**",p+1))!==-1;){let g=p;for(;u[g+1]==="**";)g++;g!==p&&u.splice(p,g-p)}return u})}levelOneOptimize(a){return a.map(u=>(u=u.reduce((p,g)=>{let b=p[p.length-1];return g==="**"&&b==="**"?p:g===".."&&b&&b!==".."&&b!=="."&&b!=="**"?(p.pop(),p):(p.push(g),p)},[]),u.length===0?[""]:u))}levelTwoFileOptimize(a){Array.isArray(a)||(a=this.slashSplit(a));let u=!1;do{if(u=!1,!this.preserveMultipleSlashes){for(let g=1;g<a.length-1;g++){let b=a[g];g===1&&b===""&&a[0]===""||(b==="."||b==="")&&(u=!0,a.splice(g,1),g--)}a[0]==="."&&a.length===2&&(a[1]==="."||a[1]==="")&&(u=!0,a.pop())}let p=0;for(;(p=a.indexOf("..",p+1))!==-1;){let g=a[p-1];g&&g!=="."&&g!==".."&&g!=="**"&&(u=!0,a.splice(p-1,2),p-=2)}}while(u);return a.length===0?[""]:a}firstPhasePreProcess(a){let u=!1;do{u=!1;for(let p of a){let g=-1;for(;(g=p.indexOf("**",g+1))!==-1;){let k=g;for(;p[k+1]==="**";)k++;k>g&&p.splice(g+1,k-g);let N=p[g+1],M=p[g+2],U=p[g+3];if(N!==".."||!M||M==="."||M===".."||!U||U==="."||U==="..")continue;u=!0,p.splice(g,1);let Q=p.slice(0);Q[g]="**",a.push(Q),g--}if(!this.preserveMultipleSlashes){for(let k=1;k<p.length-1;k++){let N=p[k];k===1&&N===""&&p[0]===""||(N==="."||N==="")&&(u=!0,p.splice(k,1),k--)}p[0]==="."&&p.length===2&&(p[1]==="."||p[1]==="")&&(u=!0,p.pop())}let b=0;for(;(b=p.indexOf("..",b+1))!==-1;){let k=p[b-1];if(k&&k!=="."&&k!==".."&&k!=="**"){u=!0;let M=b===1&&p[b+1]==="**"?["."]:[];p.splice(b-1,2,...M),p.length===0&&p.push(""),b-=2}}}}while(u);return a}secondPhasePreProcess(a){for(let u=0;u<a.length-1;u++)for(let p=u+1;p<a.length;p++){let g=this.partsMatch(a[u],a[p],!this.preserveMultipleSlashes);g&&(a[u]=g,a[p]=[])}return a.filter(u=>u.length)}partsMatch(a,u,p=!1){let g=0,b=0,k=[],N="";for(;g<a.length&&b<u.length;)if(a[g]===u[b])k.push(N==="b"?u[b]:a[g]),g++,b++;else if(p&&a[g]==="**"&&u[b]===a[g+1])k.push(a[g]),g++;else if(p&&u[b]==="**"&&a[g]===u[b+1])k.push(u[b]),b++;else if(a[g]==="*"&&u[b]&&(this.options.dot||!u[b].startsWith("."))&&u[b]!=="**"){if(N==="b")return!1;N="a",k.push(a[g]),g++,b++}else if(u[b]==="*"&&a[g]&&(this.options.dot||!a[g].startsWith("."))&&a[g]!=="**"){if(N==="a")return!1;N="b",k.push(u[b]),g++,b++}else return!1;return a.length===u.length&&k}parseNegate(){if(this.nonegate)return;let a=this.pattern,u=!1,p=0;for(let g=0;g<a.length&&a.charAt(g)==="!";g++)u=!u,p++;p&&(this.pattern=a.slice(p)),this.negate=u}matchOne(a,u,p=!1){let g=this.options;if(this.isWindows){let xe=typeof a[0]=="string"&&/^[a-z]:$/i.test(a[0]),Le=!xe&&a[0]===""&&a[1]===""&&a[2]==="?"&&/^[a-z]:$/i.test(a[3]),kt=typeof u[0]=="string"&&/^[a-z]:$/i.test(u[0]),Bt=!kt&&u[0]===""&&u[1]===""&&u[2]==="?"&&typeof u[3]=="string"&&/^[a-z]:$/i.test(u[3]),ur=Le?3:xe?0:void 0,Sr=Bt?3:kt?0:void 0;if(typeof ur=="number"&&typeof Sr=="number"){let[er,fn]=[a[ur],u[Sr]];er.toLowerCase()===fn.toLowerCase()&&(u[Sr]=er,Sr>ur?u=u.slice(Sr):ur>Sr&&(a=a.slice(ur)))}}let{optimizationLevel:b=1}=this.options;b>=2&&(a=this.levelTwoFileOptimize(a)),this.debug("matchOne",this,{file:a,pattern:u}),this.debug("matchOne",a.length,u.length);for(var k=0,N=0,M=a.length,U=u.length;k<M&&N<U;k++,N++){this.debug("matchOne loop");var Q=u[N],te=a[k];if(this.debug(u,Q,te),Q===!1)return!1;if(Q===O0){this.debug("GLOBSTAR",[u,Q,te]);var z=k,Se=N+1;if(Se===U){for(this.debug("** at the end");k<M;k++)if(a[k]==="."||a[k]===".."||!g.dot&&a[k].charAt(0)===".")return!1;return!0}for(;z<M;){var Me=a[z];if(this.debug(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2430.0",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"exports": {
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@swc/core": "^1.7.6",
|
|
37
37
|
"@swc/helpers": "^0.5.12",
|
|
38
|
-
"@zuplo/runtime": "5.
|
|
38
|
+
"@zuplo/runtime": "5.2430.0",
|
|
39
39
|
"chokidar": "^3.5.3",
|
|
40
40
|
"esbuild": "0.23.0",
|
|
41
41
|
"jsonc-parser": "^3.2.0",
|
|
42
42
|
"prettier": "^3.3.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@zuplo/graphql": "5.
|
|
46
|
-
"@zuplo/otel": "5.
|
|
47
|
-
"@zuplo/runtime": "5.
|
|
45
|
+
"@zuplo/graphql": "5.2430.0",
|
|
46
|
+
"@zuplo/otel": "5.2430.0",
|
|
47
|
+
"@zuplo/runtime": "5.2430.0"
|
|
48
48
|
}
|
|
49
49
|
}
|