@forinda/kickjs-cli 6.12.1 → 6.12.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-DA2Iw4-x.mjs → agent-docs-CLu4CsQ7.mjs} +3 -3
- package/dist/{agent-docs-DA2Iw4-x.mjs.map → agent-docs-CLu4CsQ7.mjs.map} +1 -1
- package/dist/{agent-docs-D0e0mOAm.mjs → agent-docs-CStVJrj8.mjs} +2 -2
- package/dist/{build-CzMO_RDI.mjs → build-Db4cha4R.mjs} +2 -2
- package/dist/{build-Dch8tya3.mjs → build-DzBNYKLj.mjs} +3 -3
- package/dist/{build-Dch8tya3.mjs.map → build-DzBNYKLj.mjs.map} +1 -1
- package/dist/{builtins-D-16bo8t.mjs → builtins-DVQRavE0.mjs} +21 -12
- package/dist/{builtins-3wdDp2ms.mjs → builtins-Ho5elH40.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{config-Dfe58WNn.mjs → config-CZQN6aLU.mjs} +2 -2
- package/dist/{config-JMmjCL3J.mjs → config-CpfbwTOH.mjs} +3 -3
- package/dist/{config-JMmjCL3J.mjs.map → config-CpfbwTOH.mjs.map} +1 -1
- package/dist/{doctor-CrS2RaJU.mjs → doctor-BRKjTXg-.mjs} +16 -9
- package/dist/doctor-BRKjTXg-.mjs.map +1 -0
- package/dist/{fullstack-Bz0vT69M.mjs → fullstack-CWtFWYLl.mjs} +3 -3
- package/dist/{fullstack-7OPvGidl.mjs → fullstack-DrptYERV.mjs} +4 -4
- package/dist/{fullstack-7OPvGidl.mjs.map → fullstack-DrptYERV.mjs.map} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-BBQnnS3w.mjs → plugin-BM0vR4Wp.mjs} +2 -2
- package/dist/{plugin-BkZ2DDfy.mjs → plugin-Bl42_aUN.mjs} +3 -3
- package/dist/{plugin-BkZ2DDfy.mjs.map → plugin-Bl42_aUN.mjs.map} +1 -1
- package/dist/{project-DJWJQVv8.mjs → project-Cr_EJhoL.mjs} +4 -4
- package/dist/{project-yTQHs87D.mjs → project-K-Pg2DPp.mjs} +5 -5
- package/dist/{project-yTQHs87D.mjs.map → project-K-Pg2DPp.mjs.map} +1 -1
- package/dist/{project-docs-EG0IL-2C.mjs → project-docs-CC4IryAZ.mjs} +2 -2
- package/dist/{project-docs-EG0IL-2C.mjs.map → project-docs-CC4IryAZ.mjs.map} +1 -1
- package/dist/{project-docs--fpUMHCA.mjs → project-docs-NfXHhcln.mjs} +1 -1
- package/dist/{project-root-DoCJMm4-.mjs → project-root-DJr3x5pY.mjs} +3 -3
- package/dist/{project-root-DoCJMm4-.mjs.map → project-root-DJr3x5pY.mjs.map} +1 -1
- package/dist/{project-root-BjcNKs61.mjs → project-root-pbgtKIoC.mjs} +2 -2
- package/dist/{prompts-ZYP6tl3M.mjs → prompts-XiiR969b.mjs} +2 -2
- package/dist/{prompts-ZYP6tl3M.mjs.map → prompts-XiiR969b.mjs.map} +1 -1
- package/dist/{rolldown-runtime-BzeyHBPb.mjs → rolldown-runtime-BTs2uP94.mjs} +1 -1
- package/dist/{run-plugins-Dvj0O0O8.mjs → run-plugins-CY13ekyP.mjs} +9 -7
- package/dist/run-plugins-CY13ekyP.mjs.map +1 -0
- package/dist/{typegen-Cs46KTaI.mjs → typegen-BBSL503s.mjs} +5 -5
- package/dist/{typegen-Cs46KTaI.mjs.map → typegen-BBSL503s.mjs.map} +1 -1
- package/dist/{typegen-Bw-wYIo7.mjs → typegen-e3DwxkVv.mjs} +4 -4
- package/dist/{types-CH99zNBl.mjs → types-xWud6jrx.mjs} +1 -1
- package/package.json +4 -4
- package/dist/doctor-CrS2RaJU.mjs.map +0 -1
- package/dist/run-plugins-Dvj0O0O8.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts-
|
|
1
|
+
{"version":3,"file":"prompts-XiiR969b.mjs","names":["colors"],"sources":["../src/utils/colors.ts","../src/utils/prompts.ts"],"sourcesContent":["import pc from 'picocolors'\n\nexport { pc as colors }\n\nconst METHOD_COLOR_MAP: Record<string, (s: string) => string> = {\n GET: pc.green,\n POST: pc.cyan,\n PUT: pc.yellow,\n PATCH: pc.magenta,\n DELETE: pc.red,\n}\n\n/** Color an HTTP method string for terminal display */\nexport function httpMethodColor(method: string): string {\n const fn = METHOD_COLOR_MAP[method] ?? pc.dim\n return fn(method.padEnd(7))\n}\n\n/** Color a severity tag for terminal display (padded to 10 chars) */\nexport function severityColor(severity: string): string {\n const tag = `[${severity}]`.padEnd(10)\n switch (severity) {\n case 'CRITICAL':\n return pc.red(tag)\n case 'WARNING':\n return pc.yellow(tag)\n case 'INFO':\n return pc.blue(pc.dim(tag))\n default:\n return tag\n }\n}\n","import * as clack from '@clack/prompts'\nimport { colors } from './colors'\n\nexport const symbols = {\n success: colors.green('✓'),\n error: colors.red('✖'),\n warning: colors.yellow('⚠'),\n info: colors.blue('ℹ'),\n}\n\n/** Show branded intro banner */\nexport function intro(title: string): void {\n clack.intro(colors.bgCyan(colors.black(` ${title} `)))\n}\n\n/** Show closing message */\nexport function outro(message: string): void {\n clack.outro(message)\n}\n\n/** Handle cancellation — print message and exit */\nfunction handleCancel(value: unknown): void {\n if (clack.isCancel(value)) {\n clack.cancel('Operation cancelled.')\n process.exit(0)\n }\n}\n\n/** Text input prompt */\nexport async function text(opts: {\n message: string\n placeholder?: string\n defaultValue?: string\n validate?: (value: string) => string | void\n}): Promise<string> {\n const value = await clack.text(opts as any)\n handleCancel(value)\n return value as string\n}\n\n/** Single select prompt */\nexport async function select<T>(opts: {\n message: string\n options: { value: T; label: string; hint?: string }[]\n initialValue?: T\n}): Promise<T> {\n const value = await clack.select(opts as any)\n handleCancel(value)\n return value as T\n}\n\n/** Multi-select prompt with checkboxes */\nexport async function multiSelect<T>(opts: {\n message: string\n options: { value: T; label: string; hint?: string }[]\n required?: boolean\n initialValues?: T[]\n}): Promise<T[]> {\n const value = await clack.multiselect(opts as any)\n handleCancel(value)\n return value as T[]\n}\n\n/** Yes/no confirmation prompt */\nexport async function confirm(opts: {\n message: string\n active?: string\n inactive?: string\n initialValue?: boolean\n}): Promise<boolean> {\n const value = await clack.confirm(opts)\n handleCancel(value)\n return value as boolean\n}\n\n/** Create a spinner for progress indication */\nexport function spinner() {\n return clack.spinner()\n}\n\n/** Log utilities for styled messages inside clack flow */\nexport const log = clack.log\n"],"mappings":";;;;;;;;;;2DAIA,MAAM,EAA0D,CAC9D,IAAK,EAAG,MACR,KAAM,EAAG,KACT,IAAK,EAAG,OACR,MAAO,EAAG,QACV,OAAQ,EAAG,GACb,EAGA,SAAgB,EAAgB,EAAwB,CAEtD,OADW,EAAiB,IAAW,EAAG,IAAA,CAChC,EAAO,OAAO,CAAC,CAAC,CAC5B,CAGA,SAAgB,EAAc,EAA0B,CACtD,IAAM,EAAM,IAAI,EAAS,GAAG,OAAO,EAAE,EACrC,OAAQ,EAAR,CACE,IAAK,WACH,OAAO,EAAG,IAAI,CAAG,EACnB,IAAK,UACH,OAAO,EAAG,OAAO,CAAG,EACtB,IAAK,OACH,OAAO,EAAG,KAAK,EAAG,IAAI,CAAG,CAAC,EAC5B,QACE,OAAO,CACX,CACF,CC3BWA,EAAO,MAAM,GAAG,EAClBA,EAAO,IAAI,GAAG,EACZA,EAAO,OAAO,GAAG,EACpBA,EAAO,KAAK,GAAG,EAIvB,SAAgB,EAAM,EAAqB,CACzC,EAAM,MAAMA,EAAO,OAAOA,EAAO,MAAM,IAAI,EAAM,EAAE,CAAC,CAAC,CACvD,CAGA,SAAgB,EAAM,EAAuB,CAC3C,EAAM,MAAM,CAAO,CACrB,CAGA,SAAS,EAAa,EAAsB,CACtC,EAAM,SAAS,CAAK,IACtB,EAAM,OAAO,sBAAsB,EACnC,QAAQ,KAAK,CAAC,EAElB,CAGA,eAAsB,EAAK,EAKP,CAClB,IAAM,EAAQ,MAAM,EAAM,KAAK,CAAW,EAE1C,OADA,EAAa,CAAK,EACX,CACT,CAGA,eAAsB,EAAU,EAIjB,CACb,IAAM,EAAQ,MAAM,EAAM,OAAO,CAAW,EAE5C,OADA,EAAa,CAAK,EACX,CACT,CAGA,eAAsB,EAAe,EAKpB,CACf,IAAM,EAAQ,MAAM,EAAM,YAAY,CAAW,EAEjD,OADA,EAAa,CAAK,EACX,CACT,CAGA,eAAsB,EAAQ,EAKT,CACnB,IAAM,EAAQ,MAAM,EAAM,QAAQ,CAAI,EAEtC,OADA,EAAa,CAAK,EACX,CACT,CAGA,SAAgB,GAAU,CACxB,OAAO,EAAM,QAAQ,CACvB,CAGA,MAAa,EAAM,EAAM"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v6.12.
|
|
2
|
+
* @forinda/kickjs-cli v6.12.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{c as e,l as t,s as n}from"./project-docs-
|
|
11
|
+
import{c as e,l as t,s as n}from"./project-docs-CC4IryAZ.mjs";import{a as r,c as i,d as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f,u as p}from"./prompts-XiiR969b.mjs";import{A as m,C as h,D as g,E as _,F as v,M as y,N as b,O as x,P as S,S as C,T as ee,_ as te,a as ne,b as re,c as ie,f as ae,g as oe,h as se,i as ce,j as le,k as ue,l as de,m as fe,p as pe,r as me,u as w,v as he,w as ge,x as _e,y as ve}from"./doctor-BRKjTXg-.mjs";import{a as ye,c as be,o as xe,r as Se,t as Ce,u as we}from"./project-K-Pg2DPp.mjs";import{a as T,i as E,o as Te,s as Ee}from"./config-CpfbwTOH.mjs";import{t as De}from"./project-root-DJr3x5pY.mjs";import{n as D}from"./types-xWud6jrx.mjs";import{t as Oe}from"./build-DzBNYKLj.mjs";import{n as ke}from"./agent-docs-CLu4CsQ7.mjs";import{n as O}from"./plugin-Bl42_aUN.mjs";import{a as Ae,c as je,d as Me,f as Ne,g as Pe,h as Fe,i as Ie,l as Le,m as Re,o as ze,p as Be,r as Ve,s as He,t as k,u as Ue}from"./typegen-BBSL503s.mjs";import A,{basename as We,dirname as j,join as M,relative as Ge,resolve as N,sep as Ke}from"node:path";import{cpSync as qe,existsSync as P,mkdirSync as Je,readFileSync as F,readdirSync as Ye,rmSync as Xe,writeFileSync as Ze}from"node:fs";import{copyFile as Qe,mkdir as I,readFile as L,readdir as $e,rm as et,stat as tt,writeFile as R}from"node:fs/promises";import{fork as nt,spawn as rt}from"node:child_process";import{fileURLToPath as it,pathToFileURL as z}from"node:url";import{arch as at,platform as ot,release as st}from"node:os";const ct=[{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`}];function lt(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`).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(`--packages <packages>`,`Comma-separated packages to include (e.g. auth,swagger,ws,queue)`).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)=>{c(`KickJS — Create a new project`);let n=!!(t.yes||t.nonInteractive);e||=n?`my-api`:await i({message:`Project name`,placeholder:`my-api`,defaultValue:`my-api`});let a;if(e===`.`?(a=N(`.`),e=We(a)):a=N(t.directory||e),P(a)){let i=Ye(a);if(i.length>0){if(t.force)u.warn(`Clearing existing files in ${a}`);else if(n){u.warn(`Directory "${e}" is not empty. Pass --force to clear it.`),r(`Aborted.`);return}else{u.warn(`Directory "${e}" is not empty:`);let t=i.slice(0,5);for(let e of t)u.message(` - ${e}`);if(i.length>5&&u.message(` ... and ${i.length-5} more`),!await f({message:p.red(`Remove all existing files and proceed?`),initialValue:!1})){r(`Aborted.`);return}}for(let e of i)Xe(N(a,e),{recursive:!0,force:!0})}}let s=t.template;s||=n?`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`}]});let d=t.runtime;d||=n?`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 m=t.pm;m||=n?await be(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 h=t.repo;h||=n?`inmemory`:await i({message:`Repository name`,placeholder:`inmemory (or a DB name, e.g. postgres)`,defaultValue:`inmemory`}),Ee(h);let g=t.schema;g||=n?`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(g)||(u.warn(`Unknown --schema "${g}", falling back to zod.`),g=`zod`);let _;if(t.packages!==void 0){let e=t.packages.trim().toLowerCase();_=e===``||e===`none`||e===`false`?[]:t.packages.split(`,`).map(e=>e.trim()).filter(Boolean)}else _=n?[]:await o({message:`Select packages to include`,options:[...ct],required:!1});let v;v=t.git===void 0?n?!0:await f({message:`Initialize git repository?`,initialValue:!0}):t.git;let y;if(y=t.install===void 0?n?!0:await f({message:`Install dependencies?`,initialValue:!0}):t.install,s===`fullstack`){let{initFullstackProject:t}=await import(`./fullstack-DrptYERV.mjs`);await t({name:e,directory:a,packageManager:m,initGit:v,installDeps:y,schemaLib:g,runtime:d}),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${m}${m===`pnpm`?` dev`:` run dev:server`}`)}`);return}await Ce({name:e,directory:a,packageManager:m,initGit:v,installDeps:y,template:s,defaultRepo:h,packages:_,schemaLib:g,runtime:d}),r(`Done! Next steps: ${p.cyan(`cd ${e} && ${m} dev`)}`)})}async function ut(e){let{name:n,outDir:r}=e,i=S(n),a=v(n),o=[],s=M(r,`${i}.plugin.ts`);return await t(s,`import {
|
|
12
12
|
definePlugin,
|
|
13
13
|
type AppAdapter,
|
|
14
14
|
type AppModuleEntry,
|
|
@@ -47,7 +47,7 @@ export interface ${a}PluginConfig {
|
|
|
47
47
|
* 4. \`middleware()\` — plugin middleware runs before user middleware.
|
|
48
48
|
* 5. \`contributors()\` — Context Contributors merged into every route.
|
|
49
49
|
* 6. \`onReady(container)\` — runs after the app has fully bootstrapped.
|
|
50
|
-
* 7. \`shutdown()\` —
|
|
50
|
+
* 7. \`shutdown()\` — on shutdown AND every HMR reload.
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
53
|
* \`\`\`ts
|
|
@@ -144,8 +144,10 @@ export const ${a}Plugin = definePlugin<${a}PluginConfig>({
|
|
|
144
144
|
},
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
* Called during graceful shutdown. Clean up
|
|
148
|
-
* resources this plugin
|
|
147
|
+
* Called during graceful shutdown AND on every HMR reload. Clean up
|
|
148
|
+
* long-lived resources this plugin OWNS (connections, timers,
|
|
149
|
+
* subscriptions). Never close the shared HTTP server — in dev that is
|
|
150
|
+
* Vite's listener and it will not rebind.
|
|
149
151
|
*/
|
|
150
152
|
async shutdown(): Promise<void> {
|
|
151
153
|
// Example: await this.connection?.close()
|
|
@@ -583,7 +585,7 @@ server.on('exit', () => {
|
|
|
583
585
|
Cancelled.
|
|
584
586
|
`);return}await et(l,{recursive:!0,force:!0}),console.log(` Deleted: ${l}`);let u=M(r,`index.ts`);if(await n(u)){let e=await L(u,`utf-8`),t=e,n=RegExp(`^import\\s*\\{\\s*${m(s)}Module\\s*\\}\\s*from\\s*['"][^'"]*${m(c)}(?:/[^'"]*)?['"].*\\n?`,`gm`);e=e.replace(n,``),e=Ln(e,s),e=e.replace(/\n{3,}/g,`
|
|
585
587
|
|
|
586
|
-
`),e!==t&&(await R(u,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${u}`))}console.log(`\n Module '${c}' removed.\n`)}function zn(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(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Rn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function Bn(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 Vn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Hn(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=De(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-
|
|
588
|
+
`),e!==t&&(await R(u,e,`utf-8`),console.log(` Unregistered: ${s}Module from ${u}`))}console.log(`\n Module '${c}' removed.\n`)}function zn(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(`--no-pluralize`,`Use singular module name`).option(`-f, --force`,`Skip confirmation prompt`).action(async(e,t)=>{let n=T(await E(process.cwd())),r=t.modulesDir??n.dir??`src/modules`,i=t.pluralize===!1?!1:n.pluralize??!0;for(let n of e)await Rn({name:n,modulesDir:N(r),force:t.force,pluralize:i})})}function Bn(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 Vn(e){if(e!==void 0)return e===`false`||e===`off`||e===`none`?!1:e}function Hn(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=De(process.cwd()),n=await E(t);if(e.list){let{mergeCliPlugins:e}=await import(`./plugin-Bl42_aUN.mjs`).then(e=>e.t),{builtinCliPlugins:t}=await import(`./builtins-Ho5elH40.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(`
|
|
587
589
|
Registered typegen plugins:
|
|
588
590
|
`);for(let e of r.typegens){let t=i.has(e.id)?` (disabled)`:``;console.log(` ${e.id.padEnd(a+2)}inputs: ${e.inputs.join(`, `)||`(none)`}${t}`)}console.log();return}let r=Bn(e.schemaValidator)??n?.typegen?.schemaValidator??`zod`,i=Vn(e.envFile)??n?.typegen?.envFile,a={cwd:t,srcDir:e.src??n?.typegen?.srcDir,outDir:e.out??n?.typegen?.outDir,silent:e.silent,fix:e.fix,allowDuplicates:e.allowDuplicates,noCache:e.cache===!1,schemaValidator:r,envFile:i,assetMap:n?.assetMap,runPlugins:!1};try{if(e.watch){let t=await Ve(a);e.silent||console.log(` kick typegen: watching for changes (Ctrl-C to exit)`);let n=()=>{t(),process.exit(0)};process.on(`SIGINT`,n),process.on(`SIGTERM`,n),await new Promise(()=>{})}else{await k(a);let r=await Wt({cwd:t,config:n??null,silent:e.silent,check:e.check});e.check&&r.some(e=>e.status===`written`)&&process.exit(1),e.check||await Ie(N(t,e.out??n?.typegen?.outDir??`.kickjs/types`),r,e.silent??!1)}}catch(e){e instanceof He?console.error(`
|
|
589
591
|
`+e.message+`
|
|
@@ -681,4 +683,4 @@ declare global {
|
|
|
681
683
|
export {}
|
|
682
684
|
`}const _r=()=>({id:`kick/env`,outExtension:`.ts`,inputs:[`src/env.ts`,`src/**/env.ts`,`src/**/*.env.ts`],async generate(e){let t=yr(e);if(t===!1)return null;let n=await e.getScanResult({root:vr(e),cwd:e.cwd,envFile:t});if(!n.env)return null;let r=e.config?.typegen?.schemaValidator??`zod`,i=A.resolve(e.cwd,`.kickjs/types/kick__env.ts`);return gr(n.env,i,r)}});function vr(e){return A.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function yr(e){return e.config?.typegen?.envFile}function br(e){return A.resolve(e.cwd,e.config?.typegen?.srcDir??`src`)}function xr(e){let t=e.config?.typegen?.envFile;if(t!==!1)return t}function $(e){return{root:br(e),cwd:e.cwd,envFile:xr(e)}}const Sr=()=>({id:`kick/registry`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=A.resolve(e.cwd,`.kickjs/types/kick__registry.d.ts`),r=new Set(t.collisions.map(e=>e.className));return Be(t.classes,n,r)}}),Cr=()=>({id:`kick/services`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e)),n=new Set(t.collisions.map(e=>e.className));return Re(`ServiceToken`,Le(t.classes,t.tokens,t.injects,n),"(no tokens discovered — declare with createToken<T>() or `kick g service <name>`)")}}),wr=()=>({id:`kick/modules`,inputs:[`src/**/*.ts`],async generate(e){return Re(`ModuleToken`,je((await e.getScanResult($(e))).classes),"(no @Module classes discovered — `kick g module <name>` to add one)")}}),Tr=()=>({id:`kick/plugins`,inputs:[`src/**/*.ts`],async generate(e){return Ne((await e.getScanResult($(e))).pluginsAndAdapters)}}),Er=()=>({id:`kick/augmentations`,inputs:[`src/**/*.ts`],async generate(e){return Ue((await e.getScanResult($(e))).augmentations)}}),Dr=()=>({id:`kick/context`,inputs:[`src/**/*.ts`],async generate(e){let t=await e.getScanResult($(e));return t.contextKeys.length===0?null:Me(t.contextKeys)}}),Or={fastify:{subpath:`@forinda/kickjs/fastify`,typeName:`FastifyRuntimeTypes`},h3:{subpath:`@forinda/kickjs/h3`,typeName:`H3RuntimeTypes`}},kr=[D({name:`kick/init`,register:lt}),D({name:`kick/generate`,register:Rt}),D({name:`kick/run`,register:Xt}),D({name:`kick/info`,register:tn}),D({name:`kick/inspect`,register:un}),D({name:`kick/add`,register:ye}),D({name:`kick/list`,register:xe}),D({name:`kick/explain`,register:bn}),D({name:`kick/mcp`,register:kn}),D({name:`kick/tinker`,register:Nn}),D({name:`kick/remove`,register:zn}),D({name:`kick/typegen`,register:Hn}),D({name:`kick/check`,register:er}),D({name:`kick/doctor`,register:me}),D({name:`kick/codemod`,register:nr}),D({name:`kick/registry`,typegens:[Sr()]}),D({name:`kick/services`,typegens:[Cr()]}),D({name:`kick/modules`,typegens:[wr()]}),D({name:`kick/plugins`,typegens:[Tr()]}),D({name:`kick/augmentations`,typegens:[Er()]}),D({name:`kick/context`,typegens:[Dr()]}),D({name:`kick/assets`,typegens:[rr()]}),D({name:`kick/routes`,typegens:[pr()]}),D({name:`kick/env`,typegens:[_r()]}),D({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;if(t!==`fastify`&&t!==`h3`)return null;let{subpath:n,typeName:r}=Or[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(`
|
|
683
685
|
`)}}]})];export{Ht as applyDisableFilter,Wt as runAllPluginTypegens,kr as t};
|
|
684
|
-
//# sourceMappingURL=run-plugins-
|
|
686
|
+
//# sourceMappingURL=run-plugins-CY13ekyP.mjs.map
|