@forinda/kickjs-cli 5.4.4 → 5.4.5
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-f9GCF9UO.mjs → builtins-CTv3_NFH.mjs} +4 -4
- package/dist/{builtins-f9GCF9UO.mjs.map → builtins-CTv3_NFH.mjs.map} +1 -1
- package/dist/{builtins-B9mT_e0x.mjs → builtins-WmcOB_BH.mjs} +4 -4
- package/dist/cli.mjs +2 -2
- package/dist/{config-DO_ZcO15.mjs → config-Cx9U56C1.mjs} +2 -2
- package/dist/{config-DDTX-zCM.mjs → config-NWyl31UO.mjs} +3 -3
- package/dist/{config-DDTX-zCM.mjs.map → config-NWyl31UO.mjs.map} +1 -1
- package/dist/{generator-extension-B0VOAwMA.mjs → generator-extension-C8B3jDpA.mjs} +3 -3
- package/dist/{generator-extension-B0VOAwMA.mjs.map → generator-extension-C8B3jDpA.mjs.map} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-DLnoaSX8.mjs → plugin-BqVJOCi4.mjs} +2 -2
- package/dist/{plugin-BWHJGpYB.mjs → plugin-_Kc-Swdx.mjs} +3 -3
- package/dist/{plugin-BWHJGpYB.mjs.map → plugin-_Kc-Swdx.mjs.map} +1 -1
- package/dist/{rolldown-runtime-Bdez_B3Y.mjs → rolldown-runtime-BF4Vfvmz.mjs} +1 -1
- package/dist/{run-plugins-GWzfZyd_.mjs → run-plugins-BcJCeJ3a.mjs} +2 -2
- package/dist/{typegen-BEWcYO4F.mjs → typegen-B-504b6a.mjs} +4 -4
- package/dist/{typegen-BEWcYO4F.mjs.map → typegen-B-504b6a.mjs.map} +1 -1
- package/dist/{typegen-B05WVNbq.mjs → typegen-BcmvYXaW.mjs} +3 -3
- package/dist/{types-CjlT7_CZ.mjs → types-UT7s54gu.mjs} +2 -2
- package/dist/{types-CjlT7_CZ.mjs.map → types-UT7s54gu.mjs.map} +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.4.
|
|
2
|
+
* @forinda/kickjs-cli v5.4.5
|
|
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-BF4Vfvmz.mjs";import{statSync as t}from"node:fs";import{basename as n,dirname as r,join as i,relative as a,resolve as o,sep as s}from"node:path";import{mkdir as c,readFile as l,readdir as u,stat as d,unlink as f,writeFile as p}from"node:fs/promises";import{globSync as m}from"glob";import{groupAssetKeys as h}from"@forinda/kickjs";const g=[`Service`,`Controller`,`Repository`,`Injectable`,`Component`,`Module`],_=[`.ts`,`.tsx`,`.mts`,`.cts`],v=[`node_modules`,`.kickjs`,`dist`,`build`,`.test.`,`.spec.`,`.d.ts`],y=new RegExp(String.raw`@(${g.join(`|`)})\s*\([^)]*\)`+String.raw`(?:\s*@[A-Z]\w*(?:\s*\([^)]*\))?)*`+String.raw`\s*export\s+(default\s+)?(?:abstract\s+)?class\s+(\w+)`,`g`),b=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`),x=/(?:export\s+)?const\s+(\w+)\s*(?::\s*[^=]+)?=\s*createToken\s*(?:<[^>]*>)?\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,S=/createToken\s*(?:<[^>]*>)?\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,C=/@Inject\s*\(\s*['"`]([^'"`]+)['"`]\s*\)/g,w=/\b(defineAdapter|definePlugin)\s*(?:<[^>]*>)?\s*\(/g,T=new RegExp(String.raw`export\s+(?:default\s+)?(?:abstract\s+)?class\s+(\w+)`+String.raw`(?:\s+extends\s+\w+(?:<[^>]*>)?)?`+String.raw`\s+implements\s+[^{]*\bAppAdapter\b`,`g`),E=/\bname\s*(?::\s*[^=]+)?=\s*['"`]([^'"`]+)['"`]/,D=/\bdefineAugmentation\s*\(\s*['"`]([^'"`]+)['"`]\s*(,\s*\{)?/g,O=new RegExp(String.raw`@(${[`Get`,`Post`,`Put`,`Delete`,`Patch`].join(`|`)})\s*\(`,`g`);function k(e,t){let n=1;for(let r=t+1;r<e.length;r++){let t=e[r];if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}return-1}function A(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=k(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 j(e){return(e.match(/:([a-zA-Z_]\w*)/g)??[]).map(e=>e.slice(1))}function M(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 N(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 P(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?F(n[1].trim(),t):null}return F(n[1].trim(),t)}function F(e,t){if(e.startsWith(`{`))return L(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 L(r[1])}return{filterable:[],sortable:[],searchable:[]}}function I(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 L(e){return{filterable:I(e,`filterable`),sortable:I(e,`sortable`),searchable:I(e,`searchable`)}}async function R(e,t){let n=t.extensions??_,r=t.exclude??v,o=[],s;try{s=await u(e,{withFileTypes:!0,encoding:`utf-8`})}catch{return o}for(let c of s){let s=i(e,c.name),l=a(t.cwd,s);r.some(e=>l.includes(e))||(c.isDirectory()?o.push(...await R(s,t)):c.isFile()&&n.some(e=>c.name.endsWith(e))&&o.push(s))}return o}function z(e,t){return a(t,e).split(s).join(`/`)}function ee(e,t,n){let r=[],i=z(t,n);y.lastIndex=0;let a;for(;(a=y.exec(e))!==null;){let[,e,n,o]=a;r.push({className:o,decorator:e,filePath:t,relativePath:i,isDefault:!!n})}b.lastIndex=0;let o;for(;(o=b.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 te(e,t,n){let r=[],i=z(t,n),a=new Set;x.lastIndex=0;let o;for(;(o=x.exec(e))!==null;){let[e,n,s]=o;a.add(e),r.push({name:s,variable:n,filePath:t,relativePath:i})}for(S.lastIndex=0;(o=S.exec(e))!==null;)a.has(o[0])||r.push({name:o[1],variable:null,filePath:t,relativePath:i});return r}function ne(e,t,n,r){let i=[];if(r.length===0)return i;let a=z(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);O.lastIndex=0;let u;for(;(u=O.exec(l))!==null;){let n=u[1],o=u.index,s=O.lastIndex-1,c=k(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=A(l,c+1);if(!m)continue;let{methodName:h,endPos:g}=m;O.lastIndex=g;let _=P(l.slice(o,g),e),v=M(d,`body`),y=M(d,`query`),b=M(d,`params`);i.push({controller:r.className,method:h,httpMethod:n.toUpperCase(),path:p,pathParams:j(p),queryFilterable:_?.filterable??null,querySortable:_?.sortable??null,querySearchable:_?.searchable??null,bodySchema:v?{identifier:v,source:N(e,v)}:null,querySchema:y?{identifier:y,source:N(e,y)}:null,paramsSchema:b?{identifier:b,source:N(e,b)}:null,filePath:t,relativePath:a})}}return i}function re(e,t,n){let r=[],i=z(t,n);C.lastIndex=0;let a;for(;(a=C.exec(e))!==null;)r.push({name:a[1],filePath:t,relativePath:i});return r}function B(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 ie(e,t,n){let r=[],i=z(t,n),a=new Set;w.lastIndex=0;let o;for(;(o=w.exec(e))!==null;){let n=o[1],s=w.lastIndex-1,c=k(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}))}T.lastIndex=0;let s;for(;(s=T.exec(e))!==null;){let n=s.index,o=e.indexOf(`{`,n);if(o<0)continue;let c=B(e,o);if(c<0)continue;let l=e.slice(o+1,c),u=E.exec(l);if(!u)continue;let d=u[1],f=`class::${d}::${t}`;a.has(f)||(a.add(f),r.push({kind:`adapter`,name:d,filePath:t,relativePath:i}))}return r}function ae(e,t,n){let r=[],i=z(t,n);D.lastIndex=0;let a;for(;(a=D.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=B(e,t);if(n>=0){let r=e.slice(t+1,n);o=V(r,`description`),s=V(r,`example`)}}}r.push({name:n,description:o,example:s,filePath:t,relativePath:i})}return r}function V(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 oe=[`src/config/index.ts`,`src/config/env.ts`,`src/config.ts`,`src/env.ts`];async function se(e,t){let n=t===`src/env.ts`?oe:[t];for(let t of n){let n=o(e,t),r;try{r=await l(n,`utf-8`)}catch{continue}if(/\bdefineEnv\s*\(/.test(r)&&/export\s+default\b/.test(r))return{filePath:n,relativePath:z(n,e)}}return null}function ce(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 H(e){let t=await R(o(e.root),e),n=[],r=[],i=[],a=[],s=[],c=[],u=new Map;for(let r of t){let t;try{t=await l(r,`utf-8`)}catch{continue}u.set(r,t),n.push(...ee(t,r,e.cwd)),i.push(...te(t,r,e.cwd)),a.push(...re(t,r,e.cwd)),s.push(...ie(t,r,e.cwd)),c.push(...ae(t,r,e.cwd))}for(let[t,i]of u){let a=n.filter(e=>e.filePath===t);r.push(...ne(i,t,e.cwd,a))}return n.sort((e,t)=>e.className===t.className?e.relativePath.localeCompare(t.relativePath):e.className.localeCompare(t.className)),i.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),a.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),r.sort((e,t)=>e.controller.localeCompare(t.controller)||e.method.localeCompare(t.method)),s.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),c.sort((e,t)=>e.name.localeCompare(t.name)||e.relativePath.localeCompare(t.relativePath)),{classes:n,routes:r,tokens:i,injects:a,collisions:ce(n),env:await se(e.cwd,e.envFile??`src/env.ts`),pluginsAndAdapters:s,augmentations:c}}const U="/* 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",W=new Set([`Service`,`Repository`,`Injectable`,`Component`]);var G=class extends Error{collisions;constructor(e){super(le(e)),this.name=`TokenCollisionError`,this.collisions=e}};function le(e){let t=[`kick typegen: token collision detected`];for(let n of e){t.push(``),t.push(` ${n.classes.length} classes named '${n.className}':`);for(let e of n.classes)t.push(` - ${e.relativePath}`)}return t.push(``),t.push(`Resolutions:`),t.push(` (a) Rename one of the classes`),t.push(` (b) Use createToken<T>('namespaced/Name') and import the token explicitly — see @forinda/kickjs`),t.push(` (c) Pass --allow-duplicates to namespace the registry keys automatically`),t.push(` (e.g. 'modules/users/UserService' instead of 'UserService')`),t.join(`
|
|
13
13
|
`)}function ue(e,t){let n=a(r(t),e).split(s).join(`/`);return n=n.replace(/\.(ts|tsx|mts|cts)$/i,``),n.startsWith(`.`)||(n=`./`+n),n}function de(e){let t=e.relativePath.replace(/^src\//,``).replace(/\.(ts|tsx|mts|cts)$/i,``).split(`/`);t.pop();let n=t.join(`/`);return n?`${n}/${e.className}`:e.className}function fe(e,t,n){let r=new Set,i=[];for(let a of e){if(!W.has(a.decorator))continue;let e=n.has(a.className)?de(a):a.className;if(r.has(e))continue;r.add(e);let o=ue(a.filePath,t),s=a.isDefault?`import('${o}').default`:`import('${o}').${a.className}`;i.push(` '${e}': ${s}`)}return`${U}
|
|
14
14
|
declare module '@forinda/kickjs' {
|
|
@@ -109,7 +109,7 @@ ${Y(n,` `)}
|
|
|
109
109
|
|
|
110
110
|
export {}
|
|
111
111
|
`}const J=Symbol(`asset-leaf`);function Y(e,t){let n=Object.keys(e).toSorted(),r=[];for(let i of n){let n=e[i],a=xe(i)?i:JSON.stringify(i);n===J?r.push(`${t}${a}: () => string`):(r.push(`${t}${a}: {`),r.push(Y(n,`${t} `)),r.push(`${t}}`))}return r.join(`
|
|
112
|
-
`)}function xe(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Se(e){try{return t(e).isDirectory()}catch{return!1}}var Ce=e({runTypegen:()=>Z,sweepStaleTypegen:()=>$,watchTypegen:()=>we});function X(e){let t=e.cwd??process.cwd();return{cwd:t,srcDir:o(t,e.srcDir??`src`),outDir:o(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 Z(e={}){let{cwd:t,srcDir:n,outDir:r,silent:i,allowDuplicates:a,schemaValidator:o,envFile:s}=X(e),c=Date.now(),l=await H({root:n,cwd:t,envFile:s===!1?void 0:s}),u=q(e.assetMap,t),d=await ge({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}),f=[];if(e.runPlugins!==!1)try{let{runAllPluginTypegens:e}=await import(`./builtins-
|
|
112
|
+
`)}function xe(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Se(e){try{return t(e).isDirectory()}catch{return!1}}var Ce=e({runTypegen:()=>Z,sweepStaleTypegen:()=>$,watchTypegen:()=>we});function X(e){let t=e.cwd??process.cwd();return{cwd:t,srcDir:o(t,e.srcDir??`src`),outDir:o(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 Z(e={}){let{cwd:t,srcDir:n,outDir:r,silent:i,allowDuplicates:a,schemaValidator:o,envFile:s}=X(e),c=Date.now(),l=await H({root:n,cwd:t,envFile:s===!1?void 0:s}),u=q(e.assetMap,t),d=await ge({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}),f=[];if(e.runPlugins!==!1)try{let{runAllPluginTypegens:e}=await import(`./builtins-WmcOB_BH.mjs`).then(e=>e.r),{loadKickConfig:n}=await import(`./config-Cx9U56C1.mjs`).then(e=>e.n);f=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`)}}e.runPlugins!==!1&&await $(r,d.written,f,i);let p=ve(l.tokens),m=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} (${m}ms)`),p.length>0){console.warn(` kick typegen: ${p.length} token(s) don't match the §22.2 convention:`);for(let e of p){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:p}}async function we(e={}){let t=X(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(`./builtins-WmcOB_BH.mjs`).then(e=>e.r),import(`./config-Cx9U56C1.mjs`).then(e=>e.n)]),l=await c(i),u=[],d=async()=>{try{u=(await Z({...a})).result.written}catch(e){if(r)return;if(e instanceof G)console.error(`
|
|
113
113
|
`+e.message+`
|
|
114
114
|
`);else{let t=e instanceof Error?e.message:String(e);console.error(` kick typegen failed: ${t}`)}}},f=async()=>{try{let e=await s({cwd:i,config:l,silent:!0});await $(t.outDir,u,e,!0)}catch{}};await d(),await f();let{watch:p}=await import(`node:fs`),m=null,h=e=>{e&&/\.(ts|tsx|mts|cts)$/.test(e)&&(e.includes(`.kickjs`)||e.endsWith(`.d.ts`)||(m&&clearTimeout(m),m=setTimeout(()=>{d().then(f)},100)))};if(o){r||console.log(` kick typegen: polling mode (KICKJS_WATCH_POLLING)`);let e=setInterval(()=>{Q({...a,silent:!0},!0)},2e3);return()=>clearInterval(e)}let g;try{g=p(n,{recursive:!0},(e,t)=>{h(t)})}catch(e){r||console.warn(` kick typegen: watch mode unavailable (${e?.message??e}). Falling back to polling.`);let t=setInterval(()=>{Q({...a,silent:!0},!0)},2e3);return()=>clearInterval(t)}return()=>{m&&clearTimeout(m),g.close()}}async function Q(e,t){try{await Z(e)}catch(e){if(t)return;if(e instanceof G)console.error(`
|
|
115
115
|
`+e.message+`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs-cli v5.4.
|
|
2
|
+
* @forinda/kickjs-cli v5.4.5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
function e(e){return e}var t=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`}};export{e as n,t};
|
|
12
|
-
//# sourceMappingURL=types-
|
|
12
|
+
//# sourceMappingURL=types-UT7s54gu.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-UT7s54gu.mjs","names":[],"sources":["../src/plugin/types.ts"],"sourcesContent":["// CLI Plugin shape.\n//\n// The kick CLI is itself a composition of plugins — every built-in\n// command (init, generate, run, typegen, db, …) ships as a KickCliPlugin\n// internally. Adopters extend the same surface from kick.config.ts to\n// add commands, generators, and typegens; the merging + conflict\n// detection runs the same way for built-ins and user plugins.\n//\n// Four contribution kinds:\n//\n// • commands[] — declarative shell-handler commands (same shape as\n// the existing kick.config.ts `commands` field).\n// • register() — programmatic commander registration. Called with\n// `(program, ctx)` so the callback has cwd + config\n// without re-loading.\n// • typegens[] — TypegenPlugin instances that `kick typegen` runs\n// after the legacy pass.\n// • generators[] — `kick g <name>` scaffolders (defineGenerator).\n// Replaces the `package.json > kickjs.generators`\n// discovery; that path stays as a deprecated\n// fallback for one minor version.\n//\n// Mirrors `definePlugin` / `defineAdapter` factory parity so adopters\n// don't have to learn a new helper-naming convention.\n\nimport type { Command } from 'commander'\n\nimport type { TypegenPlugin } from '../typegen/plugin'\nimport type { KickCommandDefinition, KickConfig } from '../config'\nimport type { GeneratorSpec } from '../generator-extension/define'\n\n/**\n * Runtime context handed to `register()` — saves callbacks from\n * re-loading config or guessing cwd. Forward-compatible: future fields\n * land here without changing the callback signature.\n */\nexport interface KickCliPluginContext {\n cwd: string\n /** Resolved kick.config.ts (null if the project has none). */\n config: KickConfig | null\n log: (msg: string) => void\n}\n\nexport interface KickCliPlugin {\n /** Stable identifier — used in error messages on conflict + de-dup. */\n name: string\n commands?: KickCommandDefinition[]\n /** Programmatic command registration. Called once at CLI startup. */\n register?: (program: Command, ctx: KickCliPluginContext) => void | Promise<void>\n typegens?: TypegenPlugin[]\n generators?: GeneratorSpec[]\n}\n\n/** Identity helper — exists for type inference + parity with definePlugin. */\nexport function defineCliPlugin(p: KickCliPlugin): KickCliPlugin {\n return p\n}\n\nexport class KickPluginConflictError extends Error {\n constructor(kind: 'plugin' | 'command' | 'typegen' | 'generator', id: string, owners: string[]) {\n super(\n `Two plugins registered the same ${kind} '${id}': ${owners.join(', ')}. ` +\n `Plugins must use unique ${kind} names.`,\n )\n this.name = 'KickPluginConflictError'\n }\n}\n"],"mappings":";;;;;;;;;;AAsDA,SAAgB,EAAgB,EAAiC,CAC/D,OAAO,EAGT,IAAa,EAAb,cAA6C,KAAM,CACjD,YAAY,EAAsD,EAAY,EAAkB,CAC9F,MACE,mCAAmC,EAAK,IAAI,EAAG,KAAK,EAAO,KAAK,KAAK,CAAC,4BACzC,EAAK,SACnC,CACD,KAAK,KAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-cli",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.5",
|
|
4
4
|
"description": "CLI for KickJS — project scaffolding, DDD module generation, dev/build/start",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kickjs",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"oxfmt": "^0.47.0",
|
|
70
70
|
"picocolors": "^1.1.1",
|
|
71
71
|
"pluralize": "^8.0.0",
|
|
72
|
-
"@forinda/kickjs": "5.
|
|
73
|
-
"@forinda/kickjs-db": "5.
|
|
72
|
+
"@forinda/kickjs": "5.6.0",
|
|
73
|
+
"@forinda/kickjs-db": "5.7.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@swc/core": "^1.15.33",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"vite": "^8.0.9",
|
|
83
83
|
"vitest": "^4.1.5",
|
|
84
84
|
"@forinda/kickjs-ai": "5.2.1",
|
|
85
|
-
"@forinda/kickjs-db-pg": "9.0.
|
|
85
|
+
"@forinda/kickjs-db-pg": "9.0.2"
|
|
86
86
|
},
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|