@forinda/kickjs-cli 5.3.2 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{builtins-CnQ6lxcV.mjs → builtins-DBzZkJey.mjs} +151 -90
- package/dist/builtins-DBzZkJey.mjs.map +1 -0
- package/dist/{builtins-BxGfcEP6.mjs → builtins-K-nRJcJG.mjs} +409 -214
- package/dist/cli.mjs +2 -2
- package/dist/config-CCNnXhar.mjs +11 -0
- package/dist/config-CQZ6Hppr.mjs +12 -0
- package/dist/config-CQZ6Hppr.mjs.map +1 -0
- package/dist/{generator-extension-BNgcYlom.mjs → generator-extension-Bn2aH7kY.mjs} +228 -94
- package/dist/generator-extension-Bn2aH7kY.mjs.map +1 -0
- package/dist/index.d.mts +45 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-B56zClEX.mjs → plugin-D0C4ISZA.mjs} +2 -2
- package/dist/{plugin-Ccvf-gn6.mjs → plugin-DasN_2Zr.mjs} +3 -3
- package/dist/{plugin-Ccvf-gn6.mjs.map → plugin-DasN_2Zr.mjs.map} +1 -1
- package/dist/{rolldown-runtime-CP9PNXAB.mjs → rolldown-runtime-BTpMa50s.mjs} +1 -1
- package/dist/{run-plugins-sjeIm8hS.mjs → run-plugins-Dk7KBKON.mjs} +2 -2
- package/dist/{typegen-CYA1y8NJ.mjs → typegen-Bl9kUVNL.mjs} +4 -4
- package/dist/{typegen-CYA1y8NJ.mjs.map → typegen-Bl9kUVNL.mjs.map} +1 -1
- package/dist/{typegen-CFW1vIgv.mjs → typegen-DDQJNnUl.mjs} +3 -3
- package/dist/{types-2ICiQzlQ.mjs → types-kAfWJgh0.mjs} +2 -2
- package/dist/{types-2ICiQzlQ.mjs.map → types-kAfWJgh0.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/builtins-CnQ6lxcV.mjs.map +0 -1
- package/dist/config-B5g_GsV2.mjs +0 -12
- package/dist/config-B5g_GsV2.mjs.map +0 -1
- package/dist/config-DE9Vo6LN.mjs +0 -11
- package/dist/generator-extension-BNgcYlom.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -608,6 +608,26 @@ interface ModuleConfig {
|
|
|
608
608
|
* prismaClientPath: './generated/prisma/client' // relative
|
|
609
609
|
*/
|
|
610
610
|
prismaClientPath?: string;
|
|
611
|
+
/**
|
|
612
|
+
* Module declaration style emitted by `kick g module` and the
|
|
613
|
+
* project scaffold.
|
|
614
|
+
*
|
|
615
|
+
* - `'define'` (default) — `defineModule({ name, build: () => ({...}) })`
|
|
616
|
+
* factory form. Mirrors `defineAdapter` / `definePlugin` /
|
|
617
|
+
* `defineContextDecorator`.
|
|
618
|
+
* - `'class'` — legacy `class FooModule implements AppModule { ... }`
|
|
619
|
+
* form. Still fully supported by the framework loader; pin to this
|
|
620
|
+
* value for projects that prefer the class shape (existing-codebase
|
|
621
|
+
* consistency, class-decorator setups, etc).
|
|
622
|
+
*
|
|
623
|
+
* The framework runtime accepts both shapes regardless of this
|
|
624
|
+
* setting — the flag controls codegen output only. `kick g module`
|
|
625
|
+
* inserts the matching call form into `src/modules/index.ts`
|
|
626
|
+
* (`Module()` vs `Module`); `kick rm module` matches both.
|
|
627
|
+
*
|
|
628
|
+
* @default 'define'
|
|
629
|
+
*/
|
|
630
|
+
style?: 'define' | 'class';
|
|
611
631
|
}
|
|
612
632
|
/** Configuration for the kick.config.ts file */
|
|
613
633
|
interface KickConfig {
|
|
@@ -766,6 +786,25 @@ declare function defineConfig(config: KickConfig): KickConfig;
|
|
|
766
786
|
/** Load kick.config.* from the project root */
|
|
767
787
|
declare function loadKickConfig(cwd: string): Promise<KickConfig | null>;
|
|
768
788
|
//#endregion
|
|
789
|
+
//#region src/generators/templates/types.d.ts
|
|
790
|
+
/**
|
|
791
|
+
* Module declaration style emitted by the module-index templates.
|
|
792
|
+
*
|
|
793
|
+
* - `'define'` — `defineModule({ name, build: () => ({...}) })`
|
|
794
|
+
* factory form. The recommended pattern; matches `defineAdapter`
|
|
795
|
+
* / `definePlugin` / `defineContextDecorator` parity.
|
|
796
|
+
* - `'class'` — legacy `class FooModule implements AppModule { ... }`
|
|
797
|
+
* form. Still fully supported by the framework loader; pin via
|
|
798
|
+
* `kick.config.ts > modules.style: 'class'` for projects that
|
|
799
|
+
* prefer the class shape (existing codebase consistency, custom
|
|
800
|
+
* class-decorator setups, etc.).
|
|
801
|
+
*
|
|
802
|
+
* Default `'define'` for new code. The `kick g module` orchestrator
|
|
803
|
+
* inserts the matching shape into `src/modules/index.ts` (`Module()`
|
|
804
|
+
* vs `Module`); `kick rm module` matches both.
|
|
805
|
+
*/
|
|
806
|
+
type ModuleStyle = 'define' | 'class';
|
|
807
|
+
//#endregion
|
|
769
808
|
//#region src/generators/module.d.ts
|
|
770
809
|
type BuiltinRepoType = 'drizzle' | 'inmemory' | 'prisma';
|
|
771
810
|
type RepoType = BuiltinRepoType | (string & {});
|
|
@@ -791,6 +830,12 @@ interface GenerateModuleOptions {
|
|
|
791
830
|
* without a config in tests/fixtures.
|
|
792
831
|
*/
|
|
793
832
|
tokenScope?: string;
|
|
833
|
+
/**
|
|
834
|
+
* Module declaration style — `'define'` (factory, default) or
|
|
835
|
+
* `'class'` (legacy). Resolved by the orchestrating command from
|
|
836
|
+
* `kick.config.ts > modules.style`.
|
|
837
|
+
*/
|
|
838
|
+
style?: ModuleStyle;
|
|
794
839
|
}
|
|
795
840
|
/**
|
|
796
841
|
* Generate a module — structure depends on the project pattern.
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/typegen/scanner.ts","../src/typegen/plugin.ts","../src/generator-extension/define.ts","../src/plugin/types.ts","../src/config.ts","../src/generators/module.ts","../src/generators/adapter.ts","../src/generators/middleware.ts","../src/generators/guard.ts","../src/generators/service.ts","../src/generators/controller.ts","../src/generators/dto.ts","../src/generators/project.ts","../src/generator-extension/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AAA,GAAkB,cAAA;;;;;;;;KASnC,eAAA;;;;;;UAOK,aAAA;EJ6Bf;;;;AAMF;;EI5BE,GAAA;EJ8BA;;AAUF;;;;EIjCE,IAAA;EJqCA;;;;;EI/BA,IAAA;EJuC+B;;;;;;;;AAUjC;;;;;;;;;AAcA;;;;EIzCE,IAAA;AAAA;;UAIe,aAAA;EJqDyB;;;;EIhDxC,MAAA;EJwDY;;AAQd;;EI3DE,MAAA;EJ2DqC;;;;;;;;AAcvC;;;;EI5DE,eAAA,GAAkB,eAAA;EJ+DV;;;;;;;;;EIrDR,OAAA;EJoDA;;;;;;;;;;;;;;;;AAaF;EI/CE,OAAA;AAAA;;UAIe,YAAA;EJ+Cf;EI7CA,GAAA;EJiDA;;;;;;;ACxMF;;;;;;EGqKE,IAAA,GAAO,cAAA;EHnKF;EGqKL,SAAA;EHpKM;;;AAGR;;EGuKE,SAAA;EHrKQ;;;;;;;;;EG+KR,gBAAA;AAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/typegen/scanner.ts","../src/typegen/plugin.ts","../src/generator-extension/define.ts","../src/plugin/types.ts","../src/config.ts","../src/generators/templates/types.ts","../src/generators/module.ts","../src/generators/adapter.ts","../src/generators/middleware.ts","../src/generators/guard.ts","../src/generators/service.ts","../src/generators/controller.ts","../src/generators/dto.ts","../src/generators/project.ts","../src/generator-extension/discover.ts","../src/generator-extension/context.ts","../src/utils/naming.ts"],"mappings":";;;;;;;AAgCA;;;;;AASA;;;;;AAGA;;;;;;;;;;;;AAcA;;cA1Ba,eAAA;AAAA,KASD,aAAA,WAAwB,eAAA;;UAGnB,eAAA;EA2CQ;EAzCvB,SAAA;EAcA;EAZA,SAAA,EAAW,aAAA;EAgBX;EAdA,QAAA;EAkBA;EAhBA,YAAA;EAyBA;EAvBA,SAAA;AAAA;;UAIe,eAAA;EA4BF;EA1Bb,UAAA;EA2Bc;EAzBd,MAAA;EA6BA;EA3BA,UAAA;EA2BY;EAzBZ,IAAA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AAA;EACA,QAAA;AAAA;;iBAIoB,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAqB,OAAA;;;;;AbnBhE;;;UcpBiB,mBAAA;EACf,MAAA;EACA,IAAA,EAAM,aAAA;AAAA;;;;Ad8BR;;UctBiB,eAAA;EACf,UAAA,EAAY,mBAAA;EduBZ;EcrBA,MAAA;EduBW;;;;EclBX,MAAA,EAAQ,KAAA;IAAQ,MAAA;IAAgB,MAAA;EAAA;AAAA;;;;;AdElC;;;;iBehBgB,qBAAA,CAAsB,KAAA;EACpC,IAAA;EACA,IAAA;EACA,KAAA,GAAQ,MAAA;EACR,UAAA;EACA,GAAA;EACA,SAAA;AAAA,IACE,gBAAA;;;;iBCpBY,YAAA,CAAa,IAAA;;iBAOb,WAAA,CAAY,IAAA;;iBAMZ,WAAA,CAAY,IAAA;;;AhByB5B;;;iBgBbgB,SAAA,CAAU,IAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.
|
|
2
|
+
* @forinda/kickjs-cli v5.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{_ as e,a as t,b as n,d as r,f as i,h as a,i as o,l as s,m as c,p as l,r as u,u as d,x as f,y as p}from"./generator-extension-
|
|
11
|
+
import{_ as e,a as t,b as n,d as r,f as i,h as a,i as o,l as s,m as c,p as l,r as u,u as d,x as f,y as p}from"./generator-extension-Bn2aH7kY.mjs";import{i as m,r as h}from"./config-CQZ6Hppr.mjs";import{n as g,t as _}from"./types-kAfWJgh0.mjs";export{_ as KickPluginConflictError,u as buildGeneratorContext,g as defineCliPlugin,h as defineConfig,o as defineGenerator,c as generateAdapter,d as generateController,s as generateDto,i as generateGuard,l as generateMiddleware,a as generateModule,r as generateService,t as initProject,m as loadKickConfig,e as pluralize,p as toCamelCase,n as toKebabCase,f as toPascalCase};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.
|
|
2
|
+
* @forinda/kickjs-cli v5.4.0
|
|
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-BTpMa50s.mjs";function t(e){return e}var n=class extends Error{constructor(e,t,n){super(`Two plugins registered the same ${e} '${t}': ${n.join(`, `)}. Plugins must use unique ${e} names.`),this.name=`KickPluginConflictError`}};function r(e,t=[]){let r=new Map;for(let t of e){let e=(r.get(t.name)??0)+1;if(r.set(t.name,e),e===2)throw new n(`plugin`,t.name,[t.name,t.name])}let i=new Map,a=[];for(let t of e)for(let e of t.commands??[]){let r=i.get(e.name);if(r)throw new n(`command`,e.name,[r,t.name]);i.set(e.name,t.name),a.push(e)}let o=new Set(t.map(e=>e.name)),s=[...a.filter(e=>!o.has(e.name)),...t],c=new Map,l=[];for(let t of e)for(let e of t.typegens??[]){let r=c.get(e.id);if(r)throw new n(`typegen`,e.id,[r,t.name]);c.set(e.id,t.name),l.push(e)}let u=new Map,d=[];for(let t of e)for(let e of t.generators??[]){let r=u.get(e.name);if(r)throw new n(`generator`,e.name,[r,t.name]);u.set(e.name,t.name),d.push({source:t.name,spec:e})}return{commands:s,typegens:l,generators:d,register:async(t,n)=>{let r=n??{cwd:process.cwd(),config:null,log:()=>{}};for(let n of e)n.register&&await n.register(t,r)}}}var i=e({mergeCliPlugins:()=>r});export{r as n,t as r,i as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.
|
|
2
|
+
* @forinda/kickjs-cli v5.4.0
|
|
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=plugin-
|
|
11
|
+
import{t as e}from"./rolldown-runtime-BTpMa50s.mjs";import{t}from"./types-kAfWJgh0.mjs";function n(e,n=[]){let r=new Map;for(let n of e){let e=(r.get(n.name)??0)+1;if(r.set(n.name,e),e===2)throw new t(`plugin`,n.name,[n.name,n.name])}let i=new Map,a=[];for(let n of e)for(let e of n.commands??[]){let r=i.get(e.name);if(r)throw new t(`command`,e.name,[r,n.name]);i.set(e.name,n.name),a.push(e)}let o=new Set(n.map(e=>e.name)),s=[...a.filter(e=>!o.has(e.name)),...n],c=new Map,l=[];for(let n of e)for(let e of n.typegens??[]){let r=c.get(e.id);if(r)throw new t(`typegen`,e.id,[r,n.name]);c.set(e.id,n.name),l.push(e)}let u=new Map,d=[];for(let n of e)for(let e of n.generators??[]){let r=u.get(e.name);if(r)throw new t(`generator`,e.name,[r,n.name]);u.set(e.name,n.name),d.push({source:n.name,spec:e})}return{commands:s,typegens:l,generators:d,register:async(t,n)=>{let r=n??{cwd:process.cwd(),config:null,log:()=>{}};for(let n of e)n.register&&await n.register(t,r)}}}var r=e({mergeCliPlugins:()=>n});export{n,r as t};
|
|
12
|
+
//# sourceMappingURL=plugin-DasN_2Zr.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-
|
|
1
|
+
{"version":3,"file":"plugin-DasN_2Zr.mjs","names":[],"sources":["../src/plugin/merge.ts","../src/plugin/index.ts"],"sourcesContent":["// Plugin → unified registry merge.\n//\n// Resolution rules (per the v1 spec + dogfood pivot):\n// - duplicate plugin `name` across the input array → conflict error.\n// Catches the double-install case (built-in shipped twice, or\n// adopter requiring the same plugin twice).\n// - plugin commands appear first in the merged list, then adopter\n// commands; adopter `commands` of the same name override the\n// plugin entry (filter pass).\n// - duplicate command name across two plugins → conflict error\n// listing both plugin names. Adopter overriding a plugin is\n// allowed and not an error.\n// - duplicate typegen id across two plugins → same error. Typegens\n// have no adopter override path; only plugins contribute them.\n// - register() functions are collected in input order; the caller\n// invokes each one against the same Command program. They have no\n// id-level conflict surface — owners are responsible for picking\n// non-colliding command names inside their own register().\n// - plugin order = array order. No implicit precedence rules.\n\nimport type { Command } from 'commander'\n\nimport type { KickCommandDefinition } from '../config'\nimport type { TypegenPlugin } from '../typegen/plugin'\nimport type { GeneratorSpec } from '../generator-extension/define'\nimport type { DiscoveredGenerator } from '../generator-extension/discover'\nimport { KickPluginConflictError, type KickCliPlugin, type KickCliPluginContext } from './types'\n\nexport interface MergedPlugins {\n commands: KickCommandDefinition[]\n typegens: TypegenPlugin[]\n /** DiscoveredGenerator shape so this list slots into the existing\n * dispatch path next to package.json-discovered entries. `source`\n * carries the plugin name for error attribution. */\n generators: DiscoveredGenerator[]\n /**\n * Apply every plugin's register() in input order. ctx is optional so\n * tests + lightweight callers can invoke `register(program)` without\n * constructing a full context; it falls back to cwd=process.cwd(),\n * config=null, log=no-op.\n */\n register: (program: Command, ctx?: KickCliPluginContext) => Promise<void>\n}\n\nexport function mergeCliPlugins(\n plugins: readonly KickCliPlugin[],\n adopterCommands: readonly KickCommandDefinition[] = [],\n): MergedPlugins {\n // Plugin-name dedup — catches double-install.\n const seenPluginNames = new Map<string, number>()\n for (const p of plugins) {\n const count = (seenPluginNames.get(p.name) ?? 0) + 1\n seenPluginNames.set(p.name, count)\n if (count === 2) {\n throw new KickPluginConflictError('plugin', p.name, [p.name, p.name])\n }\n }\n\n const commandOwners = new Map<string, string>()\n const pluginCommands: KickCommandDefinition[] = []\n for (const p of plugins) {\n for (const cmd of p.commands ?? []) {\n const prior = commandOwners.get(cmd.name)\n if (prior) {\n throw new KickPluginConflictError('command', cmd.name, [prior, p.name])\n }\n commandOwners.set(cmd.name, p.name)\n pluginCommands.push(cmd)\n }\n }\n\n const adopterNames = new Set(adopterCommands.map((c) => c.name))\n const filteredPlugin = pluginCommands.filter((c) => !adopterNames.has(c.name))\n const commands = [...filteredPlugin, ...adopterCommands]\n\n const typegenOwners = new Map<string, string>()\n const typegens: TypegenPlugin[] = []\n for (const p of plugins) {\n for (const tg of p.typegens ?? []) {\n const prior = typegenOwners.get(tg.id)\n if (prior) {\n throw new KickPluginConflictError('typegen', tg.id, [prior, p.name])\n }\n typegenOwners.set(tg.id, p.name)\n typegens.push(tg)\n }\n }\n\n const generatorOwners = new Map<string, string>()\n const generators: DiscoveredGenerator[] = []\n for (const p of plugins) {\n for (const spec of p.generators ?? []) {\n const prior = generatorOwners.get(spec.name)\n if (prior) {\n throw new KickPluginConflictError('generator', spec.name, [prior, p.name])\n }\n generatorOwners.set(spec.name, p.name)\n generators.push({ source: p.name, spec: spec satisfies GeneratorSpec })\n }\n }\n\n const register = async (program: Command, ctx?: KickCliPluginContext): Promise<void> => {\n const resolved: KickCliPluginContext = ctx ?? {\n cwd: process.cwd(),\n config: null,\n log: () => {},\n }\n for (const p of plugins) {\n if (p.register) await p.register(program, resolved)\n }\n }\n\n return { commands, typegens, generators, register }\n}\n","// Barrel intentionally omits `./builtins` — that module top-level-imports\n// every register*Command, which pulls heavy modules (project scaffolders,\n// fs reads at import time) into the graph. Importers that need the\n// builtin list go through `./plugin/builtins` directly; tests + adopter\n// plugins consuming only the contract types import from here.\n\nexport type { KickCliPlugin } from './types'\nexport { defineCliPlugin, KickPluginConflictError } from './types'\nexport { mergeCliPlugins, type MergedPlugins } from './merge'\n"],"mappings":";;;;;;;;;;wFA4CA,SAAgB,EACd,EACA,EAAoD,EAAE,CACvC,CAEf,IAAM,EAAkB,IAAI,IAC5B,IAAK,IAAM,KAAK,EAAS,CACvB,IAAM,GAAS,EAAgB,IAAI,EAAE,KAAK,EAAI,GAAK,EAEnD,GADA,EAAgB,IAAI,EAAE,KAAM,EAAM,CAC9B,IAA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AE,WAAU,WAAU,aAAY,eAXjB,EAAkB,IAA8C,CACtF,IAAM,EAAiC,GAAO,CAC5C,IAAK,QAAQ,KAAK,CAClB,OAAQ,KACR,QAAW,GACZ,CACD,IAAK,IAAM,KAAK,EACV,EAAE,UAAU,MAAM,EAAE,SAAS,EAAS,EAAS,EAIJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.
|
|
2
|
+
* @forinda/kickjs-cli v5.4.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{n as e,t}from"./builtins-
|
|
11
|
+
import{n as e,t}from"./builtins-DBzZkJey.mjs";export{e as applyDisableFilter,t as runAllPluginTypegens};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.
|
|
2
|
+
* @forinda/kickjs-cli v5.4.0
|
|
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-BTpMa50s.mjs";import{dirname as t,join as n,relative as r,resolve as i,sep as a}from"node:path";import{statSync as o}from"node:fs";import{mkdir as s,readFile as c,readdir as l,writeFile as u}from"node:fs/promises";import{globSync as d}from"glob";import{groupAssetKeys as f}from"@forinda/kickjs";const p=[`Service`,`Controller`,`Repository`,`Injectable`,`Component`,`Module`],m=[`.ts`,`.tsx`,`.mts`,`.cts`],h=[`node_modules`,`.kickjs`,`dist`,`build`,`.test.`,`.spec.`,`.d.ts`],g=new RegExp(String.raw`@(${p.join(`|`)})\s*\([^)]*\)`+String.raw`(?:\s*@[A-Z]\w*(?:\s*\([^)]*\))?)*`+String.raw`\s*export\s+(default\s+)?(?:abstract\s+)?class\s+(\w+)`,`g`),_=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`),v=/(?:export\s+)?const\s+(\w+)\s*(?::\s*[^=]+)?=\s*createToken\s*(?:<[^>]*>)?\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,y=/createToken\s*(?:<[^>]*>)?\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,b=/@Inject\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,x=/\b(defineAdapter|definePlugin)\s*(?:<[^>]*>)?\s*\(/g,S=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`),C=/\bname\s*(?::\s*[^=]+)?=\s*['"`]([^'"`]+)['"`]/,w=/\bdefineAugmentation\s*\(\s*['"`]([^'"`]+)['"`]\s*(,\s*\{)?/g,T=new RegExp(String.raw`@(${[`Get`,`Post`,`Put`,`Delete`,`Patch`].join(`|`)})\s*\(`,`g`);function E(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 D(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=E(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 O(e){return(e.match(/:([a-zA-Z_]\w*)/g)??[]).map(e=>e.slice(1))}function k(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 A(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 j(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?M(n[1].trim(),t):null}return M(n[1].trim(),t)}function M(e,t){if(e.startsWith(`{`))return P(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 P(r[1])}return{filterable:[],sortable:[],searchable:[]}}function N(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 P(e){return{filterable:N(e,`filterable`),sortable:N(e,`sortable`),searchable:N(e,`searchable`)}}async function F(e,t){let i=t.extensions??m,a=t.exclude??h,o=[],s;try{s=await l(e,{withFileTypes:!0,encoding:`utf-8`})}catch{return o}for(let c of s){let s=n(e,c.name),l=r(t.cwd,s);a.some(e=>l.includes(e))||(c.isDirectory()?o.push(...await F(s,t)):c.isFile()&&i.some(e=>c.name.endsWith(e))&&o.push(s))}return o}function I(e,t){return r(t,e).split(a).join(`/`)}function L(e,t,n){let r=[],i=I(t,n);g.lastIndex=0;let a;for(;(a=g.exec(e))!==null;){let[,e,n,o]=a;r.push({className:o,decorator:e,filePath:t,relativePath:i,isDefault:!!n})}_.lastIndex=0;let o;for(;(o=_.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})}return r}function R(e,t,n){let r=[],i=I(t,n),a=new Set;v.lastIndex=0;let o;for(;(o=v.exec(e))!==null;){let[e,n,s]=o;a.add(e),r.push({name:s,variable:n,filePath:t,relativePath:i})}for(y.lastIndex=0;(o=y.exec(e))!==null;)a.has(o[0])||r.push({name:o[1],variable:null,filePath:t,relativePath:i});return r}function z(e,t,n,r){let i=[];if(r.length===0)return i;let a=I(t,n),o=[];for(let t of r){let n=new RegExp(String.raw`class\s+${t.className}\b`).exec(e);n?.index!==void 0&&o.push({cls:t,start:n.index})}o.sort((e,t)=>e.start-t.start);for(let n=0;n<o.length;n++){let{cls:r,start:s}=o[n],c=n+1<o.length?o[n+1].start:e.length,l=e.slice(s,c);T.lastIndex=0;let u;for(;(u=T.exec(l))!==null;){let n=u[1],o=u.index,s=T.lastIndex-1,c=E(l,s);if(c<0)continue;let d=l.slice(s+1,c),f=d.match(/^\s*['"`]([^'"`]*)['"`]/),p=f&&f[1].length>0?f[1]:`/`,m=D(l,c+1);if(!m)continue;let{methodName:h,endPos:g}=m;T.lastIndex=g;let _=j(l.slice(o,g),e),v=k(d,`body`),y=k(d,`query`),b=k(d,`params`);i.push({controller:r.className,method:h,httpMethod:n.toUpperCase(),path:p,pathParams:O(p),queryFilterable:_?.filterable??null,querySortable:_?.sortable??null,querySearchable:_?.searchable??null,bodySchema:v?{identifier:v,source:A(e,v)}:null,querySchema:y?{identifier:y,source:A(e,y)}:null,paramsSchema:b?{identifier:b,source:A(e,b)}:null,filePath:t,relativePath:a})}}return i}function ee(e,t,n){let r=[],i=I(t,n);b.lastIndex=0;let a;for(;(a=b.exec(e))!==null;)r.push({name:a[1],filePath:t,relativePath:i});return r}function te(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 ne(e,t,n){let r=[],i=I(t,n),a=new Set;x.lastIndex=0;let o;for(;(o=x.exec(e))!==null;){let n=o[1],s=x.lastIndex-1,c=E(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}))}S.lastIndex=0;let s;for(;(s=S.exec(e))!==null;){let n=s.index,o=e.indexOf(`{`,n);if(o<0)continue;let c=te(e,o);if(c<0)continue;let l=e.slice(o+1,c),u=C.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 re(e,t,n){let r=[],i=I(t,n);w.lastIndex=0;let a;for(;(a=w.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=te(e,t);if(n>=0){let r=e.slice(t+1,n);o=B(r,`description`),s=B(r,`example`)}}}r.push({name:n,description:o,example:s,filePath:t,relativePath:i})}return r}function B(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
12
|
`:t===`t`?` `:t===`r`?`\r`:t)}const ie=[`src/config/index.ts`,`src/config/env.ts`,`src/config.ts`,`src/env.ts`];async function ae(e,t){let n=t===`src/env.ts`?ie:[t];for(let t of n){let n=i(e,t),r;try{r=await c(n,`utf-8`)}catch{continue}if(/\bdefineEnv\s*\(/.test(r)&&/export\s+default\b/.test(r))return{filePath:n,relativePath:I(n,e)}}return null}function oe(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}async function V(e){let t=await F(i(e.root),e),n=[],r=[],a=[],o=[],s=[],l=[],u=new Map;for(let r of t){let t;try{t=await c(r,`utf-8`)}catch{continue}u.set(r,t),n.push(...L(t,r,e.cwd)),a.push(...R(t,r,e.cwd)),o.push(...ee(t,r,e.cwd)),s.push(...ne(t,r,e.cwd)),l.push(...re(t,r,e.cwd))}for(let[t,i]of u){let a=n.filter(e=>e.filePath===t);r.push(...z(i,t,e.cwd,a))}return n.sort((e,t)=>e.className===t.className?e.relativePath.localeCompare(t.relativePath):e.className.localeCompare(t.className)),a.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),o.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)),l.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),{classes:n,routes:r,tokens:a,injects:o,collisions:oe(n),env:await ae(e.cwd,e.envFile??`src/env.ts`),pluginsAndAdapters:s,augmentations:l}}function H(e,t){if(!e)return{entries:[],count:0};let n=new Map;for(let[r,a]of Object.entries(e)){if(!a||typeof a.src!=`string`)continue;let e=i(t,a.src);if(!ce(e))continue;let o=d(a.glob??`**/*`,{cwd:e,nodir:!0,dot:!1,posix:!0});o.sort();let{pairs:s}=f(r,o,{strategy:a.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 U(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}
|
|
13
13
|
declare module '@forinda/kickjs' {
|
|
14
14
|
/**
|
|
@@ -109,7 +109,7 @@ ${n.join(`
|
|
|
109
109
|
`)}
|
|
110
110
|
`}async function he(e){let{classes:r,routes:i=[],tokens:a=[],injects:o=[],collisions:c=[],env:l=null,pluginsAndAdapters:d=[],augmentations:f=[],assets:p={entries:[],count:0},outDir:m,allowDuplicates:h=!1,schemaValidator:g=!1}=e;if(c.length>0&&!h)throw new J(c);await s(m,{recursive:!0});let _=n(m,`registry.d.ts`),v=n(m,`services.d.ts`),y=n(m,`modules.d.ts`),b=n(m,`plugins.d.ts`),x=n(m,`augmentations.d.ts`),S=n(m,`assets.d.ts`),C=n(m,`index.d.ts`),w=new Set(c.map(e=>e.className)),T=de(r,_,w),E=r.filter(e=>q.has(e.decorator)).map(e=>w.has(e.className)?Y(e):e.className),D=a.map(e=>e.name),O=o.map(e=>e.name),k=[...E,...D,...O],A=r.filter(e=>e.decorator===`Module`).map(e=>e.className),j=X(`ServiceToken`,k,"(no tokens discovered — declare with createToken<T>() or `kick g service <name>`)"),M=X(`ModuleToken`,A,"(no @Module classes discovered — `kick g module <name>` to add one)"),N=pe(d),P=me(f),F=U(p),I=fe(l!==null);await u(_,T,`utf-8`),await u(v,j,`utf-8`),await u(y,M,`utf-8`),await u(b,N,`utf-8`),await u(x,P,`utf-8`),await u(S,F,`utf-8`),await u(C,I,`utf-8`);let L=[_,v,y,b,x,S,C];await u(n(t(m),`.gitignore`),`# Auto-generated by kick typegen
|
|
111
111
|
*
|
|
112
|
-
`,`utf-8`);let R=new Set(d.map(e=>e.name)).size,z=new Set(f.map(e=>e.name)).size;return{registryEntries:E.length,serviceTokens:new Set(k).size,moduleTokens:A.length,routeEntries:i.length,pluginEntries:R,augmentationEntries:z,assetEntries:p.count,envWritten:l!==null,written:L,resolvedCollisions:c.length}}const ge=/^(kick\/)?([a-z][\w-]*\/[A-Z]\w*)(\/.+)?(:[a-z][\w-]+(:[a-z][\w-]+)*)?$/;function _e(e){let t=[];for(let n of e){let e=n.name;e.startsWith(`kickjs.`)||ge.test(e)||t.push({token:e,variable:n.variable,filePath:n.relativePath,reason:"does not match `<scope>/<PascalKey>[/<suffix>][:<instance>]`",suggestion:ve(e)})}return t}function ve(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)}'`}}var ye=e({runTypegen:()=>Q,watchTypegen:()=>be});function Z(e){let t=e.cwd??process.cwd();return{cwd:t,srcDir:i(t,e.srcDir??`src`),outDir:i(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:a,schemaValidator:o,envFile:s}=Z(e),c=Date.now(),l=await V({root:n,cwd:t,envFile:s===!1?void 0:s}),u=H(e.assetMap,t),d=await he({classes:l.classes,routes:l.routes,tokens:l.tokens,injects:l.injects,collisions:l.collisions,env:s===!1?null:l.env,pluginsAndAdapters:l.pluginsAndAdapters,augmentations:l.augmentations,assets:u,outDir:r,allowDuplicates:a,schemaValidator:o});if(e.runPlugins!==!1)try{let{runAllPluginTypegens:e}=await import(`./run-plugins-
|
|
112
|
+
`,`utf-8`);let R=new Set(d.map(e=>e.name)).size,z=new Set(f.map(e=>e.name)).size;return{registryEntries:E.length,serviceTokens:new Set(k).size,moduleTokens:A.length,routeEntries:i.length,pluginEntries:R,augmentationEntries:z,assetEntries:p.count,envWritten:l!==null,written:L,resolvedCollisions:c.length}}const ge=/^(kick\/)?([a-z][\w-]*\/[A-Z]\w*)(\/.+)?(:[a-z][\w-]+(:[a-z][\w-]+)*)?$/;function _e(e){let t=[];for(let n of e){let e=n.name;e.startsWith(`kickjs.`)||ge.test(e)||t.push({token:e,variable:n.variable,filePath:n.relativePath,reason:"does not match `<scope>/<PascalKey>[/<suffix>][:<instance>]`",suggestion:ve(e)})}return t}function ve(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)}'`}}var ye=e({runTypegen:()=>Q,watchTypegen:()=>be});function Z(e){let t=e.cwd??process.cwd();return{cwd:t,srcDir:i(t,e.srcDir??`src`),outDir:i(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:a,schemaValidator:o,envFile:s}=Z(e),c=Date.now(),l=await V({root:n,cwd:t,envFile:s===!1?void 0:s}),u=H(e.assetMap,t),d=await he({classes:l.classes,routes:l.routes,tokens:l.tokens,injects:l.injects,collisions:l.collisions,env:s===!1?null:l.env,pluginsAndAdapters:l.pluginsAndAdapters,augmentations:l.augmentations,assets:u,outDir:r,allowDuplicates:a,schemaValidator:o});if(e.runPlugins!==!1)try{let{runAllPluginTypegens:e}=await import(`./run-plugins-Dk7KBKON.mjs`),{loadKickConfig:n}=await import(`./config-CQZ6Hppr.mjs`).then(e=>e.n);await e({cwd:t,config:await n(t),silent:!0})}catch(e){if(!i){let t=e instanceof Error?e.message:String(e);console.warn(` kick typegen: plugin pipeline failed (${t}) — continuing`)}}let f=_e(l.tokens),p=Date.now()-c;if(!i){let e=r.replace(t+`/`,``),n=d.resolvedCollisions>0?`, ${d.resolvedCollisions} collisions namespaced`:``,i=d.envWritten?`, env typed`:``,a=d.pluginEntries>0?`, ${d.pluginEntries} plugins/adapters`:``,o=d.augmentationEntries>0?`, ${d.augmentationEntries} augmentations`:``,s=d.assetEntries>0?`, ${d.assetEntries} assets`:``;if(console.log(` kick typegen → ${d.serviceTokens} services, ${d.routeEntries} routes, ${d.moduleTokens} modules${a}${o}${s}${i}${n} → ${e} (${p}ms)`),f.length>0){console.warn(` kick typegen: ${f.length} token(s) don't match the §22.2 convention:`);for(let e of f){let t=e.variable?` [${e.variable}]`:``;console.warn(` '${e.token}' (${e.filePath})${t} — ${e.reason}`),e.suggestion&&console.warn(` → suggestion: ${e.suggestion}`)}}}return{scan:l,result:d,tokenWarnings:f}}async function be(e={}){let t=Z(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-Dk7KBKON.mjs`),import(`./config-CQZ6Hppr.mjs`).then(e=>e.n)]),l=await c(i),u=()=>s({cwd:i,config:l,silent:!0}).catch(()=>{});await $(a,r),await u();let{watch:d}=await import(`node:fs`),f=null,p=e=>{e&&/\.(ts|tsx|mts|cts)$/.test(e)&&(e.includes(`.kickjs`)||e.endsWith(`.d.ts`)||(f&&clearTimeout(f),f=setTimeout(()=>{$(a,r),u()},100)))};if(o){r||console.log(` kick typegen: polling mode (KICKJS_WATCH_POLLING)`);let e=setInterval(()=>{$({...a,silent:!0},!0)},2e3);return()=>clearInterval(e)}let m;try{m=d(n,{recursive:!0},(e,t)=>{p(t)})}catch(e){r||console.warn(` kick typegen: watch mode unavailable (${e?.message??e}). Falling back to polling.`);let t=setInterval(()=>{$({...a,silent:!0},!0)},2e3);return()=>clearInterval(t)}return()=>{f&&clearTimeout(f),m.close()}}async function $(e,t){try{await Q(e)}catch(e){if(t)return;if(e instanceof J)console.error(`
|
|
113
113
|
`+e.message+`
|
|
114
114
|
`);else{let t=e instanceof Error?e.message:String(e);console.error(` kick typegen failed: ${t}`)}}}export{H as a,J as i,ye as n,U as o,be as r,V as s,Q as t};
|
|
115
|
-
//# sourceMappingURL=typegen-
|
|
115
|
+
//# sourceMappingURL=typegen-Bl9kUVNL.mjs.map
|