@wtdlee/repomap 0.9.1 → 0.10.1
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/README.md +12 -0
- package/dist/analyzers/index.d.ts +8 -8
- package/dist/analyzers/index.js +1 -1
- package/dist/{chunk-6AZNHUOB.js → chunk-7BQRBJUG.js} +52 -25
- package/dist/{chunk-WZAAA7DS.js → chunk-ATRSGO6O.js} +175 -49
- package/dist/{chunk-NQMJ3QRX.js → chunk-LHP2OKKA.js} +1 -1
- package/dist/{chunk-2XZSFAJF.js → chunk-QBSB6BIU.js} +6 -6
- package/dist/chunk-YO6EB4OI.js +3 -0
- package/dist/cli.js +14 -14
- package/dist/{dataflow-analyzer-CJ2T0cGS.d.ts → dataflow-analyzer-DIUsRpvv.d.ts} +18 -0
- package/dist/generators/assets/docs.css +22 -0
- package/dist/generators/assets/rails-map.css +13 -0
- package/dist/generators/index.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/page-map-generator-BQ3SSOJG.js +1 -0
- package/dist/rails-map-generator-RY6KXIBU.js +1 -0
- package/dist/server/index.js +1 -1
- package/dist/types.d.ts +34 -1
- package/package.json +3 -3
- package/dist/chunk-QDVE7MT3.js +0 -5
- package/dist/page-map-generator-HROGGVAQ.js +0 -1
- package/dist/rails-map-generator-DF2YAXW4.js +0 -1
package/dist/chunk-QDVE7MT3.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {parseSync}from'@swc/core';import D from'fast-glob';import*as x from'path';import*as b from'fs';import*as Q from'fs/promises';import {parse}from'graphql';var v=class{config;basePath;constructor(e){this.config=e,this.basePath=e.path;}resolvePath(e){return `${this.basePath}/${e}`}getSetting(e,t=""){return this.config.settings[e]??t}log(e){process.env.REPOMAP_VERBOSE==="1"&&console.log(`[${this.getName()}] ${e}`);}warn(e){console.warn(`\u26A0\uFE0F ${e}`);}error(e,t){console.error(`\u274C ${e}`,t?.message||"");}};var z=["useQuery","useLazyQuery","useSuspenseQuery","useBackgroundQuery","useReadQuery"],W=["useMutation"],le=["useSubscription","useFragment","useApolloClient"],q=[...z,...W,...le],j={useQuery:"useQuery",useSuspenseQuery:"useQuery",useBackgroundQuery:"useQuery",useReadQuery:"useQuery",useLazyQuery:"useLazyQuery",useMutation:"useMutation",useSubscription:"useSubscription"},ue=["Document","useQuery","useMutation","useLazyQuery","useSuspenseQuery","useBackgroundQuery","useSubscription","Query","Mutation","gql","graphql","GET_","FETCH_","SEARCH_","CREATE_","UPDATE_","DELETE_","SUBSCRIBE_","@apollo","ApolloClient"];function M(l){return z.includes(l)||/^use[A-Z].*Query$/.test(l)}function S(l){return W.includes(l)||/^use[A-Z].*Mutation$/.test(l)}function V(l){return l==="useSubscription"}function F(l){return q.includes(l)||M(l)||S(l)}function E(l){return j[l]?j[l]:l.includes("Mutation")?"useMutation":l.includes("Lazy")?"useLazyQuery":l.includes("Subscription")?"useSubscription":"useQuery"}function R(l){return ue.some(e=>l.includes(e))}function h(l){return l.replace(/^(GET_|FETCH_|CREATE_|UPDATE_|DELETE_)/,"").replace(/_QUERY$|_MUTATION$/,"").replace(/Document$/,"").replace(/Query$|Mutation$|Variables$|Subscription$/,"")}function ce(l){try{return parseSync(l,{syntax:"typescript",tsx:!0,comments:!1})}catch{return null}}function d(l){return l?l.type==="Identifier"?l.value:l.type==="MemberExpression"&&l.property?.type==="Identifier"?l.property.value:null:null}function A(l,e){if(!(!l||typeof l!="object")){e(l);for(let t of Object.keys(l)){let r=l[t];if(Array.isArray(r))for(let s of r)A(s,e);else r&&typeof r=="object"&&A(r,e);}}}function L(l,e,t){let r={documentImports:new Map,variableOperations:new Map,staticPropertyOperations:new Map,codegenMap:t||new Map};return A(l,s=>{s.type==="ImportDeclaration"&&fe(s,r.documentImports),s.type==="VariableDeclarator"&&me(s,e,r.variableOperations),s.type==="AssignmentExpression"&&ge(s,e,r.staticPropertyOperations);}),r}function fe(l,e){let t=l.source?.value||"",r=t.includes("__generated__")||t.includes("generated")||t.includes("graphql")||t.includes(".generated")||t.endsWith(".graphql");for(let s of l.specifiers||[]){let i;(s.type==="ImportSpecifier"||s.type==="ImportDefaultSpecifier")&&(i=s.local?.value),i&&((i.endsWith("Document")||r)&&e.set(i,i.replace(/Document$/,"")),(i.endsWith("Query")||i.endsWith("Mutation"))&&e.set(i,i.replace(/Query$|Mutation$/,"")));}}function me(l,e,t){if(l.id?.type!=="Identifier")return;let r=l.id.value,s=l.init;if(!s)return;let i=null;if(s.type==="CallExpression"){let n=d(s.callee);(n==="gql"||n==="graphql")&&(i=O(s,e));}if(s.type==="TaggedTemplateExpression"){let n=d(s.tag);(n==="gql"||n==="graphql")&&(i=I(s.template));}if(s.type==="Identifier"){let n=s.value;if(n.endsWith("Document")||n.endsWith("Query")||n.endsWith("Mutation")){t.set(r,n);return}}i&&t.set(r,i);}function ge(l,e,t){if(l.left?.type!=="MemberExpression")return;let r=l.left.object,s=l.left.property;if(r?.type!=="Identifier"||s?.type!=="Identifier")return;let i=`${r.value}.${s.value}`,n=l.right;if(!n)return;let a=null;if(n.type==="CallExpression"){let o=d(n.callee);(o==="gql"||o==="graphql")&&(a=O(n,e));}if(n.type==="TaggedTemplateExpression"){let o=d(n.tag);(o==="gql"||o==="graphql")&&(a=I(n.template));}a&&t.set(i,a);}function O(l,e){if(!l.arguments?.length)return null;let t=l.arguments[0],r=t?.expression||t;if(r?.type==="TemplateLiteral")return I(r);if(l.span){let i=e.slice(l.span.start,l.span.end).match(/(?:query|mutation|subscription)\s+(\w+)/i);if(i)return i[1]}return null}function I(l,e){if(!l?.quasis?.[0])return null;let r=(l.quasis[0].raw||l.quasis[0].cooked||"").match(/(?:query|mutation|subscription)\s+(\w+)/i);return r?r[1]:null}function U(l,e,t){if(!l.arguments?.length)return false;let r=l.arguments[0],s=r?.expression||r;if(!s)return false;if(l.typeArguments?.params?.length>0){let n=l.typeArguments.params[0];if(n?.type==="TsTypeReference"&&n.typeName?.type==="Identifier"){let a=n.typeName.value;if(/Query$|Mutation$|Subscription$|Document$/.test(a))return true}}if(s.type==="Identifier"){let n=s.value;if(t.documentImports.has(n)||t.variableOperations.has(n)||n.endsWith("Document")||/^[A-Z][a-zA-Z0-9]*Query$/.test(n)||/^[A-Z][a-zA-Z0-9]*Mutation$/.test(n)||/^[A-Z][A-Z0-9_]*_QUERY$/.test(n)||/^[A-Z][A-Z0-9_]*_MUTATION$/.test(n))return true}if(s.type==="TaggedTemplateExpression"){let n=d(s.tag);if(n==="gql"||n==="graphql")return true}if(s.type==="CallExpression"){let n=d(s.callee);if(n==="gql"||n==="graphql")return true}if(s.type==="TemplateLiteral"&&s.quasis?.[0]?.raw){let n=s.quasis[0].raw;if(/(?:query|mutation|subscription)\s+\w+/i.test(n))return true}if(s.type==="MemberExpression"){let n=s.property?.value;if(n&&/Query$|Mutation$|Document$/.test(n))return true;let a=s.object?.type==="Identifier"?s.object.value:null;if(a&&n){let o=`${a}.${n}`;if(t.staticPropertyOperations.has(o))return true}}let i=l.span;if(i){let n=e.slice(i.start,Math.min(i.end,i.start+500));if(/\bDocument\b/.test(n)||/\bgql\s*[`(]/.test(n)||/\bgraphql\s*[`(]/.test(n)||/query\s+[A-Z]\w+\s*[({]/.test(n)||/mutation\s+[A-Z]\w+\s*[({]/.test(n))return true}return false}function k(l,e,t){let r=he(l,e);if(r)return r;if(l.arguments?.length>0){let s=l.arguments[0],i=s?.expression||s;if(i){let n=H(i,e,t);if(n)return n}}return null}function he(l,e){if(l.typeArguments?.params?.length>0){let t=l.typeArguments.params[0];if(t?.type==="TsTypeReference"&&t.typeName?.type==="Identifier")return h(t.typeName.value)}if(l.callee?.span&&l.span){let t=l.callee.span.end,r=Math.min(t+150,l.span.end),i=e.slice(t,r).match(/^<\s*(\w+)(?:Query|Mutation|Variables|Subscription)?[\s,>]/);if(i)return h(i[1])}return null}function H(l,e,t){if(l.type==="Identifier")return Z(l.value,t);if(l.type==="MemberExpression")return ye(l,t);if(l.type==="TaggedTemplateExpression"){let r=d(l.tag);if(r==="gql"||r==="graphql")return I(l.template)}if(l.type==="TemplateLiteral")return I(l);if(l.type==="CallExpression"){let r=d(l.callee);if(r==="gql"||r==="graphql")return O(l,e)}return l.type==="ObjectExpression"?B(l,e,t):null}function Z(l,e){let t=e.variableOperations.get(l);if(t)return e.variableOperations.has(t)?Z(t,e):t.endsWith("Document")||t.endsWith("Query")||t.endsWith("Mutation")?e.documentImports.get(t)||h(t):t;let r=e.documentImports.get(l);if(r)return r;let s=e.codegenMap.get(l);return s?s.operationName:/^(Query|Mutation|QUERY|MUTATION|Document)$/i.test(l)?null:h(l)}function ye(l,e){let t=l.object?.type==="Identifier"?l.object.value:null,r=l.property?.type==="Identifier"?l.property.value:null;if(!r)return null;if(t){let s=`${t}.${r}`,i=e.staticPropertyOperations.get(s);if(i)return i}return h(r)}function B(l,e,t){for(let r of l.properties||[])if(r.type==="KeyValueProperty"&&r.key?.type==="Identifier"&&r.key.value==="query")return H(r.value,e,t);return null}function we(l,e){let t=[],r=new Set;if(!R(l))return t;let s=ce(l);if(!s)return t;let i=L(s,l,e);return A(s,n=>{if(n.type!=="CallExpression")return;let a=d(n.callee);if(a){if(F(a)){let o=k(n,l,i),p=E(a),c=`${p}:${o||"unknown"}`;r.has(c)||(r.add(c),t.push({operationName:o||"unknown",hookName:a,type:p}));}if((a==="query"||a==="mutate")&&n.arguments?.length>0){let o=n.arguments[0],p=o?.expression||o;if(p?.type==="ObjectExpression"){let c=B(p,l,i),u=a==="mutate"?"useMutation":"useQuery",f=`${u}:${c||"unknown"}`;c&&!r.has(f)&&(r.add(f),t.push({operationName:c,hookName:`client.${a}`,type:u}));}}}}),t}function Ie(l){return `${{useQuery:"Query",useLazyQuery:"Query",useMutation:"Mutation",useSubscription:"Subscription"}[l.type]||"Query"}: ${l.operationName}`}async function N(l,e,t=8){let r=new Array(l.length).fill(null),s=0;async function i(){for(;s<l.length;){let a=s++;if(a<l.length)try{r[a]=await e(l[a],a);}catch{r[a]=null;}}}let n=Array(Math.min(t,l.length)).fill(null).map(()=>i());return await Promise.all(n),r.filter(a=>a!==null)}var K=class extends v{codegenMap=new Map;constructor(e){super(e);}getName(){return "PagesAnalyzer"}async analyze(){this.log("Starting page analysis..."),await this.loadCodegenMapping();let e=await this.findPageFiles();this.log(`Found ${e.length} page files`);let t=50,r=new Map;for(let n=0;n<e.length;n+=t){let a=e.slice(n,n+t),o=await Promise.all(a.map(async p=>{try{let c=await Q.readFile(p,"utf-8");return {filePath:p,content:c}}catch{return null}}));for(let p of o)p&&r.set(p.filePath,p.content);}let i=(await N(e,async n=>{let a=r.get(n);if(!a)return null;let o=this.detectPagesRoot(n);return this.analyzePageFile(n,a,o)},8)).filter(n=>n!==null);return this.log(`Analyzed ${i.length} pages successfully`),{pages:i}}async loadCodegenMapping(){let e=await D(["**/__generated__/graphql.ts","**/__generated__/gql.ts","**/generated/graphql.ts","**/generated/gql.ts","**/*.generated.ts","**/graphql.ts"],{cwd:this.basePath,ignore:["**/node_modules/**","**/.next/**","**/dist/**","**/build/**"],absolute:true});for(let t of e)try{let r=await Q.readFile(t,"utf-8"),s=x.relative(this.basePath,t);if(!r.includes("DocumentNode"))continue;let i=r.split(`
|
|
2
|
-
`);for(let n of i){if(!n.includes("Document")||!n.includes("="))continue;let a=[/export\s+const\s+(\w+Document)\s*=/,/export\s+const\s+(\w+):\s*DocumentNode\s*=/,/const\s+(\w+Document)\s*=.*DocumentNode/];for(let o of a){let p=n.match(o);if(!p)continue;let c=p[1],u=c.replace(/Document$/,""),f="query";n.includes('"mutation"')||c.toLowerCase().includes("mutation")?f="mutation":(n.includes('"subscription"')||c.toLowerCase().includes("subscription"))&&(f="subscription"),this.codegenMap.set(c,{operationName:u,operationType:f});break}}this.codegenMap.size>0&&this.log(`Loaded ${this.codegenMap.size} codegen mappings from ${s}`);}catch{}}analyzePageFile(e,t,r){try{let s=e.endsWith(".tsx")||e.endsWith(".jsx"),i=parseSync(t,{syntax:e.endsWith(".ts")||e.endsWith(".tsx")?"typescript":"ecmascript",tsx:s,jsx:s,comments:!1}),n=x.relative(r,e),a=this.filePathToRoutePath(n),o=this.findPageComponent(i,t);if(!o)return null;let p=this.extractRouteParams(a),c=this.extractImports(i),u=this.extractLayout(i,t),f=this.extractAuthRequirement(i,t,e),m=this.extractPermissions(t),g=this.extractDataFetching(i,t,c),y=this.extractLinkedPages(i,t),C=this.extractNavigation(t),w=this.extractSteps(t);return {path:a,filePath:n,component:o,params:p,layout:u,authentication:f,permissions:m,dataFetching:g,navigation:C,linkedPages:y,steps:w.length>0?w:void 0}}catch{return null}}async findPageFiles(){let e=this.getSetting("pagesDir","src/pages"),t=[],s=[...new Set([e,"pages","src/pages","app","src/app"])];for(let n of s){if(n==="app"||n==="src/app"){let o=["controllers","models","views","helpers"],p=this.resolvePath(n);if(o.some(u=>{try{return b.existsSync(x.join(p,u))}catch{return false}}))continue}let a=this.resolvePath(n);try{let o=await D(["**/*.tsx","**/*.ts","**/*.jsx","**/*.js"],{cwd:a,ignore:["_app.tsx","_app.ts","_app.jsx","_app.js","_document.tsx","_document.ts","_error.tsx","api/**","**/*.test.*","**/*.spec.*","**/node_modules/**","**/components/pages/**"],absolute:!0});t.push(...o),o.length>0&&this.log(`Found ${o.length} pages in ${n}`);}catch{}}let i=["frontend/src/**/pages","app/javascript/**/pages"];for(let n of i)try{let a=await D([`${n}/**/*.tsx`,`${n}/**/*.ts`,`${n}/**/*.jsx`,`${n}/**/*.js`],{cwd:this.basePath,ignore:["**/*.test.*","**/*.spec.*","**/node_modules/**","**/components/pages/**"],absolute:!0});t.push(...a);}catch{}if(t.length===0){let n=await this.findSPARoutes();n.length>0&&(this.log(`Found ${n.length} SPA routes from App.tsx`),t.push(...n));}return [...new Set(t)]}async findSPARoutes(){let e=[],t=["src/App.tsx","src/App.jsx","src/App.js","App.tsx","App.jsx","App.js"];for(let r of t){let s=this.resolvePath(r);if(b.existsSync(s))try{let i=await Q.readFile(s,"utf-8");if(!i.includes("react-router")&&!i.includes("Route"))continue;let n=parseSync(i,{syntax:"typescript",tsx:!0}),a=this.extractImports(n);this.traverseNode(n,o=>{if(o.type==="JSXOpeningElement"){let p=this.getJsxTagName(o);if(p==="Route"||p==="PrivateRoute"){let c=this.getJsxAttribute(o,"component"),u=this.getJsxAttribute(o,"element"),f=c||u,m=f?a.get(f):void 0;if(m){let g=this.resolveImportPath(x.dirname(s),m);g&&b.existsSync(g)&&e.push(g);}}}}),e.length>0&&e.push(s);}catch{}}return e}resolveImportPath(e,t){if(!t.startsWith("."))return null;let r=[".tsx",".ts",".jsx",".js","/index.tsx","/index.ts","/index.jsx","/index.js"],s=x.resolve(e,t);for(let i of r){let n=s+i;if(b.existsSync(n))return n}if(b.existsSync(s)&&b.statSync(s).isDirectory())for(let i of ["/index.tsx","/index.ts","/index.jsx","/index.js"]){let n=s+i;if(b.existsSync(n))return n}return null}detectPagesRoot(e){let t=["/src/pages/","/pages/","/src/app/","/app/","/frontend/src/pages/","/app/javascript/pages/"];for(let r of t){let s=e.indexOf(r);if(s!==-1)return e.substring(0,s+r.length-1)}return this.basePath}filePathToRoutePath(e){return "/"+e.replace(/\.tsx?$/,"").replace(/\.jsx?$/,"").replace(/\/index$/,"").replace(/\[\.\.\.(\w+)\]/g,"*").replace(/\[(\w+)\]/g,":$1")}extractRouteParams(e){let t=[],r=e.match(/:(\w+)/g);if(r)for(let s of r)t.push(s.slice(1));return t}findPageComponent(e,t){let r=this.findMainJsxComponent(e,t);if(r&&r!=="Page"&&r!=="default")return r;for(let s of e.body){if(s.type==="ExportDefaultDeclaration"){let i=s.decl;if(i?.type==="FunctionExpression"&&i.identifier?.value){let n=i.identifier.value;if(n!=="Page")return n}if(i?.type==="Identifier"){let n=i.value;if(n!=="Page")return n}if(i?.type==="ArrowFunctionExpression")return r||"default"}if(s.type==="ExportDefaultExpression"){let i=s.expression;if(i?.type==="Identifier"){let n=i.value;if(n!=="Page")return n}}}if(r)return r;for(let s of e.body)if(s.type==="VariableDeclaration"){for(let i of s.declarations)if(i.id?.type==="Identifier"&&i.id.value==="Page")return "Page"}for(let s of e.body)if(s.type==="ExportDeclaration"&&s.declaration?.type==="FunctionDeclaration"){let i=s.declaration.identifier?.value;if(i&&/^[A-Z]/.test(i))return i}for(let s of e.body){if(s.type==="FunctionDeclaration"){let i=s.identifier?.value;if(i&&/^[A-Z]/.test(i))return i}if(s.type==="VariableDeclaration"){for(let i of s.declarations)if(i.id?.type==="Identifier"){let n=i.id.value;if(n&&/^[A-Z]/.test(n)&&t.includes("return")&&t.includes("<"))return n}}}return null}findMainJsxComponent(e,t){let r=this.extractImports(e),s=new Set;for(let[a,o]of r)/^[A-Z]/.test(a)&&(o.includes("features")||o.includes("components")||o.includes("containers"))&&s.add(a);let i=[];for(let a of s){let o=new RegExp(`<${a}[\\s/>]`,"g"),p;for(;(p=o.exec(t))!==null;)i.push({name:a,index:p.index});}let n=i.find(a=>a.name.includes("Container")||a.name.includes("Page")||a.name.includes("View")||a.name.includes("Screen"));return n?n.name:i.length>0?(i.sort((a,o)=>a.index-o.index),i[0].name):null}extractImports(e){let t=new Map;for(let r of e.body)if(r.type==="ImportDeclaration"){let s=r.source?.value||"";for(let i of r.specifiers||[])i.type==="ImportSpecifier"&&i.local?.value&&t.set(i.local.value,s),i.type==="ImportDefaultSpecifier"&&i.local?.value&&t.set(i.local.value,s);}return t}extractLayout(e,t){if(t.includes("getLayout")){let r=t.match(/getLayout\s*=.*?<(\w+Layout|\w+Shell)/);if(r)return r[1]}}extractAuthRequirement(e,t,r){let s=x.basename(r),a={required:!["404.tsx","permission-denied.tsx","_app.tsx","_document.tsx","_error.tsx"].some(p=>s===p)},o=["RequiredCondition","ProtectedRoute","AuthGuard","PrivateRoute","WithAuth","RequireAuth","Authenticated","Authorized"];for(let p of o)if(t.includes(`<${p}`)){a.condition="Additional permissions required";let c=this.extractRolesFromContent(t);c.length>0&&(a.roles=c);break}return a}extractRolesFromContent(e){let t=[];this.traverseNode({content:e},()=>{});let r=e.matchAll(/(\w+Role|\w+Permission)\.(\w+)/g);for(let s of r)t.push(s[2]);return [...new Set(t)]}extractPermissions(e){let t=[],r=e.matchAll(/(?:Permission|Role|isAdmin)\.\w+/g);for(let s of r)t.includes(s[0])||t.push(s[0]);return t}extractDataFetching(e,t,r){let s=[],i=new Set,n=new Map;for(let[o,p]of this.codegenMap)n.set(o,{operationName:p.operationName,type:p.operationType});let a=L(e,t,n);if(A(e,o=>{if(o.type==="CallExpression"){let p=o,c=d(p.callee);if(!c)return;if(F(c)&&U(p,t,a)){let u=k(p,t,a),m={type:E(c),operationName:u||"unknown"},g=this.extractVariablesFromCall(p);Object.keys(g).length>0&&(m.variables=g);let y=`${m.type}:${m.operationName}`;i.has(y)||(i.add(y),s.push(m));}if(c==="query"||c==="mutate"){let u=this.analyzeClientDirectCall(p,t,a);if(u){let f=`${u.type}:${u.operationName}`;i.has(f)||(i.add(f),s.push(u));}}}}),this.extractSSRDataFetching(e,t,s,i),t.includes("getStaticProps")){let o="getStaticProps:getStaticProps";i.has(o)||(i.add(o),s.push({type:"getStaticProps",operationName:"getStaticProps"}));}return s}analyzeClientDirectCall(e,t,r){if(!e.arguments?.length)return null;let s=e.arguments[0],i=s?.expression||s;if(i?.type!=="ObjectExpression")return null;for(let n of i.properties||[])if(n.type==="KeyValueProperty"&&n.key?.type==="Identifier"&&n.key.value==="query"){let a=n.value,o=null;if(a?.type==="Identifier"){let p=a.value;o=r.variableOperations.get(p)||r.documentImports.get(p)||h(p);}if(a?.type==="MemberExpression"){let p=a.object?.type==="Identifier"?a.object.value:null,c=a.property?.type==="Identifier"?a.property.value:null;if(p&&c){let u=`${p}.${c}`;o=r.staticPropertyOperations.get(u)||h(c);}}if(o)return {type:d(e.callee)==="mutate"?"useMutation":"useQuery",operationName:o}}return null}extractDocumentImports(e){let t=new Map;for(let r of e.body)if(r.type==="ImportDeclaration"){let s=r.source?.value||"",i=s.includes("__generated__")||s.includes("generated")||s.includes("graphql")||s.includes(".generated");for(let n of r.specifiers||[]){let a=n.type==="ImportSpecifier"||n.type==="ImportDefaultSpecifier"?n.local?.value:null;if(a){if(a.endsWith("Document")||i){let o=a.replace(/Document$/,"");t.set(a,o);}(a.endsWith("Query")||a.endsWith("Mutation"))&&t.set(a,a.replace(/Query$|Mutation$/,""));}}}return t}extractVariableAssignments(e,t){let r=new Map;return this.traverseNode(e,s=>{if(s.type==="VariableDeclarator"&&s.id?.type==="Identifier"){let i=s.id.value,n=s.init;if(!n)return;if(n.type==="Identifier"){let a=n.value;(a.endsWith("Document")||a.endsWith("Query"))&&r.set(i,a);}if(n.type==="CallExpression"){let a=this.getCalleeName(n.callee);if(a==="gql"||a==="graphql"){let o=this.extractOperationNameFromGqlCall(n,t);o&&r.set(i,o);}}if(n.type==="TaggedTemplateExpression"){let a=this.getCalleeName(n.tag);if(a==="gql"||a==="graphql"){let o=n.template;if(o?.quasis?.[0]?.raw){let c=o.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);c&&r.set(i,c[1]);}}}}}),r}extractOperationNameFromGqlCall(e,t){if(!e.arguments?.length)return null;let r=e.arguments[0],s=r?.expression||r;if(s?.type==="TemplateLiteral"&&s.quasis?.[0]?.raw){let n=s.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);if(n)return n[1]}if(e.span){let n=t.slice(e.span.start,e.span.end).match(/(?:query|mutation|subscription)\s+(\w+)/i);if(n)return n[1]}return null}analyzeGraphQLHookCall(e,t,r,s){let i=this.getCalleeName(e.callee);if(!i)return null;let n=q.includes(i),a=M(i)&&!i.includes("Params"),o=S(i);if(!n&&!a&&!o)return null;let p=E(i),c=i.replace(/^use/,"").replace(/Query$|Mutation$/,""),u=this.extractTypeGeneric(e,t);if(u&&(c=u.replace(/Query$|Mutation$|Variables$/,"")),e.arguments&&e.arguments.length>0){let m=e.arguments[0],g=m?.expression||m,y=this.extractOperationFromArgument(g,r,s);y&&(c=y);}let f=this.extractVariablesFromCall(e);return {type:p,operationName:c,variables:f}}extractTypeGeneric(e,t){if(e.typeArguments?.params?.length>0){let r=e.typeArguments.params[0];if(r?.type==="TsTypeReference"&&r.typeName?.type==="Identifier")return r.typeName.value}if(e.callee?.span){let r=e.callee.span.end,i=t.slice(r,r+100).match(/^<(\w+)(?:Query|Mutation|Variables)?[,>]/);if(i)return i[1]}return null}extractOperationFromArgument(e,t,r){if(!e)return null;if(e.type==="Identifier"){let s=e.value;if(["[","{","'",'"',"`"].some(o=>s.startsWith(o)))return null;let i=r.get(s);if(i)return !i.endsWith("Document")&&!i.endsWith("Query")?i:t.get(i)||i.replace(/Document$/,"");let n=t.get(s);if(n)return n;let a=this.codegenMap.get(s);return a?a.operationName:/^(Query|Mutation|QUERY|MUTATION)$/i.test(s)?null:s.replace(/Document$/,"").replace(/Query$|Mutation$/,"")}if(e.type==="MemberExpression"&&e.property?.type==="Identifier")return e.property.value.replace(/Document$/,"").replace(/Query$|Mutation$/,"");if(e.type==="TaggedTemplateExpression"&&e.template?.quasis?.[0]?.raw){let i=e.template.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);if(i)return i[1]}if(e.type==="CallExpression"){let s=this.getCalleeName(e.callee);if((s==="graphql"||s==="gql")&&e.arguments?.length>0){let i=e.arguments[0],n=i?.expression||i;if(n?.type==="TemplateLiteral"&&n.quasis?.[0]?.raw){let o=n.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);if(o)return o[1]}}}if(e.type==="TemplateLiteral"&&e.quasis?.[0]?.raw){let i=e.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);if(i)return i[1]}return null}extractVariablesFromCall(e){let t=[];if(e.arguments&&e.arguments.length>1){let r=e.arguments[1],s=r?.expression||r;if(s?.type==="ObjectExpression"){for(let i of s.properties||[])if(i.type==="KeyValueProperty"&&i.key?.type==="Identifier"&&i.key.value==="variables"&&i.value?.type==="ObjectExpression")for(let n of i.value.properties||[])n.type==="KeyValueProperty"&&n.key?.type==="Identifier"?t.push(n.key.value):n.type==="Identifier"&&t.push(n.value);}}return t}extractSSRDataFetching(e,t,r,s){let i=this.extractImports(e),n=this.extractDocumentImports(e);for(let a of e.body)if(a.type==="ExportDeclaration"){let o=a.declaration;if(o?.type==="VariableDeclaration")for(let p of o.declarations)p.id?.type==="Identifier"&&p.id.value==="getServerSideProps"&&this.extractSSRQueriesFromNode(p,t,i,n,r,s);o?.type==="FunctionDeclaration"&&o.identifier?.value==="getServerSideProps"&&this.extractSSRQueriesFromNode(o,t,i,n,r,s);}}extractSSRQueriesFromNode(e,t,r,s,i,n){A(e,a=>{if(a.type!=="CallExpression")return;let o=d(a.callee);if(o==="query"||o==="mutate"){let p=this.extractQueryFromClientCall(a,t,r,s);if(p){let c=`getServerSideProps:\u2192 ${p}`;n.has(c)||(n.add(c),i.push({type:"getServerSideProps",operationName:`\u2192 ${p}`}));}}});}extractQueryFromClientCall(e,t,r,s){if(!e.arguments?.length)return null;let i=e.arguments[0],n=i?.expression||i;if(n?.type!=="ObjectExpression")return null;for(let a of n.properties||[])if(a.type==="KeyValueProperty"&&a.key?.type==="Identifier"&&a.key.value==="query"){let o=a.value;if(o?.type==="Identifier"){let p=o.value;if(s.has(p))return s.get(p);let c=this.codegenMap.get(p);return c?c.operationName:r.get(p)?h(p):h(p)}if(o?.type==="MemberExpression"){let p=o.object?.type==="Identifier"?o.object.value:null,c=o.property?.type==="Identifier"?o.property.value:null;if(p&&c)return `${p}.${c}`}}return null}extractNavigation(e){let t={visible:true,currentNavItem:null};(e.includes("hideNavigation")||e.includes("noNav"))&&(t.visible=false),(e.includes("miniNav")||e.includes("collapsedNav"))&&(t.mini=true);let r=e.match(/currentNav(?:Item)?[:\s=]+['"`]([^'"`]+)['"`]/);return r&&(t.currentNavItem=r[1]),t}extractLinkedPages(e,t){let r=[];return this.traverseNode(e,s=>{if(s.type==="JSXOpeningElement"&&this.getJsxTagName(s)==="Link"){let n=this.getJsxAttribute(s,"href");if(n&&n.startsWith("/")&&!n.includes("http")){let a=n.split("?")[0].split("#")[0];r.includes(a)||r.push(a);}}}),r}extractSteps(e){let t=[],r=e.matchAll(/(?:step|Step)\s*[:=]\s*['"`]([^'"`]+)['"`]/g),s=0;for(let i of r)t.push({id:s++,name:i[1]});return t}traverseNode(e,t){if(!(!e||typeof e!="object")){t(e);for(let r of Object.keys(e)){let s=e[r];if(Array.isArray(s))for(let i of s)this.traverseNode(i,t);else s&&typeof s=="object"&&this.traverseNode(s,t);}}}getCalleeName(e){if(e.type==="Identifier")return e.value;if(e.type==="MemberExpression"){let t=e.object,r=e.property;if(t.type==="Identifier"&&r.type==="Identifier")return `${t.value}.${r.value}`}return null}getJsxTagName(e){return e.name?.type==="Identifier"?e.name.value:null}getJsxAttribute(e,t){if(!e.attributes)return null;for(let r of e.attributes)if(r.type==="JSXAttribute"&&r.name?.value===t){if(r.value?.type==="StringLiteral")return r.value.value;if(r.value?.type==="JSXExpressionContainer"&&(r.value.expression?.type==="Identifier"||r.value.expression?.type==="StringLiteral"))return r.value.expression.value}return null}};var X=class extends v{constructor(e){super(e);}getName(){return "GraphQLAnalyzer"}async analyze(){this.log("Starting GraphQL analysis...");let e=[];this.log("[GraphQLAnalyzer] Step 1: Analyzing .graphql files...");let t=await this.analyzeGraphQLFiles();e.push(...t),this.log(`[GraphQLAnalyzer] Step 1 done: ${t.length} from .graphql files`),this.log("[GraphQLAnalyzer] Step 2: Analyzing inline GraphQL...");let r=await this.analyzeInlineGraphQL();e.push(...r),this.log(`[GraphQLAnalyzer] Step 2 done: ${r.length} inline operations`),this.log("[GraphQLAnalyzer] Step 3: Analyzing codegen output...");let s=await this.analyzeCodegenGenerated();e.push(...s),this.log(`[GraphQLAnalyzer] Step 3 done: ${s.length} from codegen`);let i=this.deduplicateOperations(e);return this.log(`[GraphQLAnalyzer] Deduplicated: ${i.length} unique operations`),this.log("[GraphQLAnalyzer] Step 4: Finding operation usage..."),await this.findOperationUsage(i),this.log("[GraphQLAnalyzer] Step 4 done"),this.log(`Found ${i.length} GraphQL operations`),{graphqlOperations:i}}deduplicateOperations(e){let t=new Map;for(let r of e)if(!t.has(r.name))t.set(r.name,r);else {let s=t.get(r.name);if(s)for(let i of r.usedIn)s.usedIn.includes(i)||s.usedIn.push(i);}return Array.from(t.values())}async analyzeCodegenGenerated(){let e=[],t=await D(["**/__generated__/graphql.ts","**/__generated__/gql.ts","**/generated/graphql.ts","**/generated/gql.ts","**/*.generated.ts","**/*.generated.tsx","**/graphql/generated.ts","**/gql/generated.ts"],{cwd:this.basePath,ignore:["**/node_modules/**","**/.next/**","**/dist/**","**/build/**"],absolute:true});for(let r of t)try{let s=await Q.readFile(r,"utf-8"),i=x.relative(this.basePath,r),n=s.split(`
|
|
3
|
-
`);for(let a of n){if(!a.includes("Document =")||!a.includes("DocumentNode"))continue;let o=a.match(/export\s+const\s+(\w+Document)\s*=\s*(\{"kind":"Document".+\})\s*as\s+unknown\s+as\s+DocumentNode/);if(!o)continue;let p=o[1],c=o[2];try{let u=JSON.parse(c);if(u.kind==="Document"&&u.definitions){let f=u.definitions[0];if(f?.kind==="OperationDefinition"){let m=f.name?.value||p.replace(/Document$/,""),g=f.operation,y=(f.variableDefinitions||[]).map(C=>({name:C.variable?.name?.value||"unknown",type:this.extractTypeFromAst(C.type),required:C.type?.kind==="NonNullType"}));e.push({name:m,type:g,filePath:i,usedIn:[],variables:y,returnType:this.inferReturnTypeFromAst(f),fragments:this.extractFragmentReferencesFromAst(f),fields:this.extractFieldsFromAst(f.selectionSet)});}}}catch{}}this.log(`Found ${e.length} operations in codegen output: ${i}`);}catch(s){this.warn(`Failed to analyze codegen file ${r}: ${s.message}`);}return e}extractTypeFromAst(e){return e?e.kind==="NonNullType"?`${this.extractTypeFromAst(e.type)}!`:e.kind==="ListType"?`[${this.extractTypeFromAst(e.type)}]`:e.kind==="NamedType"&&e.name?.value||"unknown":"unknown"}extractFieldsFromAst(e,t=0){if(!e?.selections||t>5)return [];let r=[];for(let s of e.selections)if(s.kind==="Field"){let i={name:s.name?.value||"unknown"};if(s.arguments?.length>0){let n=s.arguments.map(a=>a.name?.value).join(", ");i.type=`(${n})`;}s.selectionSet&&(i.fields=this.extractFieldsFromAst(s.selectionSet,t+1)),r.push(i);}else if(s.kind==="FragmentSpread")r.push({name:`...${s.name?.value}`,type:"fragment"});else if(s.kind==="InlineFragment"){let i=s.typeCondition?.name?.value||"inline";r.push({name:`... on ${i}`,type:"inline-fragment",fields:this.extractFieldsFromAst(s.selectionSet,t+1)});}return r}extractFragmentReferencesFromAst(e){let t=[],r=s=>{if(s&&(s.kind==="FragmentSpread"&&t.push(s.name?.value),s.selectionSet?.selections))for(let i of s.selectionSet.selections)r(i);};return r(e),t.filter(Boolean)}inferReturnTypeFromAst(e){if(e.selectionSet?.selections?.length>0){let t=e.selectionSet.selections[0];if(t.kind==="Field")return t.name?.value||"unknown"}return "unknown"}async analyzeGraphQLFiles(){let e=await D(["**/*.graphql"],{cwd:this.basePath,ignore:["**/node_modules/**","**/.next/**"],absolute:true});return (await N(e,async r=>{let s=await Q.readFile(r,"utf-8"),i=parse(s);return this.extractOperationsFromDocument(i,x.relative(this.basePath,r))})).flat()}async analyzeInlineGraphQL(){let e=[],t=await D(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx"],{cwd:this.basePath,ignore:["**/node_modules/**","**/.next/**","**/__tests__/**","**/*.test.*","**/*.spec.*","**/__generated__/**"],absolute:true}),r=50;for(let s=0;s<t.length;s+=r){let i=t.slice(s,s+r),n=await N(i,async a=>{try{let o=await Q.readFile(a,"utf-8");if(!o.includes("gql")&&!o.includes("graphql"))return [];let p=x.relative(this.basePath,a),c=a.endsWith(".tsx")||a.endsWith(".jsx"),u=parseSync(o,{syntax:a.endsWith(".ts")||a.endsWith(".tsx")?"typescript":"ecmascript",tsx:c,jsx:c});return this.analyzeModuleForGraphQL(u,o,p)}catch{return []}},10);e.push(...n.flat());}return e}analyzeModuleForGraphQL(e,t,r){let s=[],i=[];return this.traverseNodeWithContext(e,i,(n,a)=>{if(n.type==="TaggedTemplateExpression"){let o=n,p=this.getTagName(o.tag);if(p==="gql"||p==="graphql"){let c=this.extractTemplateContent(o.template,t);if(c)try{let u=parse(c),f=this.extractOperationsFromDocument(u,r);if(a)for(let m of f)m.variableNames=m.variableNames||[],m.variableNames.push(a),m.variableNames.push(`${m.name}Document`);s.push(...f);}catch{}}}if(n.type==="CallExpression"){let o=n,p=this.getCalleeName(o.callee);if((p==="gql"||p==="graphql")&&o.arguments.length>0){let c=o.arguments[0].expression,u=this.extractGraphQLFromExpression(c,t);if(u)try{let f=parse(u),m=this.extractOperationsFromDocument(f,r);if(a)for(let g of m)g.variableNames=g.variableNames||[],g.variableNames.push(a),g.variableNames.push(`${g.name}Document`);s.push(...m);}catch{}}}}),s}traverseNodeWithContext(e,t,r){if(!e||typeof e!="object")return;let s=false;e.type==="VariableDeclarator"&&e.id?.type==="Identifier"&&(t.push(e.id.value),s=true),r(e,t.length>0?t[t.length-1]:null);for(let i of Object.keys(e)){let n=e[i];if(Array.isArray(n))for(let a of n)this.traverseNodeWithContext(a,t,r);else n&&typeof n=="object"&&this.traverseNodeWithContext(n,t,r);}s&&t.pop();}getTagName(e){return e.type==="Identifier"?e.value:null}getCalleeName(e){return e.type==="Identifier"?e.value:null}extractTemplateContent(e,t){if(e.type==="TemplateLiteral"){if(e.quasis.length===1&&e.expressions.length===0)return e.quasis[0].raw;let r=e.span.start,s=e.span.end;return t.slice(r,s).slice(1,-1).replace(/\$\{[^}]*\}/g,"")}return null}extractGraphQLFromExpression(e,t){return e.type==="TemplateLiteral"?this.extractTemplateContent(e,t):e.type==="StringLiteral"?e.value:null}extractOperationsFromDocument(e,t){let r=[];for(let s of e.definitions){let i=this.extractOperation(s,t);i&&r.push(i);}return r}extractOperation(e,t){if(e.kind==="OperationDefinition"){let r=e.name?.value||"anonymous",s=e.operation,i=this.extractVariables(e),n=this.extractFragmentReferences(e),a=this.extractFields(e);return {name:r,type:s,filePath:t,usedIn:[],variables:i,returnType:this.inferReturnType(e),fragments:n,fields:a}}return e.kind==="FragmentDefinition"?{name:e.name.value,type:"fragment",filePath:t,usedIn:[],variables:[],returnType:e.typeCondition.name.value,fragments:this.extractFragmentReferences(e),fields:this.extractFields(e)}:null}extractFields(e){let t=[],r=(s,i=0)=>{if(!s||!s.selections||i>5)return [];let n=[];for(let a of s.selections)if(a.kind==="Field"){let o={name:a.name.value};if(a.arguments&&a.arguments.length>0){let p=a.arguments.map(c=>c.name.value).join(", ");o.type=`(${p})`;}a.selectionSet&&(o.fields=r(a.selectionSet,i+1)),n.push(o);}else if(a.kind==="FragmentSpread")n.push({name:`...${a.name.value}`,type:"fragment"});else if(a.kind==="InlineFragment"&&a.selectionSet){let o=a.typeCondition?.name?.value||"inline";n.push({name:`... on ${o}`,type:"inline-fragment",fields:r(a.selectionSet,i+1)});}return n};return e.selectionSet?r(e.selectionSet):t}extractVariables(e){let t=[];if(e.variableDefinitions)for(let r of e.variableDefinitions){let s=r.variable.name.value,i=this.typeNodeToString(r.type),n=r.type.kind==="NonNullType";t.push({name:s,type:i,required:n});}return t}typeNodeToString(e){return e.kind==="NonNullType"?`${this.typeNodeToString(e.type)}!`:e.kind==="ListType"?`[${this.typeNodeToString(e.type)}]`:e.kind==="NamedType"?e.name.value:"unknown"}extractFragmentReferences(e){let t=[],r=s=>{if(s&&(s.kind==="FragmentSpread"&&t.push(s.name.value),s.selectionSet))for(let i of s.selectionSet.selections)r(i);};return r(e),t}inferReturnType(e){if(e.selectionSet&&e.selectionSet.selections.length>0){let t=e.selectionSet.selections[0];if(t.kind==="Field")return t.name.value}return "unknown"}async findOperationUsage(e){if(e.length===0)return;let t=await D(["**/*.ts","**/*.tsx"],{cwd:this.basePath,ignore:["**/node_modules/**","**/.next/**","**/__generated__/**","**/dist/**","**/build/**"],absolute:true}),r=new Map,s=new Map,i=new Map,n=new Map;for(let u of e)if(r.set(u.name,u),s.set(`${u.name}Document`,u),n.set(`${u.name}Query`,u),n.set(`${u.name}Mutation`,u),n.set(`${u.name}Subscription`,u),n.set(`${u.name}QueryVariables`,u),n.set(`${u.name}MutationVariables`,u),u.variableNames)for(let f of u.variableNames)i.set(f,u);let a=new Set;for(let u of e)if(a.add(u.name),a.add(`${u.name}Document`),a.add(`${u.name}Query`),a.add(`${u.name}Mutation`),a.add(`${u.name}Subscription`),u.variableNames)for(let f of u.variableNames)a.add(f);let o=null,p=Array.from(a);if(p.length>0&&p.length<2e3){let u=p.sort((f,m)=>m.length-f.length).map(f=>f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));o=new RegExp(`\\b(${u.join("|")})\\b`,"g");}let c=50;for(let u=0;u<t.length;u+=c){let f=t.slice(u,u+c);await Promise.all(f.map(async m=>{try{let g=await Q.readFile(m,"utf-8"),y=x.relative(this.basePath,m);if(!R(g))return;if(o){let C=new Set,w;for(;(w=o.exec(g))!==null;)C.add(w[1]);o.lastIndex=0;for(let oe of C){let P=s.get(oe);P&&y!==P.filePath&&(P.usedIn.includes(y)||P.usedIn.push(y));}}await this.findUsageWithAST(g,m,y,r,n);}catch{}}));}}async findUsageWithAST(e,t,r,s,i){try{let n=t.endsWith(".tsx")||t.endsWith(".jsx"),a=parseSync(e,{syntax:t.endsWith(".ts")||t.endsWith(".tsx")?"typescript":"ecmascript",tsx:n,jsx:n,comments:!1});this.traverseNodeForUsage(a,e,o=>{if(o.type==="CallExpression"){let p=this.getCalleeNameForUsage(o.callee);if(p&&F(p)){let c=this.extractTypeGenericFromCall(o,e);if(c){let f=i.get(c)||s.get(c.replace(/Query$|Mutation$|Variables$/,""));f&&r!==f.filePath&&(f.usedIn.includes(r)||f.usedIn.push(r));}let u=this.extractFirstArgName(o);if(u){let f=u.replace(/Document$/,""),m=s.get(f)||i.get(u);m&&r!==m.filePath&&(m.usedIn.includes(r)||m.usedIn.push(r));}}}});}catch{}}traverseNodeForUsage(e,t,r){if(!(!e||typeof e!="object")){r(e);for(let s of Object.keys(e)){let i=e[s];if(Array.isArray(i))for(let n of i)this.traverseNodeForUsage(n,t,r);else i&&typeof i=="object"&&this.traverseNodeForUsage(i,t,r);}}}getCalleeNameForUsage(e){return e?e.type==="Identifier"?e.value:e.type==="MemberExpression"&&e.property?.type==="Identifier"?e.property.value:null:null}extractTypeGenericFromCall(e,t){if(e.typeArguments?.params?.length>0){let r=e.typeArguments.params[0];if(r?.type==="TsTypeReference"&&r.typeName?.type==="Identifier")return r.typeName.value}if(e.callee?.span){let r=e.callee.span.end,i=t.slice(r,r+150).match(/^<\s*(\w+)(?:Query|Mutation|Variables|Subscription)?(?:\s*,|\s*>)/);if(i)return i[1]}return null}extractFirstArgName(e){if(e.arguments?.length>0){let t=e.arguments[0].expression;if(t?.type==="Identifier")return t.value;if(t?.type==="MemberExpression"&&t.property?.type==="Identifier")return t.property.value}return null}};var te=class extends v{componentCache=new Map;constructor(e){super(e);}getName(){return "DataFlowAnalyzer"}async analyze(){this.log("Starting data flow analysis...");let e=await this.analyzeComponents(),t=await this.analyzeDataFlows(e);return this.log(`Analyzed ${e.length} components and ${t.length} data flows`),{components:e,dataFlows:t}}async analyzeComponents(){let e=[],t=[this.getSetting("featuresDir",""),this.getSetting("componentsDir",""),this.getSetting("pagesDir","")].filter(Boolean),r=["src/features","src/components","src/common/components","src/common","src/pages","src/app","src/modules","src/views","src/screens","components","pages","app"],i=[...new Set([...t,...r])].flatMap(o=>[`${o}/**/*.tsx`,`${o}/**/*.ts`]),n=await D(i,{cwd:this.basePath,ignore:["**/*.test.*","**/*.spec.*","**/*.stories.*","**/node_modules/**","**/__generated__/**"],absolute:true,onlyFiles:true,unique:true});this.log(`[DataFlowAnalyzer] Found ${n.length} component files to analyze`);let a=50;for(let o=0;o<n.length;o+=a){let p=n.slice(o,o+a),c=await Promise.all(p.map(async u=>{try{let f=await Q.readFile(u,"utf-8");return {filePath:u,content:f}}catch{return null}}));for(let u of c)if(u)try{let f=parseSync(u.content,{syntax:"typescript",tsx:!0,comments:!1}),m=x.relative(this.basePath,u.filePath),g=this.analyzeComponentFile(f,m,u.content);e.push(...g);}catch{}}return this.log(`[DataFlowAnalyzer] Extracted ${e.length} components`),this.buildDependencyGraph(e),e}analyzeComponentFile(e,t,r){let s=[],i=this.extractImports(e);for(let n of e.body){if(n.type==="ExportDeclaration"&&n.declaration?.type==="FunctionDeclaration"){let a=n.declaration.identifier?.value;if(a&&this.isComponentName(a)){let o=this.extractComponentInfo(a,t,r,i);s.push(o),this.componentCache.set(a,o);}}if(n.type==="FunctionDeclaration"){let a=n.identifier?.value;if(a&&this.isComponentName(a)){let o=this.extractComponentInfo(a,t,r,i);s.push(o),this.componentCache.set(a,o);}}if(n.type==="ExportDefaultDeclaration"&&n.decl?.type==="FunctionExpression"){let a=n.decl.identifier?.value;if(a&&this.isComponentName(a)){let o=this.extractComponentInfo(a,t,r,i);s.push(o),this.componentCache.set(a,o);}}if(n.type==="VariableDeclaration"){for(let a of n.declarations)if(a.id?.type==="Identifier"){let o=a.id.value;if(o&&(this.isComponentName(o)||o.startsWith("use"))&&a.init&&(a.init.type==="ArrowFunctionExpression"||a.init.type==="FunctionExpression")){let p=this.extractComponentInfo(o,t,r,i);s.push(p),this.componentCache.set(o,p);}}}if(n.type==="ExportDeclaration"&&n.declaration?.type==="VariableDeclaration"){for(let a of n.declaration.declarations)if(a.id?.type==="Identifier"){let o=a.id.value;if(o&&(this.isComponentName(o)||o.startsWith("use"))&&a.init&&(a.init.type==="ArrowFunctionExpression"||a.init.type==="FunctionExpression")){let p=this.extractComponentInfo(o,t,r,i);s.push(p),this.componentCache.set(o,p);}}}}return s}extractImports(e){let t=new Map;for(let r of e.body)if(r.type==="ImportDeclaration"){let s=r.source?.value||"";if(s.startsWith(".")||s.startsWith("@/"))for(let i of r.specifiers||[])i.type==="ImportSpecifier"&&i.local?.value&&t.set(i.local.value,s),i.type==="ImportDefaultSpecifier"&&i.local?.value&&t.set(i.local.value,s);}return t}isComponentName(e){return /^[A-Z][a-zA-Z0-9]*$/.test(e)}extractComponentInfo(e,t,r,s){let i="presentational";["/pages/","/app/","/routes/","/views/","/screens/"].some(u=>t.includes(u))?i="page":e.includes("Container")||e.includes("Provider")?i="container":e.includes("Layout")||e.includes("Shell")||e.includes("Wrapper")||e.includes("Frame")||e.includes("Scaffold")||t.includes("/layouts/")||t.includes("/layout/")?i="layout":e.startsWith("use")&&(i="hook");let a=this.extractHooksUsed(r),o=Array.from(s.keys()).filter(u=>this.isComponentName(u)||u.startsWith("use")),p=[];for(let[u,f]of s)p.push({name:u,path:f});let c=this.extractStateManagement(r);return {name:e,filePath:t,type:i,props:[],dependencies:o,dependents:[],hooks:a,stateManagement:c,imports:p}}extractHooksUsed(e){let t=[],r=new Set;if(!e.includes("use"))return t;try{let s=parseSync(e,{syntax:"typescript",tsx:!0,comments:!1}),i=this.extractDocumentImportsFromAst(s),n=this.extractVariableOperationMap(s,e);this.traverseForHooks(s,e,i,n,t,r);}catch{this.extractHooksWithRegex(e,t,r);}return t}extractDocumentImportsFromAst(e){let t=new Map;for(let r of e.body)if(r.type==="ImportDeclaration"){let s=r.source?.value||"",i=s.includes("__generated__")||s.includes("generated")||s.includes("graphql")||s.includes(".generated");for(let n of r.specifiers||[]){let a;(n.type==="ImportSpecifier"||n.type==="ImportDefaultSpecifier")&&(a=n.local?.value),a&&((a.endsWith("Document")||i)&&t.set(a,a.replace(/Document$/,"")),(a.endsWith("Query")||a.endsWith("Mutation"))&&t.set(a,a.replace(/Query$|Mutation$/,"")));}}return t}extractVariableOperationMap(e,t){let r=new Map,s=n=>{if(n.type!=="VariableDeclarator"||n.id?.type!=="Identifier")return;let a=n.id.value,o=n.init;if(o){if(o.type==="CallExpression"){let p=this.getCalleeNameFromNode(o.callee);if(p==="gql"||p==="graphql"){let c=this.extractOperationNameFromGqlCall(o,t);c&&r.set(a,c);}}if(o.type==="TaggedTemplateExpression"){let p=this.getCalleeNameFromNode(o.tag);if((p==="gql"||p==="graphql")&&o.template?.quasis?.[0]?.raw){let u=o.template.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);u&&r.set(a,u[1]);}}}},i=n=>{if(!(!n||typeof n!="object")){s(n);for(let a of Object.keys(n)){let o=n[a];if(Array.isArray(o))for(let p of o)i(p);else o&&typeof o=="object"&&i(o);}}};return i(e),r}extractOperationNameFromGqlCall(e,t){if(!e.arguments?.length)return null;let r=e.arguments[0],s=r?.expression||r;if(s?.type==="TemplateLiteral"&&s.quasis?.[0]?.raw){let n=s.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);if(n)return n[1]}if(e.span){let n=t.slice(e.span.start,e.span.end).match(/(?:query|mutation|subscription)\s+(\w+)/i);if(n)return n[1]}return null}traverseForHooks(e,t,r,s,i,n){if(!(!e||typeof e!="object")){e.type==="CallExpression"&&this.analyzeHookCall(e,t,r,s,i,n);for(let a of Object.keys(e)){let o=e[a];if(Array.isArray(o))for(let p of o)this.traverseForHooks(p,t,r,s,i,n);else o&&typeof o=="object"&&this.traverseForHooks(o,t,r,s,i,n);}}}analyzeHookCall(e,t,r,s,i,n){let a=this.getCalleeNameFromNode(e.callee);if(!a||!a.startsWith("use"))return;let o=M(a),p=S(a),c=V(a);if((o||p||c)&&this.hasGraphQLArgument(e,t,r,s)){let f=this.extractOperationNameFromCall(e,t,r,s),m=p?"Mutation":c?"Subscription":"Query",g=f?`${m}: ${f}`:`${m}: unknown`;n.has(g)||(n.add(g),i.push(g));return}if(a==="useContext"){let u=this.extractContextName(e);if(u){let f=`\u{1F504} Context: ${u}`;n.has(f)||(n.add(f),i.push(f));}return}n.has(a)||(n.add(a),i.push(a));}hasGraphQLArgument(e,t,r,s){if(!e.arguments?.length)return false;let i=e.arguments[0],n=i?.expression||i;if(!n)return false;if(n.type==="Identifier"){let a=n.value;if(r.has(a)||s.has(a)||a.endsWith("Document")||/[A-Z][a-z]*Query$/.test(a)||/[A-Z][a-z]*Mutation$/.test(a)||/^[A-Z][A-Z0-9_]*_QUERY$/.test(a)||/^[A-Z][A-Z0-9_]*_MUTATION$/.test(a))return true}if(n.type==="TaggedTemplateExpression"){let a=this.getCalleeNameFromNode(n.tag);if(a==="gql"||a==="graphql")return true}if(n.type==="CallExpression"){let a=this.getCalleeNameFromNode(n.callee);if(a==="gql"||a==="graphql")return true}if(n.type==="TemplateLiteral"&&n.quasis?.[0]?.raw){let a=n.quasis[0].raw;if(/(?:query|mutation|subscription)\s+\w+/i.test(a))return true}if(n.type==="MemberExpression"){let a=n.property?.value;if(a&&/Query$|Mutation$|Document$/.test(a))return true}if(e.span){let a=t.slice(e.span.start,Math.min(e.span.end,e.span.start+500));if(a.includes("Document")||/\bgql\s*[`(]/.test(a)||/\bgraphql\s*[`(]/.test(a)||/query\s+\w+\s*[({]/.test(a)||/mutation\s+\w+\s*[({]/.test(a))return true}return false}getCalleeNameFromNode(e){return e?e.type==="Identifier"?e.value:e.type==="MemberExpression"&&e.property?.type==="Identifier"?e.property.value:null:null}extractOperationNameFromCall(e,t,r,s){if(e.typeArguments?.params?.length>0){let i=e.typeArguments.params[0];if(i?.type==="TsTypeReference"&&i.typeName?.type==="Identifier"){let n=i.typeName.value;return h(n)}}if(e.callee?.span&&e.span){let i=e.callee.span.end,n=Math.min(i+150,e.span.end),o=t.slice(i,n).match(/^<\s*(\w+)(?:Query|Mutation|Variables|Subscription)?[\s,>]/);if(o)return h(o[1])}if(e.arguments?.length>0){let i=e.arguments[0],n=i?.expression||i;if(!n)return null;if(n.type==="Identifier"){let a=n.value,o=s.get(a);if(o)return o;let p=r.get(a);return p||(/^(Query|Mutation|QUERY|MUTATION)$/i.test(a)?null:h(a))}if(n.type==="MemberExpression"&&n.property?.type==="Identifier")return h(n.property.value);if(n.type==="TaggedTemplateExpression"&&n.template?.quasis?.[0]?.raw){let o=n.template.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);if(o)return o[1]}if(n.type==="CallExpression"){let a=this.getCalleeNameFromNode(n.callee);if((a==="graphql"||a==="gql")&&n.arguments?.length>0){let o=n.arguments[0],p=o?.expression||o;if(p?.type==="TemplateLiteral"&&p.quasis?.[0]?.raw){let u=p.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);if(u)return u[1]}}}if(n.type==="TemplateLiteral"&&n.quasis?.[0]?.raw){let o=n.quasis[0].raw.match(/(?:query|mutation|subscription)\s+(\w+)/i);if(o)return o[1]}}if(e.span){let i=t.slice(e.span.start,e.span.end),n=i.match(/\b([A-Z][a-zA-Z0-9]*Document)\b/);if(n)return h(n[1]);let a=i.match(/(?:query|mutation|subscription)\s+(\w+)/i);if(a)return a[1]}return null}extractContextName(e){if(e.arguments?.length>0){let t=e.arguments[0].expression;if(t?.type==="Identifier")return t.value.replace(/Context$/,"")}return null}extractHooksWithRegex(e,t,r){let s=/\b(useQuery|useMutation|useLazyQuery|useSuspenseQuery|useBackgroundQuery|useSubscription)(?:<[^>]*>)?\s*\(\s*([A-Z_][A-Za-z0-9_]*)?/gs,i;for(;(i=s.exec(e))!==null;){let o=i[1],p=i[2];if(p&&/^(Query|Mutation|QUERY|MUTATION)$/i.test(p))continue;let c=p?h(p):"unknown",f=`${o.includes("Mutation")?"Mutation":o.includes("Subscription")?"Subscription":"Query"}: ${c}`;r.has(f)||(r.add(f),t.push(f));}let n=/\b(use[A-Z][a-zA-Z0-9]*)\s*\(/g,a;for(;(a=n.exec(e))!==null;){let o=a[1];if(!["useQuery","useMutation","useLazyQuery","useSuspenseQuery","useBackgroundQuery","useSubscription"].includes(o))if(o==="useContext"){let p=e.slice(a.index).match(/useContext\s*\(\s*([A-Z][A-Za-z0-9]*)/);if(p){let u=`\u{1F504} Context: ${p[1].replace(/Context$/,"")}`;r.has(u)||(r.add(u),t.push(u));}}else r.has(o)||(r.add(o),t.push(o));}}extractStateManagement(e){let t=[];return e.includes("useState")&&t.push("useState"),e.includes("useReducer")&&t.push("useReducer"),e.includes("useContext")&&t.push("useContext"),e.includes("useQuery")&&t.push("Apollo Query"),e.includes("useMutation")&&t.push("Apollo Mutation"),e.includes("useRecoil")&&t.push("Recoil"),(e.includes("useSelector")||e.includes("useDispatch"))&&t.push("Redux"),t}buildDependencyGraph(e){let t=new Map;for(let r of e)t.set(r.name,r);for(let r of e)for(let s of r.dependencies){let i=t.get(s);i&&!i.dependents.includes(r.name)&&i.dependents.push(r.name);}}async analyzeDataFlows(e){let t=[],r=1,s=this.analyzeContextFlows(e);t.push(...s.map(a=>({...a,id:`flow-${r++}`})));let i=this.analyzeApolloFlows(e);t.push(...i.map(a=>({...a,id:`flow-${r++}`})));let n=this.analyzePropDrilling(e);return t.push(...n.map(a=>({...a,id:`flow-${r++}`}))),t}analyzeContextFlows(e){let t=[],r=e.filter(i=>i.name.includes("Provider")||i.name.includes("Context")),s=e.filter(i=>i.hooks.some(n=>n.includes("Context")));for(let i of r){let n=i.name.replace("Provider","").replace("Context","");for(let a of s){let o=a.hooks.find(p=>p.includes("Context")&&p.includes(n));(o||a.hooks.some(p=>p.includes(n)))&&t.push({name:`\u{1F504} ${n} Context`,description:`Data flows from ${i.name} to ${a.name} via Context`,source:{type:"context",name:i.name},target:{type:"component",name:a.name},via:[],operations:[o||`useContext(${n})`]});}}return t}analyzeApolloFlows(e){let t=[];for(let r of e){let s=r.hooks.filter(n=>n.includes("Query:")||n==="useQuery"||n==="useLazyQuery");for(let n of s){let a=n.includes(":")?n.split(":")[1].trim():r.name;t.push({name:`Query: ${a}`,description:`${r.name} fetches ${a} via Apollo`,source:{type:"api",name:`GraphQL: ${a}`},target:{type:"component",name:r.name},via:[{type:"cache",name:"Apollo Cache"}],operations:[n]});}let i=r.hooks.filter(n=>n.includes("Mutation:")||n==="useMutation");for(let n of i){let a=n.includes(":")?n.split(":")[1].trim():r.name;t.push({name:`Mutation: ${a}`,description:`${r.name} mutates ${a} via Apollo`,source:{type:"component",name:r.name},target:{type:"api",name:`GraphQL: ${a}`},via:[],operations:[n]});}}return t}analyzePropDrilling(e){let t=[];for(let r of e)r.props.length>5&&r.dependents.length>0&&t.push({name:`Prop Drilling through ${r.name}`,description:`${r.name} passes ${r.props.length} props to children`,source:{type:"component",name:r.name},target:{type:"component",name:r.dependents[0]},via:[],operations:["props"]});return t}};var se=class l extends v{apiCallCounter=0;constructor(e){super(e);}getName(){return "RestApiAnalyzer"}async analyze(){this.log("Starting REST API analysis...");let e=await D(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx"],{cwd:this.basePath,ignore:["**/node_modules/**","**/.next/**","**/__tests__/**","**/*.test.*","**/*.spec.*","**/*.stories.*","**/__generated__/**","**/dist/**","**/build/**"],absolute:true}),t=50,r=[];for(let s=0;s<e.length;s+=t){let i=e.slice(s,s+t),n=await N(i,async a=>{try{let o=await Q.readFile(a,"utf-8"),p=x.relative(this.basePath,a),c=a.endsWith(".tsx")||a.endsWith(".jsx"),u=parseSync(o,{syntax:a.endsWith(".ts")||a.endsWith(".tsx")?"typescript":"ecmascript",tsx:c,jsx:c});return this.analyzeModule(u,o,p)}catch{return []}},10);r.push(...n.flat());}return this.log(`Found ${r.length} REST API calls`),{apiCalls:r}}analyzeModule(e,t,r){let s=[],i=t.split(`
|
|
4
|
-
`);return this.traverseNode(e,n=>{if(n.type==="CallExpression"){let a=n,o=this.analyzeCallExpression(a,r,i);o&&s.push(o);}}),s}traverseNode(e,t){if(!(!e||typeof e!="object")){t(e);for(let r of Object.keys(e)){let s=e[r];if(Array.isArray(s))for(let i of s)this.traverseNode(i,t);else s&&typeof s=="object"&&this.traverseNode(s,t);}}}analyzeCallExpression(e,t,r){let s=e.callee;if(s.type==="Super"||s.type==="Import")return null;let i=this.getCalleeName(s);if(!i)return null;if(i==="fetch"||i==="window.fetch")return this.extractFetchCall(e,t,r);let n=i.match(/^axios\.(get|post|put|delete|patch)$/i);return n?this.extractAxiosMethodCall(e,t,r,n[1].toUpperCase()):i==="axios"?this.extractAxiosDirectCall(e,t,r):i==="useSWR"||i==="useSWRImmutable"?this.extractSwrCall(e,t,r):null}getCalleeName(e){if(e.type==="Identifier")return e.value;if(e.type==="MemberExpression"){let t=e.object,r=e.property;if(t.type==="Identifier"&&r.type==="Identifier")return `${t.value}.${r.value}`}return null}extractFetchCall(e,t,r){if(e.arguments.length===0)return null;let s=e.arguments[0],i=this.extractUrlFromExpression(s.expression);if(!i.url||!i.isPlaceholder&&!this.isApiUrl(i.url))return null;let n="GET",a=false;if(e.arguments.length>1){let p=e.arguments[1].expression;if(p.type==="ObjectExpression")for(let c of p.properties)c.type==="KeyValueProperty"&&c.key.type==="Identifier"&&(c.key.value==="method"&&c.value.type==="StringLiteral"&&(n=this.normalizeMethod(c.value.value)),(c.key.value==="credentials"||c.key.value==="headers")&&(a=true));}let o=this.getLineNumber(e.span.start,r);return {id:`api-${++this.apiCallCounter}`,method:n,url:i.url,callType:"fetch",filePath:t,line:o,containingFunction:"unknown",usedIn:[],requiresAuth:a,category:this.categorizeApi(i.url)}}extractAxiosMethodCall(e,t,r,s){if(e.arguments.length===0)return null;let i=e.arguments[0],n=this.extractUrlFromExpression(i.expression);if(!n.url)return null;let a=this.getLineNumber(e.span.start,r);return {id:`api-${++this.apiCallCounter}`,method:this.normalizeMethod(s),url:n.url,callType:"axios",filePath:t,line:a,containingFunction:"unknown",usedIn:[],requiresAuth:false,category:this.categorizeApi(n.url)}}extractAxiosDirectCall(e,t,r){if(e.arguments.length===0)return null;let s=e.arguments[0].expression;if(s.type!=="ObjectExpression")return null;let i=null,n="GET";for(let o of s.properties)o.type==="KeyValueProperty"&&o.key.type==="Identifier"&&(o.key.value==="url"&&o.value.type==="StringLiteral"&&(i=o.value.value),o.key.value==="method"&&o.value.type==="StringLiteral"&&(n=this.normalizeMethod(o.value.value)));if(!i)return null;let a=this.getLineNumber(e.span.start,r);return {id:`api-${++this.apiCallCounter}`,method:n,url:i,callType:"axios",filePath:t,line:a,containingFunction:"unknown",usedIn:[],requiresAuth:false,category:this.categorizeApi(i)}}extractSwrCall(e,t,r){if(e.arguments.length===0)return null;let s=e.arguments[0].expression,i=this.extractUrlFromExpression(s);if(!i.url)return null;let n=this.getLineNumber(e.span.start,r);return {id:`api-${++this.apiCallCounter}`,method:"GET",url:i.url,callType:"useSWR",filePath:t,line:n,containingFunction:"unknown",usedIn:[],requiresAuth:false,category:this.categorizeApi(i.url)}}extractUrlFromExpression(e){if(e.type==="StringLiteral")return {url:e.value,isPlaceholder:false};if(e.type==="TemplateLiteral")return e.quasis.length===1&&e.expressions.length===0?{url:e.quasis[0].raw,isPlaceholder:false}:{url:e.quasis.map(s=>s.raw).join(":param"),isPlaceholder:true};if(e.type==="Identifier")return {url:`[${e.value}]`,isPlaceholder:true};if(e.type==="MemberExpression"){let t=e.object.type==="Identifier"?e.object.value:"?",r=e.property.type==="Identifier"?e.property.value:"?";return {url:`[${t}.${r}]`,isPlaceholder:true}}if(e.type==="ConditionalExpression"){let t=this.extractUrlFromExpression(e.consequent);return t.url?t:this.extractUrlFromExpression(e.alternate)}return {url:null,isPlaceholder:false}}getLineNumber(e,t){let r=0;for(let s=0;s<t.length;s++)if(r+=t[s].length+1,r>e)return s+1;return t.length}static STATIC_FILE_EXTENSIONS=/\.(css|js|mjs|cjs|ts|tsx|jsx|png|jpg|jpeg|gif|webp|svg|ico|woff|woff2|ttf|eot|otf|mp3|mp4|webm|ogg|wav|pdf|doc|docx|xls|xlsx|ppt|pptx|zip|tar|gz|rar|html|htm|xml|txt|md|map|wasm)$/i;static NON_API_SCHEMES=/^(data:|blob:|javascript:|mailto:|tel:|file:)/;isApiUrl(e){return l.NON_API_SCHEMES.test(e)||l.STATIC_FILE_EXTENSIONS.test(e)||!e.trim()?false:!!(e.startsWith("/")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("[")||e.includes("/api/")||e.includes("/v1/")||e.includes("/v2/")||e.includes("/graphql"))}static SERVICE_PATTERNS=[{pattern:/amazonaws\.com|\.s3\./i,name:"AWS"},{pattern:/googleapis\.com|google\.com\/api/i,name:"Google API"},{pattern:/graph\.facebook\.com|facebook\.com\/v\d+/i,name:"Facebook"},{pattern:/api\.twitter\.com|twitter\.com\/\d+/i,name:"Twitter/X"},{pattern:/api\.github\.com|github\.com\/api/i,name:"GitHub API"},{pattern:/stripe\.com/i,name:"Stripe"},{pattern:/paypal\.com/i,name:"PayPal"},{pattern:/slack\.com/i,name:"Slack"},{pattern:/discord\.com|discordapp\.com/i,name:"Discord"},{pattern:/twilio\.com/i,name:"Twilio"},{pattern:/sendgrid\.(com|net)/i,name:"SendGrid"},{pattern:/mailchimp\.com/i,name:"Mailchimp"},{pattern:/hubspot\.com|hsforms\.com/i,name:"HubSpot"},{pattern:/salesforce\.com/i,name:"Salesforce"},{pattern:/zendesk\.com/i,name:"Zendesk"},{pattern:/intercom\.io/i,name:"Intercom"},{pattern:/firebase(io)?\.com|firestore\.googleapis/i,name:"Firebase"},{pattern:/supabase\.(co|com|io)/i,name:"Supabase"},{pattern:/auth0\.com/i,name:"Auth0"},{pattern:/okta\.com/i,name:"Okta"},{pattern:/clerk\.(dev|com)/i,name:"Clerk"},{pattern:/cloudflare\.com|workers\.dev/i,name:"Cloudflare"},{pattern:/vercel\.com|vercel\.app/i,name:"Vercel"},{pattern:/netlify\.com|netlify\.app/i,name:"Netlify"},{pattern:/heroku\.com|herokuapp\.com/i,name:"Heroku"},{pattern:/railway\.app/i,name:"Railway"},{pattern:/render\.com/i,name:"Render"},{pattern:/digitalocean\.com/i,name:"DigitalOcean"},{pattern:/algolia\.(com|net|io)/i,name:"Algolia"},{pattern:/elastic\.co|elasticsearch/i,name:"Elasticsearch"},{pattern:/mongodb\.com|mongodb\.net/i,name:"MongoDB"},{pattern:/planetscale\.com/i,name:"PlanetScale"},{pattern:/sentry\.io/i,name:"Sentry"},{pattern:/datadog\.com/i,name:"Datadog"},{pattern:/segment\.(com|io)/i,name:"Segment"},{pattern:/mixpanel\.com/i,name:"Mixpanel"},{pattern:/amplitude\.com/i,name:"Amplitude"},{pattern:/openai\.com/i,name:"OpenAI"},{pattern:/anthropic\.com/i,name:"Anthropic"},{pattern:/cohere\.(ai|com)/i,name:"Cohere"}];categorizeApi(e){if(e.startsWith("["))return "Dynamic URL";if(e.startsWith("/"))return e.startsWith("/api/")?"Internal API":e.includes("/graphql")?"GraphQL":"Internal Route";for(let{pattern:t,name:r}of l.SERVICE_PATTERNS)if(t.test(e))return r;try{let s=new URL(e).hostname.replace(/^(api\.|www\.)/,"").split(".");if(s.length>=2){let i=s[s.length-2];return i.charAt(0).toUpperCase()+i.slice(1)+" API"}}catch{}return "External API"}normalizeMethod(e){let t=e.toUpperCase();return ["GET","POST","PUT","DELETE","PATCH"].includes(t)?t:"unknown"}};
|
|
5
|
-
export{te as A,se as B,v as a,z as b,W as c,le as d,q as e,j as f,ue as g,M as h,S as i,V as j,F as k,E as l,R as m,h as n,ce as o,d as p,A as q,L as r,O as s,I as t,U as u,k as v,we as w,Ie as x,K as y,X as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as PageMapGenerator}from'./chunk-WZAAA7DS.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as RailsMapGenerator}from'./chunk-NQMJ3QRX.js';import'./chunk-H7VVRHQZ.js';
|