@forinda/kickjs-cli 8.17.0 → 8.17.2
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/dist/{agent-docs-BkoYR-bq.mjs → agent-docs-C4A41Cxq.mjs} +3 -3
- package/dist/{agent-docs-BkoYR-bq.mjs.map → agent-docs-C4A41Cxq.mjs.map} +1 -1
- package/dist/{agent-docs-BCgn3jTD.mjs → agent-docs-DcLd7rdR.mjs} +2 -2
- package/dist/{build-ByZMvCD0.mjs → build-BQTa8V5a.mjs} +3 -3
- package/dist/{build-ByZMvCD0.mjs.map → build-BQTa8V5a.mjs.map} +1 -1
- package/dist/{build-B0DNAPYL.mjs → build-DVG7HBiY.mjs} +2 -2
- package/dist/{builtins-BXCr0VP8.mjs → builtins-BMWR-jTf.mjs} +2 -2
- package/dist/{builtins-DAucpgiM.mjs → builtins-BSOl93g5.mjs} +4 -4
- package/dist/cli.mjs +2 -2
- package/dist/{config-CjQ2Z43B.mjs → config-CJ374HRq.mjs} +2 -2
- package/dist/{config-BdvviVyU.mjs → config-COy9BM-6.mjs} +3 -3
- package/dist/{config-BdvviVyU.mjs.map → config-COy9BM-6.mjs.map} +1 -1
- package/dist/{doctor-C7UorUoN.mjs → doctor-HJItmhxU.mjs} +4 -4
- package/dist/{doctor-C7UorUoN.mjs.map → doctor-HJItmhxU.mjs.map} +1 -1
- package/dist/{fullstack-BRCCVrIH.mjs → fullstack-3Ual2XVy.mjs} +4 -4
- package/dist/{fullstack-BRCCVrIH.mjs.map → fullstack-3Ual2XVy.mjs.map} +1 -1
- package/dist/{fullstack-DjyPVpMg.mjs → fullstack-ChowVdmv.mjs} +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{plugin-DJ8l55--.mjs → plugin-APrP2iBf.mjs} +2 -2
- package/dist/{plugin-BLiFnUHv.mjs → plugin-DeDC5OJj.mjs} +2 -2
- package/dist/{project-a6ySsOdn.mjs → project-CgnwQ6Wa.mjs} +5 -5
- package/dist/{project-a6ySsOdn.mjs.map → project-CgnwQ6Wa.mjs.map} +1 -1
- package/dist/{project-BktGFUEX.mjs → project-Dpxlanma.mjs} +4 -4
- package/dist/{project-root-B440ayQv.mjs → project-root-B8zc70xL.mjs} +3 -3
- package/dist/{project-root-B440ayQv.mjs.map → project-root-B8zc70xL.mjs.map} +1 -1
- package/dist/{project-root-DXjh5yeq.mjs → project-root-C04ULnJ3.mjs} +2 -2
- package/dist/{rolldown-runtime-CP6a3t1y.mjs → rolldown-runtime-DEqJzHIh.mjs} +1 -1
- package/dist/{run-plugins-DA8d-SRc.mjs → run-plugins-C7QLbuwX.mjs} +4 -4
- package/dist/{run-plugins-DA8d-SRc.mjs.map → run-plugins-C7QLbuwX.mjs.map} +1 -1
- package/dist/{typegen-BSqoTT4o.mjs → typegen-CddRbiCU.mjs} +5 -5
- package/dist/{typegen-BSqoTT4o.mjs.map → typegen-CddRbiCU.mjs.map} +1 -1
- package/dist/{typegen-CV1AL1yd.mjs → typegen-CeyBm5n4.mjs} +4 -4
- package/dist/{types-Dhmt7m7y.mjs → types-BhO1DrBv.mjs} +1 -1
- package/package.json +2 -2
- package/templates/feature-storage/files/_dot_env.example.append +11 -2
- package/templates/feature-storage/files/src/adapters/storage.ts +5 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.
|
|
2
|
+
* @forinda/kickjs-cli v8.17.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{f as e,o as t,r as n}from"./config-
|
|
11
|
+
import{f as e,o as t,r as n}from"./config-CJ374HRq.mjs";import{C as r,a as i,b as a,o,r as s,s as c,v as l,y as u}from"./agent-docs-DcLd7rdR.mjs";import{existsSync as d,readFileSync as f,writeFileSync as p}from"node:fs";import{dirname as m,join as h,posix as g,relative as _,resolve as v}from"node:path";import{fileURLToPath as y}from"node:url";import{execFile as b,execFileSync as x,execSync as S,spawnSync as C}from"node:child_process";import{promisify as w}from"node:util";import{randomBytes as T}from"node:crypto";import{parseSync as E}from"oxc-parser";const ee=w(b),D=/[&|<>^"'`(){}[\];!%\r\n\\]/;function O(e,t,n=process.platform){if(n!==`win32`)return[e,t];if(D.test(e)||t.some(e=>D.test(e)))return null;let r=[e,...t].map(e=>e.includes(` `)?`"${e}"`:e).join(` `);return[process.env.ComSpec||`cmd.exe`,[`/d`,`/s`,`/c`,r]]}function k(e,t,n={}){let r=O(e,t);if(!r)return null;try{return x(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,stdio:[`ignore`,`pipe`,`ignore`],windowsHide:!0}).toString().trim()||null}catch{return null}}function A(e,t,n={}){let r=O(e,t);if(!r)throw Error(`Refusing to run '${e}': unsafe arguments`);x(r[0],r[1],{cwd:n.cwd,stdio:`inherit`,windowsHide:!0})}function j(e,t,n){S(e,{cwd:t,stdio:`inherit`,env:n?{...process.env,...n}:process.env})}function M(e,t,n){let r=C(process.execPath,[e],{cwd:n,stdio:`inherit`,env:{...process.env,...t}});r.status!==0&&process.exit(r.status??1)}async function te(e,t,n={}){let r=O(e,t);if(!r)return null;try{let{stdout:e}=await ee(r[0],r[1],{encoding:`utf-8`,timeout:n.timeout??5e3,cwd:n.cwd,windowsHide:!0});return e.toString().trim()||null}catch{return null}}function ne(e,t){let n=e[t];if(!n)throw Error(`generatePackageJson: missing resolved version for ${t}. Add it to SIBLING_PACKAGES or THIRD_PARTY_PACKAGES in generators/project.ts.`);return n}function N(e,t){return Object.fromEntries(e.toSorted().map(e=>[e,ne(t,e)]))}function P(e){try{let t=x(e,[`--version`],{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`ignore`],timeout:1e4}).trim();return/^\d+\.\d+\.\d+$/.test(t)?`${e}@${t}`:void 0}catch{return}}function re(e){let t=e?.match(/@(\d+)\.(\d+)\./);return t?[Number(t[1]),Number(t[2])]:void 0}function ie(e,t){let n=re(t)?.[0];return e===`yarn`&&n!==void 0&&n>=2?`nodeLinker: node-modules
|
|
12
12
|
`:void 0}function ae(e,t,n,r){return JSON.stringify({name:e,...r?{packageManager:r}:{},version:`0.0.0`,type:`module`,scripts:{dev:`kick dev`,build:`kick build`,start:`kick start`,test:`vitest run --passWithNoTests`,...n.scripts},dependencies:N(n.dependencies,t),devDependencies:N(n.devDependencies,t)},null,2)}function oe(e,t){let n=Object.entries(t);if(n.length===0)return e;let r=e===``?[]:e.replace(/\n$/,``).split(`
|
|
13
13
|
`),i=e=>e.trim().replace(/^['"]|['"]$/g,``),a=e=>/^[\w-]+$/.test(e)?e:`'${e}'`,o=(e,t)=>{let n=r.findIndex(t=>t.replace(/\s+$/,``)===`${e}:`);if(n===-1){if(!t)return;r.length>0&&r[r.length-1]!==``&&r.push(``),r.push(`${e}:`),n=r.length-1}let i=n+1;for(let e=n+1;e<r.length&&/^(\s|$)/.test(r[e]);e++)r[e].trim()!==``&&(i=e+1);return{start:n,end:i}},s=[];for(let[e,t]of n){let{start:n,end:c}=o(`allowBuilds`,!0),l=r.slice(n+1,c).findIndex(t=>i(t.split(`:`)[0])===e),u=l===-1?void 0:/:\s*(true|false)\s*$/.exec(r[n+1+l]);if(u){s.push([e,u[1]===`true`]);continue}let d=` ${a(e)}: ${t}`;l===-1?r.splice(c,0,d):r[n+1+l]=d,s.push([e,t])}let c=[`onlyBuiltDependencies`,`ignoredBuiltDependencies`];for(let[e,t]of s){if(c.some(t=>{let n=o(t,!1);return n!==void 0&&r.slice(n.start+1,n.end).some(t=>i(t.replace(/^\s*-/,``))===e)}))continue;let{end:n}=o(t?c[0]:c[1],!0);r.splice(n,0,` - ${a(e)}`)}return`${r.join(`
|
|
14
14
|
`)}\n`}const F=`node:22-slim`,se={pnpm:{lockfile:`pnpm-lock.yaml`,installFiles:[`pnpm-workspace.yaml`],install:`pnpm install --frozen-lockfile`,installProd:`pnpm install --prod --frozen-lockfile`,run:e=>`pnpm run ${e}`,image:F,setup:`RUN corepack enable`},npm:{lockfile:`package-lock.json`,installFiles:[],install:`npm ci`,installProd:`npm ci --omit=dev`,run:e=>`npm run ${e}`,image:F},yarn:{lockfile:`yarn.lock`,installFiles:[],install:`yarn install --frozen-lockfile`,installProd:`yarn install --production --frozen-lockfile`,run:e=>`yarn run ${e}`,image:F,setup:`RUN corepack enable`},bun:{lockfile:`bun.lock`,installFiles:[],install:`bun install --frozen-lockfile`,installProd:`bun install --production --frozen-lockfile`,run:e=>`bun run ${e}`,image:`oven/bun:1`}},I={lockfile:`yarn.lock`,installFiles:[`.yarnrc.yml`],install:`yarn install --immutable`,installProd:`yarn workspaces focus --all --production`,run:e=>`yarn run ${e}`,image:F,setup:`RUN corepack enable`},ce={api:`docker run -p 3000:3000 <name>`,inertia:`docker run -p 3000:3000 -e SESSION_SECRET=<a long random string> -e APP_URL=<https://your.site> <name>`,fullstack:`docker run -p 3000:3000 <name>`};function le(e,t,n,r){let[i=0,a=0]=re(r)??[],o=t===`yarn`&&i>=2?i>=4?I:{...I,installProd:I.install}:t===`bun`&&r&&(i<1||i===1&&a<2)?{...se.bun,lockfile:`bun.lockb`}:se[t],s=`${o.setup?`\n${o.setup}`:``}
|
|
@@ -131,8 +131,8 @@ CMD ["node", "dist/index.js"]
|
|
|
131
131
|
`),console.log(g.replace(/^/gm,` `)),console.log());let S=[...new Set(e.map(e=>De[e]).filter(Boolean))];for(let e of await s(_,S,n))console.log(` Created ${e}`)}}T?console.log(` Done!
|
|
132
132
|
`):(console.log(` Finished with errors — the install above did not complete.
|
|
133
133
|
`),process.exitCode=1)})}const tt=m(y(import.meta.url));function nt(t){return{kick:n(t,`kick`),runDev:e(t,`dev`),runBuild:e(t,`build`),runStart:e(t,`start`),runTest:e(t,`test`)}}const Q=JSON.parse(f([h(tt,`..`,`package.json`),h(tt,`..`,`..`,`package.json`)].find(d),`utf-8`)),rt=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-schema`,`@forinda/kickjs-vite`,`@forinda/kickjs-swagger`,`@forinda/kickjs-ws`,`@forinda/kickjs-queue`,`@forinda/kickjs-devtools`,`@forinda/kickjs-testing`,`@forinda/kickjs-client`,`@forinda/kickjs-inertia`,`@forinda/kickjs-storage`,`@forinda/kickjs-view`],it={react:{fallback:`^19.0.0`},"react-dom":{fallback:`^19.0.0`},"@types/react":{fallback:`^19.0.0`},"@types/react-dom":{fallback:`^19.0.0`},"@vitejs/plugin-react":{fallback:`^5.0.0`},"@inertiajs/react":{fallback:`^3.9.0`,cap:`^3`},"@inertiajs/core":{fallback:`^3.9.0`,cap:`^3`},"@types/node":{fallback:`^25.0.0`},"@types/supertest":{fallback:`^7.2.1`},supertest:{fallback:`^7.2.2`},vitest:{fallback:`^4.1.2`},"@swc/core":{fallback:`^1.15.21`},"unplugin-swc":{fallback:`^1.5.9`},oxfmt:{fallback:`^0.65.0`},oxlint:{fallback:`^1.80.0`},dotenv:{fallback:`^17.3.1`,cap:`^17`},"reflect-metadata":{fallback:`^0.2.2`},vite:{fallback:`^8.0.3`,cap:`^8`},typescript:{fallback:`^7.0.2`,cap:`^7`},"@typescript/typescript6":{fallback:`^6.0.2`,cap:`^6`},express:{fallback:`^5.1.0`,cap:`^5`},"@types/express":{fallback:`^5.0.6`,cap:`^5`},fastify:{fallback:`^5.0.0`,cap:`^5`},"@fastify/middie":{fallback:`^9.0.0`,cap:`^9`},h3:{fallback:`^2.0.2`,cap:`^2`},"serve-static":{fallback:`^2.2.0`,cap:`^2`},zod:{fallback:`^4.3.6`,cap:`^4`},valibot:{fallback:`^1.4.1`,cap:`^1`},"@valibot/to-json-schema":{fallback:`^1.8.0`,cap:`^1`},yup:{fallback:`^1.7.1`,cap:`^1`},ws:{fallback:`^8.18.0`,cap:`^8`},bullmq:{fallback:`^5.0.0`,cap:`^5`},ioredis:{fallback:`^5.0.0`,cap:`^5`}};function $(e){if(!e)return null;let t=e.trim();if(/^\d+\.\d+\.\d+/.test(t))return t.split(/\s/)[0];try{let e=JSON.parse(t),n=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`);return n.length>0?n[n.length-1]:null}catch{return null}}function at(e){return e===`@forinda/kickjs-cli`?`^${Q.version}`:`latest`}async function ot(e,t,n){let r=Array.from({length:e.length}),i=0,a=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let t=i++;r[t]=await n(e[t])}});return await Promise.all(a),r}async function st(){let e=[...rt.map(e=>({name:e,fallback:at(e),cap:void 0})),...Object.entries(it).map(([e,t])=>({name:e,...t}))],t=Date.now()+2e4,n=await ot(e,8,async({name:e,fallback:n,cap:r})=>{let i=t-Date.now();if(i<=0)return[e,n];let a=r?`${e}@${r}`:e,o=$(await te(`npm`,r?[`view`,a,`version`,`--json`]:[`view`,a,`version`],{timeout:i}));return[e,o?`^${o}`:n]});return Object.fromEntries(n)}function ct(e,t){let n=k(`npm`,[`view`,`${e}@${t}`,`version`],{timeout:2e4});return n&&/^\d+\.\d+\.\d+/.test(n)?n:null}function lt(e){return(e??``).replace(/^[\^~>=<\s]+/,``)}function ut(e,t){let n=e=>lt(e).split(`-`)[0].split(`.`).map(e=>Number.parseInt(e,10)||0),[r=0,i=0,a=0]=n(e),[o=0,s=0,c=0]=n(t);return r===o?i===s?a>=c:i>s:r>o}const dt=Q.version;async function ft(){let e=$(await te(`npm`,[`view`,`@forinda/kickjs-cli`,`version`],{timeout:5e3}));return e&&pt(dt,e)?e:null}function pt(e,t){return e.split(`-`)[0]===t.split(`-`)[0]?e.includes(`-`)&&!t.includes(`-`):!ut(e,t)}function mt(e,t,n){let r=k(`npm`,[`view`,`${e}@${t}`,`exports`,`--json`],{timeout:2e4});if(!r)return!1;try{let e=JSON.parse(r);return Object.prototype.hasOwnProperty.call(e,n)}catch{return!1}}async function ht(t){let{name:i,directory:o,packageManager:s=`pnpm`,template:c=`rest`,defaultRepo:f=`inmemory`,packages:p=[],schemaLib:m=`zod`,runtime:g=`express`}=t,_=o,v=e=>console.log(` ${e}`);console.log(`\n Creating KickJS project: ${i}\n`),t.versions||v(`Resolving package versions...`);let y=t.versions??await st(),b=Object.keys(y).filter(e=>y[e]===`latest`);if(b.length>0&&v(`WARNING: could not reach npm for ${b.join(`, `)} — pinned to 'latest'`),g!==`express`){if(mt(`@forinda/kickjs`,`latest`,`./${g}`))v(`Using @forinda/kickjs@latest (stable ships the ${g} runtime)`);else{let e=[`@forinda/kickjs`,`@forinda/kickjs-cli`,`@forinda/kickjs-vite`],t=[],n=!1;for(let r of e){let e=ct(r,`alpha`);e&&ut(e,lt(y[r]))&&(y[r]=`^${e}`,t.push(`${r}@^${e}`),r===`@forinda/kickjs`&&(n=!0))}v(n?`Using the alpha channel for the ${g} runtime: ${t.join(`, `)}`:`WARNING: could not resolve @forinda/kickjs@alpha — the ${g} runtime subpath may be missing. After install, run: ${s} add @forinda/kickjs@alpha`)}}let x=p.filter(e=>!d(h(l,`feature-${e}`)));x.length>0&&v(`WARNING: skipping unknown package(s): ${x.join(`, `)} — add them later with kick add`);let C=a([...vt({template:c,runtime:g,schemaLib:m,packages:p}),...t.extraLayers??[]],{vars:{name:i,version:Q.version},extra:[{slot:`repo`,code:f===`inmemory`?`repo: 'inmemory'`:`repo: { name: '${f.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}' }`},...t.spaClientDir?[_t(t.spaClientDir)]:[]]}),w=t.platformConfig===!1?void 0:P(s);await r(h(_,`package.json`),ae(i,y,C,w));let E=ie(s,w);E&&await r(h(_,`.yarnrc.yml`),E);let ee=u(C.files,{name:i,template:c,runtime:g,packageManager:s,...nt(s),templateLabel:{rest:`REST API`,minimal:`Minimal`,inertia:`Inertia (React)`}[c],sessionSecret:T(32).toString(`hex`),packages:[...C.dependencies,...C.devDependencies].filter(e=>e.startsWith(`@forinda/`)).map(e=>`- \`${e}\``).join(`
|
|
134
|
-
`)});for(let[e,t]of ee)await r(h(_,e),t);t.deploy?.length&&t.platformConfig!==!1&&await z({dir:_,targets:t.deploy,pm:s,force:!0});let{generateAgentDocs:D}=await import(`./agent-docs-
|
|
135
|
-
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${s} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-
|
|
134
|
+
`)});for(let[e,t]of ee)await r(h(_,e),t);t.deploy?.length&&t.platformConfig!==!1&&await z({dir:_,targets:t.deploy,pm:s,force:!0});let{generateAgentDocs:D}=await import(`./agent-docs-DcLd7rdR.mjs`).then(e=>e.t);await D({outDir:_,name:i,pm:s,template:c,only:`both`,force:!0});let O={...Ye,...Ze(p),...C.builds};if(t.approveInstallScripts!==!1&&Z(s,_,O),t.installDeps){console.log(`\n Installing dependencies with ${s}...\n`);try{S(`${s} install`,{cwd:_,stdio:`inherit`}),console.log(`
|
|
135
|
+
Dependencies installed successfully!`)}catch{console.log(`\n Warning: ${s} install failed. Run it manually.`)}}try{let{runTypegen:e}=await import(`./typegen-CeyBm5n4.mjs`).then(e=>e.n);await e({cwd:_,allowDuplicates:!0,silent:!0})}catch{}if(t.initGit)try{S(`git init`,{cwd:_,stdio:`pipe`}),S(`git branch -M main`,{cwd:_,stdio:`pipe`}),S(`git add -A`,{cwd:_,stdio:`pipe`}),S(`git commit -m "chore: initial commit from kick new"`,{cwd:_,stdio:`pipe`}),v(`Git repository initialized`)}catch{v(`Warning: git init failed (git may not be installed)`)}console.log(`
|
|
136
136
|
Project scaffolded successfully!`),console.log();let k=_!==process.cwd();v(`Next steps:`),k&&v(` cd ${i}`),t.installDeps||v(` ${s} install`);let A=n(s,`kick`),j={rest:`${A} g module user`,minimal:`# add your routes to src/index.ts`,inertia:`# pages: src/modules/pages + src/client/pages`};v(` ${j[c]??j.rest}`),v(` ${e(s,`dev`)}`);let M=e=>{let t=Math.max(...e.map(([e])=>e.length))+2;for(let[n,r]of e)v(` ${n.padEnd(t)}${r}`)};return v(``),v(`Commands:`),M([[e(s,`dev`),`Start dev server with Vite HMR`],[e(s,`build`),`Production build via Vite`],[e(s,`start`),`Run production build`]]),v(``),v(`Generators:`),M([[`${A} g module <name>`,`REST module (controller, service, DTOs, repository)`],[`${A} g scaffold <n> <f..>`,`CRUD module from field definitions`],[`${A} g controller <name>`,`Standalone controller`],[`${A} g service <name>`,`@Service() class`],[`${A} g middleware <name>`,`Global connect-style middleware`],[`${A} g guard <name>`,`Route guard (auth, roles, etc.)`],[`${A} g adapter <name>`,`AppAdapter with lifecycle hooks`],[`${A} g dto <name>`,`DTO schema (Zod / Valibot / Yup)`],[`${A} g config`,`Generate kick.config.ts`]]),v(``),v(`Add packages:`),M([[`${A} add <pkg>`,`Install a KickJS package + peers`],[`${A} add --list`,`Show all available packages`]]),v(``),v(`Available: ${Ue}`),v(``),{builds:O}}const gt=e=>`'${JSON.stringify(e).slice(1,-1).replaceAll(`\\"`,`"`).replaceAll(`'`,`\\'`)}'`;function _t(e){return{import:{from:`@forinda/kickjs/spa`,names:[`SpaAdapter`]},slot:`adapter`,code:`// Serves the built frontend from this origin in production.
|
|
137
137
|
// Inert until the client build exists, so \`kick dev\` (where Vite
|
|
138
138
|
// serves the client and proxies /api here) is unaffected.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.
|
|
2
|
+
* @forinda/kickjs-cli v8.17.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{t as e}from"./rolldown-runtime-
|
|
12
|
-
//# sourceMappingURL=project-root-
|
|
11
|
+
import{t as e}from"./rolldown-runtime-DEqJzHIh.mjs";import{dirname as t,parse as n,resolve as r}from"node:path";import{existsSync as i}from"node:fs";var a=/* @__PURE__ */ e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=r(e),{root:s}=n(a),c=null,l=a;for(;;){for(let e of o)if(i(r(l,e)))return l;if(c===null&&i(r(l,`package.json`))&&(c=l),l===s)break;let e=t(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
|
|
12
|
+
//# sourceMappingURL=project-root-B8zc70xL.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-root-
|
|
1
|
+
{"version":3,"file":"project-root-B8zc70xL.mjs","names":["__exportAll","project_root_exports","findProjectRoot","CONFIG_FILENAMES","start","resolve","startDir","fsRoot","parse","firstPackageJson","cursor","name","existsSync","parent","dirname"],"sources":["../src/utils/project-root.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { dirname, parse, resolve } from 'node:path'\n\nconst CONFIG_FILENAMES = ['kick.config.ts', 'kick.config.js', 'kick.config.mjs', 'kick.config.json']\n\n/**\n * Walk up from `startDir` looking for the project root. A directory\n * counts as the root when it contains any of:\n * - `kick.config.{ts,js,mjs,json}` (strongest signal)\n * - `package.json` (fallback when no config file exists yet)\n *\n * Returns the absolute path of the first matching directory, or\n * `startDir` itself when nothing was found (no surprises — callers\n * that didn't find a config still get a reasonable cwd).\n *\n * `kick.config.*` wins over `package.json` when both appear at\n * different levels, so adopters running `kick typegen` from `src/`\n * land on the project root that owns the config, not on the nearest\n * workspace package boundary in a monorepo.\n */\nexport function findProjectRoot(startDir: string = process.cwd()): string {\n const start = resolve(startDir)\n const { root: fsRoot } = parse(start)\n\n let firstPackageJson: string | null = null\n let cursor = start\n while (true) {\n for (const name of CONFIG_FILENAMES) {\n if (existsSync(resolve(cursor, name))) return cursor\n }\n if (firstPackageJson === null && existsSync(resolve(cursor, 'package.json'))) {\n firstPackageJson = cursor\n }\n if (cursor === fsRoot) break\n const parent = dirname(cursor)\n if (parent === cursor) break\n cursor = parent\n }\n\n return firstPackageJson ?? start\n}\n"],"mappings":";;;;;;;;;;sMAGA,MAAMG,EAAmB,CAAC,iBAAkB,iBAAkB,kBAAmB,kBAAkB,EAiBnG,SAAgBD,EAAgB,EAAmB,QAAQ,IAAI,EAAW,CACxE,IAAME,EAAQC,EAAQC,CAAQ,EACxB,CAAE,KAAMC,GAAWC,EAAMJ,CAAK,EAEhCK,EAAkC,KAClCC,EAASN,EACb,OAAa,CACX,IAAK,IAAMO,KAAQR,EACjB,GAAIS,EAAWP,EAAQK,EAAQC,CAAI,CAAC,EAAG,OAAOD,EAKhD,GAHID,IAAqB,MAAQG,EAAWP,EAAQK,EAAQ,cAAc,CAAC,IACzE,EAAmBA,GAEjBA,IAAWH,EAAQ,MACvB,IAAMM,EAASC,EAAQJ,CAAM,EAC7B,GAAIG,IAAWH,EAAQ,MACvB,EAASG,CACX,CAEA,OAAOJ,GAAoBL,CAC7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.
|
|
2
|
+
* @forinda/kickjs-cli v8.17.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{t as e}from"./rolldown-runtime-
|
|
11
|
+
import{t as e}from"./rolldown-runtime-DEqJzHIh.mjs";import{existsSync as t}from"node:fs";import{dirname as n,parse as r,resolve as i}from"node:path";var a=/* @__PURE__ */ e({findProjectRoot:()=>s});const o=[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`];function s(e=process.cwd()){let a=i(e),{root:s}=r(a),c=null,l=a;for(;;){for(let e of o)if(t(i(l,e)))return l;if(c===null&&t(i(l,`package.json`))&&(c=l),l===s)break;let e=n(l);if(e===l)break;l=e}return c??a}export{a as n,s as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v8.17.
|
|
2
|
+
* @forinda/kickjs-cli v8.17.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{t as e}from"./rolldown-runtime-
|
|
11
|
+
import{t as e}from"./rolldown-runtime-DEqJzHIh.mjs";import{C as t,S as n,_ as r,a as i,b as a,d as o,f as s,g as c,h as l,i as u,m as d,n as f,o as p,p as m,u as h,v as g,x as _,y as v}from"./agent-docs-C4A41Cxq.mjs";import{A as y,C as b,D as x,E as ee,F as S,M as te,N as ne,O as re,P as C,S as ie,T as ae,_ as oe,a as se,b as ce,c as le,f as ue,g as de,h as fe,i as pe,j as me,k as he,l as ge,m as _e,p as ve,r as ye,u as be,v as xe,w as Se,x as Ce,y as we}from"./doctor-HJItmhxU.mjs";import{a as Te,c as w,d as Ee,f as De,h as Oe,l as T,m as ke,o as Ae,p as je,s as E,u as Me}from"./config-COy9BM-6.mjs";import{_ as Ne,a as Pe,b as Fe,d as Ie,g as Le,h as Re,l as ze,m as Be,n as Ve,o as He,p as Ue,r as We,s as D,t as Ge,u as Ke,v as qe,x as Je,y as Ye}from"./project-CgnwQ6Wa.mjs";import{t as O}from"./project-root-B8zc70xL.mjs";import{n as k,t as Xe}from"./types-BhO1DrBv.mjs";import{t as Ze}from"./build-BQTa8V5a.mjs";import{C as Qe,S as $e,_ as et,a as tt,b as nt,c as rt,d as it,f as at,g as ot,h as st,i as ct,l as lt,m as ut,o as dt,p as ft,r as pt,s as mt,t as ht,u as gt,v as _t,w as vt,x as A,y as yt}from"./typegen-CddRbiCU.mjs";import{createRequire as bt}from"node:module";import j,{basename as xt,dirname as M,join as N,relative as P,resolve as F,sep as I}from"node:path";import{cpSync as St,existsSync as L,mkdirSync as Ct,readFileSync as R,readdirSync as z,rmSync as wt,statSync as Tt,writeFileSync as B}from"node:fs";import{copyFile as Et,mkdir as Dt,readFile as V,readdir as Ot,rm as kt,stat as At,writeFile as jt}from"node:fs/promises";import{fork as Mt,spawn as Nt,spawnSync as Pt}from"node:child_process";import{createHash as Ft}from"node:crypto";import{fileURLToPath as It,pathToFileURL as H}from"node:url";import{parseSync as Lt}from"oxc-parser";import{arch as Rt,platform as zt,release as Bt}from"node:os";const Vt=[{value:`swagger`,label:`Swagger`,hint:`OpenAPI docs`},{value:`ws`,label:`WebSocket`,hint:`rooms, heartbeat`},{value:`queue`,label:`Queue`,hint:`BullMQ/RabbitMQ/Kafka`},{value:`devtools`,label:`DevTools`,hint:`debug dashboard`},{value:`storage`,label:`Storage`,hint:`disk, S3 / R2 / MinIO`},{value:`views`,label:`Views`,hint:`server-rendered .kick templates`}];function Ht(e){e.command(`new [name]`).alias(`init`).description(`Create a new KickJS project (use "." for current directory)`).option(`-d, --directory <dir>`,`Target directory (defaults to project name)`).option(`--pm <manager>`,`Package manager: pnpm | npm | yarn | bun`).option(`--git`,`Initialize git repository`).option(`--no-git`,`Skip git initialization`).option(`--install`,`Install dependencies after scaffolding`).option(`--no-install`,`Skip dependency installation`).option(`-f, --force`,`Remove existing files without prompting`).option(`-t, --template <type>`,`Project template: rest | minimal | fullstack | inertia`).option(`--runtime <engine>`,`HTTP runtime: express | fastify | h3`).option(`-r, --repo <type>`,`Repository name (inmemory, or any DB name e.g. postgres)`).option(`-s, --schema <lib>`,`Schema library for env / DTOs: zod | valibot | yup (default: zod)`).option(`--frontend <kind>`,`Fullstack web/ scaffold: 'kick' (wired React app) or 'vite' (create-vite, unwired)`).option(`--vite-template <name>`,`create-vite TypeScript template for --frontend vite (default 'react-ts')`).option(`--packages <packages>`,`Comma-separated packages to include (e.g. swagger,ws,queue,devtools)`).option(`--deploy <targets>`,`Comma-separated deploy targets to write files for: netlify, vercel, docker (later: kick g deploy)`).option(`-y, --yes`,`Pick safe defaults for every prompt (template=minimal, repo=inmemory, no extras, git+install on)`).option(`--non-interactive`,`alias for --yes`).action(async(e,t)=>{o(`KickJS — Create a new project`);let n=We(),a=e=>{e&&s.warn(`kick ${Ge} is behind the latest release, ${e} — templates and options added since are missing. Upgrade: npm i -g @forinda/kickjs-cli@latest`)},c=[];try{c=t.deploy?Je(t.deploy):[]}catch(e){s.error(e.message),d(`Aborted.`),process.exitCode=1;return}let u=!!(t.yes||t.nonInteractive);e||=u?`my-api`:await r({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let f;if(e===`.`?(f=F(`.`),e=xt(f)):f=F(t.directory||e),L(f)){let n=z(f);if(n.length>0){if(t.force)s.warn(`Clearing existing files in ${f}`);else if(u){s.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),d(`Aborted.`);return}else{s.warn(`Directory "${e}" is not empty:`);let t=n.slice(0,5);for(let e of t)s.message(` - ${e}`);if(n.length>5&&s.message(` ... and ${n.length-5} more`),!await h({message:v.red(`Remove all existing files and proceed?`),initialValue:!1})){d(`Aborted.`);return}}for(let e of n)wt(F(f,e),{recursive:!0,force:!0})}}u||a(await Promise.race([n,new Promise(e=>setTimeout(e,3e3,null).unref())]));let p=t.template;p||=u?`minimal`:await l({message:`Project template`,options:[{value:`rest`,label:`REST API`,hint:`Express + Swagger`},{value:`minimal`,label:`Minimal`,hint:`bare Express`},{value:`fullstack`,label:`Fullstack`,hint:`server + Vite React web, typed client`},{value:`inertia`,label:`Inertia`,hint:`server-driven React pages, one app, SSR`}]});let g=t.runtime;g||=u?`express`:await l({message:`HTTP runtime`,options:[{value:`express`,label:`Express`,hint:`default, zero-config`},{value:`fastify`,label:`Fastify`,hint:`fastify + @fastify/middie`},{value:`h3`,label:`h3`,hint:`Nitro / Nuxt engine`}]});let _=t.pm;_||=u?await i(void 0):await l({message:`Package manager`,options:[{value:`pnpm`,label:`pnpm`},{value:`npm`,label:`npm`},{value:`yarn`,label:`yarn`},{value:`bun`,label:`bun`}]});let y=t.repo;y||=u?`inmemory`:await r({message:`Repository name`,placeholder:`inmemory (or a DB name, e.g. postgres)`,defaultValue:`inmemory`}),Oe(y);let b=t.schema;p===`inertia`&&(b&&b!==`zod`&&s.warn(`The inertia template uses zod — ignoring --schema ${b}.`),b=`zod`),b||=u?`zod`:await l({message:`Schema library (env + DTO validation)`,options:[{value:`zod`,label:`Zod`,hint:`default — broad ecosystem`},{value:`valibot`,label:`Valibot`,hint:`smaller bundle`},{value:`yup`,label:`Yup`,hint:`classic API`}]}),[`zod`,`valibot`,`yup`].includes(b)||(s.warn(`Unknown --schema "${b}", falling back to zod.`),b=`zod`);let x;if(t.packages!==void 0){let e=t.packages.trim().toLowerCase();x=e===``||e===`none`||e===`false`?[]:t.packages.split(`,`).map(e=>e.trim()).filter(Boolean)}else x=u?[]:await m({message:`Select packages to include`,options:[...Vt],required:!1});let ee;ee=t.git===void 0?u?!0:await h({message:`Initialize git repository?`,initialValue:!0}):t.git;let S;if(S=t.install===void 0?u?!0:await h({message:`Install dependencies?`,initialValue:!0}):t.install,t.frontend!==void 0&&t.frontend!==`kick`&&t.frontend!==`vite`){s.error(`Unknown --frontend '${String(t.frontend)}'. Use 'kick' (wired React app) or 'vite' (create-vite).`),d(`Aborted.`);return}let{VITE_TEMPLATES:te,DEFAULT_VITE_TEMPLATE:ne}=await import(`./fullstack-3Ual2XVy.mjs`);if(t.viteTemplate!==void 0&&!te.some(e=>e.value===t.viteTemplate)){s.error(`Unknown --vite-template '${String(t.viteTemplate)}'. TypeScript templates only: ${te.map(e=>e.value).join(`, `)}.`),d(`Aborted.`);return}let re=t.frontend===`vite`?`vite`:`kick`,C=t.viteTemplate??ne;if(p===`fullstack`&&!t.frontend&&!u&&(re=await l({message:`Frontend for web/`,options:[{value:`kick`,label:`KickJS React app`,hint:`typed client, /api proxy, route types — wired`},{value:`vite`,label:`Delegate to create-vite`,hint:`pick any framework; wiring is manual (guide printed after)`}]})),re===`vite`&&!t.viteTemplate&&!u&&(C=await l({message:`create-vite template`,options:te.map(e=>({value:e.value,label:e.label})),initialValue:ne})),p===`fullstack`){let{initFullstackProject:t}=await import(`./fullstack-3Ual2XVy.mjs`);await t({name:e,directory:f,packageManager:_,initGit:ee,installDeps:S,schemaLib:b,runtime:g,packages:x,frontend:re,viteTemplate:C,deploy:c}),u&&a(await n),d(`Done! Next steps: ${v.cyan(`cd ${e} && ${_}${_===`pnpm`?` dev`:` run dev:server`}`)}`)}else await Ve({name:e,directory:f,packageManager:_,initGit:ee,installDeps:S,template:p,defaultRepo:y,packages:x,schemaLib:b,runtime:g,deploy:c}),u&&a(await n),d(`Done! Next steps: ${v.cyan(`cd ${e} && ${je(_,`dev`)}`)}`)})}function Ut(e,t=[]){let n=/* @__PURE__ */ new Map;for(let t of e){let e=(n.get(t.name)??0)+1;if(n.set(t.name,e),e===2)throw new Xe(`plugin`,t.name,[t.name,t.name])}let r=/* @__PURE__ */ new Map,i=[];for(let t of e)for(let e of t.commands??[]){let n=r.get(e.name);if(n)throw new Xe(`command`,e.name,[n,t.name]);r.set(e.name,t.name),i.push(e)}let a=new Set(t.map(e=>e.name)),o=[...i.filter(e=>!a.has(e.name)),...t],s=/* @__PURE__ */ new Map,c=[];for(let t of e)for(let e of t.typegens??[]){let n=s.get(e.id);if(n)throw new Xe(`typegen`,e.id,[n,t.name]);s.set(e.id,t.name),c.push(e)}let l=/* @__PURE__ */ new Map,u=[];for(let t of e)for(let e of t.generators??[]){let n=l.get(e.name);if(n)throw new Xe(`generator`,e.name,[n,t.name]);l.set(e.name,t.name),u.push({source:t.name,spec:e})}return{commands:o,typegens:c,generators:u,register:async(t,n)=>{let r;if(n)r={generators:u,...n};else{let{findProjectRoot:e}=await import(`./project-root-B8zc70xL.mjs`).then(e=>e.n),t=process.cwd();r={cwd:t,projectRoot:e(t),config:null,log:()=>{},generators:u}}for(let n of e)n.register&&await n.register(t,r)}}}async function Wt(e){let{name:n,outDir:r}=e,i=C(n),a=S(n),o=[],s=N(r,`${i}.plugin.ts`);return await t(s,`import {
|
|
12
12
|
definePlugin,
|
|
13
13
|
type AppAdapter,
|
|
14
14
|
type AppModuleEntry,
|
|
@@ -682,7 +682,7 @@ server.on('exit', () => {
|
|
|
682
682
|
Cancelled.
|
|
683
683
|
`);return}await kt(l,{recursive:!0,force:!0}),console.log(` Deleted: ${l}`);let u=N(r,`index.ts`);if(await _(u)){let e=await V(u,`utf-8`),n=e,r=RegExp(`^import\\s*\\{\\s*${y(s)}Module\\s*\\}\\s*from\\s*['"][^'"]*${y(c)}(?:/[^'"]*)?['"].*\\n?`,`gm`);e=e.replace(r,``),e=Xr(e,s),e=e.replace(/\n{3,}/g,`
|
|
684
684
|
|
|
685
|
-
`),e!==n&&(await t(u,e),console.log(` Unregistered: ${s}Module from ${u}`))}console.log(`\n Module '${c}' removed.\n`)}function Qr(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--pluralize`,`The module folder is pluralized (users/ for user)`).option(`--no-pluralize`,`The module folder is the name as typed (the default)`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=await E(process.cwd()),r=w(n),i=t.modulesDir??r.dir??`src/modules`,a=T(t.pluralize,r);for(let n of e)await Zr({name:n,modulesDir:F(i),force:t.force,pluralize:a})})}function $r(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;if(e===`kickjs-schema`||e===`schema`)return`kickjs-schema`;console.warn(` kick typegen: unknown --schema-validator '${e}' (supported: 'zod', 'kickjs-schema', 'false'). Falling back to project config.`)}}function ei(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function ti(e){e.command(`typegen`).description(`Generate type-safe DI registry and module types into .kickjs/types/`).option(`-w, --watch`,`Watch source files and regenerate on change`).option(`-s, --src <dir>`,`Source directory to scan`,`src`).option(`-o, --out <dir>`,`Output directory`,`.kickjs/types`).option(`--silent`,`Suppress output`).option(`--allow-duplicates`,`Auto-namespace duplicate class names instead of failing (use with caution)`).option(`--schema-validator <name>`,`Schema validator for body/query/params typing (currently 'zod' or 'false')`).option(`--env-file <path>`,`Path to env schema file for KickEnv typing (default 'src/env.ts'; pass 'false' to disable)`).option(`--check`,`CI gate: exit non-zero if any generated file in .kickjs/types/ is out of date (routes, env, db, assets, adopter plugins) instead of writing it`).option(`--fix`,`Patch module import.meta.glob() calls to cover decorated classes that aren't loaded by any glob (orphans)`).option(`--list`,"List every registered typegen plugin id (use to populate `typegen.disable`)").option(`--no-cache`,`Disable the persistent scan cache; re-read + re-extract every file from cold`).action(async e=>{let t=O(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-
|
|
685
|
+
`),e!==n&&(await t(u,e),console.log(` Unregistered: ${s}Module from ${u}`))}console.log(`\n Module '${c}' removed.\n`)}function Qr(e){e.command(`remove`).alias(`rm`).description(`Remove generated code`).command(`module <names...>`).description(`Remove one or more modules (e.g. kick rm module user task)`).option(`--modules-dir <dir>`,`Modules directory`).option(`--pluralize`,`The module folder is pluralized (users/ for user)`).option(`--no-pluralize`,`The module folder is the name as typed (the default)`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=await E(process.cwd()),r=w(n),i=t.modulesDir??r.dir??`src/modules`,a=T(t.pluralize,r);for(let n of e)await Zr({name:n,modulesDir:F(i),force:t.force,pluralize:a})})}function $r(e){if(e!==void 0){if(e===`false`||e===`off`||e===`none`)return!1;if(e===`zod`)return`zod`;if(e===`kickjs-schema`||e===`schema`)return`kickjs-schema`;console.warn(` kick typegen: unknown --schema-validator '${e}' (supported: 'zod', 'kickjs-schema', 'false'). Falling back to project config.`)}}function ei(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function ti(e){e.command(`typegen`).description(`Generate type-safe DI registry and module types into .kickjs/types/`).option(`-w, --watch`,`Watch source files and regenerate on change`).option(`-s, --src <dir>`,`Source directory to scan`,`src`).option(`-o, --out <dir>`,`Output directory`,`.kickjs/types`).option(`--silent`,`Suppress output`).option(`--allow-duplicates`,`Auto-namespace duplicate class names instead of failing (use with caution)`).option(`--schema-validator <name>`,`Schema validator for body/query/params typing (currently 'zod' or 'false')`).option(`--env-file <path>`,`Path to env schema file for KickEnv typing (default 'src/env.ts'; pass 'false' to disable)`).option(`--check`,`CI gate: exit non-zero if any generated file in .kickjs/types/ is out of date (routes, env, db, assets, adopter plugins) instead of writing it`).option(`--fix`,`Patch module import.meta.glob() calls to cover decorated classes that aren't loaded by any glob (orphans)`).option(`--list`,"List every registered typegen plugin id (use to populate `typegen.disable`)").option(`--no-cache`,`Disable the persistent scan cache; re-read + re-extract every file from cold`).action(async e=>{let t=O(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-DeDC5OJj.mjs`),{builtinCliPlugins:t}=await import(`./builtins-BMWR-jTf.mjs`),r=e([...t,...n?.plugins??[]],n?.commands??[]),i=new Set(n?.typegen?.disable??[]);if(r.typegens.length===0){console.log(` No typegen plugins registered.`);return}let a=Math.max(...r.typegens.map(e=>e.id.length));console.log(`
|
|
686
686
|
Registered typegen plugins:
|
|
687
687
|
`);for(let e of r.typegens){let t=i.has(e.id)?` (disabled)`:``,n=`${e.id.replace(/\//g,`__`)}${e.outExtension??`.d.ts`}`;console.log(` ${e.id.padEnd(a+2)}→ .kickjs/types/${n}${t}`),console.log(` ${` `.repeat(a+2)} watches: ${e.inputs.join(`, `)||`(none)`}`)}console.log(`
|
|
688
688
|
Disable one in kick.config.ts:
|
|
@@ -876,4 +876,4 @@ declare global {
|
|
|
876
876
|
export {}
|
|
877
877
|
`}const Ka=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=Ja(e);if(t===!1)return null;let n=await e.getScanResult({root:qa(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=e.config?.typegen?.schemaValidator??`zod`,i=j.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return Ga(n.env,i,r)}});function qa(e){return j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Ja(e){return e.config?.typegen?.envFile}function Ya(e){return j.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function Xa(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function $(e){return{root:Ya(e),cwd:e.cwd,envFile:Xa(e)}}const Za=()=>({id:`kick/registry`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=j.resolve(e.cwd,`.kickjs/types/kick__registry.d.ts`),r=new Set(t.collisions.map(e=>e.className));return at(t.classes,n,r)}}),Qa=()=>({id:`kick/services`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=new Set(t.collisions.map(e=>e.className)),r=lt(t.classes,t.tokens,t.injects,n);return ut(`ServiceToken`,r,"(no tokens discovered — declare with createToken<T>() or `kick g service <name>`)")}}),$a=()=>({id:`kick/modules`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return ut(`ModuleToken`,rt(t.classes),"(no @Module classes discovered — `kick g module <name>` to add one)")}}),eo=()=>({id:`kick/plugins`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return it(t.pluginsAndAdapters)}}),to=()=>({id:`kick/context`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return t.contextKeys.length===0?null:gt(t.contextKeys)}}),no=()=>({id:`kick/route-flags`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return ft(t.routeFlags)}}),ro={express:{subpath:`@forinda/kickjs/express`,typeName:`ExpressRuntimeTypes`},fastify:{subpath:`@forinda/kickjs/fastify`,typeName:`FastifyRuntimeTypes`},h3:{subpath:`@forinda/kickjs/h3`,typeName:`H3RuntimeTypes`}},io=[k({name:`kick/init`,register:Ht}),k({name:`kick/generate`,register:Sn}),k({name:`kick/run`,register:Vn}),k({name:`kick/info`,register:Kn}),k({name:`kick/inspect`,register:nr}),k({name:`kick/add`,register:Ke}),k({name:`kick/runtime-swap`,register:vr}),k({name:`kick/list`,register:Ie}),k({name:`kick/explain`,register:jr}),k({name:`kick/mcp`,register:Hr}),k({name:`kick/tinker`,register:Kr}),k({name:`kick/remove`,register:Qr}),k({name:`kick/typegen`,register:ti}),k({name:`kick/check`,register:bi}),k({name:`kick/doctor`,register:ye}),k({name:`kick/env-command`,register:Oi}),k({name:`kick/codemod`,register:Ai}),k({name:`kick/deploy`,register:ea}),k({name:`kick/registry`,typegens:[Za()]}),k({name:`kick/services`,typegens:[Qa()]}),k({name:`kick/modules`,typegens:[$a()]}),k({name:`kick/plugins`,typegens:[eo()]}),k({name:`kick/context`,typegens:[to()]}),k({name:`kick/route-flags`,typegens:[no()]}),k({name:`kick/assets`,typegens:[ta()]}),k({name:`kick/routes`,typegens:[da()]}),k({name:`kick/client`,typegens:[Wa()]}),k({name:`kick/env`,typegens:[Ka()]}),k({name:`kick/runtime`,typegens:[{id:`kick/runtime`,outExtension:`.ts`,inputs:[`kick.config.ts`,`kick.config.js`,`kick.config.mjs`,`kick.config.json`],async generate(e){let t=e.config?.runtime??`express`;if(t!==`express`&&t!==`fastify`&&t!==`h3`)return null;let{subpath:n,typeName:r}=ro[t];return[`// Runtime escape-hatch types for the '${t}' engine (kick.config runtime).`,`declare module '@forinda/kickjs' {`,` interface KickRuntimeRegister {`,` runtime: import('${n}').${r}`,` }`,`}`,``,`export {}`,``].join(`
|
|
878
878
|
`)}}]})];export{Dn as applyDisableFilter,On as n,Ut as r,kn as runAllPluginTypegens,io as t};
|
|
879
|
-
//# sourceMappingURL=run-plugins-
|
|
879
|
+
//# sourceMappingURL=run-plugins-C7QLbuwX.mjs.map
|