@h3ravel/console 11.3.2 → 11.3.4

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/bin/fire.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));require(`tsx/esm`);let c=require(`@h3ravel/core`);c=s(c);let l=require(`@h3ravel/shared`);l=s(l);let u=require(`node:fs/promises`);u=s(u);let d=require(`@h3ravel/support`);d=s(d);let f=require(`dayjs`);f=s(f);let p=require(`node:fs`);p=s(p);let m=require(`node:path`);m=s(m);let h=require(`@h3ravel/http`);h=s(h);let g=require(`@h3ravel/router`);g=s(g);let _=require(`@h3ravel/database`);_=s(_);let v=require(`@h3ravel/cache`);v=s(v);let y=require(`@h3ravel/queue`);y=s(y);let b=require(`@h3ravel/mail`);b=s(b);let x=require(`@h3ravel/config`);x=s(x);let S=require(`commander`);S=s(S);let C=require(`path`);C=s(C);let w=require(`child_process`);w=s(w);let T=require(`tsdown`);T=s(T);var E=class extends c.ConsoleCommand{};const D=String.raw`
2
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));require(`tsx/esm`);let c=require(`@h3ravel/core`);c=s(c);let l=require(`@h3ravel/shared`);l=s(l);let u=require(`node:fs/promises`);u=s(u);let d=require(`@h3ravel/support`);d=s(d);let f=require(`dayjs`);f=s(f);let p=require(`node:path`);p=s(p);let m=require(`@h3ravel/http`);m=s(m);let h=require(`@h3ravel/router`);h=s(h);let g=require(`@h3ravel/database`);g=s(g);let _=require(`@h3ravel/cache`);_=s(_);let v=require(`@h3ravel/queue`);v=s(v);let y=require(`@h3ravel/mail`);y=s(y);let b=require(`@h3ravel/config`);b=s(b);let x=require(`commander`);x=s(x);let S=require(`node:fs`);S=s(S);let C=require(`path`);C=s(C);let w=require(`child_process`);w=s(w);let T=require(`tsdown`);T=s(T);var E=class extends c.ConsoleCommand{};const D=String.raw`
3
3
  111
4
4
  111111111
5
5
  1111111111 111111
@@ -66,5 +66,5 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
66
66
  | {--force : Create the model even if it already exists}
67
67
  }
68
68
  {^name : The name of the [name] to generate}
69
- `;description=`Generate component classes`;async handle(){let e=this.dictionary.baseCommand??this.dictionary.name,t={controller:`makeController`,resource:`makeResource`,migration:`makeMigration`,factory:`makeFactory`,seeder:`makeSeeder`,model:`makeModel`,view:`makeView`};try{await this?.[t[e]]()}catch(e){l.Logger.error(e)}}async makeController(){let e=this.option(`api`)?`-resource`:``,t=this.argument(`name`),n=this.option(`force`),r=m.default.join(app_path(`Http/Controllers`),t+`.ts`),i=l.FileSystem.findModulePkg(`@h3ravel/http`,this.kernel.cwd)??``,a=m.default.join(i,`dist/stubs/controller${e}.stub`);!n&&(0,p.existsSync)(r)&&l.Logger.error(`ERORR: ${t} controller already exists`);let o=await(0,u.readFile)(a,`utf-8`);o=o.replace(/{{ name }}/g,t),await(0,u.writeFile)(r,o),l.Logger.split(`INFO: Controller Created`,l.Logger.log(m.default.basename(r),`gray`,!1))}makeResource(){l.Logger.success(`Resource support is not yet available`)}async makeMigration(){let e=this.argument(`name`),t=(0,f.default)().format(`YYYY_MM_DD_HHmmss`),n=m.default.join(database_path(`migrations`),`${t}_${e}.ts`),r=l.FileSystem.findModulePkg(`@h3ravel/database`,this.kernel.cwd)??``,i=this.option(`create`,!1),a=this.option(`table`);if(!a&&typeof i==`string`&&(a=i,i=!0),!a){let t=A.guess(e);a=t[0],i=!!t[1]}let o=m.default.join(r,this.getMigrationStubName(a,i)),s=await(0,u.readFile)(o,`utf-8`);a!==null&&(s=s.replace(/DummyTable|{{\s*table\s*}}/g,a)),l.Logger.info(`INFO: Creating Migration`),await this.kernel.ensureDirectoryExists(m.default.dirname(n)),await(0,u.writeFile)(n,s),l.Logger.split(`INFO: Migration Created`,l.Logger.log(m.default.basename(n),`gray`,!1))}makeFactory(){l.Logger.success(`Factory support is not yet available`)}makeSeeder(){l.Logger.success(`Seeder support is not yet available`)}async makeModel(){let e=this.option(`type`,`ts`),t=this.argument(`name`),n=this.argument(`force`),r=m.default.join(app_path(`Models`),t.toLowerCase(),`.`+e);!n&&(0,p.existsSync)(r)&&l.Logger.error(`ERORR: ${t} view already exists`);let i=l.FileSystem.findModulePkg(`@h3ravel/database`,this.kernel.cwd)??``,a=m.default.join(i,`dist/stubs/model-${e}.stub`),o=await(0,u.readFile)(a,`utf-8`);o=o.replace(/{{ name }}/g,t),await(0,u.writeFile)(r,o),l.Logger.split(`INFO: Model Created`,l.Logger.log(m.default.basename(r),`gray`,!1))}async makeView(){let e=this.argument(`name`),t=this.option(`force`),n=m.default.join(base_path(`src/resources/views`),e+`.edge`);e.includes(`/`)&&await(0,u.mkdir)((0,d.beforeLast)(n,`/`),{recursive:!0}),!t&&(0,p.existsSync)(n)&&l.Logger.error(`ERORR: ${e} view already exists`),await(0,u.writeFile)(n,`{{-- src/resources/views/${e}.edge --}}`),l.Logger.split(`INFO: View Created`,l.Logger.log(`src/resources/views/${e}.edge`,`gray`,!1))}getMigrationStubName(e,t=!1,n=`ts`){let r;return r=e?t?`migration.create-${n}.stub`:`migration.update-${n}.stub`:`migration-${n}.stub`,`dist/stubs/`+r}},M=class extends E{signature=`postinstall`;description=`Default post installation command`;async handle(){this.createSqliteDB()}async createSqliteDB(){config(`database.default`)===`sqlite`&&(await l.FileSystem.fileExists(database_path())||await(0,u.mkdir)(database_path(),{recursive:!0}),await l.FileSystem.fileExists(database_path(`db.sqlite`))||await(0,u.writeFile)(database_path(`db.sqlite`),``))}},N=[h.HttpServiceProvider,x.ConfigServiceProvider,g.RouteServiceProvider,g.AssetsServiceProvider,_.DatabaseServiceProvider,v.CacheServiceProvider,y.QueueServiceProvider,b.MailServiceProvider],P=class e{static parseOptions(t){let n=[],r=/\{([^{}]+(?:\{[^{}]*\}[^{}]*)*)\}/g,i;for(;(i=r.exec(t))!==null;){let t=i[1][0]===`^`||/:[#^]/.test(i[1]),r=([`#`,`^`].includes(i[1][0])||/:[#^]/.test(i[1]))&&!t,a=i[1].trim().replace(/[#^]/,``),o=a.indexOf(`:`);if(o===-1){n.push({name:a});continue}let s=a.substring(0,o).trim(),c=a.substring(o+1).trim(),l=c,u,d=c.indexOf(`|`);if(d!==-1){l=c.substring(0,d).trim();let t=c.substring(d+1).trim().replace(/^\{/,``).trim();u=e.parseOptions(`{`+t+`}`)}else l=l.trim();let f=s,p=/[^a-zA-Z0-9_|-]/.test(f),m=!1;f.endsWith(`?*`)?(p=!1,m=!0,f=f.slice(0,-2)):f.endsWith(`*`)?(m=!0,f=f.slice(0,-1)):f.endsWith(`?`)&&(p=!1,f=f.slice(0,-1));let h=f.startsWith(`--`),g,_;if(h){let e=f.split(`|`).map(e=>e.trim());g=[];for(let t of e){t.startsWith(`--`)&&t.slice(2).length===1?t=`-`+t.slice(2):t.startsWith(`-`)&&!t.startsWith(`--`)&&t.slice(1).length>1?t=`--`+t.slice(1):!t.startsWith(`-`)&&t.slice(1).length>1&&(t=`--`+t);let e=t.indexOf(`=`);if(e!==-1){g.push(t.substring(0,e));let n=t.substring(e+1);_=n===`*`?[]:n===`true`||n===`false`||!n&&!p?n===`true`:isNaN(Number(n))?n:Number(n)}else g.push(t)}}n.push({name:h?g[g.length-1]:f,required:p,multiple:m,description:l,flags:g,shared:t,isFlag:h,isHidden:r,defaultValue:_,nestedOptions:u})}return n}static parseSignature(t,n){let r=t.split(`
70
- `).map(e=>e.trim()).filter(e=>e.length>0),i=[`#`,`^`].includes(r[0][0])||/:[#^]/.test(r[0]),a=r[0].replace(/[^\w=:-]/g,``),o=n.getDescription(),s=a.endsWith(`:`),c=r.slice(1).join(` `),l=e.parseOptions(c);return s?{baseCommand:a.slice(0,-1),isNamespaceCommand:s,subCommands:l.filter(e=>!e.flags&&!e.isHidden),description:o,commandClass:n,options:l.filter(e=>!!e.flags),isHidden:i}:{baseCommand:a,isNamespaceCommand:s,options:l,description:o,commandClass:n,isHidden:i}}};function F(e={}){let t,n,r=e.args||[],i=e.allowRestarts||!1,a=e.input,o=e.options||e;return delete o.args,delete o.allowRestarts,{name:`run`,buildStart(e){let n=a??e.input;if(typeof n==`string`&&(n=[n]),typeof n==`object`&&(n=Object.values(n)),n.length>1)throw Error("@rollup/plugin-run must have a single entry point; consider setting the `input` option");t=(0,C.resolve)(n[0])},generateBundle(e,t,n){n||this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`)},writeBundle(e,a){let s=(e,t)=>{n&&n.kill(),n=(0,w.fork)((0,C.join)(e,t),r,o)},c=e.dir||(0,C.dirname)(e.file),l=Object.keys(a).find(e=>{let n=a[e];return n.isEntry&&n.facadeModuleId===t});l?(s(c,l),i&&(process.stdin.resume(),process.stdin.setEncoding(`utf8`),process.stdin.on(`data`,e=>{let t=e.toString().trim().toLowerCase();t===`rs`||t===`restart`||e.toString().charCodeAt(0)===11?s(c,l):(t===`cls`||t===`clear`||e.toString().charCodeAt(0)===12)&&console.clear()}))):this.error(`@rollup/plugin-run could not find output chunk`)}}}const I=process.env.NODE_ENV||`development`,L=I===`development`?`.h3ravel/serve`:`dist`,R={outDir:L,entry:[`src/**/*.ts`],format:[`esm`],target:`node22`,sourcemap:I===`development`,clean:!0,shims:!0,copy:[{from:`public`,to:L},`src/resources`,`src/database`],env:I===`development`?{NODE_ENV:I,SRC_PATH:L}:{},watch:I===`development`&&process.env.CLI_BUILD!==`true`?[`.env`,`.env.*`,`src`,`../../packages`]:!1,dts:!1,logLevel:`silent`,nodeProtocol:!0,skipNodeModulesBundle:!0,plugins:I===`development`&&process.env.CLI_BUILD!==`true`?[F({env:Object.assign({},process.env,{NODE_ENV:I,SRC_PATH:L}),execArgv:[`-r`,`source-map-support/register`],allowRestarts:!1,input:process.cwd()+`/src/server.ts`})]:[]};var z=R,B=class e{commands=[];constructor(e,t){this.app=e,this.kernel=t}async build(){return this.loadBaseCommands(),await this.loadDiscoveredCommands(),this.initialize()}loadBaseCommands(){[new j(this.app,this.kernel),new k(this.app,this.kernel),new M(this.app,this.kernel)].forEach(e=>this.addCommand(e))}async loadDiscoveredCommands(){let e=[...this.app.registeredCommands.map(e=>new e(this.app,this.kernel))],t=app_path(`Console/Commands/*.js`).replace(`/src/`,`/.h3ravel/serve/`);for await(let n of(0,u.glob)(t)){let t=m.default.basename(n).replace(`.js`,``);try{let r=(await import(n))[t];e.push(new r(this.app,this.kernel))}catch{}}e.forEach(e=>this.addCommand(e))}addCommand(e){this.commands.push(P.parseSignature(e.getSignature(),e))}initialize(){let e=l.Logger.parse([[`Musket CLI:`,`white`],[this.kernel.consolePackage.version,`green`]],` `,!1),t=l.Logger.parse([[`H3ravel Framework:`,`white`],[this.kernel.modulePackage.version,`green`]],` `,!1),n={quiet:[`-q, --quiet`,`Do not output any message`],silent:[`--silent`,`Do not output any message`],verbose:[`-v, --verbose <number>`,`Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug`],lock:[`--lock`,`Locked and loaded, do not ask any interactive question`]};S.program.name(`musket`).version(`${e}\n${t}`).description(O).addOption(new S.Option(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new S.Option(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new S.Option(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new S.Option(n.lock[0],n.lock[1])).action(async()=>{let e=new k(this.app,this.kernel);e.setInput(S.program.opts(),S.program.args,S.program.registeredArguments,{},S.program),e.handle()}),S.program.command(`init`).description(`Initialize H3ravel.`).action(async()=>{l.Logger.success(`Initialized: H3ravel has been initialized!`)});for(let e=0;e<this.commands.length;e++){let t=this.commands[e],r=t.commandClass;if(t.isNamespaceCommand&&t.subCommands){let e=t.isHidden?S.program:S.program.command(t.baseCommand).description(t.description??``).addOption(new S.Option(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new S.Option(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new S.Option(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new S.Option(n.lock[0],n.lock[1])).action(async()=>{r.setInput(e.opts(),e.args,e.registeredArguments,t,S.program),await r.handle()});(t.options?.length??0)>0&&t.options?.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(t=>{this.makeOption(t,e)}),t.subCommands.filter((e,t,n)=>!e.shared&&n.findIndex(t=>t.name===e.name)===t).forEach(e=>{let i=S.program.command(`${t.baseCommand}:${e.name}`).description(e.description||``).addOption(new S.Option(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new S.Option(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new S.Option(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new S.Option(n.lock[0],n.lock[1])).action(async()=>{r.setInput(i.opts(),i.args,i.registeredArguments,e,S.program),await r.handle()});t.subCommands?.filter(e=>e.shared).forEach(t=>{this.makeOption(t,i,!1,e)}),t.options?.filter(e=>e.shared).forEach(t=>{this.makeOption(t,i,!1,e)}),e.nestedOptions&&e.nestedOptions.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(e=>{this.makeOption(e,i)})})}else{let e=S.program.command(t.baseCommand).description(t.description??``);t?.options?.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(t=>{this.makeOption(t,e,!0)}),e.action(async()=>{r.setInput(e.opts(),e.args,e.registeredArguments,t,S.program),await r.handle()})}}return S.program.hook(`preAction`,async(e,t)=>{t.name()!==`fire`&&await(0,T.build)({...z,watch:!1,plugins:[]})}),S.program}makeOption(e,t,n,r){let i=e.description?.replace(/\[(\w+)\]/g,(e,t)=>r?.[t]??`[${t}]`)??``,a=e.name.replaceAll(`-`,``);if(e.isFlag)if(n){let n=e.flags?.map(e=>e.length===1?`-${e}`:`--${e}`).join(`, `).replaceAll(`----`,`--`).replaceAll(`---`,`-`);t.option(n||``,i,String(e.defaultValue)||void 0)}else t.option(e.flags?.join(`, `)+(e.required?` <${a}>`:``),i,e.defaultValue);else t.argument(e.required?`<${e.name}>`:`[${e.name}]`,i,e.defaultValue)}static async parse(t){return(await new e(t.app,t).build()).parseAsync()}},V=class e extends c.ConsoleKernel{constructor(e){super(e),this.app=e}static init(t){let n=new e(t);Promise.all([n.loadRequirements()]).then(([e])=>e.run())}async run(){await B.parse(this),process.exit(0)}async loadRequirements(){this.cwd=m.default.join(process.cwd(),this.basePath),this.modulePath=l.FileSystem.findModulePkg(`@h3ravel/core`,this.cwd)??``,this.consolePath=l.FileSystem.findModulePkg(`@h3ravel/console`,this.cwd)??``;try{this.modulePackage=await import(m.default.join(this.modulePath,`package.json`))}catch{this.modulePackage={version:`N/A`}}try{this.consolePackage=await import(m.default.join(this.consolePath,`package.json`))}catch{this.consolePackage={version:`N/A`}}return this}},H=class extends c.ServiceProvider{static priority=992;static console=!0;register(){}boot(){V.init(this.app),process.on(`SIGINT`,()=>{process.exit(0)}),process.on(`SIGTERM`,()=>{process.exit(0)})}},U=class{async fire(){let e=new c.Application(process.cwd()),t=app_path(`Providers/*.js`).replace(`/src/`,`/.h3ravel/serve/`);for await(let e of(0,u.glob)(t)){let t=m.default.basename(e).replace(`.js`,``);try{N.push((await import(e))[t])}catch{}}N.push(H),e.registerProviders(N),await e.registerConfiguredProviders(),await e.boot()}};new U().fire();
69
+ `;description=`Generate component classes`;async handle(){let e=this.dictionary.baseCommand??this.dictionary.name;this.argument(`name`)||this.program.error(`Please provide a valid name for the `+e);let t={controller:`makeController`,resource:`makeResource`,migration:`makeMigration`,factory:`makeFactory`,seeder:`makeSeeder`,model:`makeModel`,view:`makeView`};try{await this?.[t[e]]()}catch(e){l.Logger.error(e)}}async makeController(){let e=this.option(`api`)?`-resource`:``,t=this.argument(`name`),n=this.option(`force`),r=app_path(`Http/Controllers/${t}.ts`),i=l.FileSystem.findModulePkg(`@h3ravel/http`,this.kernel.cwd)??``,a=p.default.join(i,`dist/stubs/controller${e}.stub`);!n&&await l.FileSystem.fileExists(r)&&l.Logger.error(`ERORR: ${t} controller already exists`);let o=await(0,u.readFile)(a,`utf-8`);o=o.replace(/{{ name }}/g,t),await(0,u.writeFile)(r,o),l.Logger.split(`INFO: Controller Created`,l.Logger.log(p.default.basename(r),`gray`,!1))}makeResource(){l.Logger.success(`Resource support is not yet available`)}async makeMigration(){let e=this.argument(`name`),t=(0,f.default)().format(`YYYY_MM_DD_HHmmss`),n=database_path(`migrations/${t}_${e}.ts`),r=l.FileSystem.findModulePkg(`@h3ravel/database`,this.kernel.cwd)??``,i=this.option(`create`,!1),a=this.option(`table`);if(!a&&typeof i==`string`&&(a=i,i=!0),!a){let t=A.guess(e);a=t[0],i=!!t[1]}let o=p.default.join(r,this.getMigrationStubName(a,i)),s=await(0,u.readFile)(o,`utf-8`);a!==null&&(s=s.replace(/DummyTable|{{\s*table\s*}}/g,a)),l.Logger.info(`INFO: Creating Migration`),await this.kernel.ensureDirectoryExists(p.default.dirname(n)),await(0,u.writeFile)(n,s),l.Logger.split(`INFO: Migration Created`,l.Logger.log(p.default.basename(n),`gray`,!1))}makeFactory(){l.Logger.success(`Factory support is not yet available`)}makeSeeder(){l.Logger.success(`Seeder support is not yet available`)}async makeModel(){let e=this.option(`type`,`ts`),t=this.argument(`name`),n=this.argument(`force`),r=app_path(`Models/${t.toLowerCase()}.${e}`);!n&&await l.FileSystem.fileExists(r)&&l.Logger.error(`ERORR: ${t} model already exists`);let i=l.FileSystem.findModulePkg(`@h3ravel/database`,this.kernel.cwd)??``,a=p.default.join(i,`dist/stubs/model-${e}.stub`),o=await(0,u.readFile)(a,`utf-8`);o=o.replace(/{{ name }}/g,t),await(0,u.writeFile)(r,o),l.Logger.split(`INFO: Model Created`,l.Logger.log(p.default.basename(r),`gray`,!1))}async makeView(){let e=this.argument(`name`),t=this.option(`force`),n=base_path(`src/resources/views/${e}.edge`);e.includes(`/`)&&await(0,u.mkdir)((0,d.beforeLast)(n,`/`),{recursive:!0}),!t&&await l.FileSystem.fileExists(n)&&l.Logger.error(`ERORR: ${e} view already exists`),await(0,u.writeFile)(n,`{{-- src/resources/views/${e}.edge --}}`),l.Logger.split(`INFO: View Created`,l.Logger.log(`src/resources/views/${e}.edge`,`gray`,!1))}getMigrationStubName(e,t=!1,n=`ts`){let r;return r=e?t?`migration.create-${n}.stub`:`migration.update-${n}.stub`:`migration-${n}.stub`,`dist/stubs/`+r}},M=class extends E{signature=`postinstall`;description=`Default post installation command`;async handle(){this.createSqliteDB()}async createSqliteDB(){config(`database.default`)===`sqlite`&&(await l.FileSystem.fileExists(database_path())||await(0,u.mkdir)(database_path(),{recursive:!0}),await l.FileSystem.fileExists(database_path(`db.sqlite`))||await(0,u.writeFile)(database_path(`db.sqlite`),``))}},N=[m.HttpServiceProvider,b.ConfigServiceProvider,h.RouteServiceProvider,h.AssetsServiceProvider,g.DatabaseServiceProvider,_.CacheServiceProvider,v.QueueServiceProvider,y.MailServiceProvider],P=class e{static parseOptions(t){let n=[],r=/\{([^{}]+(?:\{[^{}]*\}[^{}]*)*)\}/g,i;for(;(i=r.exec(t))!==null;){let t=i[1][0]===`^`||/:[#^]/.test(i[1]),r=([`#`,`^`].includes(i[1][0])||/:[#^]/.test(i[1]))&&!t,a=i[1].trim().replace(/[#^]/,``),o=a.indexOf(`:`);if(o===-1){n.push({name:a});continue}let s=a.substring(0,o).trim(),c=a.substring(o+1).trim(),l=c,u,d=c.indexOf(`|`);if(d!==-1){l=c.substring(0,d).trim();let t=c.substring(d+1).trim().replace(/^\{/,``).trim();u=e.parseOptions(`{`+t+`}`)}else l=l.trim();let f=s,p=/[^a-zA-Z0-9_|-]/.test(f),m=!1;f.endsWith(`?*`)?(p=!1,m=!0,f=f.slice(0,-2)):f.endsWith(`*`)?(m=!0,f=f.slice(0,-1)):f.endsWith(`?`)&&(p=!1,f=f.slice(0,-1));let h=f.startsWith(`--`),g,_;if(h){let e=f.split(`|`).map(e=>e.trim());g=[];for(let t of e){t.startsWith(`--`)&&t.slice(2).length===1?t=`-`+t.slice(2):t.startsWith(`-`)&&!t.startsWith(`--`)&&t.slice(1).length>1?t=`--`+t.slice(1):!t.startsWith(`-`)&&t.slice(1).length>1&&(t=`--`+t);let e=t.indexOf(`=`);if(e!==-1){g.push(t.substring(0,e));let n=t.substring(e+1);_=n===`*`?[]:n===`true`||n===`false`||!n&&!p?n===`true`:isNaN(Number(n))?n:Number(n)}else g.push(t)}}n.push({name:h?g[g.length-1]:f,required:p,multiple:m,description:l,flags:g,shared:t,isFlag:h,isHidden:r,defaultValue:_,nestedOptions:u})}return n}static parseSignature(t,n){let r=t.split(`
70
+ `).map(e=>e.trim()).filter(e=>e.length>0),i=[`#`,`^`].includes(r[0][0])||/:[#^]/.test(r[0]),a=r[0].replace(/[^\w=:-]/g,``),o=n.getDescription(),s=a.endsWith(`:`),c=r.slice(1).join(` `),l=e.parseOptions(c);return s?{baseCommand:a.slice(0,-1),isNamespaceCommand:s,subCommands:l.filter(e=>!e.flags&&!e.isHidden),description:o,commandClass:n,options:l.filter(e=>!!e.flags),isHidden:i}:{baseCommand:a,isNamespaceCommand:s,options:l,description:o,commandClass:n,isHidden:i}}};function F(e={}){let t,n,r=e.args||[],i=e.allowRestarts||!1,a=e.input,o=e.options||e;return delete o.args,delete o.allowRestarts,{name:`run`,buildStart(e){let n=a??e.input;if(typeof n==`string`&&(n=[n]),typeof n==`object`&&(n=Object.values(n)),n.length>1)throw Error("@rollup/plugin-run must have a single entry point; consider setting the `input` option");t=(0,C.resolve)(n[0])},generateBundle(e,t,n){n||this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`)},writeBundle(e,a){let s=(e,t)=>{n&&n.kill(),n=(0,w.fork)((0,C.join)(e,t),r,o)},c=e.dir||(0,C.dirname)(e.file),l=Object.keys(a).find(e=>{let n=a[e];return n.isEntry&&n.facadeModuleId===t});l?(s(c,l),i&&(process.stdin.resume(),process.stdin.setEncoding(`utf8`),process.stdin.on(`data`,e=>{let t=e.toString().trim().toLowerCase();t===`rs`||t===`restart`||e.toString().charCodeAt(0)===11?s(c,l):(t===`cls`||t===`clear`||e.toString().charCodeAt(0)===12)&&console.clear()}))):this.error(`@rollup/plugin-run could not find output chunk`)}}}const I=process.env.NODE_ENV||`development`,L=I===`development`?`.h3ravel/serve`:`dist`,R={outDir:L,entry:[`src/**/*.ts`],format:[`esm`],target:`node22`,sourcemap:I===`development`,clean:!0,shims:!0,copy:[{from:`public`,to:L},`src/resources`,`src/database`],env:I===`development`?{NODE_ENV:I,SRC_PATH:L}:{},watch:I===`development`&&process.env.CLI_BUILD!==`true`?[`.env`,`.env.*`,`src`,`../../packages`]:!1,dts:!1,logLevel:`silent`,nodeProtocol:!0,skipNodeModulesBundle:!0,hooks(e){e.hook(`build:done`,async()=>{let e=[`database/migrations`,`database/factories`,`database/seeders`];for(let t=0;t<e.length;t++){let n=e[t];(0,S.existsSync)(p.default.join(L,n))&&await(0,u.rm)(p.default.join(L,n),{recursive:!0})}})},plugins:I===`development`&&process.env.CLI_BUILD!==`true`?[F({env:Object.assign({},process.env,{NODE_ENV:I,SRC_PATH:L}),execArgv:[`-r`,`source-map-support/register`],allowRestarts:!1,input:process.cwd()+`/src/server.ts`})]:[]};var z=R,B=class e{commands=[];constructor(e,t){this.app=e,this.kernel=t}async build(){return this.loadBaseCommands(),await this.loadDiscoveredCommands(),this.initialize()}loadBaseCommands(){[new j(this.app,this.kernel),new k(this.app,this.kernel),new M(this.app,this.kernel)].forEach(e=>this.addCommand(e))}async loadDiscoveredCommands(){let e=[...this.app.registeredCommands.map(e=>new e(this.app,this.kernel))],t=app_path(`Console/Commands/*.js`).replace(`/src/`,`/.h3ravel/serve/`);for await(let n of(0,u.glob)(t)){let t=p.default.basename(n).replace(`.js`,``);try{let r=(await import(n))[t];e.push(new r(this.app,this.kernel))}catch{}}e.forEach(e=>this.addCommand(e))}addCommand(e){this.commands.push(P.parseSignature(e.getSignature(),e))}initialize(){let e=l.Logger.parse([[`Musket CLI:`,`white`],[this.kernel.consolePackage.version,`green`]],` `,!1),t=l.Logger.parse([[`H3ravel Framework:`,`white`],[this.kernel.modulePackage.version,`green`]],` `,!1),n={quiet:[`-q, --quiet`,`Do not output any message`],silent:[`--silent`,`Do not output any message`],verbose:[`-v, --verbose <number>`,`Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug`],lock:[`--lock`,`Locked and loaded, do not ask any interactive question`]};x.program.name(`musket`).version(`${e}\n${t}`).description(O).addOption(new x.Option(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new x.Option(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new x.Option(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new x.Option(n.lock[0],n.lock[1])).action(async()=>{let e=new k(this.app,this.kernel);e.setInput(x.program.opts(),x.program.args,x.program.registeredArguments,{},x.program),e.handle()}),x.program.command(`init`).description(`Initialize H3ravel.`).action(async()=>{l.Logger.success(`Initialized: H3ravel has been initialized!`)});for(let e=0;e<this.commands.length;e++){let t=this.commands[e],r=t.commandClass;if(t.isNamespaceCommand&&t.subCommands){let e=t.isHidden?x.program:x.program.command(t.baseCommand).description(t.description??``).addOption(new x.Option(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new x.Option(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new x.Option(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new x.Option(n.lock[0],n.lock[1])).action(async()=>{r.setInput(e.opts(),e.args,e.registeredArguments,t,x.program),await r.handle()});(t.options?.length??0)>0&&t.options?.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(t=>{this.makeOption(t,e)}),t.subCommands.filter((e,t,n)=>!e.shared&&n.findIndex(t=>t.name===e.name)===t).forEach(e=>{let i=x.program.command(`${t.baseCommand}:${e.name}`).description(e.description||``).addOption(new x.Option(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new x.Option(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new x.Option(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new x.Option(n.lock[0],n.lock[1])).action(async()=>{r.setInput(i.opts(),i.args,i.registeredArguments,e,x.program),await r.handle()});t.subCommands?.filter(e=>e.shared).forEach(t=>{this.makeOption(t,i,!1,e)}),t.options?.filter(e=>e.shared).forEach(t=>{this.makeOption(t,i,!1,e)}),e.nestedOptions&&e.nestedOptions.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(e=>{this.makeOption(e,i)})})}else{let e=x.program.command(t.baseCommand).description(t.description??``);t?.options?.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(t=>{this.makeOption(t,e,!0)}),e.action(async()=>{r.setInput(e.opts(),e.args,e.registeredArguments,t,x.program),await r.handle()})}}return x.program.hook(`preAction`,async(e,t)=>{t.name()!==`fire`&&await(0,T.build)({...z,watch:!1,plugins:[]})}),x.program}makeOption(e,t,n,r){let i=e.description?.replace(/\[(\w+)\]/g,(e,t)=>r?.[t]??`[${t}]`)??``,a=e.name.replaceAll(`-`,``);if(e.isFlag)if(n){let n=e.flags?.map(e=>e.length===1?`-${e}`:`--${e}`).join(`, `).replaceAll(`----`,`--`).replaceAll(`---`,`-`);t.option(n||``,i,String(e.defaultValue)||void 0)}else t.option(e.flags?.join(`, `)+(e.required?` <${a}>`:``),i,e.defaultValue);else t.argument(e.required?`<${e.name}>`:`[${e.name}]`,i,e.defaultValue)}static async parse(t){return(await new e(t.app,t).build()).parseAsync()}},V=class e extends c.ConsoleKernel{constructor(e){super(e),this.app=e}static init(t){let n=new e(t);Promise.all([n.loadRequirements()]).then(([e])=>e.run())}async run(){await B.parse(this),process.exit(0)}async loadRequirements(){this.cwd=p.default.join(process.cwd(),this.basePath),this.modulePath=l.FileSystem.findModulePkg(`@h3ravel/core`,this.cwd)??``,this.consolePath=l.FileSystem.findModulePkg(`@h3ravel/console`,this.cwd)??``;try{this.modulePackage=await import(p.default.join(this.modulePath,`package.json`))}catch{this.modulePackage={version:`N/A`}}try{this.consolePackage=await import(p.default.join(this.consolePath,`package.json`))}catch{this.consolePackage={version:`N/A`}}return this}},H=class extends c.ServiceProvider{static priority=992;static console=!0;register(){}boot(){V.init(this.app),process.on(`SIGINT`,()=>{process.exit(0)}),process.on(`SIGTERM`,()=>{process.exit(0)})}},U=class{async fire(){let e=new c.Application(process.cwd()),t=app_path(`Providers/*.js`).replace(`/src/`,`/.h3ravel/serve/`);for await(let e of(0,u.glob)(t)){let t=p.default.basename(e).replace(`.js`,``);try{N.push((await import(e))[t])}catch{}}N.push(H),e.registerProviders(N),await e.registerConfiguredProviders(),await e.boot()}};new U().fire();
package/bin/fire.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import"tsx/esm";import{Application as e,ConsoleCommand as t,ConsoleKernel as n,ServiceProvider as r}from"@h3ravel/core";import{FileSystem as i,Logger as a}from"@h3ravel/shared";import{glob as o,mkdir as s,readFile as c,writeFile as l}from"node:fs/promises";import{beforeLast as u}from"@h3ravel/support";import d from"dayjs";import{existsSync as f}from"node:fs";import p from"node:path";import{HttpServiceProvider as m}from"@h3ravel/http";import{AssetsServiceProvider as h,RouteServiceProvider as g}from"@h3ravel/router";import{DatabaseServiceProvider as _}from"@h3ravel/database";import{CacheServiceProvider as v}from"@h3ravel/cache";import{QueueServiceProvider as y}from"@h3ravel/queue";import{MailServiceProvider as b}from"@h3ravel/mail";import{ConfigServiceProvider as x}from"@h3ravel/config";import{Option as S,program as C}from"commander";import{dirname as w,join as T,resolve as E}from"path";import{fork as D}from"child_process";import{build as O}from"tsdown";var k=class extends t{};String.raw`
2
+ import"tsx/esm";import{Application as e,ConsoleCommand as t,ConsoleKernel as n,ServiceProvider as r}from"@h3ravel/core";import{FileSystem as i,Logger as a}from"@h3ravel/shared";import{glob as o,mkdir as s,readFile as c,rm as l,writeFile as u}from"node:fs/promises";import{beforeLast as d}from"@h3ravel/support";import f from"dayjs";import p from"node:path";import{HttpServiceProvider as m}from"@h3ravel/http";import{AssetsServiceProvider as h,RouteServiceProvider as g}from"@h3ravel/router";import{DatabaseServiceProvider as _}from"@h3ravel/database";import{CacheServiceProvider as v}from"@h3ravel/cache";import{QueueServiceProvider as y}from"@h3ravel/queue";import{MailServiceProvider as b}from"@h3ravel/mail";import{ConfigServiceProvider as x}from"@h3ravel/config";import{Option as S,program as C}from"commander";import{existsSync as w}from"node:fs";import{dirname as T,join as E,resolve as D}from"path";import{fork as O}from"child_process";import{build as k}from"tsdown";var A=class extends t{};String.raw`
3
3
  111
