@forinda/kickjs-cli 6.0.0 → 6.1.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.
Files changed (32) hide show
  1. package/dist/{agent-docs-Dmku65k2.mjs → agent-docs-DB5y-kvS.mjs} +3 -3
  2. package/dist/{agent-docs-Dmku65k2.mjs.map → agent-docs-DB5y-kvS.mjs.map} +1 -1
  3. package/dist/build-9YFC7Rd4.mjs +13 -0
  4. package/dist/build-9YFC7Rd4.mjs.map +1 -0
  5. package/dist/{builtins-G49e_Qsj.mjs → builtins-mr3TIDa8.mjs} +2 -2
  6. package/dist/cli.mjs +143 -151
  7. package/dist/{config-DdtRfl33.mjs → config-Dc4XuP2E.mjs} +3 -3
  8. package/dist/config-Dc4XuP2E.mjs.map +1 -0
  9. package/dist/{doctor-SUUDEI1J.mjs → doctor-shX-k8ju.mjs} +41 -41
  10. package/dist/doctor-shX-k8ju.mjs.map +1 -0
  11. package/dist/index.d.mts +279 -1
  12. package/dist/index.d.mts.map +1 -1
  13. package/dist/index.mjs +2 -2
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/{plugin-Dg0Lk2Lp.mjs → plugin-DVOWYRqG.mjs} +3 -3
  16. package/dist/{plugin-Dg0Lk2Lp.mjs.map → plugin-DVOWYRqG.mjs.map} +1 -1
  17. package/dist/{project-docs-C-dA6-TO.mjs → project-docs-Cq_MswOY.mjs} +2 -2
  18. package/dist/{project-docs-C-dA6-TO.mjs.map → project-docs-Cq_MswOY.mjs.map} +1 -1
  19. package/dist/{project-root-so4F5DRN.mjs → project-root-C3u57Vec.mjs} +3 -3
  20. package/dist/{project-root-so4F5DRN.mjs.map → project-root-C3u57Vec.mjs.map} +1 -1
  21. package/dist/{rolldown-runtime-DrKbExWn.mjs → rolldown-runtime-BMxBusPc.mjs} +1 -1
  22. package/dist/{run-plugins-B2_AT35s.mjs → run-plugins-COniKxrL.mjs} +73 -82
  23. package/dist/run-plugins-COniKxrL.mjs.map +1 -0
  24. package/dist/typegen-DPATg8Ix.mjs +114 -0
  25. package/dist/typegen-DPATg8Ix.mjs.map +1 -0
  26. package/dist/{types-C5PH0h7Z.mjs → types-B2r_OeIa.mjs} +1 -1
  27. package/package.json +7 -7
  28. package/dist/config-DdtRfl33.mjs.map +0 -1
  29. package/dist/doctor-SUUDEI1J.mjs.map +0 -1
  30. package/dist/run-plugins-B2_AT35s.mjs.map +0 -1
  31. package/dist/typegen-5MX2F5iL.mjs +0 -114
  32. package/dist/typegen-5MX2F5iL.mjs.map +0 -1
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @forinda/kickjs-cli v6.1.0
3
+ *
4
+ * Copyright (c) Felix Orinda
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ import{t as e}from"./rolldown-runtime-BMxBusPc.mjs";import{basename as t,dirname as n,join as r,relative as i,resolve as a,sep as o}from"node:path";import{statSync as s}from"node:fs";import{mkdir as c,readFile as l,readdir as u,stat as d,unlink as f,writeFile as p}from"node:fs/promises";import{globSync as m}from"glob";import{groupAssetKeys as h}from"@forinda/kickjs";import{parseSync as g}from"oxc-parser";const _=[`classes`,`tokens`,`injects`,`pluginsAndAdapters`,`augmentations`,`contextKeys`,`routes`,`moduleMounts`,`globPatterns`];function v(e){if(!e||typeof e!=`object`)return!1;let t=e;return _.every(e=>Array.isArray(t[e]))}var y=class e{path;prev;next=new Map;nextSig=new Map;constructor(e,t){this.path=e,this.prev=t}static async load(t){let n=r(t,`scan.json`),i=new Map;try{let e=await l(n,`utf-8`),t=JSON.parse(e);if(t.version===2&&t.files)for(let[e,n]of Object.entries(t.files))n&&typeof n.sig==`string`&&v(n.extract)&&i.set(e,n)}catch{}return new e(n,i)}static async signature(e){try{let t=await d(e);return`${t.mtimeMs}:${t.size}`}catch{return null}}get(e,t){let n=this.prev.get(e);return n&&n.sig===t?n.extract:null}set(e,t,n){this.next.set(e,n),this.nextSig.set(e,t)}cachedFiles(){return[...this.prev.keys()]}peek(e){return this.prev.get(e)?.extract??null}carry(e){let t=this.prev.get(e);return t?(this.next.set(e,t.extract),this.nextSig.set(e,t.sig),!0):!1}async save(){let e={};for(let[t,n]of this.next){let r=this.nextSig.get(t);r&&(e[t]={sig:r,extract:n})}let t={version:2,files:e};try{await c(n(this.path),{recursive:!0}),await p(this.path,JSON.stringify(t),`utf-8`)}catch{}}};let b=null;function x(){return b??=new Set(ce),b}const S=new Set([`Get`,`Post`,`Put`,`Delete`,`Patch`]);function C(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function w(e,t){if(Array.isArray(e)){for(let n of e)w(n,t);return}if(C(e)){t(e);for(let n of Object.keys(e)){if(n===`type`)continue;let r=e[n];typeof r==`object`&&r&&w(r,t)}}}function T(e){if(!C(e))return null;if(e.type===`Literal`&&typeof e.value==`string`)return e.value;if(e.type===`TemplateLiteral`){let t=e.quasis,n=e.expressions;if(t?.length===1&&(n?.length??0)===0){let e=t[0].value?.cooked;return typeof e==`string`?e:null}}return null}function E(e){return C(e)&&e.type===`Identifier`?e.name:null}function D(e){return E(e.callee)}function O(e,t){if(!e||e.type!==`ObjectExpression`)return null;for(let n of e.properties??[]){if(n.type!==`Property`)continue;let e=n.key;if((E(e)??(e.type===`Literal`?String(e.value):T(e)))===t)return n.value}return null}function k(e){let t=e.arguments?.[0];return C(t)&&t.type===`ObjectExpression`?t:null}function A(e,t){let n=O(e,t);if(!C(n)||n.type!==`ArrayExpression`)return[];let r=[];for(let e of n.elements??[]){let t=T(e);t!==null&&r.push(t)}return r}function ee(e,t){return i(t,e).split(o).join(`/`)}function te(e){return(e.match(/:([a-zA-Z_]\w*)/g)??[]).map(e=>e.slice(1))}function ne(e,t){for(let n of e.implements??[]){let e=n.expression??n;if(E(e)===t)return!0;if(e.type===`TSQualifiedName`||e.type===`MemberExpression`){let n=e.right??e.property;if(n&&E(n)===t)return!0}}return!1}function j(e){return e.decorators??[]}function M(e){let t=e.expression;if(!C(t)||t.type!==`CallExpression`)return null;let n=D(t);return n?{name:n,call:t}:null}function re(e){let t=new Map,n=new Set;for(let r of e.body??[]){if(r.type===`ImportDeclaration`){let e=T(r.source)??``;for(let n of r.specifiers??[]){let r=E(n.local);r&&t.set(r,{source:e})}continue}let e=r.type===`VariableDeclaration`?r:r.type===`ExportNamedDeclaration`&&C(r.declaration)?r.declaration:null;if(C(e)&&e.type===`VariableDeclaration`)for(let t of e.declarations??[]){let e=E(t.id);e&&n.add(e)}}return{imports:t,topLevelConsts:n}}function ie(e,t){let n=t.imports.get(e);return n?{identifier:e,source:n.source}:t.topLevelConsts.has(e)?{identifier:e,source:``}:{identifier:e,source:null}}function N(e,t,n){let r=E(O(e,t));return r?ie(r,n):null}function ae(e,t){for(let n of e){let e=M(n);if(!e||e.name!==`ApiQueryParams`)continue;let r=e.call.arguments?.[0],i=null;if(C(r)&&r.type===`ObjectExpression`)i=r;else{let e=E(r);if(e){let n=t.get(e);n&&n.type===`ObjectExpression`&&(i=n)}}return{filterable:A(i,`filterable`),sortable:A(i,`sortable`),searchable:A(i,`searchable`)}}return null}function oe(e,t,n){let r;try{let n=g(t,e);if(n.errors.length>0)return null;r=n.program}catch{return null}let i=ee(t,n),a=re(r),o=[],s=[],c=[],l=[],u=[],d=[],f=[],p=[],m=[],h=new Set,_=new Set,v=new Set,y=new Map;for(let e of r.body??[]){let t=e.type===`VariableDeclaration`?e:e.type===`ExportNamedDeclaration`&&C(e.declaration)?e.declaration:null;if(C(t)&&t.type===`VariableDeclaration`)for(let e of t.declarations??[]){let t=E(e.id);t&&C(e.init)&&y.set(t,e.init)}}let b=[];for(let e of r.body??[])if(e.type===`ExportNamedDeclaration`&&C(e.declaration)){let t=e.declaration;t.type===`ClassDeclaration`&&b.push({cls:t,isDefault:!1})}else if(e.type===`ExportDefaultDeclaration`&&C(e.declaration)){let t=e.declaration;t.type===`ClassDeclaration`&&b.push({cls:t,isDefault:!0})}for(let{cls:e,isDefault:n}of b){let r=E(e.id);if(!r)continue;let a=null;for(let t of j(e)){let e=M(t);if(e&&x().has(e.name)){a=e.name;break}}a?o.push({className:r,decorator:a,filePath:t,relativePath:i,isDefault:n}):ne(e,`AppModule`)&&o.push({className:r,decorator:`Module`,filePath:t,relativePath:i,isDefault:n})}for(let e of r.body??[]){if(e.type!==`ExportNamedDeclaration`||!C(e.declaration))continue;let n=e.declaration;if(n.type===`VariableDeclaration`)for(let e of n.declarations??[]){let n=E(e.id),r=e.init;!n||!C(r)||r.type!==`CallExpression`||D(r)===`defineModule`&&(o.some(e=>e.className===n)||o.push({className:n,decorator:`Module`,filePath:t,relativePath:i,isDefault:!1}))}}w(r,e=>{if(e.type===`VariableDeclarator`){let n=e.init;if(C(n)&&n.type===`CallExpression`&&D(n)===`createToken`){let r=T(n.arguments?.[0]);r!==null&&(v.add(n),s.push({name:r,variable:E(e.id),filePath:t,relativePath:i}))}return}if(e.type!==`CallExpression`){if(e.type===`Decorator`){let n=M(e);if(n?.name===`Inject`){let e=T(n.call.arguments?.[0]);e!==null&&c.push({name:e,filePath:t,relativePath:i})}}return}let n=e.callee,r=D(e);if(r===`createToken`&&!v.has(e)){let n=T(e.arguments?.[0]);n!==null&&s.push({name:n,variable:null,filePath:t,relativePath:i});return}if(r===`defineAdapter`||r===`definePlugin`){let n=T(O(k(e),`name`));if(n!==null){let e=r===`definePlugin`?`plugin`:`adapter`,a=`${r}::${n}::${t}`;h.has(a)||(h.add(a),l.push({kind:e,name:n,filePath:t,relativePath:i}))}return}if(r===`defineAugmentation`){let n=e.arguments??[],r=T(n[0]);if(r!==null){let e=C(n[1])&&n[1].type===`ObjectExpression`?n[1]:null;u.push({name:r,description:T(O(e,`description`)),example:T(O(e,`example`)),filePath:t,relativePath:i})}return}if(r===`defineContextDecorator`||r===`defineHttpContextDecorator`){let n=T(O(k(e),`key`));n!==null&&!_.has(n)&&(_.add(n),d.push({key:n,filePath:t,relativePath:i}));return}if(C(n)&&n.type===`CallExpression`){let r=n.callee;if(C(r)&&r.type===`MemberExpression`&&E(r.property)===`withParams`){let n=E(r.object);if(n===`defineContextDecorator`||n===`defineHttpContextDecorator`){let n=T(O(k(e),`key`));n!==null&&!_.has(n)&&(_.add(n),d.push({key:n,filePath:t,relativePath:i}))}}return}if(C(n)&&n.type===`MemberExpression`&&E(n.property)===`glob`){let t=n.object;C(t)&&t.type===`MetaProperty`&&w(e.arguments,e=>{let t=T(e);t!==null&&m.push(t)})}});let A=[];w(r,e=>{if(e.type===`ClassDeclaration`||e.type===`ClassExpression`){let t=E(e.id);t&&A.push({cls:e,className:t})}});for(let{cls:e,className:n}of A){let r=o.find(e=>e.className===n),s=e.body?.body;if(ne(e,`AppAdapter`))for(let e of s??[]){if(e.type!==`PropertyDefinition`||E(e.key)!==`name`)continue;let n=T(e.value);if(n===null)continue;let r=`class::${n}::${t}`;h.has(r)||(h.add(r),l.push({kind:`adapter`,name:n,filePath:t,relativePath:i}));break}for(let e of s??[]){if(e.type!==`MethodDefinition`)continue;let o=E(e.key);if(!o)continue;if(o===`routes`){se(e.value,p);continue}if(!r)continue;let s=j(e),c=ae(s,y);for(let e of s){let r=M(e);if(!r||!S.has(r.name))continue;let s=r.call.arguments??[],l=T(s[0]),u=l&&l.length>0?l:`/`,d=C(s[1])&&s[1].type===`ObjectExpression`?s[1]:null;f.push({controller:n,method:o,httpMethod:r.name.toUpperCase(),path:u,pathParams:te(u),queryFilterable:c?.filterable??null,querySortable:c?.sortable??null,querySearchable:c?.searchable??null,bodySchema:N(d,`body`,a),querySchema:N(d,`query`,a),paramsSchema:N(d,`params`,a),filePath:t,relativePath:i})}}}return w(r,e=>{if(e.type!==`Property`||E(e.key)!==`routes`)return;let t=e.value;C(t)&&(t.type===`FunctionExpression`||t.type===`ArrowFunctionExpression`)&&se(t,p)}),{classes:o,tokens:s,injects:c,pluginsAndAdapters:l,augmentations:u,contextKeys:d,routes:f,moduleMounts:p,globPatterns:/\.module\.[mc]?[tj]sx?$/.test(t)?m:[]}}function se(e,t){let n=[],r=[];w(e.body,e=>{if(e.type!==`Property`)return;let t=E(e.key);if(t===`path`){let t=T(e.value);t!==null&&n.push(t)}else if(t===`controller`){let t=E(e.value);t&&/^[A-Z]/.test(t)&&r.push(t)}});let i=Math.min(n.length,r.length);for(let e=0;e<i;e++)t.push({controller:r[e],mountPath:n[e]})}const ce=[`Service`,`Controller`,`Repository`,`Injectable`,`Component`,`Module`],le=[`.ts`,`.tsx`,`.mts`,`.cts`],ue=[`node_modules`,`.kickjs`,`dist`,`build`,`.test.`,`.spec.`,`.d.ts`],de=new RegExp(String.raw`@(${ce.join(`|`)})\s*\([^)]*\)`+String.raw`(?:\s*@[A-Z]\w*(?:\s*\([^)]*\))?)*`+String.raw`\s*export\s+(default\s+)?(?:abstract\s+)?class\s+(\w+)`,`g`),fe=new RegExp(String.raw`export\s+(default\s+)?(?:abstract\s+)?class\s+(\w+)`+String.raw`(?:\s+extends\s+\w+(?:<[^>]*>)?)?`+String.raw`\s+implements\s+[^{]*\bAppModule\b`,`g`),pe=/export\s+const\s+(\w+)\s*(?::\s*[^=]+)?=\s*defineModule\s*(?:<[^>]*>)?\s*\(/g,me=/(?:export\s+)?const\s+(\w+)\s*(?::\s*[^=]+)?=\s*createToken\s*(?:<[^>]*>)?\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,he=/createToken\s*(?:<[^>]*>)?\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,ge=/@Inject\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,P=/\b(defineAdapter|definePlugin)\s*(?:<[^>]*>)?\s*\(/g,F=/\b(?:defineContextDecorator|defineHttpContextDecorator)\s*(?:\.withParams\s*<(?:[^<>]|<[^<>]*>)*>\s*\(\s*\))?\s*(?:<(?:[^<>]|<[^<>]*>)*>)?\s*\(/g,I=new RegExp(String.raw`export\s+(?:default\s+)?(?:abstract\s+)?class\s+(\w+)`+String.raw`(?:\s+extends\s+\w+(?:<[^>]*>)?)?`+String.raw`\s+implements\s+[^{]*\bAppAdapter\b`,`g`),_e=/\bname\s*(?::\s*[^=]+)?=\s*['"`]([^'"`]+)['"`]/,L=/\bdefineAugmentation\s*\(\s*['"`]([^'"`]+)['"`]\s*(,\s*\{)?/g,R=new RegExp(String.raw`@(${[`Get`,`Post`,`Put`,`Delete`,`Patch`].join(`|`)})\s*\(`,`g`);function z(e,t){let n=1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}return-1}function ve(e,t){let n=t;for(;n<e.length;){for(;n<e.length&&/\s/.test(e[n]);)n++;if(e[n]!==`@`)break;let t=e.slice(n).match(/^@([A-Z]\w*)/);if(!t)break;for(n+=t[0].length;n<e.length&&/\s/.test(e[n]);)n++;if(e[n]===`(`){let t=z(e,n);if(t<0)return null;n=t+1}}for(;n<e.length&&/\s/.test(e[n]);)n++;for(let t of[`public`,`private`,`protected`])if(e.slice(n,n+t.length)===t&&/\s/.test(e.charAt(n+t.length))){for(n+=t.length;n<e.length&&/\s/.test(e[n]);)n++;break}if(e.slice(n,n+5)===`async`&&/\s/.test(e.charAt(n+5)))for(n+=5;n<e.length&&/\s/.test(e[n]);)n++;let r=e.slice(n).match(/^([a-zA-Z_]\w*)\s*\(/);return r?{methodName:r[1],endPos:n+r[0].length}:null}function ye(e){return(e.match(/:([a-zA-Z_]\w*)/g)??[]).map(e=>e.slice(1))}function be(e,t){let n=e.endsWith(`/`)?e.slice(0,-1):e;return!t||t===`/`?n||`/`:n+(t.startsWith(`/`)?t:`/`+t)||`/`}const xe=/\b(?:public\s+|private\s+|protected\s+)?routes\s*\([^)]*\)\s*(?::\s*[A-Za-z_][\w<>[\]\s,|]*\s*)?\{/g,Se=/\bpath\s*:\s*['"`]([^'"`]*)['"`]/g,Ce=/\bcontroller\s*:\s*([A-Z]\w*)\b/g,B=/\bimport\.meta\.glob\s*\(/g;function we(e){let t=[];for(B.lastIndex=0;B.exec(e)!==null;){let n=B.lastIndex-1,r=z(e,n);if(r<0)continue;let i=e.slice(n+1,r),a=/['"`]([^'"`]+)['"`]/g,o;for(;(o=a.exec(i))!==null;)t.push(o[1])}return t}function Te(e){let t=e.replace(/[.+^$()|[\]\\]/g,`\\$&`).replace(/\?/g,`.`).replace(/\*\*\//g,`___DOUBLESTAR_SLASH___`).replace(/\*\*/g,`___DOUBLESTAR___`).replace(/\*/g,`[^/]*`).replace(/___DOUBLESTAR_SLASH___/g,`(?:.+/)?`).replace(/___DOUBLESTAR___/g,`.*`);return RegExp(`^`+t+`$`)}function Ee(e,t){let n=e.startsWith(`./`)?e:`./`+e,r=!1;for(let e of t){let t=e.startsWith(`!`);Te(t?e.slice(1):e).test(n)&&(r=!t)}return r}function De(e){let t=[];xe.lastIndex=0;let n;for(;(n=xe.exec(e))!==null;){let r=e.indexOf(`{`,n.index+n[0].length-1);if(r<0)continue;let i=K(e,r);if(i<0)continue;let a=e.slice(r+1,i),o=[];Se.lastIndex=0;let s;for(;(s=Se.exec(a))!==null;)o.push(s[1]??``);let c=[];Ce.lastIndex=0;let l;for(;(l=Ce.exec(a))!==null;)c.push(l[1]);let u=Math.min(o.length,c.length);for(let e=0;e<u;e++)t.push({controller:c[e],mountPath:o[e]})}return t}function V(e,t){let n=new RegExp(String.raw`\b${t}\s*:\s*([A-Za-z_$][\w$]*)`,`g`).exec(e);return n?n[1]:null}function H(e,t){let n=new RegExp(String.raw`import\s*(?:type\s+)?\{[^}]*\b${t}\b[^}]*\}\s*from\s*['"\`]([^'"\`]+)['"\`]`).exec(e);if(n)return n[1];let r=new RegExp(String.raw`import\s+(?:type\s+)?${t}\s+from\s*['"\`]([^'"\`]+)['"\`]`).exec(e);if(r)return r[1];let i=new RegExp(String.raw`import\s*\*\s*as\s+${t}\s+from\s*['"\`]([^'"\`]+)['"\`]`).exec(e);return i?i[1]:new RegExp(String.raw`(?:^|\n)\s*(?:export\s+)?const\s+${t}\b`).test(e)?``:null}function Oe(e,t){let n=/@ApiQueryParams\s*\(\s*([\s\S]*?)\s*\)\s*$/.exec(e);if(!n){let n=/@ApiQueryParams\s*\(([\s\S]*?)\)/.exec(e);return n?U(n[1].trim(),t):null}return U(n[1].trim(),t)}function U(e,t){if(e.startsWith(`{`))return ke(e);let n=/^([A-Za-z_]\w*)/.exec(e);if(n){let e=n[1],r=new RegExp(String.raw`const\s+${e}\s*(?::\s*[^=]+)?=\s*(\{[\s\S]*?\n\})`,`m`).exec(t);if(r)return ke(r[1])}return{filterable:[],sortable:[],searchable:[]}}function W(e,t){let n=new RegExp(String.raw`${t}\s*:\s*\[([\s\S]*?)\]`).exec(e);return n?Array.from(n[1].matchAll(/['"`]([^'"`]+)['"`]/g)).map(e=>e[1]):[]}function ke(e){return{filterable:W(e,`filterable`),sortable:W(e,`sortable`),searchable:W(e,`searchable`)}}async function Ae(e,t){let n=t.extensions??le,a=t.exclude??ue,o=[],s;try{s=await u(e,{withFileTypes:!0,encoding:`utf-8`})}catch{return o}for(let c of s){let s=r(e,c.name),l=i(t.cwd,s);a.some(e=>l.includes(e))||(c.isDirectory()?o.push(...await Ae(s,t)):c.isFile()&&n.some(e=>c.name.endsWith(e))&&o.push(s))}return o}function G(e,t){return i(t,e).split(o).join(`/`)}function je(e,t,n){let r=[],i=G(t,n);de.lastIndex=0;let a;for(;(a=de.exec(e))!==null;){let[,e,n,o]=a;r.push({className:o,decorator:e,filePath:t,relativePath:i,isDefault:!!n})}fe.lastIndex=0;let o;for(;(o=fe.exec(e))!==null;){let[,e,n]=o;r.some(e=>e.className===n&&e.filePath===t)||r.push({className:n,decorator:`Module`,filePath:t,relativePath:i,isDefault:!!e})}pe.lastIndex=0;let s;for(;(s=pe.exec(e))!==null;){let[,e]=s;r.some(n=>n.className===e&&n.filePath===t)||r.push({className:e,decorator:`Module`,filePath:t,relativePath:i,isDefault:!1})}return r}function Me(e,t,n){let r=[],i=G(t,n),a=new Set;me.lastIndex=0;let o;for(;(o=me.exec(e))!==null;){let[e,n,s]=o;a.add(e),r.push({name:s,variable:n,filePath:t,relativePath:i})}for(he.lastIndex=0;(o=he.exec(e))!==null;)a.has(o[0])||r.push({name:o[1],variable:null,filePath:t,relativePath:i});return r}function Ne(e,t,n,r,i=new Map){let a=[];if(r.length===0)return a;let o=G(t,n),s=[];for(let t of r){let n=new RegExp(String.raw`class\s+${t.className}\b`).exec(e);n?.index!==void 0&&s.push({cls:t,start:n.index})}s.sort((e,t)=>e.start-t.start);for(let n=0;n<s.length;n++){let{cls:r,start:c}=s[n],l=n+1<s.length?s[n+1].start:e.length,u=e.slice(c,l);R.lastIndex=0;let d;for(;(d=R.exec(u))!==null;){let n=d[1],s=d.index,c=R.lastIndex-1,l=z(u,c);if(l<0)continue;let f=u.slice(c+1,l),p=f.match(/^\s*['"`]([^'"`]*)['"`]/),m=p&&p[1].length>0?p[1]:`/`,h=ve(u,l+1);if(!h)continue;let{methodName:g,endPos:_}=h;R.lastIndex=_;let v=Oe(u.slice(s,_),e),y=V(f,`body`),b=V(f,`query`),x=V(f,`params`),S=i.get(r.className)??``,C=S?be(S,m):m;a.push({controller:r.className,method:g,httpMethod:n.toUpperCase(),path:m,pathParams:ye(C),queryFilterable:v?.filterable??null,querySortable:v?.sortable??null,querySearchable:v?.searchable??null,bodySchema:y?{identifier:y,source:H(e,y)}:null,querySchema:b?{identifier:b,source:H(e,b)}:null,paramsSchema:x?{identifier:x,source:H(e,x)}:null,filePath:t,relativePath:o})}}return a}function Pe(e,t,n){let r=[],i=G(t,n);ge.lastIndex=0;let a;for(;(a=ge.exec(e))!==null;)r.push({name:a[1],filePath:t,relativePath:i});return r}function K(e,t){let n=1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`{`)n++;else if(t===`}`&&(n--,n===0))return r}return-1}function Fe(e,t,n){let r=[],i=G(t,n),a=new Set;P.lastIndex=0;let o;for(;(o=P.exec(e))!==null;){let n=o[1],s=P.lastIndex-1,c=z(e,s);if(c<0)continue;let l=e.slice(s+1,c),u=/\bname\s*:\s*['"`]([^'"`]+)['"`]/.exec(l);if(!u)continue;let d=u[1],f=`${n}::${d}::${t}`;a.has(f)||(a.add(f),r.push({kind:n===`definePlugin`?`plugin`:`adapter`,name:d,filePath:t,relativePath:i}))}I.lastIndex=0;let s;for(;(s=I.exec(e))!==null;){let n=s.index,o=e.indexOf(`{`,n);if(o<0)continue;let c=K(e,o);if(c<0)continue;let l=e.slice(o+1,c),u=_e.exec(l);if(!u)continue;let d=u[1],f=`class::${d}::${t}`;a.has(f)||(a.add(f),r.push({kind:`adapter`,name:d,filePath:t,relativePath:i}))}return r}function Ie(e,t,n){let r=[],i=G(t,n),a=new Set;for(F.lastIndex=0;F.exec(e)!==null;){let n=F.lastIndex-1,o=z(e,n);if(o<0)continue;let s=e.slice(n+1,o),c=/\bkey\s*:\s*['"`]([^'"`]+)['"`]/.exec(s);if(!c)continue;let l=c[1];a.has(l)||(a.add(l),r.push({key:l,filePath:t,relativePath:i}))}return r}function Le(e,t,n){let r=[],i=G(t,n);L.lastIndex=0;let a;for(;(a=L.exec(e))!==null;){let n=a[1],o=null,s=null;if(a[2]){let t=e.indexOf(`{`,a.index+a[0].length-1);if(t>=0){let n=K(e,t);if(n>=0){let r=e.slice(t+1,n);o=Re(r,`description`),s=Re(r,`example`)}}}r.push({name:n,description:o,example:s,filePath:t,relativePath:i})}return r}function Re(e,t){let n=RegExp(`\\b${t}\\s*:\\s*(['"\`])`,`g`).exec(e);if(!n)return null;let r=n[1],i=n.index+n[0].length,a=i,o=null;for(;a<e.length;){let t=e[a];if(t===`\\`){a+=2;continue}if(t===r){o=e.slice(i,a);break}a++}return o===null?null:o.replace(/\\(.)/g,(e,t)=>t===`n`?`
12
+ `:t===`t`?` `:t===`r`?`\r`:t)}const ze=[`src/config/index.ts`,`src/config/env.ts`,`src/config.ts`,`src/env.ts`];async function Be(e,t){let n=t===`src/env.ts`?ze:[t];for(let t of n){let n=a(e,t),r;try{r=await l(n,`utf-8`)}catch{continue}if(!(!/\bdefineEnv\s*\(/.test(r)&&!/\bfrom(Zod|Valibot|Yup)\s*\(/.test(r))&&/export\s+default\b/.test(r)&&!/export\s+default\s+loadEnvFromSchema\s*\(/.test(r))return{filePath:n,relativePath:G(n,e)}}return null}function Ve(e){let t=new Map;for(let n of e){let e=t.get(n.className)??[];e.push(n),t.set(n.className,e)}let n=[];for(let[e,r]of t)new Set(r.map(e=>e.filePath)).size>1&&n.push({className:e,classes:r});return n.sort((e,t)=>e.className.localeCompare(t.className)),n}function He(e,t,n){return oe(e,t,n)||Ue(e,t,n)}function Ue(e,t,n){let r=je(e,t,n);return{classes:r,tokens:Me(e,t,n),injects:Pe(e,t,n),pluginsAndAdapters:Fe(e,t,n),augmentations:Le(e,t,n),contextKeys:Ie(e,t,n),routes:Ne(e,t,n,r,new Map),moduleMounts:De(e),globPatterns:/\.module\.[mc]?[tj]sx?$/.test(t)?we(e):[]}}async function We(e,t,n){let r=n?await y.signature(e):null;if(n&&r){let t=n.get(e,r);if(t)return n.set(e,r,t),t}let i;try{i=await l(e,`utf-8`)}catch{return null}let a=He(i,e,t);return n&&r&&n.set(e,r,a),a}async function Ge(e,t,n){let r=[],i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;;){let t=i++;if(t>=e.length)return;r[t]=await n(e[t],t)}});return await Promise.all(a),r}async function q(e){let t=(await Ae(a(e.root),e)).toSorted(),n=e.cacheDir?await y.load(e.cacheDir):null,r=Je(t,await Ge(t,16,t=>We(t,e.cwd,n))),i=await Be(e.cwd,e.envFile??`src/env.ts`);return n&&await n.save(),{...r,env:i}}function Ke(e,t,n){let r=n.extensions??le,a=n.exclude??ue;if(!e.startsWith(t+o)&&e!==t||!r.some(t=>e.endsWith(t)))return!1;let s=i(n.cwd,e);return!a.some(e=>s.includes(e))}async function qe(e,t){if(!e.cacheDir)return q(e);let n=a(e.root),r=await y.load(e.cacheDir),i=r.cachedFiles();if(i.length===0)return q(e);let o=new Set(t.removed.map(t=>a(e.cwd,t))),s=t.changed.map(t=>a(e.cwd,t)).filter(t=>!o.has(t)&&Ke(t,n,e)),c=new Set(s),u=new Set(i);for(let e of c)u.add(e);for(let e of o)u.delete(e);let d=new Map;await Ge(s,16,async t=>{if(!u.has(t))return;let n=await y.signature(t),i;try{i=await l(t,`utf-8`)}catch{u.delete(t);return}let a=He(i,t,e.cwd);d.set(t,a),n&&r.set(t,n,a)});let f=[...u].toSorted(),p=Je(f,f.map(e=>d.get(e)||(r.carry(e),r.peek(e)))),m=await Be(e.cwd,e.envFile??`src/env.ts`);return await r.save(),{...p,env:m}}function Je(e,t){let n=[],r=[],i=[],a=[],s=[],c=[],l=[],u=new Map;for(let e of t)if(e)for(let{controller:t,mountPath:n}of e.moduleMounts)u.has(t)||u.set(t,n);let d=new Map;for(let o=0;o<e.length;o++){let f=t[o];if(f){n.push(...f.classes),i.push(...f.tokens),a.push(...f.injects),s.push(...f.pluginsAndAdapters),c.push(...f.augmentations),l.push(...f.contextKeys),f.globPatterns.length>0&&d.set(e[o],f.globPatterns);for(let e of f.routes){let t=u.get(e.controller);if(t){let n=be(t,e.path);r.push({...e,pathParams:ye(n)})}else r.push(e)}}}let f=[];for(let[e,t]of d){if(!/\.module\.[mc]?[tj]sx?$/.test(e)||t.length===0)continue;let r=e.replaceAll(o,`/`),i=r.slice(0,r.lastIndexOf(`/`));for(let a of n){if(a.decorator===`Module`)continue;let n=a.filePath.replaceAll(o,`/`);n.startsWith(i+`/`)&&n!==r&&(Ee(n.slice(i.length+1),t)||f.push({className:a.className,filePath:a.filePath,relativePath:a.relativePath,moduleFilePath:e,decorator:a.decorator}))}}n.sort((e,t)=>e.className===t.className?e.relativePath.localeCompare(t.relativePath):e.className.localeCompare(t.className)),i.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),a.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),r.sort((e,t)=>e.controller.localeCompare(t.controller)||e.method.localeCompare(t.method)),s.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),c.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),l.sort((e,t)=>e.key.localeCompare(t.key)||e.relativePath.localeCompare(t.relativePath));let p=Ve(n);return f.sort((e,t)=>e.relativePath.localeCompare(t.relativePath)||e.className.localeCompare(t.className)),{classes:n,routes:r,tokens:i,injects:a,collisions:p,pluginsAndAdapters:s,augmentations:c,contextKeys:l,orphanedClasses:f}}const J="/* eslint-disable */\n// AUTO-GENERATED by `kick typegen`. DO NOT EDIT.\n// Re-run with `kick typegen` or rely on `kick dev` to refresh.\n",Y=new Set([`Service`,`Repository`,`Injectable`,`Component`]);var X=class extends Error{collisions;constructor(e){super(Ye(e)),this.name=`TokenCollisionError`,this.collisions=e}};function Ye(e){let t=[`kick typegen: token collision detected`];for(let n of e){t.push(``),t.push(` ${n.classes.length} classes named '${n.className}':`);for(let e of n.classes)t.push(` - ${e.relativePath}`)}return t.push(``),t.push(`Resolutions:`),t.push(` (a) Rename one of the classes`),t.push(` (b) Use createToken<T>('namespaced/Name') and import the token explicitly — see @forinda/kickjs`),t.push(` (c) Pass --allow-duplicates to namespace the registry keys automatically`),t.push(` (e.g. 'modules/users/UserService' instead of 'UserService')`),t.join(`
13
+ `)}function Xe(e,t){let r=i(n(t),e).split(o).join(`/`);return r=r.replace(/\.(ts|tsx|mts|cts)$/i,``),r.startsWith(`.`)||(r=`./`+r),r}function Ze(e){let t=e.relativePath.replace(/^src\//,``).replace(/\.(ts|tsx|mts|cts)$/i,``).split(`/`);t.pop();let n=t.join(`/`);return n?`${n}/${e.className}`:e.className}function Qe(e,t,n){let r=new Set,i=[];for(let a of e){if(!Y.has(a.decorator))continue;let e=n.has(a.className)?Ze(a):a.className;if(r.has(e))continue;r.add(e);let o=Xe(a.filePath,t),s=a.isDefault?`import('${o}').default`:`import('${o}').${a.className}`;i.push(` '${e}': ${s}`)}return`${J}
14
+ declare module '@forinda/kickjs' {
15
+ interface KickJsRegistry {
16
+ ${i.length?i.join(`
17
+ `):" // (no services discovered yet — run `kick g service <name>` to add one)"}
18
+ }
19
+ }
20
+
21
+ export {}
22
+ `}function $e(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function et(e){return`${J}
23
+ declare module '@forinda/kickjs' {
24
+ /**
25
+ * Key-only registry of every context key produced by a
26
+ * \`defineContextDecorator\` / \`defineHttpContextDecorator\` in the
27
+ * project. Feeds \`dependsOn\` typo-checking. Value types live in
28
+ * \`ContextMeta\`; this only records that the key exists.
29
+ */
30
+ interface ContextKeys {
31
+ ${[...new Set(e.map(e=>e.key))].toSorted().map(e=>` ${$e(e)?e:JSON.stringify(e)}: true`).join(`
32
+ `)}
33
+ }
34
+ }
35
+
36
+ export {}
37
+ `}function tt(e,t,n){return t.length===0?`${J}
38
+ // ${n}
39
+ export type ${e} = never
40
+ `:`${J}
41
+ export type ${e} =
42
+ ${[...new Set(t)].toSorted().map(e=>` | '${e}'`).join(`
43
+ `)}
44
+ `}function nt(e,t,n,r){return[...e.filter(e=>Y.has(e.decorator)).map(e=>r.has(e.className)?Ze(e):e.className),...t.map(e=>e.name),...n.map(e=>e.name)]}function rt(e){return e.filter(e=>e.decorator===`Module`).map(e=>e.className)}function it(e){let t=new Map;for(let n of e)t.has(n.name)||t.set(n.name,n);return`${J}
45
+ declare module '@forinda/kickjs' {
46
+ /**
47
+ * Map of every plugin/adapter \`name\` discovered in the project. The
48
+ * value type is the kind tag (\`'plugin'\` or \`'adapter'\`); the
49
+ * \`keyof\` of this interface narrows \`dependsOn\` so misspelled deps
50
+ * become compile errors instead of boot-time \`MissingMountDepError\`.
51
+ */
52
+ interface KickJsPluginRegistry {
53
+ ${[...t.values()].toSorted((e,t)=>e.name.localeCompare(t.name)).map(e=>` '${e.name}': '${e.kind}'`).join(`
54
+ `)||" // (no plugins/adapters discovered yet — `defineAdapter`/`definePlugin` calls feed this)"}
55
+ }
56
+ }
57
+
58
+ export {}
59
+ `}function at(e){if(e.length===0)return`${J}
60
+ // No augmentations discovered.
61
+ //
62
+ // Plugins advertise augmentable interfaces via:
63
+ //
64
+ // import { defineAugmentation } from '@forinda/kickjs'
65
+ // defineAugmentation('FeatureFlags', {
66
+ // description: 'Feature flag shape consumed by FlagsPlugin',
67
+ // example: '{ beta: boolean; rolloutPercentage: number }',
68
+ // })
69
+ //
70
+ // See \`docs/guide/typegen.md#augmentations\` for the full pattern.
71
+ export {}
72
+ `;let t=new Map;for(let n of e)t.has(n.name)||t.set(n.name,n);let n=[];for(let e of[...t.values()].toSorted((e,t)=>e.name.localeCompare(t.name))){let t=[];if(e.description)for(let n of e.description.split(`
73
+ `))t.push(` * ${n}`);if(e.example){t.push(` * @example`," * ```ts");for(let n of e.example.split(`
74
+ `))t.push(` * ${n}`);t.push(" * ```")}t.push(` * @see ${e.relativePath}`),n.push([`/**`,...t,` */`,`export interface ${e.name}Augmentation {}`].join(`
75
+ `))}return`${J}
76
+ // Catalogue of augmentable interfaces in this project. The interfaces
77
+ // below are documentation only — augment the source-of-truth interfaces
78
+ // in your own \`d.ts\` files (the framework declares the actual types).
79
+
80
+ ${n.join(`
81
+
82
+ `)}
83
+ `}const ot=/^(kick\/)?([a-z][\w-]*\/[A-Z]\w*)(\/.+)?(:[a-z][\w-]+(:[a-z][\w-]+)*)?$/;function st(e){let t=[];for(let n of e){let e=n.name;e.startsWith(`kickjs.`)||ot.test(e)||t.push({token:e,variable:n.variable,filePath:n.relativePath,reason:"does not match `<scope>/<PascalKey>[/<suffix>][:<instance>]`",suggestion:ct(e)})}return t}function ct(e){if(/^[A-Z]\w*$/.test(e))return`'<scope>/${e}' (e.g. 'mycorp/${e}')`;if(e.includes(`.`))return`consider '<scope>/PascalKey' instead of dotted form`;let t=/^([a-z][\w-]*)\/([a-z]\w*)$/.exec(e);if(t){let[,e,n]=t;return`'${e}/${n.charAt(0).toUpperCase()}${n.slice(1)}'`}}function lt(e,t){if(!e)return{entries:[],count:0};let n=new Map;for(let[r,i]of Object.entries(e)){if(!i||typeof i.src!=`string`)continue;let e=a(t,i.src);if(!pt(e))continue;let o=m(i.glob??`**/*`,{cwd:e,nodir:!0,dot:!1,posix:!0});o.sort();let{pairs:s}=h(r,o,{strategy:i.keys??`auto`});for(let{key:e}of s){let t=e.slice(r.length+1);n.set(e,{namespace:r,key:t})}}return{entries:[...n.values()],count:n.size}}function ut(e){let t="/* eslint-disable */\n// AUTO-GENERATED by `kick typegen`. DO NOT EDIT.\n// Re-run with `kick typegen` or rely on `kick dev` to refresh.\n";if(e.entries.length===0)return`${t}
84
+ declare module '@forinda/kickjs' {
85
+ /**
86
+ * Map of every typed asset discovered in the project's assetMap.
87
+ * (No assetMap entries discovered yet — declare with
88
+ * \`assetMap: { name: { src: 'src/...' } }\` in kick.config.ts.)
89
+ */
90
+ interface KickAssets {}
91
+ }
92
+
93
+ export {}
94
+ `;let n={};for(let t of e.entries){let e=`${t.namespace}/${t.key}`.split(`/`),r=n;for(let t=0;t<e.length-1;t++){let n=e[t],i=r[n];if(i===Z){let e={};r[n]=e,r=e}else i||(r[n]={}),r=r[n]}let i=e[e.length-1];typeof r[i]!=`object`&&(r[i]=Z)}return`${t}
95
+ declare module '@forinda/kickjs' {
96
+ /**
97
+ * Map of every typed asset discovered in the project's assetMap.
98
+ * Each leaf is a \`() => string\` thunk that returns the resolved
99
+ * absolute path for the file in the current run mode (dev → src,
100
+ * prod → dist).
101
+ */
102
+ interface KickAssets {
103
+ ${dt(n,` `)}
104
+ }
105
+ }
106
+
107
+ export {}
108
+ `}const Z=Symbol(`asset-leaf`);function dt(e,t){let n=Object.keys(e).toSorted(),r=[];for(let i of n){let n=e[i],a=ft(i)?i:JSON.stringify(i);n===Z?r.push(`${t}${a}: () => string`):(r.push(`${t}${a}: {`),r.push(dt(n,`${t} `)),r.push(`${t}}`))}return r.join(`
109
+ `)}function ft(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function pt(e){try{return s(e).isDirectory()}catch{return!1}}var mt=e({runTypegen:()=>Q,sweepStaleTypegen:()=>vt,watchTypegen:()=>_t,writeTypegenArtifacts:()=>$});function ht(e){let t=e.cwd??process.cwd();return{cwd:t,srcDir:a(t,e.srcDir??`src`),outDir:a(t,e.outDir??`.kickjs/types`),silent:e.silent??!1,allowDuplicates:e.allowDuplicates??!1,schemaValidator:e.schemaValidator??!1,envFile:e.envFile??`src/env.ts`}}async function Q(e={}){let{cwd:t,srcDir:n,outDir:r,silent:i,allowDuplicates:o,envFile:s}=ht(e),c=Date.now(),l={root:n,cwd:t,cacheDir:a(t,`.kickjs`,`cache`),envFile:s===!1?void 0:s},u=e.changedFiles?await qe(l,e.changedFiles):await q(l);if(u.collisions.length>0&&!o)throw new X(u.collisions);let d=lt(e.assetMap,t),f=[],p=[];if(e.runPlugins!==!1){try{let{runAllPluginTypegens:n}=await import(`./run-plugins-COniKxrL.mjs`),{loadKickConfig:r}=await import(`./config-Dc4XuP2E.mjs`).then(e=>e.n);f=await n({cwd:t,config:await r(t),silent:!0,changedFiles:e.changedFiles})}catch(e){if(!i){let t=e instanceof Error?e.message:String(e);console.warn(` kick typegen: plugin pipeline failed (${t}) — continuing`)}}p.push(...await $(r,f,i))}let m=st(u.tokens),h=gt(u,d.count,p),g=Date.now()-c;if(!i){let e=r.replace(t+`/`,``),n=h.resolvedCollisions>0?`, ${h.resolvedCollisions} collisions namespaced`:``,i=h.envWritten?`, env typed`:``,a=h.pluginEntries>0?`, ${h.pluginEntries} plugins/adapters`:``,o=h.augmentationEntries>0?`, ${h.augmentationEntries} augmentations`:``,s=h.assetEntries>0?`, ${h.assetEntries} assets`:``;if(console.log(` kick typegen → ${h.serviceTokens} services, ${h.routeEntries} routes, ${h.moduleTokens} modules${a}${o}${s}${i}${n} → ${e} (${g}ms)`),m.length>0){console.warn(` kick typegen: ${m.length} token(s) don't match the §22.2 convention:`);for(let e of m){let t=e.variable?` [${e.variable}]`:``;console.warn(` '${e.token}' (${e.filePath})${t} — ${e.reason}`),e.suggestion&&console.warn(` → suggestion: ${e.suggestion}`)}}if(u.orphanedClasses.length>0){console.warn(` kick typegen: ${u.orphanedClasses.length} decorated class(es) not matched by any module's import.meta.glob():`);for(let e of u.orphanedClasses)console.warn(` @${e.decorator} ${e.className} (${e.relativePath})`),console.warn(` → not picked up by any glob in ${e.moduleFilePath}`)}}return{scan:u,result:h,tokenWarnings:m}}function gt(e,t,n){let r=new Set(e.collisions.map(e=>e.className)),i=e.classes.filter(e=>Y.has(e.decorator)),a=nt(e.classes,e.tokens,e.injects,r);return{registryEntries:i.length,serviceTokens:new Set(a).size,moduleTokens:rt(e.classes).length,routeEntries:e.routes.length,pluginEntries:new Set(e.pluginsAndAdapters.map(e=>e.name)).size,augmentationEntries:new Set(e.augmentations.map(e=>e.name)).size,assetEntries:t,envWritten:e.env!==null,written:n,resolvedCollisions:e.collisions.length}}async function $(e,t,i){await c(e,{recursive:!0}),await p(r(n(e),`.gitignore`),`# Auto-generated by kick typegen
110
+ *
111
+ `,`utf-8`);let a=t.filter(e=>e.outFile).map(e=>e.outFile);return await vt(e,a,t,i),a}async function _t(e={}){let t=ht(e),{srcDir:n,silent:r,cwd:i}=t,a={...t,allowDuplicates:!0,runPlugins:!1},o=process.env.KICKJS_WATCH_POLLING===`1`||process.env.KICKJS_WATCH_POLLING===`true`,[{runAllPluginTypegens:s},{loadKickConfig:c}]=await Promise.all([import(`./run-plugins-COniKxrL.mjs`),import(`./config-Dc4XuP2E.mjs`).then(e=>e.n)]),l=await c(i),u=async()=>{try{await Q({...a})}catch(e){if(r)return;if(e instanceof X)console.error(`
112
+ `+e.message+`
113
+ `);else{let t=e instanceof Error?e.message:String(e);console.error(` kick typegen failed: ${t}`)}}},d=async()=>{try{let e=await s({cwd:i,config:l,silent:!0});await $(t.outDir,e,!0)}catch{}};await u(),await d();let{watch:f}=await import(`node:fs`),p=null,m=e=>{e&&/\.(ts|tsx|mts|cts)$/.test(e)&&(e.includes(`.kickjs`)||e.endsWith(`.d.ts`)||(p&&clearTimeout(p),p=setTimeout(()=>{u().then(d)},100)))};if(o){r||console.log(` kick typegen: polling mode (KICKJS_WATCH_POLLING)`);let e=setInterval(()=>{u().then(d)},2e3);return()=>clearInterval(e)}let h;try{h=f(n,{recursive:!0},(e,t)=>{m(t)})}catch(e){r||console.warn(` kick typegen: watch mode unavailable (${e?.message??e}). Falling back to polling.`);let t=setInterval(()=>{u().then(d)},2e3);return()=>clearInterval(t)}return()=>{p&&clearTimeout(p),h.close()}}async function vt(e,n,r,i){let o=new Set;for(let e of n)o.add(t(e));for(let e of r)e.outFile&&o.add(t(e.outFile));let s;try{s=await u(e)}catch{return[]}let c=[];for(let t of s){if(!yt.has(t)||o.has(t))continue;let n=a(e,t);try{if(!(await d(n)).isFile())continue;await f(n),c.push(t)}catch{}}return c.length>0&&!i&&console.log(` kick typegen: swept ${c.length} stale file(s): ${c.join(`, `)}`),c}const yt=new Set([`assets.d.ts`,`env.ts`,`routes.ts`,`registry.d.ts`,`services.d.ts`,`modules.d.ts`,`plugins.d.ts`,`augmentations.d.ts`,`index.d.ts`]);export{lt as a,rt as c,et as d,it as f,qe as g,q as h,$ as i,nt as l,tt as m,mt as n,ut as o,Qe as p,_t as r,X as s,Q as t,at as u};
114
+ //# sourceMappingURL=typegen-DPATg8Ix.mjs.map