4
4
  111111111
5
5
  1111111111 111111
@@ -21,19 +21,19 @@ import"tsx/esm";import{Application as e,ConsoleCommand as t,ConsoleKernel as n,S
21
21
  111111 111 111111
22
22
  111111111
23
23
  110
24
- `;const A=String.raw`
24
+ `;const j=String.raw`
25
25
  _ _ _____ _
26
26
  | | | |___ / _ __ __ ___ _____| |
27
27
  | |_| | |_ \| '__/ _ \ \ / / _ \ |
28
28
  | _ |___) | | | (_| |\ V / __/ |
29
29
  |_| |_|____/|_| \__,_| \_/ \___|_|
30
30
 
31
- `;var j=class extends k{signature=`list`;description=`List all available commands`;async handle(){let e=[{short:`-h`,long:`--help`,description:`Display help for the given command. When no command is given display help for the list command`}].concat(this.program.options).map(e=>a.describe(a.log(` `+[e.short,e.long].filter(e=>!!e).join(`, `),`green`,!1),e.description,25,!1).join(``)),t=this.program.commands.map(e=>a.describe(a.log(` `+e.name(),`green`,!1),e.description(),25,!1).join(``)).reduce((e,t)=>{let n=t.replace(/\x1b\[\d+m/g,``),r=n.includes(`:`)?n.split(`:`)[0].trim():`__root__`;return e[r]??=[],e[r].push(t),e},{}),n=Object.entries(t).map(([e,t])=>{let n=e===`__root__`?``:e;return[a.log(n,`yellow`,!1),t.join(`
31
+ `;var M=class extends A{signature=`list`;description=`List all available commands`;async handle(){let e=[{short:`-h`,long:`--help`,description:`Display help for the given command. When no command is given display help for the list command`}].concat(this.program.options).map(e=>a.describe(a.log(` `+[e.short,e.long].filter(e=>!!e).join(`, `),`green`,!1),e.description,25,!1).join(``)),t=this.program.commands.map(e=>a.describe(a.log(` `+e.name(),`green`,!1),e.description(),25,!1).join(``)).reduce((e,t)=>{let n=t.replace(/\x1b\[\d+m/g,``),r=n.includes(`:`)?n.split(`:`)[0].trim():`__root__`;return e[r]??=[],e[r].push(t),e},{}),n=Object.entries(t).map(([e,t])=>{let n=e===`__root__`?``:e;return[a.log(n,`yellow`,!1),t.join(`
32
32
  `)].join(`
33
- `)});a.log([[`H3ravel Framework`,`white`],[this.kernel.modulePackage.version,`green`]],` `),console.log(``),console.log(A),console.log(``),a.log(`Usage:`,`yellow`),a.log(` command [options] [arguments]`,`white`),console.log(``),a.log(`Options:`,`yellow`),console.log(e.join(`
33
+ `)});a.log([[`H3ravel Framework`,`white`],[this.kernel.modulePackage.version,`green`]],` `),console.log(``),console.log(j),console.log(``),a.log(`Usage:`,`yellow`),a.log(` command [options] [arguments]`,`white`),console.log(``),a.log(`Options:`,`yellow`),console.log(e.join(`
34
34
  `).trim()),console.log(``),a.log(`Available Commands:`,`yellow`),console.log(n.join(`
35
35
 
36
- `).trim())}},M=class e{static CREATE_PATTERNS=[/^create_(\w+)_table$/,/^create_(\w+)$/];static CHANGE_PATTERNS=[/.+_(to|from|in)_(\w+)_table$/,/.+_(to|from|in)_(\w+)$/];static guess(t){for(let n of e.CREATE_PATTERNS){let e=t.match(n);if(e)return[e[1],!0]}for(let n of e.CHANGE_PATTERNS){let e=t.match(n);if(e)return[e[2],!1]}return[]}},N=class extends k{signature=`#make:
36
+ `).trim())}},N=class e{static CREATE_PATTERNS=[/^create_(\w+)_table$/,/^create_(\w+)$/];static CHANGE_PATTERNS=[/.+_(to|from|in)_(\w+)_table$/,/.+_(to|from|in)_(\w+)$/];static guess(t){for(let n of e.CREATE_PATTERNS){let e=t.match(n);if(e)return[e[1],!0]}for(let n of e.CHANGE_PATTERNS){let e=t.match(n);if(e)return[e[2],!1]}return[]}},P=class extends A{signature=`#make:
37
37
  {controller : Create a new controller class.
38
38
  | {--a|api : Exclude the create and edit methods from the controller}
39
39
  | {--m|model= : Generate a resource controller for the given model}
@@ -66,5 +66,5 @@ import"tsx/esm";import{Application as e,ConsoleCommand as t,ConsoleKernel as n,S
66
66
  | {--force : Create the model even if it already exists}
67
67
  }
68
68
  {^name : The name of the [name] to generate}
69
- `;description=`Generate component classes`;async handle(){let e=this.dictionary.baseCommand??this.dictionary.name,t={controller:`makeController`,resource:`makeResource`,migration:`makeMigration`,factory:`makeFactory`,seeder:`makeSeeder`,model:`makeModel`,view:`makeView`};try{await this?.[t[e]]()}catch(e){a.error(e)}}async makeController(){let e=this.option(`api`)?`-resource`:``,t=this.argument(`name`),n=this.option(`force`),r=p.join(app_path(`Http/Controllers`),t+`.ts`),o=i.findModulePkg(`@h3ravel/http`,this.kernel.cwd)??``,s=p.join(o,`dist/stubs/controller${e}.stub`);!n&&f(r)&&a.error(`ERORR: ${t} controller already exists`);let u=await c(s,`utf-8`);u=u.replace(/{{ name }}/g,t),await l(r,u),a.split(`INFO: Controller Created`,a.log(p.basename(r),`gray`,!1))}makeResource(){a.success(`Resource support is not yet available`)}async makeMigration(){let e=this.argument(`name`),t=d().format(`YYYY_MM_DD_HHmmss`),n=p.join(database_path(`migrations`),`${t}_${e}.ts`),r=i.findModulePkg(`@h3ravel/database`,this.kernel.cwd)??``,o=this.option(`create`,!1),s=this.option(`table`);if(!s&&typeof o==`string`&&(s=o,o=!0),!s){let t=M.guess(e);s=t[0],o=!!t[1]}let u=p.join(r,this.getMigrationStubName(s,o)),f=await c(u,`utf-8`);s!==null&&(f=f.replace(/DummyTable|{{\s*table\s*}}/g,s)),a.info(`INFO: Creating Migration`),await this.kernel.ensureDirectoryExists(p.dirname(n)),await l(n,f),a.split(`INFO: Migration Created`,a.log(p.basename(n),`gray`,!1))}makeFactory(){a.success(`Factory support is not yet available`)}makeSeeder(){a.success(`Seeder support is not yet available`)}async makeModel(){let e=this.option(`type`,`ts`),t=this.argument(`name`),n=this.argument(`force`),r=p.join(app_path(`Models`),t.toLowerCase(),`.`+e);!n&&f(r)&&a.error(`ERORR: ${t} view already exists`);let o=i.findModulePkg(`@h3ravel/database`,this.kernel.cwd)??``,s=p.join(o,`dist/stubs/model-${e}.stub`),u=await c(s,`utf-8`);u=u.replace(/{{ name }}/g,t),await l(r,u),a.split(`INFO: Model Created`,a.log(p.basename(r),`gray`,!1))}async makeView(){let e=this.argument(`name`),t=this.option(`force`),n=p.join(base_path(`src/resources/views`),e+`.edge`);e.includes(`/`)&&await s(u(n,`/`),{recursive:!0}),!t&&f(n)&&a.error(`ERORR: ${e} view already exists`),await l(n,`{{-- src/resources/views/${e}.edge --}}`),a.split(`INFO: View Created`,a.log(`src/resources/views/${e}.edge`,`gray`,!1))}getMigrationStubName(e,t=!1,n=`ts`){let r;return r=e?t?`migration.create-${n}.stub`:`migration.update-${n}.stub`:`migration-${n}.stub`,`dist/stubs/`+r}},P=class extends k{signature=`postinstall`;description=`Default post installation command`;async handle(){this.createSqliteDB()}async createSqliteDB(){config(`database.default`)===`sqlite`&&(await i.fileExists(database_path())||await s(database_path(),{recursive:!0}),await i.fileExists(database_path(`db.sqlite`))||await l(database_path(`db.sqlite`),``))}},F=[m,x,g,h,_,v,y,b],I=class e{static parseOptions(t){let n=[],r=/\{([^{}]+(?:\{[^{}]*\}[^{}]*)*)\}/g,i;for(;(i=r.exec(t))!==null;){let t=i[1][0]===`^`||/:[#^]/.test(i[1]),r=([`#`,`^`].includes(i[1][0])||/:[#^]/.test(i[1]))&&!t,a=i[1].trim().replace(/[#^]/,``),o=a.indexOf(`:`);if(o===-1){n.push({name:a});continue}let s=a.substring(0,o).trim(),c=a.substring(o+1).trim(),l=c,u,d=c.indexOf(`|`);if(d!==-1){l=c.substring(0,d).trim();let t=c.substring(d+1).trim().replace(/^\{/,``).trim();u=e.parseOptions(`{`+t+`}`)}else l=l.trim();let f=s,p=/[^a-zA-Z0-9_|-]/.test(f),m=!1;f.endsWith(`?*`)?(p=!1,m=!0,f=f.slice(0,-2)):f.endsWith(`*`)?(m=!0,f=f.slice(0,-1)):f.endsWith(`?`)&&(p=!1,f=f.slice(0,-1));let h=f.startsWith(`--`),g,_;if(h){let e=f.split(`|`).map(e=>e.trim());g=[];for(let t of e){t.startsWith(`--`)&&t.slice(2).length===1?t=`-`+t.slice(2):t.startsWith(`-`)&&!t.startsWith(`--`)&&t.slice(1).length>1?t=`--`+t.slice(1):!t.startsWith(`-`)&&t.slice(1).length>1&&(t=`--`+t);let e=t.indexOf(`=`);if(e!==-1){g.push(t.substring(0,e));let n=t.substring(e+1);_=n===`*`?[]:n===`true`||n===`false`||!n&&!p?n===`true`:isNaN(Number(n))?n:Number(n)}else g.push(t)}}n.push({name:h?g[g.length-1]:f,required:p,multiple:m,description:l,flags:g,shared:t,isFlag:h,isHidden:r,defaultValue:_,nestedOptions:u})}return n}static parseSignature(t,n){let r=t.split(`
70
- `).map(e=>e.trim()).filter(e=>e.length>0),i=[`#`,`^`].includes(r[0][0])||/:[#^]/.test(r[0]),a=r[0].replace(/[^\w=:-]/g,``),o=n.getDescription(),s=a.endsWith(`:`),c=r.slice(1).join(` `),l=e.parseOptions(c);return s?{baseCommand:a.slice(0,-1),isNamespaceCommand:s,subCommands:l.filter(e=>!e.flags&&!e.isHidden),description:o,commandClass:n,options:l.filter(e=>!!e.flags),isHidden:i}:{baseCommand:a,isNamespaceCommand:s,options:l,description:o,commandClass:n,isHidden:i}}};function L(e={}){let t,n,r=e.args||[],i=e.allowRestarts||!1,a=e.input,o=e.options||e;return delete o.args,delete o.allowRestarts,{name:`run`,buildStart(e){let n=a??e.input;if(typeof n==`string`&&(n=[n]),typeof n==`object`&&(n=Object.values(n)),n.length>1)throw Error("@rollup/plugin-run must have a single entry point; consider setting the `input` option");t=E(n[0])},generateBundle(e,t,n){n||this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`)},writeBundle(e,a){let s=(e,t)=>{n&&n.kill(),n=D(T(e,t),r,o)},c=e.dir||w(e.file),l=Object.keys(a).find(e=>{let n=a[e];return n.isEntry&&n.facadeModuleId===t});l?(s(c,l),i&&(process.stdin.resume(),process.stdin.setEncoding(`utf8`),process.stdin.on(`data`,e=>{let t=e.toString().trim().toLowerCase();t===`rs`||t===`restart`||e.toString().charCodeAt(0)===11?s(c,l):(t===`cls`||t===`clear`||e.toString().charCodeAt(0)===12)&&console.clear()}))):this.error(`@rollup/plugin-run could not find output chunk`)}}}const R=process.env.NODE_ENV||`development`,z=R===`development`?`.h3ravel/serve`:`dist`;var B={outDir:z,entry:[`src/**/*.ts`],format:[`esm`],target:`node22`,sourcemap:R===`development`,clean:!0,shims:!0,copy:[{from:`public`,to:z},`src/resources`,`src/database`],env:R===`development`?{NODE_ENV:R,SRC_PATH:z}:{},watch:R===`development`&&process.env.CLI_BUILD!==`true`?[`.env`,`.env.*`,`src`,`../../packages`]:!1,dts:!1,logLevel:`silent`,nodeProtocol:!0,skipNodeModulesBundle:!0,plugins:R===`development`&&process.env.CLI_BUILD!==`true`?[L({env:Object.assign({},process.env,{NODE_ENV:R,SRC_PATH:z}),execArgv:[`-r`,`source-map-support/register`],allowRestarts:!1,input:process.cwd()+`/src/server.ts`})]:[]},V=class e{commands=[];constructor(e,t){this.app=e,this.kernel=t}async build(){return this.loadBaseCommands(),await this.loadDiscoveredCommands(),this.initialize()}loadBaseCommands(){[new N(this.app,this.kernel),new j(this.app,this.kernel),new P(this.app,this.kernel)].forEach(e=>this.addCommand(e))}async loadDiscoveredCommands(){let e=[...this.app.registeredCommands.map(e=>new e(this.app,this.kernel))],t=app_path(`Console/Commands/*.js`).replace(`/src/`,`/.h3ravel/serve/`);for await(let n of o(t)){let t=p.basename(n).replace(`.js`,``);try{let r=(await import(n))[t];e.push(new r(this.app,this.kernel))}catch{}}e.forEach(e=>this.addCommand(e))}addCommand(e){this.commands.push(I.parseSignature(e.getSignature(),e))}initialize(){let e=a.parse([[`Musket CLI:`,`white`],[this.kernel.consolePackage.version,`green`]],` `,!1),t=a.parse([[`H3ravel Framework:`,`white`],[this.kernel.modulePackage.version,`green`]],` `,!1),n={quiet:[`-q, --quiet`,`Do not output any message`],silent:[`--silent`,`Do not output any message`],verbose:[`-v, --verbose <number>`,`Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug`],lock:[`--lock`,`Locked and loaded, do not ask any interactive question`]};C.name(`musket`).version(`${e}\n${t}`).description(A).addOption(new S(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new S(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new S(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new S(n.lock[0],n.lock[1])).action(async()=>{let e=new j(this.app,this.kernel);e.setInput(C.opts(),C.args,C.registeredArguments,{},C),e.handle()}),C.command(`init`).description(`Initialize H3ravel.`).action(async()=>{a.success(`Initialized: H3ravel has been initialized!`)});for(let e=0;e<this.commands.length;e++){let t=this.commands[e],r=t.commandClass;if(t.isNamespaceCommand&&t.subCommands){let e=t.isHidden?C:C.command(t.baseCommand).description(t.description??``).addOption(new S(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new S(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new S(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new S(n.lock[0],n.lock[1])).action(async()=>{r.setInput(e.opts(),e.args,e.registeredArguments,t,C),await r.handle()});(t.options?.length??0)>0&&t.options?.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(t=>{this.makeOption(t,e)}),t.subCommands.filter((e,t,n)=>!e.shared&&n.findIndex(t=>t.name===e.name)===t).forEach(e=>{let i=C.command(`${t.baseCommand}:${e.name}`).description(e.description||``).addOption(new S(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new S(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new S(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new S(n.lock[0],n.lock[1])).action(async()=>{r.setInput(i.opts(),i.args,i.registeredArguments,e,C),await r.handle()});t.subCommands?.filter(e=>e.shared).forEach(t=>{this.makeOption(t,i,!1,e)}),t.options?.filter(e=>e.shared).forEach(t=>{this.makeOption(t,i,!1,e)}),e.nestedOptions&&e.nestedOptions.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(e=>{this.makeOption(e,i)})})}else{let e=C.command(t.baseCommand).description(t.description??``);t?.options?.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(t=>{this.makeOption(t,e,!0)}),e.action(async()=>{r.setInput(e.opts(),e.args,e.registeredArguments,t,C),await r.handle()})}}return C.hook(`preAction`,async(e,t)=>{t.name()!==`fire`&&await O({...B,watch:!1,plugins:[]})}),C}makeOption(e,t,n,r){let i=e.description?.replace(/\[(\w+)\]/g,(e,t)=>r?.[t]??`[${t}]`)??``,a=e.name.replaceAll(`-`,``);if(e.isFlag)if(n){let n=e.flags?.map(e=>e.length===1?`-${e}`:`--${e}`).join(`, `).replaceAll(`----`,`--`).replaceAll(`---`,`-`);t.option(n||``,i,String(e.defaultValue)||void 0)}else t.option(e.flags?.join(`, `)+(e.required?` <${a}>`:``),i,e.defaultValue);else t.argument(e.required?`<${e.name}>`:`[${e.name}]`,i,e.defaultValue)}static async parse(t){return(await new e(t.app,t).build()).parseAsync()}},H=class e extends n{constructor(e){super(e),this.app=e}static init(t){let n=new e(t);Promise.all([n.loadRequirements()]).then(([e])=>e.run())}async run(){await V.parse(this),process.exit(0)}async loadRequirements(){this.cwd=p.join(process.cwd(),this.basePath),this.modulePath=i.findModulePkg(`@h3ravel/core`,this.cwd)??``,this.consolePath=i.findModulePkg(`@h3ravel/console`,this.cwd)??``;try{this.modulePackage=await import(p.join(this.modulePath,`package.json`))}catch{this.modulePackage={version:`N/A`}}try{this.consolePackage=await import(p.join(this.consolePath,`package.json`))}catch{this.consolePackage={version:`N/A`}}return this}},U=class extends r{static priority=992;static console=!0;register(){}boot(){H.init(this.app),process.on(`SIGINT`,()=>{process.exit(0)}),process.on(`SIGTERM`,()=>{process.exit(0)})}};new class{async fire(){let t=new e(process.cwd()),n=(app_path(`Providers/*.js`).replace(`/src/`,`/.h3ravel/serve/`));for await(let e of o(n)){let t=(p.basename(e).replace(`.js`,``));try{F.push((await import(e))[t])}catch{}}F.push(U),t.registerProviders(F),await t.registerConfiguredProviders(),await t.boot()}}().fire();export{};
69
+ `;description=`Generate component classes`;async handle(){let e=this.dictionary.baseCommand??this.dictionary.name;this.argument(`name`)||this.program.error(`Please provide a valid name for the `+e);let t={controller:`makeController`,resource:`makeResource`,migration:`makeMigration`,factory:`makeFactory`,seeder:`makeSeeder`,model:`makeModel`,view:`makeView`};try{await this?.[t[e]]()}catch(e){a.error(e)}}async makeController(){let e=this.option(`api`)?`-resource`:``,t=this.argument(`name`),n=this.option(`force`),r=app_path(`Http/Controllers/${t}.ts`),o=i.findModulePkg(`@h3ravel/http`,this.kernel.cwd)??``,s=p.join(o,`dist/stubs/controller${e}.stub`);!n&&await i.fileExists(r)&&a.error(`ERORR: ${t} controller already exists`);let l=await c(s,`utf-8`);l=l.replace(/{{ name }}/g,t),await u(r,l),a.split(`INFO: Controller Created`,a.log(p.basename(r),`gray`,!1))}makeResource(){a.success(`Resource support is not yet available`)}async makeMigration(){let e=this.argument(`name`),t=f().format(`YYYY_MM_DD_HHmmss`),n=database_path(`migrations/${t}_${e}.ts`),r=i.findModulePkg(`@h3ravel/database`,this.kernel.cwd)??``,o=this.option(`create`,!1),s=this.option(`table`);if(!s&&typeof o==`string`&&(s=o,o=!0),!s){let t=N.guess(e);s=t[0],o=!!t[1]}let l=p.join(r,this.getMigrationStubName(s,o)),d=await c(l,`utf-8`);s!==null&&(d=d.replace(/DummyTable|{{\s*table\s*}}/g,s)),a.info(`INFO: Creating Migration`),await this.kernel.ensureDirectoryExists(p.dirname(n)),await u(n,d),a.split(`INFO: Migration Created`,a.log(p.basename(n),`gray`,!1))}makeFactory(){a.success(`Factory support is not yet available`)}makeSeeder(){a.success(`Seeder support is not yet available`)}async makeModel(){let e=this.option(`type`,`ts`),t=this.argument(`name`),n=this.argument(`force`),r=app_path(`Models/${t.toLowerCase()}.${e}`);!n&&await i.fileExists(r)&&a.error(`ERORR: ${t} model already exists`);let o=i.findModulePkg(`@h3ravel/database`,this.kernel.cwd)??``,s=p.join(o,`dist/stubs/model-${e}.stub`),l=await c(s,`utf-8`);l=l.replace(/{{ name }}/g,t),await u(r,l),a.split(`INFO: Model Created`,a.log(p.basename(r),`gray`,!1))}async makeView(){let e=this.argument(`name`),t=this.option(`force`),n=base_path(`src/resources/views/${e}.edge`);e.includes(`/`)&&await s(d(n,`/`),{recursive:!0}),!t&&await i.fileExists(n)&&a.error(`ERORR: ${e} view already exists`),await u(n,`{{-- src/resources/views/${e}.edge --}}`),a.split(`INFO: View Created`,a.log(`src/resources/views/${e}.edge`,`gray`,!1))}getMigrationStubName(e,t=!1,n=`ts`){let r;return r=e?t?`migration.create-${n}.stub`:`migration.update-${n}.stub`:`migration-${n}.stub`,`dist/stubs/`+r}},F=class extends A{signature=`postinstall`;description=`Default post installation command`;async handle(){this.createSqliteDB()}async createSqliteDB(){config(`database.default`)===`sqlite`&&(await i.fileExists(database_path())||await s(database_path(),{recursive:!0}),await i.fileExists(database_path(`db.sqlite`))||await u(database_path(`db.sqlite`),``))}},I=[m,x,g,h,_,v,y,b],L=class e{static parseOptions(t){let n=[],r=/\{([^{}]+(?:\{[^{}]*\}[^{}]*)*)\}/g,i;for(;(i=r.exec(t))!==null;){let t=i[1][0]===`^`||/:[#^]/.test(i[1]),r=([`#`,`^`].includes(i[1][0])||/:[#^]/.test(i[1]))&&!t,a=i[1].trim().replace(/[#^]/,``),o=a.indexOf(`:`);if(o===-1){n.push({name:a});continue}let s=a.substring(0,o).trim(),c=a.substring(o+1).trim(),l=c,u,d=c.indexOf(`|`);if(d!==-1){l=c.substring(0,d).trim();let t=c.substring(d+1).trim().replace(/^\{/,``).trim();u=e.parseOptions(`{`+t+`}`)}else l=l.trim();let f=s,p=/[^a-zA-Z0-9_|-]/.test(f),m=!1;f.endsWith(`?*`)?(p=!1,m=!0,f=f.slice(0,-2)):f.endsWith(`*`)?(m=!0,f=f.slice(0,-1)):f.endsWith(`?`)&&(p=!1,f=f.slice(0,-1));let h=f.startsWith(`--`),g,_;if(h){let e=f.split(`|`).map(e=>e.trim());g=[];for(let t of e){t.startsWith(`--`)&&t.slice(2).length===1?t=`-`+t.slice(2):t.startsWith(`-`)&&!t.startsWith(`--`)&&t.slice(1).length>1?t=`--`+t.slice(1):!t.startsWith(`-`)&&t.slice(1).length>1&&(t=`--`+t);let e=t.indexOf(`=`);if(e!==-1){g.push(t.substring(0,e));let n=t.substring(e+1);_=n===`*`?[]:n===`true`||n===`false`||!n&&!p?n===`true`:isNaN(Number(n))?n:Number(n)}else g.push(t)}}n.push({name:h?g[g.length-1]:f,required:p,multiple:m,description:l,flags:g,shared:t,isFlag:h,isHidden:r,defaultValue:_,nestedOptions:u})}return n}static parseSignature(t,n){let r=t.split(`
70
+ `).map(e=>e.trim()).filter(e=>e.length>0),i=[`#`,`^`].includes(r[0][0])||/:[#^]/.test(r[0]),a=r[0].replace(/[^\w=:-]/g,``),o=n.getDescription(),s=a.endsWith(`:`),c=r.slice(1).join(` `),l=e.parseOptions(c);return s?{baseCommand:a.slice(0,-1),isNamespaceCommand:s,subCommands:l.filter(e=>!e.flags&&!e.isHidden),description:o,commandClass:n,options:l.filter(e=>!!e.flags),isHidden:i}:{baseCommand:a,isNamespaceCommand:s,options:l,description:o,commandClass:n,isHidden:i}}};function R(e={}){let t,n,r=e.args||[],i=e.allowRestarts||!1,a=e.input,o=e.options||e;return delete o.args,delete o.allowRestarts,{name:`run`,buildStart(e){let n=a??e.input;if(typeof n==`string`&&(n=[n]),typeof n==`object`&&(n=Object.values(n)),n.length>1)throw Error("@rollup/plugin-run must have a single entry point; consider setting the `input` option");t=D(n[0])},generateBundle(e,t,n){n||this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`)},writeBundle(e,a){let s=(e,t)=>{n&&n.kill(),n=O(E(e,t),r,o)},c=e.dir||T(e.file),l=Object.keys(a).find(e=>{let n=a[e];return n.isEntry&&n.facadeModuleId===t});l?(s(c,l),i&&(process.stdin.resume(),process.stdin.setEncoding(`utf8`),process.stdin.on(`data`,e=>{let t=e.toString().trim().toLowerCase();t===`rs`||t===`restart`||e.toString().charCodeAt(0)===11?s(c,l):(t===`cls`||t===`clear`||e.toString().charCodeAt(0)===12)&&console.clear()}))):this.error(`@rollup/plugin-run could not find output chunk`)}}}const z=process.env.NODE_ENV||`development`,B=z===`development`?`.h3ravel/serve`:`dist`;var V={outDir:B,entry:[`src/**/*.ts`],format:[`esm`],target:`node22`,sourcemap:z===`development`,clean:!0,shims:!0,copy:[{from:`public`,to:B},`src/resources`,`src/database`],env:z===`development`?{NODE_ENV:z,SRC_PATH:B}:{},watch:z===`development`&&process.env.CLI_BUILD!==`true`?[`.env`,`.env.*`,`src`,`../../packages`]:!1,dts:!1,logLevel:`silent`,nodeProtocol:!0,skipNodeModulesBundle:!0,hooks(e){e.hook(`build:done`,async()=>{let e=[`database/migrations`,`database/factories`,`database/seeders`];for(let t=0;t<e.length;t++){let n=e[t];w(p.join(B,n))&&await l(p.join(B,n),{recursive:!0})}})},plugins:z===`development`&&process.env.CLI_BUILD!==`true`?[R({env:Object.assign({},process.env,{NODE_ENV:z,SRC_PATH:B}),execArgv:[`-r`,`source-map-support/register`],allowRestarts:!1,input:process.cwd()+`/src/server.ts`})]:[]},H=class e{commands=[];constructor(e,t){this.app=e,this.kernel=t}async build(){return this.loadBaseCommands(),await this.loadDiscoveredCommands(),this.initialize()}loadBaseCommands(){[new P(this.app,this.kernel),new M(this.app,this.kernel),new F(this.app,this.kernel)].forEach(e=>this.addCommand(e))}async loadDiscoveredCommands(){let e=[...this.app.registeredCommands.map(e=>new e(this.app,this.kernel))],t=app_path(`Console/Commands/*.js`).replace(`/src/`,`/.h3ravel/serve/`);for await(let n of o(t)){let t=p.basename(n).replace(`.js`,``);try{let r=(await import(n))[t];e.push(new r(this.app,this.kernel))}catch{}}e.forEach(e=>this.addCommand(e))}addCommand(e){this.commands.push(L.parseSignature(e.getSignature(),e))}initialize(){let e=a.parse([[`Musket CLI:`,`white`],[this.kernel.consolePackage.version,`green`]],` `,!1),t=a.parse([[`H3ravel Framework:`,`white`],[this.kernel.modulePackage.version,`green`]],` `,!1),n={quiet:[`-q, --quiet`,`Do not output any message`],silent:[`--silent`,`Do not output any message`],verbose:[`-v, --verbose <number>`,`Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug`],lock:[`--lock`,`Locked and loaded, do not ask any interactive question`]};C.name(`musket`).version(`${e}\n${t}`).description(j).addOption(new S(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new S(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new S(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new S(n.lock[0],n.lock[1])).action(async()=>{let e=new M(this.app,this.kernel);e.setInput(C.opts(),C.args,C.registeredArguments,{},C),e.handle()}),C.command(`init`).description(`Initialize H3ravel.`).action(async()=>{a.success(`Initialized: H3ravel has been initialized!`)});for(let e=0;e<this.commands.length;e++){let t=this.commands[e],r=t.commandClass;if(t.isNamespaceCommand&&t.subCommands){let e=t.isHidden?C:C.command(t.baseCommand).description(t.description??``).addOption(new S(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new S(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new S(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new S(n.lock[0],n.lock[1])).action(async()=>{r.setInput(e.opts(),e.args,e.registeredArguments,t,C),await r.handle()});(t.options?.length??0)>0&&t.options?.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(t=>{this.makeOption(t,e)}),t.subCommands.filter((e,t,n)=>!e.shared&&n.findIndex(t=>t.name===e.name)===t).forEach(e=>{let i=C.command(`${t.baseCommand}:${e.name}`).description(e.description||``).addOption(new S(n.quiet[0],n.quiet[1]).implies({silent:!0})).addOption(new S(n.silent[0],n.silent[1]).implies({quiet:!0})).addOption(new S(n.verbose[0],n.verbose[1]).choices([`1`,`2`,`3`])).addOption(new S(n.lock[0],n.lock[1])).action(async()=>{r.setInput(i.opts(),i.args,i.registeredArguments,e,C),await r.handle()});t.subCommands?.filter(e=>e.shared).forEach(t=>{this.makeOption(t,i,!1,e)}),t.options?.filter(e=>e.shared).forEach(t=>{this.makeOption(t,i,!1,e)}),e.nestedOptions&&e.nestedOptions.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(e=>{this.makeOption(e,i)})})}else{let e=C.command(t.baseCommand).description(t.description??``);t?.options?.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t).forEach(t=>{this.makeOption(t,e,!0)}),e.action(async()=>{r.setInput(e.opts(),e.args,e.registeredArguments,t,C),await r.handle()})}}return C.hook(`preAction`,async(e,t)=>{t.name()!==`fire`&&await k({...V,watch:!1,plugins:[]})}),C}makeOption(e,t,n,r){let i=e.description?.replace(/\[(\w+)\]/g,(e,t)=>r?.[t]??`[${t}]`)??``,a=e.name.replaceAll(`-`,``);if(e.isFlag)if(n){let n=e.flags?.map(e=>e.length===1?`-${e}`:`--${e}`).join(`, `).replaceAll(`----`,`--`).replaceAll(`---`,`-`);t.option(n||``,i,String(e.defaultValue)||void 0)}else t.option(e.flags?.join(`, `)+(e.required?` <${a}>`:``),i,e.defaultValue);else t.argument(e.required?`<${e.name}>`:`[${e.name}]`,i,e.defaultValue)}static async parse(t){return(await new e(t.app,t).build()).parseAsync()}},U=class e extends n{constructor(e){super(e),this.app=e}static init(t){let n=new e(t);Promise.all([n.loadRequirements()]).then(([e])=>e.run())}async run(){await H.parse(this),process.exit(0)}async loadRequirements(){this.cwd=p.join(process.cwd(),this.basePath),this.modulePath=i.findModulePkg(`@h3ravel/core`,this.cwd)??``,this.consolePath=i.findModulePkg(`@h3ravel/console`,this.cwd)??``;try{this.modulePackage=await import(p.join(this.modulePath,`package.json`))}catch{this.modulePackage={version:`N/A`}}try{this.consolePackage=await import(p.join(this.consolePath,`package.json`))}catch{this.consolePackage={version:`N/A`}}return this}},W=class extends r{static priority=992;static console=!0;register(){}boot(){U.init(this.app),process.on(`SIGINT`,()=>{process.exit(0)}),process.on(`SIGTERM`,()=>{process.exit(0)})}};new class{async fire(){let t=new e(process.cwd()),n=(app_path(`Providers/*.js`).replace(`/src/`,`/.h3ravel/serve/`));for await(let e of o(n)){let t=(p.basename(e).replace(`.js`,``));try{I.push((await import(e))[t])}catch{}}I.push(W),t.registerProviders(I),await t.registerConfiguredProviders(),await t.boot()}}().fire();export{};
package/dist/index.cjs CHANGED
@@ -32,8 +32,6 @@ let __h3ravel_support = require("@h3ravel/support");
32
32
  __h3ravel_support = __toESM(__h3ravel_support);
33
33
  let dayjs = require("dayjs");
34
34
  dayjs = __toESM(dayjs);
35
- let node_fs = require("node:fs");
36
- node_fs = __toESM(node_fs);
37
35
  let node_path = require("node:path");
38
36
  node_path = __toESM(node_path);
39
37
  require("@h3ravel/http");
@@ -45,6 +43,8 @@ require("@h3ravel/mail");
45
43
  require("@h3ravel/config");
46
44
  let commander = require("commander");
47
45
  commander = __toESM(commander);
46
+ let node_fs = require("node:fs");
47
+ node_fs = __toESM(node_fs);
48
48
  let path = require("path");
49
49
  path = __toESM(path);
50
50
  let child_process = require("child_process");
@@ -195,6 +195,7 @@ var MakeCommand = class extends Command {
195
195
  description = "Generate component classes";
196
196
  async handle() {
197
197
  const command = this.dictionary.baseCommand ?? this.dictionary.name;
198
+ if (!this.argument("name")) this.program.error("Please provide a valid name for the " + command);
198
199
  const methods = {
199
200
  controller: "makeController",
200
201
  resource: "makeResource",
@@ -217,15 +218,15 @@ var MakeCommand = class extends Command {
217
218
  const type = this.option("api") ? "-resource" : "";
218
219
  const name = this.argument("name");
219
220
  const force = this.option("force");
220
- const path$4 = node_path.default.join(app_path("Http/Controllers"), name + ".ts");
221
+ const path$5 = app_path(`Http/Controllers/${name}.ts`);
221
222
  const crtlrPath = __h3ravel_shared.FileSystem.findModulePkg("@h3ravel/http", this.kernel.cwd) ?? "";
222
223
  const stubPath = node_path.default.join(crtlrPath, `dist/stubs/controller${type}.stub`);
223
224
  /** Check if the controller already exists */
224
- if (!force && (0, node_fs.existsSync)(path$4)) __h3ravel_shared.Logger.error(`ERORR: ${name} controller already exists`);
225
+ if (!force && await __h3ravel_shared.FileSystem.fileExists(path$5)) __h3ravel_shared.Logger.error(`ERORR: ${name} controller already exists`);
225
226
  let stub = await (0, node_fs_promises.readFile)(stubPath, "utf-8");
226
227
  stub = stub.replace(/{{ name }}/g, name);
227
- await (0, node_fs_promises.writeFile)(path$4, stub);
228
- __h3ravel_shared.Logger.split("INFO: Controller Created", __h3ravel_shared.Logger.log(node_path.default.basename(path$4), "gray", false));
228
+ await (0, node_fs_promises.writeFile)(path$5, stub);
229
+ __h3ravel_shared.Logger.split("INFO: Controller Created", __h3ravel_shared.Logger.log(node_path.default.basename(path$5), "gray", false));
229
230
  }
230
231
  makeResource() {
231
232
  __h3ravel_shared.Logger.success("Resource support is not yet available");
@@ -236,7 +237,7 @@ var MakeCommand = class extends Command {
236
237
  async makeMigration() {
237
238
  const name = this.argument("name");
238
239
  const datePrefix = (0, dayjs.default)().format("YYYY_MM_DD_HHmmss");
239
- const path$4 = node_path.default.join(database_path("migrations"), `${datePrefix}_${name}.ts`);
240
+ const path$5 = database_path(`migrations/${datePrefix}_${name}.ts`);
240
241
  const crtlrPath = __h3ravel_shared.FileSystem.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
241
242
  let create = this.option("create", false);
242
243
  let table = this.option("table");
@@ -253,9 +254,9 @@ var MakeCommand = class extends Command {
253
254
  let stub = await (0, node_fs_promises.readFile)(stubPath, "utf-8");
254
255
  if (table !== null) stub = stub.replace(/DummyTable|{{\s*table\s*}}/g, table);
255
256
  __h3ravel_shared.Logger.info("INFO: Creating Migration");
256
- await this.kernel.ensureDirectoryExists(node_path.default.dirname(path$4));
257
- await (0, node_fs_promises.writeFile)(path$4, stub);
258
- __h3ravel_shared.Logger.split("INFO: Migration Created", __h3ravel_shared.Logger.log(node_path.default.basename(path$4), "gray", false));
257
+ await this.kernel.ensureDirectoryExists(node_path.default.dirname(path$5));
258
+ await (0, node_fs_promises.writeFile)(path$5, stub);
259
+ __h3ravel_shared.Logger.split("INFO: Migration Created", __h3ravel_shared.Logger.log(node_path.default.basename(path$5), "gray", false));
259
260
  }
260
261
  /**
261
262
  * Create a new model factory
@@ -276,15 +277,15 @@ var MakeCommand = class extends Command {
276
277
  const type = this.option("type", "ts");
277
278
  const name = this.argument("name");
278
279
  const force = this.argument("force");
279
- const path$4 = node_path.default.join(app_path("Models"), name.toLowerCase(), "." + type);
280
+ const path$5 = app_path(`Models/${name.toLowerCase()}.${type}`);
280
281
  /** Check if the model already exists */
281
- if (!force && (0, node_fs.existsSync)(path$4)) __h3ravel_shared.Logger.error(`ERORR: ${name} view already exists`);
282
+ if (!force && await __h3ravel_shared.FileSystem.fileExists(path$5)) __h3ravel_shared.Logger.error(`ERORR: ${name} model already exists`);
282
283
  const crtlrPath = __h3ravel_shared.FileSystem.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
283
284
  const stubPath = node_path.default.join(crtlrPath, `dist/stubs/model-${type}.stub`);
284
285
  let stub = await (0, node_fs_promises.readFile)(stubPath, "utf-8");
285
286
  stub = stub.replace(/{{ name }}/g, name);
286
- await (0, node_fs_promises.writeFile)(path$4, stub);
287
- __h3ravel_shared.Logger.split("INFO: Model Created", __h3ravel_shared.Logger.log(node_path.default.basename(path$4), "gray", false));
287
+ await (0, node_fs_promises.writeFile)(path$5, stub);
288
+ __h3ravel_shared.Logger.split("INFO: Model Created", __h3ravel_shared.Logger.log(node_path.default.basename(path$5), "gray", false));
288
289
  }
289
290
  /**
290
291
  * Create a new view.
@@ -292,11 +293,11 @@ var MakeCommand = class extends Command {
292
293
  async makeView() {
293
294
  const name = this.argument("name");
294
295
  const force = this.option("force");
295
- const path$4 = node_path.default.join(base_path("src/resources/views"), name + ".edge");
296
- if (name.includes("/")) await (0, node_fs_promises.mkdir)((0, __h3ravel_support.beforeLast)(path$4, "/"), { recursive: true });
296
+ const path$5 = base_path(`src/resources/views/${name}.edge`);
297
+ if (name.includes("/")) await (0, node_fs_promises.mkdir)((0, __h3ravel_support.beforeLast)(path$5, "/"), { recursive: true });
297
298
  /** Check if the view already exists */
298
- if (!force && (0, node_fs.existsSync)(path$4)) __h3ravel_shared.Logger.error(`ERORR: ${name} view already exists`);
299
- await (0, node_fs_promises.writeFile)(path$4, `{{-- src/resources/views/${name}.edge --}}`);
299
+ if (!force && await __h3ravel_shared.FileSystem.fileExists(path$5)) __h3ravel_shared.Logger.error(`ERORR: ${name} view already exists`);
300
+ await (0, node_fs_promises.writeFile)(path$5, `{{-- src/resources/views/${name}.edge --}}`);
300
301
  __h3ravel_shared.Logger.split("INFO: View Created", __h3ravel_shared.Logger.log(`src/resources/views/${name}.edge`, "gray", false));
301
302
  }
302
303
  /**
@@ -336,6 +337,7 @@ var PostinstallCommand = class extends Command {
336
337
  }
337
338
  /**
338
339
  * Create sqlite database if none exist
340
+ *
339
341
  * @returns
340
342
  */
341
343
  async createSqliteDB() {
@@ -592,6 +594,19 @@ const TsDownConfig = {
592
594
  logLevel: "silent",
593
595
  nodeProtocol: true,
594
596
  skipNodeModulesBundle: true,
597
+ hooks(e) {
598
+ e.hook("build:done", async () => {
599
+ const paths = [
600
+ "database/migrations",
601
+ "database/factories",
602
+ "database/seeders"
603
+ ];
604
+ for (let i = 0; i < paths.length; i++) {
605
+ const name = paths[i];
606
+ if ((0, node_fs.existsSync)(node_path.default.join(outDir, name))) await (0, node_fs_promises.rm)(node_path.default.join(outDir, name), { recursive: true });
607
+ }
608
+ });
609
+ },
595
610
  plugins: env === "development" && process.env.CLI_BUILD !== "true" ? [run({
596
611
  env: Object.assign({}, process.env, {
597
612
  NODE_ENV: env,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["ConsoleCommand","Logger","e","path","nodepath","FileSystem","Logger","TableGuesser","stub: string","FileSystem","options: CommandOption[]","nestedOptions: CommandOption[] | undefined","flags: string[] | undefined","defaultValue: string | number | boolean | undefined | string[]","dir","entryFileName","TsDownConfig: Options","app: Application","kernel: Kernel","commands: Command[]","path","Logger","Option","program","i","cmd","TsDownConfig","ConsoleKernel","app: Application","path","FileSystem","ServiceProvider"],"sources":["../src/Commands/Command.ts","../src/logo.ts","../src/Commands/ListCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/PostinstallCommand.ts","../src/Signature.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Musket.ts","../src/Kernel.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { ConsoleCommand } from '@h3ravel/core'\n\nexport class Command extends ConsoleCommand { }\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","import { Command } from './Command'\nimport { Logger } from '@h3ravel/shared'\nimport { Option } from 'commander'\n/* eslint-disable no-control-regex */\nimport { altLogo } from '../logo'\n\nexport class ListCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'list'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'List all available commands'\n\n public async handle () {\n const options = [\n {\n short: '-h',\n long: '--help',\n description: 'Display help for the given command. When no command is given display help for the list command'\n } as Option\n ]\n .concat(this.program.options)\n .map(e => {\n const desc = Logger.describe(Logger.log(\n ' ' + [e.short, e.long].filter(e => !!e).join(', '), 'green', false\n ), e.description, 25, false)\n return desc.join('')\n })\n\n /** Get the program commands */\n const commands = this.program.commands.map(e => {\n const desc = Logger.describe(Logger.log(' ' + e.name(), 'green', false), e.description(), 25, false)\n return desc.join('')\n })\n\n const grouped = commands.reduce<Record<string, string[]>>((acc, cmd) => {\n /** strip colors before checking prefix */\n const clean = cmd.replace(/\\x1b\\[\\d+m/g, '')\n const prefix = clean.includes(':') ? clean.split(':')[0].trim() : '__root__'\n acc[prefix] ??= []\n /** keep original with colors */\n acc[prefix].push(cmd)\n return acc\n }, {})\n\n const list = Object.entries(grouped).map(([group, cmds]) => {\n const label = group === '__root__' ? '' : group\n return [Logger.log(label, 'yellow', false), cmds.join('\\n')].join('\\n')\n })\n\n /** Ootput the app version */\n Logger.log([['H3ravel Framework', 'white'], [this.kernel.modulePackage.version, 'green']], ' ')\n\n console.log('')\n\n console.log(altLogo)\n\n console.log('')\n\n Logger.log('Usage:', 'yellow')\n Logger.log(' command [options] [arguments]', 'white')\n\n console.log('')\n\n /** Ootput the options */\n Logger.log('Options:', 'yellow')\n console.log(options.join('\\n').trim())\n\n console.log('')\n\n /** Ootput the commands */\n Logger.log('Available Commands:', 'yellow')\n console.log(list.join('\\n\\n').trim())\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from './Command'\nimport { TableGuesser } from '../Utils'\nimport { beforeLast } from '@h3ravel/support'\nimport dayjs from 'dayjs'\nimport { existsSync } from 'node:fs'\nimport nodepath from 'node:path'\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Create a new controller class. \n | {--a|api : Exclude the create and edit methods from the controller} \n | {--m|model= : Generate a resource controller for the given model} \n | {--r|resource : Generate a resource controller class} \n | {--force : Create the controller even if it already exists}\n }\n {resource : Create a new resource. \n | {--c|collection : Create a resource collection}\n | {--force : Create the resource even if it already exists}\n }\n {migration : Generates a new database migration class. \n | {--l|type=ts : The file type to generate} \n | {--t|table : The table to migrate} \n | {--c|create : The table to be created} \n }\n {factory : Create a new model factory.}\n {seeder : Create a new seeder class.}\n {view : Create a new view.\n | {--force : Create the view even if it already exists}\n }\n {model : Create a new Eloquent model class. \n | {--api : Indicates if the generated controller should be an API resource controller} \n | {--c|controller : Create a new controller for the model} \n | {--f|factory : Create a new factory for the model} \n | {--m|migration : Create a new migration file for the model} \n | {--r|resource : Indicates if the generated controller should be a resource controller} \n | {--a|all : Generate a migration, seeder, factory, policy, resource controller, and form request classes for the model} \n | {--s|seed : Create a new seeder for the model} \n | {--t|type=ts : The file type to generate}\n | {--force : Create the model even if it already exists}\n } \n {^name : The name of the [name] to generate}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes'\n\n public async handle () {\n const command = (this.dictionary.baseCommand ?? this.dictionary.name) as never\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n migration: 'makeMigration',\n factory: 'makeFactory',\n seeder: 'makeSeeder',\n model: 'makeModel',\n view: 'makeView',\n } as const\n\n try {\n await (this as any)?.[methods[command]]()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n /**\n * Create a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : ''\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = nodepath.join(app_path('Http/Controllers'), name + '.ts')\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n\n /** Check if the controller already exists */\n if (!force && existsSync(path)) {\n Logger.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Controller Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n protected makeResource () {\n Logger.success('Resource support is not yet available')\n }\n\n /**\n * Generate a new database migration class\n */\n protected async makeMigration () {\n const name = this.argument('name')\n const datePrefix = dayjs().format('YYYY_MM_DD_HHmmss')\n const path = nodepath.join(database_path('migrations'), `${datePrefix}_${name}.ts`)\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n\n let create = this.option('create', false)\n let table = this.option('table')\n if (!table && typeof create === 'string') {\n table = create\n create = true\n }\n\n if (!table) {\n const guessed = TableGuesser.guess(name)\n table = guessed[0]\n create = !!guessed[1]\n }\n\n const stubPath = nodepath.join(crtlrPath, this.getMigrationStubName(table, create))\n let stub = await readFile(stubPath, 'utf-8')\n\n if (table !== null) {\n stub = stub.replace(/DummyTable|{{\\s*table\\s*}}/g, table)\n }\n\n Logger.info('INFO: Creating Migration')\n\n await this.kernel.ensureDirectoryExists(nodepath.dirname(path))\n await writeFile(path, stub)\n\n Logger.split('INFO: Migration Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new model factory\n */\n protected makeFactory () {\n Logger.success('Factory support is not yet available')\n }\n\n /**\n * Create a new seeder class\n */\n protected makeSeeder () {\n Logger.success('Seeder support is not yet available')\n }\n\n /**\n * Generate a new Arquebus model class\n */\n protected async makeModel () {\n const type = this.option('type', 'ts')\n const name = this.argument('name')\n const force = this.argument('force')\n\n const path = nodepath.join(app_path('Models'), name.toLowerCase(), '.' + type)\n\n /** Check if the model already exists */\n if (!force && existsSync(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/model-${type}.stub`)\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Model Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new view.\n */\n protected async makeView () {\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = nodepath.join(base_path('src/resources/views'), name + '.edge')\n\n if (name.includes('/')) {\n await mkdir(beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the view already exists */\n if (!force && existsSync(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`)\n Logger.split('INFO: View Created', Logger.log(`src/resources/views/${name}.edge`, 'gray', false))\n }\n\n /**\n * Ge the database migration file name\n * \n * @param table \n * @param create \n * @param type \n * @returns \n */\n getMigrationStubName (table?: string, create: boolean = false, type: 'ts' | 'js' = 'ts') {\n let stub: string\n if (!table) {\n stub = `migration-${type}.stub`\n }\n else if (create) {\n stub = `migration.create-${type}.stub`\n }\n else {\n stub = `migration.update-${type}.stub`\n }\n return 'dist/stubs/' + stub\n }\n}\n","import { mkdir, writeFile } from 'node:fs/promises'\n\nimport { Command } from './Command'\nimport { FileSystem } from '@h3ravel/shared'\n\nexport class PostinstallCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'postinstall'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Default post installation command'\n\n public async handle () {\n this.createSqliteDB()\n }\n\n /**\n * Create sqlite database if none exist\n * @returns \n */\n private async createSqliteDB () {\n if (config('database.default') !== 'sqlite') return\n\n if (!await FileSystem.fileExists(database_path())) {\n await mkdir(database_path(), { recursive: true })\n }\n\n if (!await FileSystem.fileExists(database_path('db.sqlite'))) {\n await writeFile(database_path('db.sqlite'), '')\n }\n }\n}\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\n\nimport { Command } from './Commands/Command'\n\nexport class Signature {\n /**\n * Helper to parse options inside a block of text\n * \n * @param block \n * @returns \n */\n static parseOptions (block: string): CommandOption[] {\n const options: CommandOption[] = []\n /**\n * Match { ... } blocks at top level \n */\n const regex = /\\{([^{}]+(?:\\{[^{}]*\\}[^{}]*)*)\\}/g\n let match\n\n while ((match = regex.exec(block)) !== null) {\n const shared = '^' === match[1][0]! || /:[#^]/.test(match[1])\n const isHidden = (['#', '^'].includes(match[1][0]!) || /:[#^]/.test(match[1])) && !shared\n const content = match[1].trim().replace(/[#^]/, '')\n /**\n * Split by first ':' to separate name and description+nested\n */\n const colonIndex = content.indexOf(':')\n if (colonIndex === -1) {\n /**\n * No description, treat whole as name\n */\n options.push({ name: content })\n continue\n }\n\n const namePart = content.substring(0, colonIndex).trim()\n const rest = content.substring(colonIndex + 1).trim()\n\n /**\n * Check for nested options after '|'\n */\n let description = rest\n let nestedOptions: CommandOption[] | undefined\n\n const pipeIndex = rest.indexOf('|')\n if (pipeIndex !== -1) {\n description = rest.substring(0, pipeIndex).trim()\n const nestedText = rest.substring(pipeIndex + 1).trim()\n /**\n * nestedText should start with '{' and end with ')', clean it\n * Also Remove trailing ')' if present\n */\n const cleanedNestedText = nestedText.replace(/^\\{/, '').trim()\n\n /**\n * Parse nested options recursively\n */\n nestedOptions = Signature.parseOptions('{' + cleanedNestedText + '}')\n } else {\n /**\n * Trim the string\n */\n description = description.trim()\n }\n\n /**\n * Parse name modifiers (?, *, ?*)\n */\n let name = namePart\n let required = /[^a-zA-Z0-9_|-]/.test(name)\n let multiple = false\n\n if (name.endsWith('?*')) {\n required = false\n multiple = true\n name = name.slice(0, -2)\n } else if (name.endsWith('*')) {\n multiple = true\n name = name.slice(0, -1)\n } else if (name.endsWith('?')) {\n required = false\n name = name.slice(0, -1)\n }\n\n /**\n * Check if it's a flag option (starts with --)\n */\n const isFlag = name.startsWith('--')\n let flags: string[] | undefined\n let defaultValue: string | number | boolean | undefined | string[]\n\n if (isFlag) {\n /**\n * Parse flags and default values\n */\n const flagParts = name.split('|').map(s => s.trim())\n\n flags = []\n\n for (let part of flagParts) {\n if (part.startsWith('--') && part.slice(2).length === 1) {\n part = '-' + part.slice(2)\n } else if (part.startsWith('-') && !part.startsWith('--') && part.slice(1).length > 1) {\n part = '--' + part.slice(1)\n } else if (!part.startsWith('-') && part.slice(1).length > 1) {\n part = '--' + part\n }\n\n const eqIndex = part.indexOf('=')\n if (eqIndex !== -1) {\n flags.push(part.substring(0, eqIndex))\n const val = part.substring(eqIndex + 1)\n if (val === '*') {\n defaultValue = []\n } else if (val === 'true' || val === 'false' || (!val && !required)) {\n defaultValue = val === 'true'\n } else if (!isNaN(Number(val))) {\n defaultValue = Number(val)\n } else {\n defaultValue = val\n }\n } else {\n flags.push(part)\n }\n }\n }\n\n options.push({\n name: isFlag ? flags![flags!.length - 1] : name,\n required,\n multiple,\n description,\n flags,\n shared,\n isFlag,\n isHidden,\n defaultValue,\n nestedOptions,\n })\n }\n\n return options\n }\n\n /**\n * Helper to parse a command's signature\n * \n * @param signature \n * @param commandClass \n * @returns \n */\n static parseSignature (signature: string, commandClass: Command): ParsedCommand {\n const lines = signature.split('\\n').map(l => l.trim()).filter(l => l.length > 0)\n const isHidden = ['#', '^'].includes(lines[0][0]!) || /:[#^]/.test(lines[0])\n const baseCommand = lines[0].replace(/[^\\w=:-]/g, '')\n const description = commandClass.getDescription()\n const isNamespaceCommand = baseCommand.endsWith(':')\n\n /**\n * Join the rest lines to a single string for parsing\n */\n const rest = lines.slice(1).join(' ')\n\n /**\n * Parse all top-level options/subcommands\n */\n const allOptions = Signature.parseOptions(rest)\n\n if (isNamespaceCommand) {\n /**\n * Separate subcommands (those without flags) and base options (flags)\n * Here we assume subcommands are those without flags (isFlag false)\n * and base options are flags or options after subcommands\n\n * For simplicity, treat all top-level options as subcommands\n * and assume base command options come after subcommands in signature (not shown in example)\n */\n\n return {\n baseCommand: baseCommand.slice(0, -1),\n isNamespaceCommand,\n subCommands: allOptions.filter(e => !e.flags && !e.isHidden),\n description,\n commandClass,\n options: allOptions.filter(e => !!e.flags),\n isHidden,\n }\n } else {\n return {\n baseCommand,\n isNamespaceCommand,\n options: allOptions,\n description,\n commandClass,\n isHidden,\n }\n }\n }\n}\n","import { dirname, join, resolve } from 'path';\n\nimport { fork } from 'child_process';\n\nfunction run (opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart (options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle (_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle (outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown'\nimport run from '@rollup/plugin-run'\n\nconst env = process.env.NODE_ENV || 'development'\nconst outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n SRC_PATH: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n SRC_PATH: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n}\n\nexport default TsDownConfig\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\nimport { Option, program, type Command as Commander } from 'commander'\n\nimport { Application } from '@h3ravel/core'\nimport { Command } from './Commands/Command'\nimport { Kernel } from './Kernel'\nimport { ListCommand } from './Commands/ListCommand'\nimport { Logger } from '@h3ravel/shared'\nimport { MakeCommand } from './Commands/MakeCommand'\nimport { Signature } from './Signature'\nimport TsDownConfig from './TsdownConfig'\nimport { altLogo } from './logo'\nimport { build } from 'tsdown'\nimport { glob } from 'node:fs/promises'\nimport path from 'node:path'\nimport { PostinstallCommand } from './Commands/PostinstallCommand'\n\n/**\n * Musket is H3ravel's CLI tool\n */\nexport class Musket {\n private commands: ParsedCommand[] = []\n\n constructor(private app: Application, private kernel: Kernel) { }\n\n async build () {\n this.loadBaseCommands()\n await this.loadDiscoveredCommands()\n return this.initialize()\n }\n\n private loadBaseCommands () {\n const commands: Command[] = [\n new MakeCommand(this.app, this.kernel),\n new ListCommand(this.app, this.kernel),\n new PostinstallCommand(this.app, this.kernel),\n ]\n\n commands.forEach(e => this.addCommand(e))\n }\n\n private async loadDiscoveredCommands () {\n const commands: Command[] = [\n ...this.app.registeredCommands.map(cmd => new cmd(this.app, this.kernel))\n ]\n\n /**\n * Musket Commands auto registration\n */\n const providers_path = app_path('Console/Commands/*.js').replace('/src/', '/.h3ravel/serve/')\n\n /** Add the App Commands */\n for await (const cmd of glob(providers_path)) {\n const name = path.basename(cmd).replace('.js', '')\n try {\n const cmdClass = (await import(cmd))[name]\n commands.push(new cmdClass(this.app, this.kernel))\n } catch { /** */ }\n }\n\n commands.forEach(e => this.addCommand(e))\n }\n\n addCommand (command: Command) {\n this.commands.push(Signature.parseSignature(command.getSignature(), command))\n }\n\n private initialize () {\n /** Init the Musket Version */\n const cliVersion = Logger.parse([\n ['Musket CLI:', 'white'],\n [this.kernel.consolePackage.version, 'green']\n ], ' ', false)\n\n /** Init the App Version */\n const localVersion = Logger.parse([\n ['H3ravel Framework:', 'white'],\n [this.kernel.modulePackage.version, 'green']\n ], ' ', false)\n\n const additional = {\n quiet: ['-q, --quiet', 'Do not output any message'],\n silent: ['--silent', 'Do not output any message'],\n verbose: ['-v, --verbose <number>', 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'],\n lock: ['--lock', 'Locked and loaded, do not ask any interactive question'],\n }\n\n /** Init Commander */\n program\n .name('musket')\n .version(`${cliVersion}\\n${localVersion}`)\n .description(altLogo)\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n const instance = new ListCommand(this.app, this.kernel)\n instance.setInput(program.opts(), program.args, program.registeredArguments, {}, program)\n instance.handle()\n })\n\n /** Create the init Command */\n program\n .command('init')\n .description('Initialize H3ravel.')\n .action(async () => {\n Logger.success('Initialized: H3ravel has been initialized!')\n })\n\n /** Loop through all the available commands */\n for (let i = 0; i < this.commands.length; i++) {\n const command = this.commands[i]\n const instance = command.commandClass\n\n if (command.isNamespaceCommand && command.subCommands) {\n /**\n * Initialize the base command\n */\n const cmd = command.isHidden\n ? program\n : program\n .command(command.baseCommand)\n .description(command.description ?? '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n\n /**\n * Add options to the base command if it has any\n */\n if ((command.options?.length ?? 0) > 0) {\n command.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n\n /**\n * Initialize the sub commands\n */\n command\n .subCommands\n .filter((v, i, a) => !v.shared && a.findIndex(t => t.name === v.name) === i)\n .forEach(sub => {\n const cmd = program\n .command(`${command.baseCommand}:${sub.name}`)\n .description(sub.description || '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, sub, program)\n await instance.handle()\n })\n\n /**\n * Add the shared arguments here\n */\n command.subCommands?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add the shared options here\n */\n command.options?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add options to the sub command if it has any\n */\n if (sub.nestedOptions) {\n sub.nestedOptions\n .filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n })\n } else {\n /**\n * Initialize command with options\n */\n const cmd = program\n .command(command.baseCommand)\n .description(command.description ?? '')\n\n command\n ?.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd, true)\n })\n\n cmd.action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n }\n }\n\n /** Rebuild the app on every command except fire so we wont need TS */\n program.hook('preAction', async (_, cmd) => {\n if (cmd.name() !== 'fire') {\n await build({\n ...TsDownConfig,\n watch: false,\n plugins: []\n })\n }\n })\n\n return program\n }\n\n makeOption (opt: CommandOption, cmd: Commander, parse?: boolean, parent?: any) {\n const description = opt.description?.replace(/\\[(\\w+)\\]/g, (_, k) => parent?.[k] ?? `[${k}]`) ?? ''\n const type = opt.name.replaceAll('-', '')\n\n if (opt.isFlag) {\n if (parse) {\n const flags = opt.flags\n ?.map(f => (f.length === 1 ? `-${f}` : `--${f}`)).join(', ')!\n .replaceAll('----', '--')\n .replaceAll('---', '-')\n\n cmd.option(flags || '', description!, String(opt.defaultValue) || undefined)\n } else {\n cmd.option(\n opt.flags?.join(', ') + (opt.required ? ` <${type}>` : ''),\n description!,\n opt.defaultValue as any\n )\n }\n } else {\n cmd.argument(\n opt.required ? `<${opt.name}>` : `[${opt.name}]`,\n description,\n opt.defaultValue\n )\n }\n }\n\n static async parse (kernel: Kernel) {\n return (await new Musket(kernel.app, kernel).build()).parseAsync()\n }\n\n}\n","import { Application, ConsoleKernel } from '@h3ravel/core'\n\nimport { FileSystem } from '@h3ravel/shared'\nimport { Musket } from './Musket'\nimport path from 'node:path'\n\nexport class Kernel extends ConsoleKernel {\n constructor(public app: Application) {\n super(app)\n }\n\n static init (app: Application) {\n const instance = new Kernel(app)\n\n Promise.all([instance.loadRequirements()])\n .then(([e]) => e.run())\n }\n\n\n private async run () {\n await Musket.parse(this)\n process.exit(0)\n }\n\n private async loadRequirements () {\n this.cwd = path.join(process.cwd(), this.basePath)\n this.modulePath = FileSystem.findModulePkg('@h3ravel/core', this.cwd) ?? ''\n this.consolePath = FileSystem.findModulePkg('@h3ravel/console', this.cwd) ?? ''\n\n try {\n this.modulePackage = await import(path.join(this.modulePath, 'package.json'))\n } catch {\n this.modulePackage = { version: 'N/A' }\n }\n\n try {\n this.consolePackage = await import(path.join(this.consolePath, 'package.json'))\n } catch {\n this.consolePackage = { version: 'N/A' }\n }\n\n return this\n }\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { Kernel } from '../Kernel'\nimport { ServiceProvider } from '@h3ravel/core'\n/**\n * Handles CLI commands and tooling.\n * \n * Register DatabaseManager and QueryBuilder.\n * Set up ORM models and relationships.\n * Register migration and seeder commands.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = true\n\n register () {\n }\n\n boot () {\n Kernel.init(this.app)\n\n process.on('SIGINT', () => {\n process.exit(0)\n })\n process.on('SIGTERM', () => {\n process.exit(0)\n })\n }\n}\n"],"x_google_ignoreList":[6],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,UAAb,cAA6BA,8BAAe;;;;ACF5C,MAAa,OAAO,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;AAwB9B,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;AClBjC,IAAa,cAAb,cAAiC,QAAQ;;;;;;CAOrC,AAAU,YAAoB;;;;;;CAO9B,AAAU,cAAsB;CAEhC,MAAa,SAAU;EACnB,MAAM,UAAU,CACZ;GACI,OAAO;GACP,MAAM;GACN,aAAa;GAChB,CACJ,CACI,OAAO,KAAK,QAAQ,QAAQ,CAC5B,KAAI,MAAK;AAIN,UAHaC,wBAAO,SAASA,wBAAO,IAChC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,QAAO,QAAK,CAAC,CAACC,IAAE,CAAC,KAAK,KAAK,EAAE,SAAS,MAClE,EAAE,EAAE,aAAa,IAAI,MAAM,CAChB,KAAK,GAAG;IACtB;EAQN,MAAM,UALW,KAAK,QAAQ,SAAS,KAAI,MAAK;AAE5C,UADaD,wBAAO,SAASA,wBAAO,IAAI,OAAO,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,aAAa,EAAE,IAAI,MAAM,CACzF,KAAK,GAAG;IACtB,CAEuB,QAAkC,KAAK,QAAQ;;GAEpE,MAAM,QAAQ,IAAI,QAAQ,e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A,QAAK,gBAAgB,MAAM,OAAOD,kBAAK,KAAK,KAAK,YAAY,eAAe;UACxE;AACJ,QAAK,gBAAgB,EAAE,SAAS,OAAO;;AAG3C,MAAI;AACA,QAAK,iBAAiB,MAAM,OAAOA,kBAAK,KAAK,KAAK,aAAa,eAAe;UAC1E;AACJ,QAAK,iBAAiB,EAAE,SAAS,OAAO;;AAG5C,SAAO;;;;;;;;;;;;;;;AC5Bf,IAAa,yBAAb,cAA4CE,+BAAgB;CACxD,OAAc,WAAW;;;;CAKzB,OAAc,UAAU;CAExB,WAAY;CAGZ,OAAQ;AACJ,SAAO,KAAK,KAAK,IAAI;AAErB,UAAQ,GAAG,gBAAgB;AACvB,WAAQ,KAAK,EAAE;IACjB;AACF,UAAQ,GAAG,iBAAiB;AACxB,WAAQ,KAAK,EAAE;IACjB"}
1
+ {"version":3,"file":"index.cjs","names":["ConsoleCommand","Logger","e","path","FileSystem","nodepath","Logger","TableGuesser","stub: string","FileSystem","options: CommandOption[]","nestedOptions: CommandOption[] | undefined","flags: string[] | undefined","defaultValue: string | number | boolean | undefined | string[]","dir","entryFileName","TsDownConfig: Options","path","app: Application","kernel: Kernel","commands: Command[]","path","Logger","Option","program","i","cmd","TsDownConfig","ConsoleKernel","app: Application","path","FileSystem","ServiceProvider"],"sources":["../src/Commands/Command.ts","../src/logo.ts","../src/Commands/ListCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/PostinstallCommand.ts","../src/Signature.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Musket.ts","../src/Kernel.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { ConsoleCommand } from '@h3ravel/core'\n\nexport class Command extends ConsoleCommand { }\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","import { Command } from './Command'\nimport { Logger } from '@h3ravel/shared'\nimport { Option } from 'commander'\n/* eslint-disable no-control-regex */\nimport { altLogo } from '../logo'\n\nexport class ListCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'list'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'List all available commands'\n\n public async handle () {\n const options = [\n {\n short: '-h',\n long: '--help',\n description: 'Display help for the given command. When no command is given display help for the list command'\n } as Option\n ]\n .concat(this.program.options)\n .map(e => {\n const desc = Logger.describe(Logger.log(\n ' ' + [e.short, e.long].filter(e => !!e).join(', '), 'green', false\n ), e.description, 25, false)\n return desc.join('')\n })\n\n /** Get the program commands */\n const commands = this.program.commands.map(e => {\n const desc = Logger.describe(Logger.log(' ' + e.name(), 'green', false), e.description(), 25, false)\n return desc.join('')\n })\n\n const grouped = commands.reduce<Record<string, string[]>>((acc, cmd) => {\n /** strip colors before checking prefix */\n const clean = cmd.replace(/\\x1b\\[\\d+m/g, '')\n const prefix = clean.includes(':') ? clean.split(':')[0].trim() : '__root__'\n acc[prefix] ??= []\n /** keep original with colors */\n acc[prefix].push(cmd)\n return acc\n }, {})\n\n const list = Object.entries(grouped).map(([group, cmds]) => {\n const label = group === '__root__' ? '' : group\n return [Logger.log(label, 'yellow', false), cmds.join('\\n')].join('\\n')\n })\n\n /** Ootput the app version */\n Logger.log([['H3ravel Framework', 'white'], [this.kernel.modulePackage.version, 'green']], ' ')\n\n console.log('')\n\n console.log(altLogo)\n\n console.log('')\n\n Logger.log('Usage:', 'yellow')\n Logger.log(' command [options] [arguments]', 'white')\n\n console.log('')\n\n /** Ootput the options */\n Logger.log('Options:', 'yellow')\n console.log(options.join('\\n').trim())\n\n console.log('')\n\n /** Ootput the commands */\n Logger.log('Available Commands:', 'yellow')\n console.log(list.join('\\n\\n').trim())\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from './Command'\nimport { TableGuesser } from '../Utils'\nimport { beforeLast } from '@h3ravel/support'\nimport dayjs from 'dayjs'\nimport nodepath from 'node:path'\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Create a new controller class. \n | {--a|api : Exclude the create and edit methods from the controller} \n | {--m|model= : Generate a resource controller for the given model} \n | {--r|resource : Generate a resource controller class} \n | {--force : Create the controller even if it already exists}\n }\n {resource : Create a new resource. \n | {--c|collection : Create a resource collection}\n | {--force : Create the resource even if it already exists}\n }\n {migration : Generates a new database migration class. \n | {--l|type=ts : The file type to generate} \n | {--t|table : The table to migrate} \n | {--c|create : The table to be created} \n }\n {factory : Create a new model factory.}\n {seeder : Create a new seeder class.}\n {view : Create a new view.\n | {--force : Create the view even if it already exists}\n }\n {model : Create a new Eloquent model class. \n | {--api : Indicates if the generated controller should be an API resource controller} \n | {--c|controller : Create a new controller for the model} \n | {--f|factory : Create a new factory for the model} \n | {--m|migration : Create a new migration file for the model} \n | {--r|resource : Indicates if the generated controller should be a resource controller} \n | {--a|all : Generate a migration, seeder, factory, policy, resource controller, and form request classes for the model} \n | {--s|seed : Create a new seeder for the model} \n | {--t|type=ts : The file type to generate}\n | {--force : Create the model even if it already exists}\n } \n {^name : The name of the [name] to generate}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes'\n\n public async handle () {\n const command = (this.dictionary.baseCommand ?? this.dictionary.name) as never\n\n if (!this.argument('name')) {\n this.program.error('Please provide a valid name for the ' + command)\n }\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n migration: 'makeMigration',\n factory: 'makeFactory',\n seeder: 'makeSeeder',\n model: 'makeModel',\n view: 'makeView',\n } as const\n\n try {\n await (this as any)?.[methods[command]]()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n /**\n * Create a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : ''\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = app_path(`Http/Controllers/${name}.ts`)\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n\n /** Check if the controller already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Controller Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n protected makeResource () {\n Logger.success('Resource support is not yet available')\n }\n\n /**\n * Generate a new database migration class\n */\n protected async makeMigration () {\n const name = this.argument('name')\n const datePrefix = dayjs().format('YYYY_MM_DD_HHmmss')\n const path = database_path(`migrations/${datePrefix}_${name}.ts`)\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n\n let create = this.option('create', false)\n let table = this.option('table')\n if (!table && typeof create === 'string') {\n table = create\n create = true\n }\n\n if (!table) {\n const guessed = TableGuesser.guess(name)\n table = guessed[0]\n create = !!guessed[1]\n }\n\n const stubPath = nodepath.join(crtlrPath, this.getMigrationStubName(table, create))\n let stub = await readFile(stubPath, 'utf-8')\n\n if (table !== null) {\n stub = stub.replace(/DummyTable|{{\\s*table\\s*}}/g, table)\n }\n\n Logger.info('INFO: Creating Migration')\n\n await this.kernel.ensureDirectoryExists(nodepath.dirname(path))\n await writeFile(path, stub)\n\n Logger.split('INFO: Migration Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new model factory\n */\n protected makeFactory () {\n Logger.success('Factory support is not yet available')\n }\n\n /**\n * Create a new seeder class\n */\n protected makeSeeder () {\n Logger.success('Seeder support is not yet available')\n }\n\n /**\n * Generate a new Arquebus model class\n */\n protected async makeModel () {\n const type = this.option('type', 'ts')\n const name = this.argument('name')\n const force = this.argument('force')\n\n const path = app_path(`Models/${name.toLowerCase()}.${type}`)\n\n /** Check if the model already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} model already exists`)\n }\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/model-${type}.stub`)\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Model Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new view.\n */\n protected async makeView () {\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = base_path(`src/resources/views/${name}.edge`)\n\n if (name.includes('/')) {\n await mkdir(beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the view already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`)\n Logger.split('INFO: View Created', Logger.log(`src/resources/views/${name}.edge`, 'gray', false))\n }\n\n /**\n * Ge the database migration file name\n * \n * @param table \n * @param create \n * @param type \n * @returns \n */\n getMigrationStubName (table?: string, create: boolean = false, type: 'ts' | 'js' = 'ts') {\n let stub: string\n if (!table) {\n stub = `migration-${type}.stub`\n }\n else if (create) {\n stub = `migration.create-${type}.stub`\n }\n else {\n stub = `migration.update-${type}.stub`\n }\n return 'dist/stubs/' + stub\n }\n}\n","import { mkdir, writeFile } from 'node:fs/promises'\n\nimport { Command } from './Command'\nimport { FileSystem } from '@h3ravel/shared'\n\nexport class PostinstallCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'postinstall'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Default post installation command'\n\n public async handle () {\n this.createSqliteDB()\n }\n\n /**\n * Create sqlite database if none exist\n * \n * @returns \n */\n private async createSqliteDB () {\n if (config('database.default') !== 'sqlite') return\n\n if (!await FileSystem.fileExists(database_path())) {\n await mkdir(database_path(), { recursive: true })\n }\n\n if (!await FileSystem.fileExists(database_path('db.sqlite'))) {\n await writeFile(database_path('db.sqlite'), '')\n }\n }\n}\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\n\nimport { Command } from './Commands/Command'\n\nexport class Signature {\n /**\n * Helper to parse options inside a block of text\n * \n * @param block \n * @returns \n */\n static parseOptions (block: string): CommandOption[] {\n const options: CommandOption[] = []\n /**\n * Match { ... } blocks at top level \n */\n const regex = /\\{([^{}]+(?:\\{[^{}]*\\}[^{}]*)*)\\}/g\n let match\n\n while ((match = regex.exec(block)) !== null) {\n const shared = '^' === match[1][0]! || /:[#^]/.test(match[1])\n const isHidden = (['#', '^'].includes(match[1][0]!) || /:[#^]/.test(match[1])) && !shared\n const content = match[1].trim().replace(/[#^]/, '')\n /**\n * Split by first ':' to separate name and description+nested\n */\n const colonIndex = content.indexOf(':')\n if (colonIndex === -1) {\n /**\n * No description, treat whole as name\n */\n options.push({ name: content })\n continue\n }\n\n const namePart = content.substring(0, colonIndex).trim()\n const rest = content.substring(colonIndex + 1).trim()\n\n /**\n * Check for nested options after '|'\n */\n let description = rest\n let nestedOptions: CommandOption[] | undefined\n\n const pipeIndex = rest.indexOf('|')\n if (pipeIndex !== -1) {\n description = rest.substring(0, pipeIndex).trim()\n const nestedText = rest.substring(pipeIndex + 1).trim()\n /**\n * nestedText should start with '{' and end with ')', clean it\n * Also Remove trailing ')' if present\n */\n const cleanedNestedText = nestedText.replace(/^\\{/, '').trim()\n\n /**\n * Parse nested options recursively\n */\n nestedOptions = Signature.parseOptions('{' + cleanedNestedText + '}')\n } else {\n /**\n * Trim the string\n */\n description = description.trim()\n }\n\n /**\n * Parse name modifiers (?, *, ?*)\n */\n let name = namePart\n let required = /[^a-zA-Z0-9_|-]/.test(name)\n let multiple = false\n\n if (name.endsWith('?*')) {\n required = false\n multiple = true\n name = name.slice(0, -2)\n } else if (name.endsWith('*')) {\n multiple = true\n name = name.slice(0, -1)\n } else if (name.endsWith('?')) {\n required = false\n name = name.slice(0, -1)\n }\n\n /**\n * Check if it's a flag option (starts with --)\n */\n const isFlag = name.startsWith('--')\n let flags: string[] | undefined\n let defaultValue: string | number | boolean | undefined | string[]\n\n if (isFlag) {\n /**\n * Parse flags and default values\n */\n const flagParts = name.split('|').map(s => s.trim())\n\n flags = []\n\n for (let part of flagParts) {\n if (part.startsWith('--') && part.slice(2).length === 1) {\n part = '-' + part.slice(2)\n } else if (part.startsWith('-') && !part.startsWith('--') && part.slice(1).length > 1) {\n part = '--' + part.slice(1)\n } else if (!part.startsWith('-') && part.slice(1).length > 1) {\n part = '--' + part\n }\n\n const eqIndex = part.indexOf('=')\n if (eqIndex !== -1) {\n flags.push(part.substring(0, eqIndex))\n const val = part.substring(eqIndex + 1)\n if (val === '*') {\n defaultValue = []\n } else if (val === 'true' || val === 'false' || (!val && !required)) {\n defaultValue = val === 'true'\n } else if (!isNaN(Number(val))) {\n defaultValue = Number(val)\n } else {\n defaultValue = val\n }\n } else {\n flags.push(part)\n }\n }\n }\n\n options.push({\n name: isFlag ? flags![flags!.length - 1] : name,\n required,\n multiple,\n description,\n flags,\n shared,\n isFlag,\n isHidden,\n defaultValue,\n nestedOptions,\n })\n }\n\n return options\n }\n\n /**\n * Helper to parse a command's signature\n * \n * @param signature \n * @param commandClass \n * @returns \n */\n static parseSignature (signature: string, commandClass: Command): ParsedCommand {\n const lines = signature.split('\\n').map(l => l.trim()).filter(l => l.length > 0)\n const isHidden = ['#', '^'].includes(lines[0][0]!) || /:[#^]/.test(lines[0])\n const baseCommand = lines[0].replace(/[^\\w=:-]/g, '')\n const description = commandClass.getDescription()\n const isNamespaceCommand = baseCommand.endsWith(':')\n\n /**\n * Join the rest lines to a single string for parsing\n */\n const rest = lines.slice(1).join(' ')\n\n /**\n * Parse all top-level options/subcommands\n */\n const allOptions = Signature.parseOptions(rest)\n\n if (isNamespaceCommand) {\n /**\n * Separate subcommands (those without flags) and base options (flags)\n * Here we assume subcommands are those without flags (isFlag false)\n * and base options are flags or options after subcommands\n\n * For simplicity, treat all top-level options as subcommands\n * and assume base command options come after subcommands in signature (not shown in example)\n */\n\n return {\n baseCommand: baseCommand.slice(0, -1),\n isNamespaceCommand,\n subCommands: allOptions.filter(e => !e.flags && !e.isHidden),\n description,\n commandClass,\n options: allOptions.filter(e => !!e.flags),\n isHidden,\n }\n } else {\n return {\n baseCommand,\n isNamespaceCommand,\n options: allOptions,\n description,\n commandClass,\n isHidden,\n }\n }\n }\n}\n","import { dirname, join, resolve } from 'path';\n\nimport { fork } from 'child_process';\n\nfunction run (opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart (options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle (_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle (outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown'\nimport { existsSync } from 'node:fs'\nimport path from 'node:path'\nimport { rm } from 'node:fs/promises'\nimport run from '@rollup/plugin-run'\n\nconst env = process.env.NODE_ENV || 'development'\nconst outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n SRC_PATH: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n hooks (e) {\n e.hook('build:done', async () => {\n const paths = ['database/migrations', 'database/factories', 'database/seeders']\n for (let i = 0; i < paths.length; i++) {\n const name = paths[i]\n if (existsSync(path.join(outDir, name)))\n await rm(path.join(outDir, name), { recursive: true })\n }\n })\n },\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n SRC_PATH: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n}\n\nexport default TsDownConfig\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\nimport { Option, program, type Command as Commander } from 'commander'\n\nimport { Application } from '@h3ravel/core'\nimport { Command } from './Commands/Command'\nimport { Kernel } from './Kernel'\nimport { ListCommand } from './Commands/ListCommand'\nimport { Logger } from '@h3ravel/shared'\nimport { MakeCommand } from './Commands/MakeCommand'\nimport { Signature } from './Signature'\nimport TsDownConfig from './TsdownConfig'\nimport { altLogo } from './logo'\nimport { build } from 'tsdown'\nimport { glob } from 'node:fs/promises'\nimport path from 'node:path'\nimport { PostinstallCommand } from './Commands/PostinstallCommand'\n\n/**\n * Musket is H3ravel's CLI tool\n */\nexport class Musket {\n private commands: ParsedCommand[] = []\n\n constructor(private app: Application, private kernel: Kernel) { }\n\n async build () {\n this.loadBaseCommands()\n await this.loadDiscoveredCommands()\n return this.initialize()\n }\n\n private loadBaseCommands () {\n const commands: Command[] = [\n new MakeCommand(this.app, this.kernel),\n new ListCommand(this.app, this.kernel),\n new PostinstallCommand(this.app, this.kernel),\n ]\n\n commands.forEach(e => this.addCommand(e))\n }\n\n private async loadDiscoveredCommands () {\n const commands: Command[] = [\n ...this.app.registeredCommands.map(cmd => new cmd(this.app, this.kernel))\n ]\n\n /**\n * Musket Commands auto registration\n */\n const providers_path = app_path('Console/Commands/*.js').replace('/src/', '/.h3ravel/serve/')\n\n /** Add the App Commands */\n for await (const cmd of glob(providers_path)) {\n const name = path.basename(cmd).replace('.js', '')\n try {\n const cmdClass = (await import(cmd))[name]\n commands.push(new cmdClass(this.app, this.kernel))\n } catch { /** */ }\n }\n\n commands.forEach(e => this.addCommand(e))\n }\n\n addCommand (command: Command) {\n this.commands.push(Signature.parseSignature(command.getSignature(), command))\n }\n\n private initialize () {\n /** Init the Musket Version */\n const cliVersion = Logger.parse([\n ['Musket CLI:', 'white'],\n [this.kernel.consolePackage.version, 'green']\n ], ' ', false)\n\n /** Init the App Version */\n const localVersion = Logger.parse([\n ['H3ravel Framework:', 'white'],\n [this.kernel.modulePackage.version, 'green']\n ], ' ', false)\n\n const additional = {\n quiet: ['-q, --quiet', 'Do not output any message'],\n silent: ['--silent', 'Do not output any message'],\n verbose: ['-v, --verbose <number>', 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'],\n lock: ['--lock', 'Locked and loaded, do not ask any interactive question'],\n }\n\n /** Init Commander */\n program\n .name('musket')\n .version(`${cliVersion}\\n${localVersion}`)\n .description(altLogo)\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n const instance = new ListCommand(this.app, this.kernel)\n instance.setInput(program.opts(), program.args, program.registeredArguments, {}, program)\n instance.handle()\n })\n\n /** Create the init Command */\n program\n .command('init')\n .description('Initialize H3ravel.')\n .action(async () => {\n Logger.success('Initialized: H3ravel has been initialized!')\n })\n\n /** Loop through all the available commands */\n for (let i = 0; i < this.commands.length; i++) {\n const command = this.commands[i]\n const instance = command.commandClass\n\n if (command.isNamespaceCommand && command.subCommands) {\n /**\n * Initialize the base command\n */\n const cmd = command.isHidden\n ? program\n : program\n .command(command.baseCommand)\n .description(command.description ?? '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n\n /**\n * Add options to the base command if it has any\n */\n if ((command.options?.length ?? 0) > 0) {\n command.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n\n /**\n * Initialize the sub commands\n */\n command\n .subCommands\n .filter((v, i, a) => !v.shared && a.findIndex(t => t.name === v.name) === i)\n .forEach(sub => {\n const cmd = program\n .command(`${command.baseCommand}:${sub.name}`)\n .description(sub.description || '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, sub, program)\n await instance.handle()\n })\n\n /**\n * Add the shared arguments here\n */\n command.subCommands?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add the shared options here\n */\n command.options?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add options to the sub command if it has any\n */\n if (sub.nestedOptions) {\n sub.nestedOptions\n .filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n })\n } else {\n /**\n * Initialize command with options\n */\n const cmd = program\n .command(command.baseCommand)\n .description(command.description ?? '')\n\n command\n ?.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd, true)\n })\n\n cmd.action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n }\n }\n\n /** Rebuild the app on every command except fire so we wont need TS */\n program.hook('preAction', async (_, cmd) => {\n if (cmd.name() !== 'fire') {\n await build({\n ...TsDownConfig,\n watch: false,\n plugins: []\n })\n }\n })\n\n return program\n }\n\n makeOption (opt: CommandOption, cmd: Commander, parse?: boolean, parent?: any) {\n const description = opt.description?.replace(/\\[(\\w+)\\]/g, (_, k) => parent?.[k] ?? `[${k}]`) ?? ''\n const type = opt.name.replaceAll('-', '')\n\n if (opt.isFlag) {\n if (parse) {\n const flags = opt.flags\n ?.map(f => (f.length === 1 ? `-${f}` : `--${f}`)).join(', ')!\n .replaceAll('----', '--')\n .replaceAll('---', '-')\n\n cmd.option(flags || '', description!, String(opt.defaultValue) || undefined)\n } else {\n cmd.option(\n opt.flags?.join(', ') + (opt.required ? ` <${type}>` : ''),\n description!,\n opt.defaultValue as any\n )\n }\n } else {\n cmd.argument(\n opt.required ? `<${opt.name}>` : `[${opt.name}]`,\n description,\n opt.defaultValue\n )\n }\n }\n\n static async parse (kernel: Kernel) {\n return (await new Musket(kernel.app, kernel).build()).parseAsync()\n }\n\n}\n","import { Application, ConsoleKernel } from '@h3ravel/core'\n\nimport { FileSystem } from '@h3ravel/shared'\nimport { Musket } from './Musket'\nimport path from 'node:path'\n\nexport class Kernel extends ConsoleKernel {\n constructor(public app: Application) {\n super(app)\n }\n\n static init (app: Application) {\n const instance = new Kernel(app)\n\n Promise.all([instance.loadRequirements()])\n .then(([e]) => e.run())\n }\n\n\n private async run () {\n await Musket.parse(this)\n process.exit(0)\n }\n\n private async loadRequirements () {\n this.cwd = path.join(process.cwd(), this.basePath)\n this.modulePath = FileSystem.findModulePkg('@h3ravel/core', this.cwd) ?? ''\n this.consolePath = FileSystem.findModulePkg('@h3ravel/console', this.cwd) ?? ''\n\n try {\n this.modulePackage = await import(path.join(this.modulePath, 'package.json'))\n } catch {\n this.modulePackage = { version: 'N/A' }\n }\n\n try {\n this.consolePackage = await import(path.join(this.consolePath, 'package.json'))\n } catch {\n this.consolePackage = { version: 'N/A' }\n }\n\n return this\n }\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { Kernel } from '../Kernel'\nimport { ServiceProvider } from '@h3ravel/core'\n/**\n * Handles CLI commands and tooling.\n * \n * Register DatabaseManager and QueryBuilder.\n * Set up ORM models and relationships.\n * Register migration and seeder commands.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = true\n\n register () {\n }\n\n boot () {\n Kernel.init(this.app)\n\n process.on('SIGINT', () => {\n process.exit(0)\n })\n process.on('SIGTERM', () => {\n process.exit(0)\n })\n }\n}\n"],"x_google_ignoreList":[6],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,UAAb,cAA6BA,8BAAe;;;;ACF5C,MAAa,OAAO,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;AAwB9B,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;AClBjC,IAAa,cAAb,cAAiC,QAAQ;;;;;;CAOrC,AAAU,YAAoB;;;;;;CAO9B,AAAU,cAAsB;CAEhC,MAAa,SAAU;EACnB,MAAM,UAAU,CACZ;GACI,OAAO;GACP,MAAM;GACN,aAAa;GAChB,CACJ,CACI,OAAO,KAAK,QAAQ,QAAQ,CAC5B,KAAI,MAAK;AAIN,UAHaC,wBAAO,SAASA,wBAAO,IAChC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,QAAO,QAAK,CAAC,CAACC,IAAE,CAAC,KAAK,KAAK,EAAE,SAAS,MAClE,EAAE,EAAE,aAAa,IAAI,MAAM,CAChB,KAAK,GAAG;IACtB;EAQN,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,OAAO,CAAC,OAAO,EAAE,YAAY;;;;;;ACvP1E,IAAa,SAAb,MAAa,eAAeI,6BAAc;CACtC,YAAY,AAAOC,KAAkB;AACjC,QAAM,IAAI;EADK;;CAInB,OAAO,KAAM,KAAkB;EAC3B,MAAM,WAAW,IAAI,OAAO,IAAI;AAEhC,UAAQ,IAAI,CAAC,SAAS,kBAAkB,CAAC,CAAC,CACrC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;;CAI/B,MAAc,MAAO;AACjB,QAAM,OAAO,MAAM,KAAK;AACxB,UAAQ,KAAK,EAAE;;CAGnB,MAAc,mBAAoB;AAC9B,OAAK,MAAMC,kBAAK,KAAK,QAAQ,KAAK,EAAE,KAAK,SAAS;AAClD,OAAK,aAAaC,4BAAW,cAAc,iBAAiB,KAAK,IAAI,IAAI;AACzE,OAAK,cAAcA,4BAAW,cAAc,oBAAoB,KAAK,IAAI,IAAI;AAE7E,MAAI;AACA,QAAK,gBAAgB,MAAM,OAAOD,kBAAK,KAAK,KAAK,YAAY,eAAe;UACxE;AACJ,QAAK,gBAAgB,EAAE,SAAS,OAAO;;AAG3C,MAAI;AACA,QAAK,iBAAiB,MAAM,OAAOA,kBAAK,KAAK,KAAK,aAAa,eAAe;UAC1E;AACJ,QAAK,iBAAiB,EAAE,SAAS,OAAO;;AAG5C,SAAO;;;;;;;;;;;;;;;AC5Bf,IAAa,yBAAb,cAA4CE,+BAAgB;CACxD,OAAc,WAAW;;;;CAKzB,OAAc,UAAU;CAExB,WAAY;CAGZ,OAAQ;AACJ,SAAO,KAAK,KAAK,IAAI;AAErB,UAAQ,GAAG,gBAAgB;AACvB,WAAQ,KAAK,EAAE;IACjB;AACF,UAAQ,GAAG,iBAAiB;AACxB,WAAQ,KAAK,EAAE;IACjB"}
package/dist/index.d.cts CHANGED
@@ -91,6 +91,7 @@ declare class PostinstallCommand extends Command {
91
91
  handle(): Promise<void>;
92
92
  /**
93
93
  * Create sqlite database if none exist
94
+ *
94
95
  * @returns
95
96
  */
96
97
  private createSqliteDB;
package/dist/index.d.ts CHANGED
@@ -91,6 +91,7 @@ declare class PostinstallCommand extends Command {
91
91
  handle(): Promise<void>;
92
92
  /**
93
93
  * Create sqlite database if none exist
94
+ *
94
95
  * @returns
95
96
  */
96
97
  private createSqliteDB;
package/dist/index.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { TableGuesser, Utils } from "./Utils-Dn22CO9s.js";
2
2
  import { Application, ConsoleCommand, ConsoleKernel, ServiceProvider } from "@h3ravel/core";
3
3
  import { FileSystem, Logger } from "@h3ravel/shared";
4
- import { glob, mkdir, readFile, writeFile } from "node:fs/promises";
4
+ import { glob, mkdir, readFile, rm, writeFile } from "node:fs/promises";
5
5
  import { beforeLast } from "@h3ravel/support";
6
6
  import dayjs from "dayjs";
7
- import { existsSync } from "node:fs";
8
7
  import nodepath from "node:path";
9
8
  import "@h3ravel/http";
10
9
  import "@h3ravel/router";
@@ -14,6 +13,7 @@ import "@h3ravel/queue";
14
13
  import "@h3ravel/mail";
15
14
  import "@h3ravel/config";
16
15
  import { Option, program } from "commander";
16
+ import { existsSync } from "node:fs";
17
17
  import { dirname, join, resolve } from "path";
18
18
  import { fork } from "child_process";
19
19
  import { build } from "tsdown";
@@ -161,6 +161,7 @@ var MakeCommand = class extends Command {
161
161
  description = "Generate component classes";
162
162
  async handle() {
163
163
  const command = this.dictionary.baseCommand ?? this.dictionary.name;
164
+ if (!this.argument("name")) this.program.error("Please provide a valid name for the " + command);
164
165
  const methods = {
165
166
  controller: "makeController",
166
167
  resource: "makeResource",
@@ -183,11 +184,11 @@ var MakeCommand = class extends Command {
183
184
  const type = this.option("api") ? "-resource" : "";
184
185
  const name = this.argument("name");
185
186
  const force = this.option("force");
186
- const path = nodepath.join(app_path("Http/Controllers"), name + ".ts");
187
+ const path = app_path(`Http/Controllers/${name}.ts`);
187
188
  const crtlrPath = FileSystem.findModulePkg("@h3ravel/http", this.kernel.cwd) ?? "";
188
189
  const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`);
189
190
  /** Check if the controller already exists */
190
- if (!force && existsSync(path)) Logger.error(`ERORR: ${name} controller already exists`);
191
+ if (!force && await FileSystem.fileExists(path)) Logger.error(`ERORR: ${name} controller already exists`);
191
192
  let stub = await readFile(stubPath, "utf-8");
192
193
  stub = stub.replace(/{{ name }}/g, name);
193
194
  await writeFile(path, stub);
@@ -202,7 +203,7 @@ var MakeCommand = class extends Command {
202
203
  async makeMigration() {
203
204
  const name = this.argument("name");
204
205
  const datePrefix = dayjs().format("YYYY_MM_DD_HHmmss");
205
- const path = nodepath.join(database_path("migrations"), `${datePrefix}_${name}.ts`);
206
+ const path = database_path(`migrations/${datePrefix}_${name}.ts`);
206
207
  const crtlrPath = FileSystem.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
207
208
  let create = this.option("create", false);
208
209
  let table = this.option("table");
@@ -242,9 +243,9 @@ var MakeCommand = class extends Command {
242
243
  const type = this.option("type", "ts");
243
244
  const name = this.argument("name");
244
245
  const force = this.argument("force");
245
- const path = nodepath.join(app_path("Models"), name.toLowerCase(), "." + type);
246
+ const path = app_path(`Models/${name.toLowerCase()}.${type}`);
246
247
  /** Check if the model already exists */
247
- if (!force && existsSync(path)) Logger.error(`ERORR: ${name} view already exists`);
248
+ if (!force && await FileSystem.fileExists(path)) Logger.error(`ERORR: ${name} model already exists`);
248
249
  const crtlrPath = FileSystem.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
249
250
  const stubPath = nodepath.join(crtlrPath, `dist/stubs/model-${type}.stub`);
250
251
  let stub = await readFile(stubPath, "utf-8");
@@ -258,10 +259,10 @@ var MakeCommand = class extends Command {
258
259
  async makeView() {
259
260
  const name = this.argument("name");
260
261
  const force = this.option("force");
261
- const path = nodepath.join(base_path("src/resources/views"), name + ".edge");
262
+ const path = base_path(`src/resources/views/${name}.edge`);
262
263
  if (name.includes("/")) await mkdir(beforeLast(path, "/"), { recursive: true });
263
264
  /** Check if the view already exists */
264
- if (!force && existsSync(path)) Logger.error(`ERORR: ${name} view already exists`);
265
+ if (!force && await FileSystem.fileExists(path)) Logger.error(`ERORR: ${name} view already exists`);
265
266
  await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`);
266
267
  Logger.split("INFO: View Created", Logger.log(`src/resources/views/${name}.edge`, "gray", false));
267
268
  }
@@ -302,6 +303,7 @@ var PostinstallCommand = class extends Command {
302
303
  }
303
304
  /**
304
305
  * Create sqlite database if none exist
306
+ *
305
307
  * @returns
306
308
  */
307
309
  async createSqliteDB() {
@@ -558,6 +560,19 @@ const TsDownConfig = {
558
560
  logLevel: "silent",
559
561
  nodeProtocol: true,
560
562
  skipNodeModulesBundle: true,
563
+ hooks(e) {
564
+ e.hook("build:done", async () => {
565
+ const paths = [
566
+ "database/migrations",
567
+ "database/factories",
568
+ "database/seeders"
569
+ ];
570
+ for (let i = 0; i < paths.length; i++) {
571
+ const name = paths[i];
572
+ if (existsSync(nodepath.join(outDir, name))) await rm(nodepath.join(outDir, name), { recursive: true });
573
+ }
574
+ });
575
+ },
561
576
  plugins: env === "development" && process.env.CLI_BUILD !== "true" ? [run({
562
577
  env: Object.assign({}, process.env, {
563
578
  NODE_ENV: env,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["e","stub: string","options: CommandOption[]","nestedOptions: CommandOption[] | undefined","flags: string[] | undefined","defaultValue: string | number | boolean | undefined | string[]","dir","entryFileName","TsDownConfig: Options","app: Application","kernel: Kernel","commands: Command[]","path","i","cmd","TsDownConfig","app: Application","path"],"sources":["../src/Commands/Command.ts","../src/logo.ts","../src/Commands/ListCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/PostinstallCommand.ts","../src/Signature.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Musket.ts","../src/Kernel.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { ConsoleCommand } from '@h3ravel/core'\n\nexport class Command extends ConsoleCommand { }\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","import { Command } from './Command'\nimport { Logger } from '@h3ravel/shared'\nimport { Option } from 'commander'\n/* eslint-disable no-control-regex */\nimport { altLogo } from '../logo'\n\nexport class ListCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'list'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'List all available commands'\n\n public async handle () {\n const options = [\n {\n short: '-h',\n long: '--help',\n description: 'Display help for the given command. When no command is given display help for the list command'\n } as Option\n ]\n .concat(this.program.options)\n .map(e => {\n const desc = Logger.describe(Logger.log(\n ' ' + [e.short, e.long].filter(e => !!e).join(', '), 'green', false\n ), e.description, 25, false)\n return desc.join('')\n })\n\n /** Get the program commands */\n const commands = this.program.commands.map(e => {\n const desc = Logger.describe(Logger.log(' ' + e.name(), 'green', false), e.description(), 25, false)\n return desc.join('')\n })\n\n const grouped = commands.reduce<Record<string, string[]>>((acc, cmd) => {\n /** strip colors before checking prefix */\n const clean = cmd.replace(/\\x1b\\[\\d+m/g, '')\n const prefix = clean.includes(':') ? clean.split(':')[0].trim() : '__root__'\n acc[prefix] ??= []\n /** keep original with colors */\n acc[prefix].push(cmd)\n return acc\n }, {})\n\n const list = Object.entries(grouped).map(([group, cmds]) => {\n const label = group === '__root__' ? '' : group\n return [Logger.log(label, 'yellow', false), cmds.join('\\n')].join('\\n')\n })\n\n /** Ootput the app version */\n Logger.log([['H3ravel Framework', 'white'], [this.kernel.modulePackage.version, 'green']], ' ')\n\n console.log('')\n\n console.log(altLogo)\n\n console.log('')\n\n Logger.log('Usage:', 'yellow')\n Logger.log(' command [options] [arguments]', 'white')\n\n console.log('')\n\n /** Ootput the options */\n Logger.log('Options:', 'yellow')\n console.log(options.join('\\n').trim())\n\n console.log('')\n\n /** Ootput the commands */\n Logger.log('Available Commands:', 'yellow')\n console.log(list.join('\\n\\n').trim())\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from './Command'\nimport { TableGuesser } from '../Utils'\nimport { beforeLast } from '@h3ravel/support'\nimport dayjs from 'dayjs'\nimport { existsSync } from 'node:fs'\nimport nodepath from 'node:path'\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Create a new controller class. \n | {--a|api : Exclude the create and edit methods from the controller} \n | {--m|model= : Generate a resource controller for the given model} \n | {--r|resource : Generate a resource controller class} \n | {--force : Create the controller even if it already exists}\n }\n {resource : Create a new resource. \n | {--c|collection : Create a resource collection}\n | {--force : Create the resource even if it already exists}\n }\n {migration : Generates a new database migration class. \n | {--l|type=ts : The file type to generate} \n | {--t|table : The table to migrate} \n | {--c|create : The table to be created} \n }\n {factory : Create a new model factory.}\n {seeder : Create a new seeder class.}\n {view : Create a new view.\n | {--force : Create the view even if it already exists}\n }\n {model : Create a new Eloquent model class. \n | {--api : Indicates if the generated controller should be an API resource controller} \n | {--c|controller : Create a new controller for the model} \n | {--f|factory : Create a new factory for the model} \n | {--m|migration : Create a new migration file for the model} \n | {--r|resource : Indicates if the generated controller should be a resource controller} \n | {--a|all : Generate a migration, seeder, factory, policy, resource controller, and form request classes for the model} \n | {--s|seed : Create a new seeder for the model} \n | {--t|type=ts : The file type to generate}\n | {--force : Create the model even if it already exists}\n } \n {^name : The name of the [name] to generate}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes'\n\n public async handle () {\n const command = (this.dictionary.baseCommand ?? this.dictionary.name) as never\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n migration: 'makeMigration',\n factory: 'makeFactory',\n seeder: 'makeSeeder',\n model: 'makeModel',\n view: 'makeView',\n } as const\n\n try {\n await (this as any)?.[methods[command]]()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n /**\n * Create a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : ''\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = nodepath.join(app_path('Http/Controllers'), name + '.ts')\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n\n /** Check if the controller already exists */\n if (!force && existsSync(path)) {\n Logger.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Controller Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n protected makeResource () {\n Logger.success('Resource support is not yet available')\n }\n\n /**\n * Generate a new database migration class\n */\n protected async makeMigration () {\n const name = this.argument('name')\n const datePrefix = dayjs().format('YYYY_MM_DD_HHmmss')\n const path = nodepath.join(database_path('migrations'), `${datePrefix}_${name}.ts`)\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n\n let create = this.option('create', false)\n let table = this.option('table')\n if (!table && typeof create === 'string') {\n table = create\n create = true\n }\n\n if (!table) {\n const guessed = TableGuesser.guess(name)\n table = guessed[0]\n create = !!guessed[1]\n }\n\n const stubPath = nodepath.join(crtlrPath, this.getMigrationStubName(table, create))\n let stub = await readFile(stubPath, 'utf-8')\n\n if (table !== null) {\n stub = stub.replace(/DummyTable|{{\\s*table\\s*}}/g, table)\n }\n\n Logger.info('INFO: Creating Migration')\n\n await this.kernel.ensureDirectoryExists(nodepath.dirname(path))\n await writeFile(path, stub)\n\n Logger.split('INFO: Migration Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new model factory\n */\n protected makeFactory () {\n Logger.success('Factory support is not yet available')\n }\n\n /**\n * Create a new seeder class\n */\n protected makeSeeder () {\n Logger.success('Seeder support is not yet available')\n }\n\n /**\n * Generate a new Arquebus model class\n */\n protected async makeModel () {\n const type = this.option('type', 'ts')\n const name = this.argument('name')\n const force = this.argument('force')\n\n const path = nodepath.join(app_path('Models'), name.toLowerCase(), '.' + type)\n\n /** Check if the model already exists */\n if (!force && existsSync(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/model-${type}.stub`)\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Model Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new view.\n */\n protected async makeView () {\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = nodepath.join(base_path('src/resources/views'), name + '.edge')\n\n if (name.includes('/')) {\n await mkdir(beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the view already exists */\n if (!force && existsSync(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`)\n Logger.split('INFO: View Created', Logger.log(`src/resources/views/${name}.edge`, 'gray', false))\n }\n\n /**\n * Ge the database migration file name\n * \n * @param table \n * @param create \n * @param type \n * @returns \n */\n getMigrationStubName (table?: string, create: boolean = false, type: 'ts' | 'js' = 'ts') {\n let stub: string\n if (!table) {\n stub = `migration-${type}.stub`\n }\n else if (create) {\n stub = `migration.create-${type}.stub`\n }\n else {\n stub = `migration.update-${type}.stub`\n }\n return 'dist/stubs/' + stub\n }\n}\n","import { mkdir, writeFile } from 'node:fs/promises'\n\nimport { Command } from './Command'\nimport { FileSystem } from '@h3ravel/shared'\n\nexport class PostinstallCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'postinstall'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Default post installation command'\n\n public async handle () {\n this.createSqliteDB()\n }\n\n /**\n * Create sqlite database if none exist\n * @returns \n */\n private async createSqliteDB () {\n if (config('database.default') !== 'sqlite') return\n\n if (!await FileSystem.fileExists(database_path())) {\n await mkdir(database_path(), { recursive: true })\n }\n\n if (!await FileSystem.fileExists(database_path('db.sqlite'))) {\n await writeFile(database_path('db.sqlite'), '')\n }\n }\n}\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\n\nimport { Command } from './Commands/Command'\n\nexport class Signature {\n /**\n * Helper to parse options inside a block of text\n * \n * @param block \n * @returns \n */\n static parseOptions (block: string): CommandOption[] {\n const options: CommandOption[] = []\n /**\n * Match { ... } blocks at top level \n */\n const regex = /\\{([^{}]+(?:\\{[^{}]*\\}[^{}]*)*)\\}/g\n let match\n\n while ((match = regex.exec(block)) !== null) {\n const shared = '^' === match[1][0]! || /:[#^]/.test(match[1])\n const isHidden = (['#', '^'].includes(match[1][0]!) || /:[#^]/.test(match[1])) && !shared\n const content = match[1].trim().replace(/[#^]/, '')\n /**\n * Split by first ':' to separate name and description+nested\n */\n const colonIndex = content.indexOf(':')\n if (colonIndex === -1) {\n /**\n * No description, treat whole as name\n */\n options.push({ name: content })\n continue\n }\n\n const namePart = content.substring(0, colonIndex).trim()\n const rest = content.substring(colonIndex + 1).trim()\n\n /**\n * Check for nested options after '|'\n */\n let description = rest\n let nestedOptions: CommandOption[] | undefined\n\n const pipeIndex = rest.indexOf('|')\n if (pipeIndex !== -1) {\n description = rest.substring(0, pipeIndex).trim()\n const nestedText = rest.substring(pipeIndex + 1).trim()\n /**\n * nestedText should start with '{' and end with ')', clean it\n * Also Remove trailing ')' if present\n */\n const cleanedNestedText = nestedText.replace(/^\\{/, '').trim()\n\n /**\n * Parse nested options recursively\n */\n nestedOptions = Signature.parseOptions('{' + cleanedNestedText + '}')\n } else {\n /**\n * Trim the string\n */\n description = description.trim()\n }\n\n /**\n * Parse name modifiers (?, *, ?*)\n */\n let name = namePart\n let required = /[^a-zA-Z0-9_|-]/.test(name)\n let multiple = false\n\n if (name.endsWith('?*')) {\n required = false\n multiple = true\n name = name.slice(0, -2)\n } else if (name.endsWith('*')) {\n multiple = true\n name = name.slice(0, -1)\n } else if (name.endsWith('?')) {\n required = false\n name = name.slice(0, -1)\n }\n\n /**\n * Check if it's a flag option (starts with --)\n */\n const isFlag = name.startsWith('--')\n let flags: string[] | undefined\n let defaultValue: string | number | boolean | undefined | string[]\n\n if (isFlag) {\n /**\n * Parse flags and default values\n */\n const flagParts = name.split('|').map(s => s.trim())\n\n flags = []\n\n for (let part of flagParts) {\n if (part.startsWith('--') && part.slice(2).length === 1) {\n part = '-' + part.slice(2)\n } else if (part.startsWith('-') && !part.startsWith('--') && part.slice(1).length > 1) {\n part = '--' + part.slice(1)\n } else if (!part.startsWith('-') && part.slice(1).length > 1) {\n part = '--' + part\n }\n\n const eqIndex = part.indexOf('=')\n if (eqIndex !== -1) {\n flags.push(part.substring(0, eqIndex))\n const val = part.substring(eqIndex + 1)\n if (val === '*') {\n defaultValue = []\n } else if (val === 'true' || val === 'false' || (!val && !required)) {\n defaultValue = val === 'true'\n } else if (!isNaN(Number(val))) {\n defaultValue = Number(val)\n } else {\n defaultValue = val\n }\n } else {\n flags.push(part)\n }\n }\n }\n\n options.push({\n name: isFlag ? flags![flags!.length - 1] : name,\n required,\n multiple,\n description,\n flags,\n shared,\n isFlag,\n isHidden,\n defaultValue,\n nestedOptions,\n })\n }\n\n return options\n }\n\n /**\n * Helper to parse a command's signature\n * \n * @param signature \n * @param commandClass \n * @returns \n */\n static parseSignature (signature: string, commandClass: Command): ParsedCommand {\n const lines = signature.split('\\n').map(l => l.trim()).filter(l => l.length > 0)\n const isHidden = ['#', '^'].includes(lines[0][0]!) || /:[#^]/.test(lines[0])\n const baseCommand = lines[0].replace(/[^\\w=:-]/g, '')\n const description = commandClass.getDescription()\n const isNamespaceCommand = baseCommand.endsWith(':')\n\n /**\n * Join the rest lines to a single string for parsing\n */\n const rest = lines.slice(1).join(' ')\n\n /**\n * Parse all top-level options/subcommands\n */\n const allOptions = Signature.parseOptions(rest)\n\n if (isNamespaceCommand) {\n /**\n * Separate subcommands (those without flags) and base options (flags)\n * Here we assume subcommands are those without flags (isFlag false)\n * and base options are flags or options after subcommands\n\n * For simplicity, treat all top-level options as subcommands\n * and assume base command options come after subcommands in signature (not shown in example)\n */\n\n return {\n baseCommand: baseCommand.slice(0, -1),\n isNamespaceCommand,\n subCommands: allOptions.filter(e => !e.flags && !e.isHidden),\n description,\n commandClass,\n options: allOptions.filter(e => !!e.flags),\n isHidden,\n }\n } else {\n return {\n baseCommand,\n isNamespaceCommand,\n options: allOptions,\n description,\n commandClass,\n isHidden,\n }\n }\n }\n}\n","import { dirname, join, resolve } from 'path';\n\nimport { fork } from 'child_process';\n\nfunction run (opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart (options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle (_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle (outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown'\nimport run from '@rollup/plugin-run'\n\nconst env = process.env.NODE_ENV || 'development'\nconst outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n SRC_PATH: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n SRC_PATH: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n}\n\nexport default TsDownConfig\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\nimport { Option, program, type Command as Commander } from 'commander'\n\nimport { Application } from '@h3ravel/core'\nimport { Command } from './Commands/Command'\nimport { Kernel } from './Kernel'\nimport { ListCommand } from './Commands/ListCommand'\nimport { Logger } from '@h3ravel/shared'\nimport { MakeCommand } from './Commands/MakeCommand'\nimport { Signature } from './Signature'\nimport TsDownConfig from './TsdownConfig'\nimport { altLogo } from './logo'\nimport { build } from 'tsdown'\nimport { glob } from 'node:fs/promises'\nimport path from 'node:path'\nimport { PostinstallCommand } from './Commands/PostinstallCommand'\n\n/**\n * Musket is H3ravel's CLI tool\n */\nexport class Musket {\n private commands: ParsedCommand[] = []\n\n constructor(private app: Application, private kernel: Kernel) { }\n\n async build () {\n this.loadBaseCommands()\n await this.loadDiscoveredCommands()\n return this.initialize()\n }\n\n private loadBaseCommands () {\n const commands: Command[] = [\n new MakeCommand(this.app, this.kernel),\n new ListCommand(this.app, this.kernel),\n new PostinstallCommand(this.app, this.kernel),\n ]\n\n commands.forEach(e => this.addCommand(e))\n }\n\n private async loadDiscoveredCommands () {\n const commands: Command[] = [\n ...this.app.registeredCommands.map(cmd => new cmd(this.app, this.kernel))\n ]\n\n /**\n * Musket Commands auto registration\n */\n const providers_path = app_path('Console/Commands/*.js').replace('/src/', '/.h3ravel/serve/')\n\n /** Add the App Commands */\n for await (const cmd of glob(providers_path)) {\n const name = path.basename(cmd).replace('.js', '')\n try {\n const cmdClass = (await import(cmd))[name]\n commands.push(new cmdClass(this.app, this.kernel))\n } catch { /** */ }\n }\n\n commands.forEach(e => this.addCommand(e))\n }\n\n addCommand (command: Command) {\n this.commands.push(Signature.parseSignature(command.getSignature(), command))\n }\n\n private initialize () {\n /** Init the Musket Version */\n const cliVersion = Logger.parse([\n ['Musket CLI:', 'white'],\n [this.kernel.consolePackage.version, 'green']\n ], ' ', false)\n\n /** Init the App Version */\n const localVersion = Logger.parse([\n ['H3ravel Framework:', 'white'],\n [this.kernel.modulePackage.version, 'green']\n ], ' ', false)\n\n const additional = {\n quiet: ['-q, --quiet', 'Do not output any message'],\n silent: ['--silent', 'Do not output any message'],\n verbose: ['-v, --verbose <number>', 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'],\n lock: ['--lock', 'Locked and loaded, do not ask any interactive question'],\n }\n\n /** Init Commander */\n program\n .name('musket')\n .version(`${cliVersion}\\n${localVersion}`)\n .description(altLogo)\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n const instance = new ListCommand(this.app, this.kernel)\n instance.setInput(program.opts(), program.args, program.registeredArguments, {}, program)\n instance.handle()\n })\n\n /** Create the init Command */\n program\n .command('init')\n .description('Initialize H3ravel.')\n .action(async () => {\n Logger.success('Initialized: H3ravel has been initialized!')\n })\n\n /** Loop through all the available commands */\n for (let i = 0; i < this.commands.length; i++) {\n const command = this.commands[i]\n const instance = command.commandClass\n\n if (command.isNamespaceCommand && command.subCommands) {\n /**\n * Initialize the base command\n */\n const cmd = command.isHidden\n ? program\n : program\n .command(command.baseCommand)\n .description(command.description ?? '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n\n /**\n * Add options to the base command if it has any\n */\n if ((command.options?.length ?? 0) > 0) {\n command.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n\n /**\n * Initialize the sub commands\n */\n command\n .subCommands\n .filter((v, i, a) => !v.shared && a.findIndex(t => t.name === v.name) === i)\n .forEach(sub => {\n const cmd = program\n .command(`${command.baseCommand}:${sub.name}`)\n .description(sub.description || '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, sub, program)\n await instance.handle()\n })\n\n /**\n * Add the shared arguments here\n */\n command.subCommands?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add the shared options here\n */\n command.options?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add options to the sub command if it has any\n */\n if (sub.nestedOptions) {\n sub.nestedOptions\n .filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n })\n } else {\n /**\n * Initialize command with options\n */\n const cmd = program\n .command(command.baseCommand)\n .description(command.description ?? '')\n\n command\n ?.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd, true)\n })\n\n cmd.action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n }\n }\n\n /** Rebuild the app on every command except fire so we wont need TS */\n program.hook('preAction', async (_, cmd) => {\n if (cmd.name() !== 'fire') {\n await build({\n ...TsDownConfig,\n watch: false,\n plugins: []\n })\n }\n })\n\n return program\n }\n\n makeOption (opt: CommandOption, cmd: Commander, parse?: boolean, parent?: any) {\n const description = opt.description?.replace(/\\[(\\w+)\\]/g, (_, k) => parent?.[k] ?? `[${k}]`) ?? ''\n const type = opt.name.replaceAll('-', '')\n\n if (opt.isFlag) {\n if (parse) {\n const flags = opt.flags\n ?.map(f => (f.length === 1 ? `-${f}` : `--${f}`)).join(', ')!\n .replaceAll('----', '--')\n .replaceAll('---', '-')\n\n cmd.option(flags || '', description!, String(opt.defaultValue) || undefined)\n } else {\n cmd.option(\n opt.flags?.join(', ') + (opt.required ? ` <${type}>` : ''),\n description!,\n opt.defaultValue as any\n )\n }\n } else {\n cmd.argument(\n opt.required ? `<${opt.name}>` : `[${opt.name}]`,\n description,\n opt.defaultValue\n )\n }\n }\n\n static async parse (kernel: Kernel) {\n return (await new Musket(kernel.app, kernel).build()).parseAsync()\n }\n\n}\n","import { Application, ConsoleKernel } from '@h3ravel/core'\n\nimport { FileSystem } from '@h3ravel/shared'\nimport { Musket } from './Musket'\nimport path from 'node:path'\n\nexport class Kernel extends ConsoleKernel {\n constructor(public app: Application) {\n super(app)\n }\n\n static init (app: Application) {\n const instance = new Kernel(app)\n\n Promise.all([instance.loadRequirements()])\n .then(([e]) => e.run())\n }\n\n\n private async run () {\n await Musket.parse(this)\n process.exit(0)\n }\n\n private async loadRequirements () {\n this.cwd = path.join(process.cwd(), this.basePath)\n this.modulePath = FileSystem.findModulePkg('@h3ravel/core', this.cwd) ?? ''\n this.consolePath = FileSystem.findModulePkg('@h3ravel/console', this.cwd) ?? ''\n\n try {\n this.modulePackage = await import(path.join(this.modulePath, 'package.json'))\n } catch {\n this.modulePackage = { version: 'N/A' }\n }\n\n try {\n this.consolePackage = await import(path.join(this.consolePath, 'package.json'))\n } catch {\n this.consolePackage = { version: 'N/A' }\n }\n\n return this\n }\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { Kernel } from '../Kernel'\nimport { ServiceProvider } from '@h3ravel/core'\n/**\n * Handles CLI commands and tooling.\n * \n * Register DatabaseManager and QueryBuilder.\n * Set up ORM models and relationships.\n * Register migration and seeder commands.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = true\n\n register () {\n }\n\n boot () {\n Kernel.init(this.app)\n\n process.on('SIGINT', () => {\n process.exit(0)\n })\n process.on('SIGTERM', () => {\n process.exit(0)\n })\n }\n}\n"],"x_google_ignoreList":[6],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,UAAb,cAA6B,eAAe;;;;ACF5C,MAAa,OAAO,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;AAwB9B,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;AClBjC,IAAa,cAAb,cAAiC,QAAQ;;;;;;CAOrC,AAAU,YAAoB;;;;;;CAO9B,AAAU,cAAsB;CAEhC,MAAa,SAAU;EACnB,MAAM,UAAU,CACZ;GACI,OAAO;GACP,MAAM;GACN,aAAa;GAChB,CACJ,CACI,OAAO,KAAK,QAAQ,QAAQ,CAC5B,KAAI,MAAK;AAIN,UAHa,OAAO,SAAS,OAAO,IAChC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,QAAO,QAAK,CAAC,CAACA,IAAE,CAAC,KAAK,KAAK,EAAE,SAAS,MAClE,EAAE,EAAE,aAAa,IAAI,MAAM,CAChB,KAAK,GAAG;IACtB;EAQN,MAAM,UALW,KAAK,QAAQ,SAAS,KAAI,MAAK;AAE5C,UADa,OAAO,SAAS,OAAO,IAAI,OAAO,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,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,cAAc,oBAAoB,KAAK,IAAI,IAAI;AAE7E,MAAI;AACA,QAAK,gBAAgB,MAAM,OAAOA,SAAK,KAAK,KAAK,YAAY,eAAe;UACxE;AACJ,QAAK,gBAAgB,EAAE,SAAS,OAAO;;AAG3C,MAAI;AACA,QAAK,iBAAiB,MAAM,OAAOA,SAAK,KAAK,KAAK,aAAa,eAAe;UAC1E;AACJ,QAAK,iBAAiB,EAAE,SAAS,OAAO;;AAG5C,SAAO;;;;;;;;;;;;;;;AC5Bf,IAAa,yBAAb,cAA4C,gBAAgB;CACxD,OAAc,WAAW;;;;CAKzB,OAAc,UAAU;CAExB,WAAY;CAGZ,OAAQ;AACJ,SAAO,KAAK,KAAK,IAAI;AAErB,UAAQ,GAAG,gBAAgB;AACvB,WAAQ,KAAK,EAAE;IACjB;AACF,UAAQ,GAAG,iBAAiB;AACxB,WAAQ,KAAK,EAAE;IACjB"}
1
+ {"version":3,"file":"index.js","names":["e","stub: string","options: CommandOption[]","nestedOptions: CommandOption[] | undefined","flags: string[] | undefined","defaultValue: string | number | boolean | undefined | string[]","dir","entryFileName","TsDownConfig: Options","path","app: Application","kernel: Kernel","commands: Command[]","path","i","cmd","TsDownConfig","app: Application","path"],"sources":["../src/Commands/Command.ts","../src/logo.ts","../src/Commands/ListCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/PostinstallCommand.ts","../src/Signature.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Musket.ts","../src/Kernel.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { ConsoleCommand } from '@h3ravel/core'\n\nexport class Command extends ConsoleCommand { }\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","import { Command } from './Command'\nimport { Logger } from '@h3ravel/shared'\nimport { Option } from 'commander'\n/* eslint-disable no-control-regex */\nimport { altLogo } from '../logo'\n\nexport class ListCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'list'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'List all available commands'\n\n public async handle () {\n const options = [\n {\n short: '-h',\n long: '--help',\n description: 'Display help for the given command. When no command is given display help for the list command'\n } as Option\n ]\n .concat(this.program.options)\n .map(e => {\n const desc = Logger.describe(Logger.log(\n ' ' + [e.short, e.long].filter(e => !!e).join(', '), 'green', false\n ), e.description, 25, false)\n return desc.join('')\n })\n\n /** Get the program commands */\n const commands = this.program.commands.map(e => {\n const desc = Logger.describe(Logger.log(' ' + e.name(), 'green', false), e.description(), 25, false)\n return desc.join('')\n })\n\n const grouped = commands.reduce<Record<string, string[]>>((acc, cmd) => {\n /** strip colors before checking prefix */\n const clean = cmd.replace(/\\x1b\\[\\d+m/g, '')\n const prefix = clean.includes(':') ? clean.split(':')[0].trim() : '__root__'\n acc[prefix] ??= []\n /** keep original with colors */\n acc[prefix].push(cmd)\n return acc\n }, {})\n\n const list = Object.entries(grouped).map(([group, cmds]) => {\n const label = group === '__root__' ? '' : group\n return [Logger.log(label, 'yellow', false), cmds.join('\\n')].join('\\n')\n })\n\n /** Ootput the app version */\n Logger.log([['H3ravel Framework', 'white'], [this.kernel.modulePackage.version, 'green']], ' ')\n\n console.log('')\n\n console.log(altLogo)\n\n console.log('')\n\n Logger.log('Usage:', 'yellow')\n Logger.log(' command [options] [arguments]', 'white')\n\n console.log('')\n\n /** Ootput the options */\n Logger.log('Options:', 'yellow')\n console.log(options.join('\\n').trim())\n\n console.log('')\n\n /** Ootput the commands */\n Logger.log('Available Commands:', 'yellow')\n console.log(list.join('\\n\\n').trim())\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from './Command'\nimport { TableGuesser } from '../Utils'\nimport { beforeLast } from '@h3ravel/support'\nimport dayjs from 'dayjs'\nimport nodepath from 'node:path'\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Create a new controller class. \n | {--a|api : Exclude the create and edit methods from the controller} \n | {--m|model= : Generate a resource controller for the given model} \n | {--r|resource : Generate a resource controller class} \n | {--force : Create the controller even if it already exists}\n }\n {resource : Create a new resource. \n | {--c|collection : Create a resource collection}\n | {--force : Create the resource even if it already exists}\n }\n {migration : Generates a new database migration class. \n | {--l|type=ts : The file type to generate} \n | {--t|table : The table to migrate} \n | {--c|create : The table to be created} \n }\n {factory : Create a new model factory.}\n {seeder : Create a new seeder class.}\n {view : Create a new view.\n | {--force : Create the view even if it already exists}\n }\n {model : Create a new Eloquent model class. \n | {--api : Indicates if the generated controller should be an API resource controller} \n | {--c|controller : Create a new controller for the model} \n | {--f|factory : Create a new factory for the model} \n | {--m|migration : Create a new migration file for the model} \n | {--r|resource : Indicates if the generated controller should be a resource controller} \n | {--a|all : Generate a migration, seeder, factory, policy, resource controller, and form request classes for the model} \n | {--s|seed : Create a new seeder for the model} \n | {--t|type=ts : The file type to generate}\n | {--force : Create the model even if it already exists}\n } \n {^name : The name of the [name] to generate}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes'\n\n public async handle () {\n const command = (this.dictionary.baseCommand ?? this.dictionary.name) as never\n\n if (!this.argument('name')) {\n this.program.error('Please provide a valid name for the ' + command)\n }\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n migration: 'makeMigration',\n factory: 'makeFactory',\n seeder: 'makeSeeder',\n model: 'makeModel',\n view: 'makeView',\n } as const\n\n try {\n await (this as any)?.[methods[command]]()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n /**\n * Create a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : ''\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = app_path(`Http/Controllers/${name}.ts`)\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n\n /** Check if the controller already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Controller Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n protected makeResource () {\n Logger.success('Resource support is not yet available')\n }\n\n /**\n * Generate a new database migration class\n */\n protected async makeMigration () {\n const name = this.argument('name')\n const datePrefix = dayjs().format('YYYY_MM_DD_HHmmss')\n const path = database_path(`migrations/${datePrefix}_${name}.ts`)\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n\n let create = this.option('create', false)\n let table = this.option('table')\n if (!table && typeof create === 'string') {\n table = create\n create = true\n }\n\n if (!table) {\n const guessed = TableGuesser.guess(name)\n table = guessed[0]\n create = !!guessed[1]\n }\n\n const stubPath = nodepath.join(crtlrPath, this.getMigrationStubName(table, create))\n let stub = await readFile(stubPath, 'utf-8')\n\n if (table !== null) {\n stub = stub.replace(/DummyTable|{{\\s*table\\s*}}/g, table)\n }\n\n Logger.info('INFO: Creating Migration')\n\n await this.kernel.ensureDirectoryExists(nodepath.dirname(path))\n await writeFile(path, stub)\n\n Logger.split('INFO: Migration Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new model factory\n */\n protected makeFactory () {\n Logger.success('Factory support is not yet available')\n }\n\n /**\n * Create a new seeder class\n */\n protected makeSeeder () {\n Logger.success('Seeder support is not yet available')\n }\n\n /**\n * Generate a new Arquebus model class\n */\n protected async makeModel () {\n const type = this.option('type', 'ts')\n const name = this.argument('name')\n const force = this.argument('force')\n\n const path = app_path(`Models/${name.toLowerCase()}.${type}`)\n\n /** Check if the model already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} model already exists`)\n }\n\n const crtlrPath = FileSystem.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/model-${type}.stub`)\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Model Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new view.\n */\n protected async makeView () {\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = base_path(`src/resources/views/${name}.edge`)\n\n if (name.includes('/')) {\n await mkdir(beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the view already exists */\n if (!force && await FileSystem.fileExists(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`)\n Logger.split('INFO: View Created', Logger.log(`src/resources/views/${name}.edge`, 'gray', false))\n }\n\n /**\n * Ge the database migration file name\n * \n * @param table \n * @param create \n * @param type \n * @returns \n */\n getMigrationStubName (table?: string, create: boolean = false, type: 'ts' | 'js' = 'ts') {\n let stub: string\n if (!table) {\n stub = `migration-${type}.stub`\n }\n else if (create) {\n stub = `migration.create-${type}.stub`\n }\n else {\n stub = `migration.update-${type}.stub`\n }\n return 'dist/stubs/' + stub\n }\n}\n","import { mkdir, writeFile } from 'node:fs/promises'\n\nimport { Command } from './Command'\nimport { FileSystem } from '@h3ravel/shared'\n\nexport class PostinstallCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'postinstall'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Default post installation command'\n\n public async handle () {\n this.createSqliteDB()\n }\n\n /**\n * Create sqlite database if none exist\n * \n * @returns \n */\n private async createSqliteDB () {\n if (config('database.default') !== 'sqlite') return\n\n if (!await FileSystem.fileExists(database_path())) {\n await mkdir(database_path(), { recursive: true })\n }\n\n if (!await FileSystem.fileExists(database_path('db.sqlite'))) {\n await writeFile(database_path('db.sqlite'), '')\n }\n }\n}\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\n\nimport { Command } from './Commands/Command'\n\nexport class Signature {\n /**\n * Helper to parse options inside a block of text\n * \n * @param block \n * @returns \n */\n static parseOptions (block: string): CommandOption[] {\n const options: CommandOption[] = []\n /**\n * Match { ... } blocks at top level \n */\n const regex = /\\{([^{}]+(?:\\{[^{}]*\\}[^{}]*)*)\\}/g\n let match\n\n while ((match = regex.exec(block)) !== null) {\n const shared = '^' === match[1][0]! || /:[#^]/.test(match[1])\n const isHidden = (['#', '^'].includes(match[1][0]!) || /:[#^]/.test(match[1])) && !shared\n const content = match[1].trim().replace(/[#^]/, '')\n /**\n * Split by first ':' to separate name and description+nested\n */\n const colonIndex = content.indexOf(':')\n if (colonIndex === -1) {\n /**\n * No description, treat whole as name\n */\n options.push({ name: content })\n continue\n }\n\n const namePart = content.substring(0, colonIndex).trim()\n const rest = content.substring(colonIndex + 1).trim()\n\n /**\n * Check for nested options after '|'\n */\n let description = rest\n let nestedOptions: CommandOption[] | undefined\n\n const pipeIndex = rest.indexOf('|')\n if (pipeIndex !== -1) {\n description = rest.substring(0, pipeIndex).trim()\n const nestedText = rest.substring(pipeIndex + 1).trim()\n /**\n * nestedText should start with '{' and end with ')', clean it\n * Also Remove trailing ')' if present\n */\n const cleanedNestedText = nestedText.replace(/^\\{/, '').trim()\n\n /**\n * Parse nested options recursively\n */\n nestedOptions = Signature.parseOptions('{' + cleanedNestedText + '}')\n } else {\n /**\n * Trim the string\n */\n description = description.trim()\n }\n\n /**\n * Parse name modifiers (?, *, ?*)\n */\n let name = namePart\n let required = /[^a-zA-Z0-9_|-]/.test(name)\n let multiple = false\n\n if (name.endsWith('?*')) {\n required = false\n multiple = true\n name = name.slice(0, -2)\n } else if (name.endsWith('*')) {\n multiple = true\n name = name.slice(0, -1)\n } else if (name.endsWith('?')) {\n required = false\n name = name.slice(0, -1)\n }\n\n /**\n * Check if it's a flag option (starts with --)\n */\n const isFlag = name.startsWith('--')\n let flags: string[] | undefined\n let defaultValue: string | number | boolean | undefined | string[]\n\n if (isFlag) {\n /**\n * Parse flags and default values\n */\n const flagParts = name.split('|').map(s => s.trim())\n\n flags = []\n\n for (let part of flagParts) {\n if (part.startsWith('--') && part.slice(2).length === 1) {\n part = '-' + part.slice(2)\n } else if (part.startsWith('-') && !part.startsWith('--') && part.slice(1).length > 1) {\n part = '--' + part.slice(1)\n } else if (!part.startsWith('-') && part.slice(1).length > 1) {\n part = '--' + part\n }\n\n const eqIndex = part.indexOf('=')\n if (eqIndex !== -1) {\n flags.push(part.substring(0, eqIndex))\n const val = part.substring(eqIndex + 1)\n if (val === '*') {\n defaultValue = []\n } else if (val === 'true' || val === 'false' || (!val && !required)) {\n defaultValue = val === 'true'\n } else if (!isNaN(Number(val))) {\n defaultValue = Number(val)\n } else {\n defaultValue = val\n }\n } else {\n flags.push(part)\n }\n }\n }\n\n options.push({\n name: isFlag ? flags![flags!.length - 1] : name,\n required,\n multiple,\n description,\n flags,\n shared,\n isFlag,\n isHidden,\n defaultValue,\n nestedOptions,\n })\n }\n\n return options\n }\n\n /**\n * Helper to parse a command's signature\n * \n * @param signature \n * @param commandClass \n * @returns \n */\n static parseSignature (signature: string, commandClass: Command): ParsedCommand {\n const lines = signature.split('\\n').map(l => l.trim()).filter(l => l.length > 0)\n const isHidden = ['#', '^'].includes(lines[0][0]!) || /:[#^]/.test(lines[0])\n const baseCommand = lines[0].replace(/[^\\w=:-]/g, '')\n const description = commandClass.getDescription()\n const isNamespaceCommand = baseCommand.endsWith(':')\n\n /**\n * Join the rest lines to a single string for parsing\n */\n const rest = lines.slice(1).join(' ')\n\n /**\n * Parse all top-level options/subcommands\n */\n const allOptions = Signature.parseOptions(rest)\n\n if (isNamespaceCommand) {\n /**\n * Separate subcommands (those without flags) and base options (flags)\n * Here we assume subcommands are those without flags (isFlag false)\n * and base options are flags or options after subcommands\n\n * For simplicity, treat all top-level options as subcommands\n * and assume base command options come after subcommands in signature (not shown in example)\n */\n\n return {\n baseCommand: baseCommand.slice(0, -1),\n isNamespaceCommand,\n subCommands: allOptions.filter(e => !e.flags && !e.isHidden),\n description,\n commandClass,\n options: allOptions.filter(e => !!e.flags),\n isHidden,\n }\n } else {\n return {\n baseCommand,\n isNamespaceCommand,\n options: allOptions,\n description,\n commandClass,\n isHidden,\n }\n }\n }\n}\n","import { dirname, join, resolve } from 'path';\n\nimport { fork } from 'child_process';\n\nfunction run (opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart (options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle (_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle (outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown'\nimport { existsSync } from 'node:fs'\nimport path from 'node:path'\nimport { rm } from 'node:fs/promises'\nimport run from '@rollup/plugin-run'\n\nconst env = process.env.NODE_ENV || 'development'\nconst outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n SRC_PATH: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n hooks (e) {\n e.hook('build:done', async () => {\n const paths = ['database/migrations', 'database/factories', 'database/seeders']\n for (let i = 0; i < paths.length; i++) {\n const name = paths[i]\n if (existsSync(path.join(outDir, name)))\n await rm(path.join(outDir, name), { recursive: true })\n }\n })\n },\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n SRC_PATH: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n}\n\nexport default TsDownConfig\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\nimport { Option, program, type Command as Commander } from 'commander'\n\nimport { Application } from '@h3ravel/core'\nimport { Command } from './Commands/Command'\nimport { Kernel } from './Kernel'\nimport { ListCommand } from './Commands/ListCommand'\nimport { Logger } from '@h3ravel/shared'\nimport { MakeCommand } from './Commands/MakeCommand'\nimport { Signature } from './Signature'\nimport TsDownConfig from './TsdownConfig'\nimport { altLogo } from './logo'\nimport { build } from 'tsdown'\nimport { glob } from 'node:fs/promises'\nimport path from 'node:path'\nimport { PostinstallCommand } from './Commands/PostinstallCommand'\n\n/**\n * Musket is H3ravel's CLI tool\n */\nexport class Musket {\n private commands: ParsedCommand[] = []\n\n constructor(private app: Application, private kernel: Kernel) { }\n\n async build () {\n this.loadBaseCommands()\n await this.loadDiscoveredCommands()\n return this.initialize()\n }\n\n private loadBaseCommands () {\n const commands: Command[] = [\n new MakeCommand(this.app, this.kernel),\n new ListCommand(this.app, this.kernel),\n new PostinstallCommand(this.app, this.kernel),\n ]\n\n commands.forEach(e => this.addCommand(e))\n }\n\n private async loadDiscoveredCommands () {\n const commands: Command[] = [\n ...this.app.registeredCommands.map(cmd => new cmd(this.app, this.kernel))\n ]\n\n /**\n * Musket Commands auto registration\n */\n const providers_path = app_path('Console/Commands/*.js').replace('/src/', '/.h3ravel/serve/')\n\n /** Add the App Commands */\n for await (const cmd of glob(providers_path)) {\n const name = path.basename(cmd).replace('.js', '')\n try {\n const cmdClass = (await import(cmd))[name]\n commands.push(new cmdClass(this.app, this.kernel))\n } catch { /** */ }\n }\n\n commands.forEach(e => this.addCommand(e))\n }\n\n addCommand (command: Command) {\n this.commands.push(Signature.parseSignature(command.getSignature(), command))\n }\n\n private initialize () {\n /** Init the Musket Version */\n const cliVersion = Logger.parse([\n ['Musket CLI:', 'white'],\n [this.kernel.consolePackage.version, 'green']\n ], ' ', false)\n\n /** Init the App Version */\n const localVersion = Logger.parse([\n ['H3ravel Framework:', 'white'],\n [this.kernel.modulePackage.version, 'green']\n ], ' ', false)\n\n const additional = {\n quiet: ['-q, --quiet', 'Do not output any message'],\n silent: ['--silent', 'Do not output any message'],\n verbose: ['-v, --verbose <number>', 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'],\n lock: ['--lock', 'Locked and loaded, do not ask any interactive question'],\n }\n\n /** Init Commander */\n program\n .name('musket')\n .version(`${cliVersion}\\n${localVersion}`)\n .description(altLogo)\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n const instance = new ListCommand(this.app, this.kernel)\n instance.setInput(program.opts(), program.args, program.registeredArguments, {}, program)\n instance.handle()\n })\n\n /** Create the init Command */\n program\n .command('init')\n .description('Initialize H3ravel.')\n .action(async () => {\n Logger.success('Initialized: H3ravel has been initialized!')\n })\n\n /** Loop through all the available commands */\n for (let i = 0; i < this.commands.length; i++) {\n const command = this.commands[i]\n const instance = command.commandClass\n\n if (command.isNamespaceCommand && command.subCommands) {\n /**\n * Initialize the base command\n */\n const cmd = command.isHidden\n ? program\n : program\n .command(command.baseCommand)\n .description(command.description ?? '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n\n /**\n * Add options to the base command if it has any\n */\n if ((command.options?.length ?? 0) > 0) {\n command.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n\n /**\n * Initialize the sub commands\n */\n command\n .subCommands\n .filter((v, i, a) => !v.shared && a.findIndex(t => t.name === v.name) === i)\n .forEach(sub => {\n const cmd = program\n .command(`${command.baseCommand}:${sub.name}`)\n .description(sub.description || '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, sub, program)\n await instance.handle()\n })\n\n /**\n * Add the shared arguments here\n */\n command.subCommands?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add the shared options here\n */\n command.options?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add options to the sub command if it has any\n */\n if (sub.nestedOptions) {\n sub.nestedOptions\n .filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n })\n } else {\n /**\n * Initialize command with options\n */\n const cmd = program\n .command(command.baseCommand)\n .description(command.description ?? '')\n\n command\n ?.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd, true)\n })\n\n cmd.action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n }\n }\n\n /** Rebuild the app on every command except fire so we wont need TS */\n program.hook('preAction', async (_, cmd) => {\n if (cmd.name() !== 'fire') {\n await build({\n ...TsDownConfig,\n watch: false,\n plugins: []\n })\n }\n })\n\n return program\n }\n\n makeOption (opt: CommandOption, cmd: Commander, parse?: boolean, parent?: any) {\n const description = opt.description?.replace(/\\[(\\w+)\\]/g, (_, k) => parent?.[k] ?? `[${k}]`) ?? ''\n const type = opt.name.replaceAll('-', '')\n\n if (opt.isFlag) {\n if (parse) {\n const flags = opt.flags\n ?.map(f => (f.length === 1 ? `-${f}` : `--${f}`)).join(', ')!\n .replaceAll('----', '--')\n .replaceAll('---', '-')\n\n cmd.option(flags || '', description!, String(opt.defaultValue) || undefined)\n } else {\n cmd.option(\n opt.flags?.join(', ') + (opt.required ? ` <${type}>` : ''),\n description!,\n opt.defaultValue as any\n )\n }\n } else {\n cmd.argument(\n opt.required ? `<${opt.name}>` : `[${opt.name}]`,\n description,\n opt.defaultValue\n )\n }\n }\n\n static async parse (kernel: Kernel) {\n return (await new Musket(kernel.app, kernel).build()).parseAsync()\n }\n\n}\n","import { Application, ConsoleKernel } from '@h3ravel/core'\n\nimport { FileSystem } from '@h3ravel/shared'\nimport { Musket } from './Musket'\nimport path from 'node:path'\n\nexport class Kernel extends ConsoleKernel {\n constructor(public app: Application) {\n super(app)\n }\n\n static init (app: Application) {\n const instance = new Kernel(app)\n\n Promise.all([instance.loadRequirements()])\n .then(([e]) => e.run())\n }\n\n\n private async run () {\n await Musket.parse(this)\n process.exit(0)\n }\n\n private async loadRequirements () {\n this.cwd = path.join(process.cwd(), this.basePath)\n this.modulePath = FileSystem.findModulePkg('@h3ravel/core', this.cwd) ?? ''\n this.consolePath = FileSystem.findModulePkg('@h3ravel/console', this.cwd) ?? ''\n\n try {\n this.modulePackage = await import(path.join(this.modulePath, 'package.json'))\n } catch {\n this.modulePackage = { version: 'N/A' }\n }\n\n try {\n this.consolePackage = await import(path.join(this.consolePath, 'package.json'))\n } catch {\n this.consolePackage = { version: 'N/A' }\n }\n\n return this\n }\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { Kernel } from '../Kernel'\nimport { ServiceProvider } from '@h3ravel/core'\n/**\n * Handles CLI commands and tooling.\n * \n * Register DatabaseManager and QueryBuilder.\n * Set up ORM models and relationships.\n * Register migration and seeder commands.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = true\n\n register () {\n }\n\n boot () {\n Kernel.init(this.app)\n\n process.on('SIGINT', () => {\n process.exit(0)\n })\n process.on('SIGTERM', () => {\n process.exit(0)\n })\n }\n}\n"],"x_google_ignoreList":[6],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,UAAb,cAA6B,eAAe;;;;ACF5C,MAAa,OAAO,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;AAwB9B,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;AClBjC,IAAa,cAAb,cAAiC,QAAQ;;;;;;CAOrC,AAAU,YAAoB;;;;;;CAO9B,AAAU,cAAsB;CAEhC,MAAa,SAAU;EACnB,MAAM,UAAU,CACZ;GACI,OAAO;GACP,MAAM;GACN,aAAa;GAChB,CACJ,CACI,OAAO,KAAK,QAAQ,QAAQ,CAC5B,KAAI,MAAK;AAIN,UAHa,OAAO,SAAS,OAAO,IAChC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,QAAO,QAAK,CAAC,CAACA,IAAE,CAAC,KAAK,KAAK,EAAE,SAAS,MAClE,EAAE,EAAE,aAAa,IAAI,MAAM,CAChB,KAAK,GAAG;IACtB;EAQN,MAAM,UALW,KAAK,QAAQ,SAAS,KAAI,MAAK;AAE5C,UADa,OAAO,SAAS,OAAO,IAAI,OAAO,EAAE,MAA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kB;EAC3B,MAAM,WAAW,IAAI,OAAO,IAAI;AAEhC,UAAQ,IAAI,CAAC,SAAS,kBAAkB,CAAC,CAAC,CACrC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;;CAI/B,MAAc,MAAO;AACjB,QAAM,OAAO,MAAM,KAAK;AACxB,UAAQ,KAAK,EAAE;;CAGnB,MAAc,mBAAoB;AAC9B,OAAK,MAAMC,SAAK,KAAK,QAAQ,KAAK,EAAE,KAAK,SAAS;AAClD,OAAK,aAAa,WAAW,cAAc,iBAAiB,KAAK,IAAI,IAAI;AACzE,OAAK,cAAc,WAAW,cAAc,oBAAoB,KAAK,IAAI,IAAI;AAE7E,MAAI;AACA,QAAK,gBAAgB,MAAM,OAAOA,SAAK,KAAK,KAAK,YAAY,eAAe;UACxE;AACJ,QAAK,gBAAgB,EAAE,SAAS,OAAO;;AAG3C,MAAI;AACA,QAAK,iBAAiB,MAAM,OAAOA,SAAK,KAAK,KAAK,aAAa,eAAe;UAC1E;AACJ,QAAK,iBAAiB,EAAE,SAAS,OAAO;;AAG5C,SAAO;;;;;;;;;;;;;;;AC5Bf,IAAa,yBAAb,cAA4C,gBAAgB;CACxD,OAAc,WAAW;;;;CAKzB,OAAc,UAAU;CAExB,WAAY;CAGZ,OAAQ;AACJ,SAAO,KAAK,KAAK,IAAI;AAErB,UAAQ,GAAG,gBAAgB;AACvB,WAAQ,KAAK,EAAE;IACjB;AACF,UAAQ,GAAG,iBAAiB;AACxB,WAAQ,KAAK,EAAE;IACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/console",
3
- "version": "11.3.2",
3
+ "version": "11.3.4",
4
4
  "description": "CLI utilities for scaffolding, running migrations, tasks and for H3ravel.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -66,14 +66,14 @@
66
66
  "radashi": "^12.6.2",
67
67
  "resolve-from": "^5.0.0",
68
68
  "tsx": "^4.20.5",
69
- "@h3ravel/database": "^11.2.1",
70
- "@h3ravel/config": "^1.4.0",
71
69
  "@h3ravel/cache": "^11.0.1",
70
+ "@h3ravel/config": "^1.4.0",
71
+ "@h3ravel/mail": "^11.0.1",
72
+ "@h3ravel/database": "^11.2.1",
72
73
  "@h3ravel/http": "^11.2.0",
73
74
  "@h3ravel/queue": "^11.0.1",
74
- "@h3ravel/shared": "^0.20.0",
75
75
  "@h3ravel/router": "^1.9.0",
76
- "@h3ravel/mail": "^11.0.1"
76
+ "@h3ravel/shared": "^0.20.0"
77
77
  },
78
78
  "scripts": {
79
79
  "barrelx": "barrelsby --directory src --delete --singleQuotes",