@h3ravel/console 11.10.1 → 11.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/bin/fire.cjs +0 -31
- package/bin/fire.js +0 -31
- package/bin/spawn.cjs +0 -2
- package/bin/spawn.js +0 -2
- package/bin/zero-BGMatB6V.js +0 -1
- package/bin/zero-Ce9OzYZl.cjs +0 -1
- package/dist/index.cjs +0 -453
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -127
- package/dist/index.d.ts +0 -127
- package/dist/index.js +0 -415
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h3ravel/console",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.11.0",
|
|
4
4
|
"description": "CLI utilities for scaffolding, running migrations, tasks and for H3ravel.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"preferred-pm": "^4.1.1",
|
|
66
66
|
"radashi": "^12.6.2",
|
|
67
67
|
"resolve-from": "^5.0.0",
|
|
68
|
-
"@h3ravel/musket": "^0.1.
|
|
68
|
+
"@h3ravel/musket": "^0.1.8",
|
|
69
69
|
"tsx": "^4.20.5",
|
|
70
70
|
"@h3ravel/shared": "^0.22.3"
|
|
71
71
|
},
|
package/bin/fire.cjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./zero-Ce9OzYZl.cjs`);require(`tsx/esm`);let t=require(`@h3ravel/core`);t=e.__toESM(t);let n=require(`@h3ravel/shared`);n=e.__toESM(n);let r=require(`@h3ravel/musket`);r=e.__toESM(r);let i=require(`execa`);i=e.__toESM(i);let a=require(`preferred-pm`);a=e.__toESM(a);let o=require(`node:fs/promises`);o=e.__toESM(o),require(`@h3ravel/support`);let s=require(`node:path`);s=e.__toESM(s);let c=require(`node:fs`);c=e.__toESM(c);let l=require(`child_process`);l=e.__toESM(l);let u=require(`path`);u=e.__toESM(u);const d=String.raw`
|
|
3
|
-
111
|
|
4
|
-
111111111
|
|
5
|
-
1111111111 111111
|
|
6
|
-
111111 111 111111
|
|
7
|
-
111111 111 111111
|
|
8
|
-
11111 111 11111
|
|
9
|
-
1111111 111 1111111
|
|
10
|
-
111 11111 111 111111 111 1111 1111 11111111 1111
|
|
11
|
-
111 11111 1111 111111 111 1111 1111 1111 11111 1111
|
|
12
|
-
111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
|
|
13
|
-
111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
|
|
14
|
-
111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
|
|
15
|
-
111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
|
|
16
|
-
111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
|
|
17
|
-
1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
|
|
18
|
-
11011 111111 11 11111
|
|
19
|
-
111111 11101 111111
|
|
20
|
-
111111 111 111111
|
|
21
|
-
111111 111 111111
|
|
22
|
-
111111111
|
|
23
|
-
110
|
|
24
|
-
`,f=String.raw`
|
|
25
|
-
_ _ _____ _
|
|
26
|
-
| | | |___ / _ __ __ ___ _____| |
|
|
27
|
-
| |_| | |_ \| '__/ _ \ \ / / _ \ |
|
|
28
|
-
| _ |___) | | | (_| |\ V / __/ |
|
|
29
|
-
|_| |_|____/|_| \__,_| \_/ \___|_|
|
|
30
|
-
|
|
31
|
-
`;function p(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,u.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,l.fork)((0,u.join)(e,t),r,o)},c=e.dir||(0,u.dirname)(e.file),d=Object.keys(a).find(e=>{let n=a[e];return n.isEntry&&n.facadeModuleId===t});d?(s(c,d),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,d):(t===`cls`||t===`clear`||e.toString().charCodeAt(0)===12)&&console.clear()}))):this.error(`@rollup/plugin-run could not find output chunk`)}}}const m=process.env.NODE_ENV||`development`;let h=m===`development`?`.h3ravel/serve`:`dist`;process.env.DIST_DIR&&(h=process.env.DIST_DIR);const g={outDir:h,entry:[`src/**/*.ts`],format:[`esm`],target:`node22`,sourcemap:m===`development`,minify:!!process.env.DIST_MINIFY,external:[/^@h3ravel\/.*/gi],clean:!0,shims:!0,copy:[{from:`public`,to:h},`src/resources`,`src/database`],env:m===`development`?{NODE_ENV:m,DIST_DIR:h}:{},watch:m===`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,c.existsSync)(s.default.join(h,n))&&await(0,o.rm)(s.default.join(h,n),{recursive:!0})}})},plugins:m===`development`&&process.env.CLI_BUILD!==`true`?[p({env:Object.assign({},process.env,{NODE_ENV:m,DIST_DIR:h}),execArgv:[`-r`,`source-map-support/register`],allowRestarts:!1,input:process.cwd()+`/src/server.ts`})]:[]};var _=g,v=class extends t.ServiceProvider{static priority=992;static runsInConsole=!0;runsInConsole=!0;register(){}boot(){let e=`/${env(`DIST_DIR`,`.h3ravel/serve`)}/`.replaceAll(`//`,``);r.Kernel.init(this.app,{logo:f,resolver:new t.ContainerResolver(this.app).resolveMethodParams,tsDownConfig:_,packages:[{name:`@h3ravel/core`,alias:`H3ravel Framework`},{name:`@h3ravel/musket`,alias:`Musket CLI`}],cliName:`musket`,hideMusketInfo:!0,discoveryPaths:[app_path(`Console/Commands/*.js`).replace(`/src/`,e)]}),process.on(`SIGINT`,()=>{process.exit(0)}),process.on(`SIGTERM`,()=>{process.exit(0)})}},y=class{async fire(){let e=process.env.DIST_DIR??`/.h3ravel/serve/`,n=[],r=new t.Application(process.cwd()),i=base_path(s.default.join(e,`bootstrap/providers.js`));n.push(...(await import(i)).default),n.push(v),await r.quickStartup(n,[`CoreServiceProvider`])}};new y().fire();
|
package/bin/fire.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import"./zero-BGMatB6V.js";import"tsx/esm";import{Application as e,ContainerResolver as t,ServiceProvider as n}from"@h3ravel/core";import{FileSystem as r}from"@h3ravel/shared";import{Kernel as i}from"@h3ravel/musket";import{execa as a}from"execa";import o from"preferred-pm";import{mkdir as s,rm as c,writeFile as l}from"node:fs/promises";import"@h3ravel/support";import u from"node:path";import{existsSync as d}from"node:fs";import{fork as f}from"child_process";import{dirname as p,join as m,resolve as h}from"path";String.raw`
|
|
3
|
-
111
|
|
4
|
-
111111111
|
|
5
|
-
1111111111 111111
|
|
6
|
-
111111 111 111111
|
|
7
|
-
111111 111 111111
|
|
8
|
-
11111 111 11111
|
|
9
|
-
1111111 111 1111111
|
|
10
|
-
111 11111 111 111111 111 1111 1111 11111111 1111
|
|
11
|
-
111 11111 1111 111111 111 1111 1111 1111 11111 1111
|
|
12
|
-
111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
|
|
13
|
-
111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
|
|
14
|
-
111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
|
|
15
|
-
111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
|
|
16
|
-
111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
|
|
17
|
-
1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
|
|
18
|
-
11011 111111 11 11111
|
|
19
|
-
111111 11101 111111
|
|
20
|
-
111111 111 111111
|
|
21
|
-
111111 111 111111
|
|
22
|
-
111111111
|
|
23
|
-
110
|
|
24
|
-
`;const g=String.raw`
|
|
25
|
-
_ _ _____ _
|
|
26
|
-
| | | |___ / _ __ __ ___ _____| |
|
|
27
|
-
| |_| | |_ \| '__/ _ \ \ / / _ \ |
|
|
28
|
-
| _ |___) | | | (_| |\ V / __/ |
|
|
29
|
-
|_| |_|____/|_| \__,_| \_/ \___|_|
|
|
30
|
-
|
|
31
|
-
`;function _(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=h(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=f(m(e,t),r,o)},c=e.dir||p(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 v=process.env.NODE_ENV||`development`;let y=v===`development`?`.h3ravel/serve`:`dist`;process.env.DIST_DIR&&(y=process.env.DIST_DIR);var b={outDir:y,entry:[`src/**/*.ts`],format:[`esm`],target:`node22`,sourcemap:v===`development`,minify:!!process.env.DIST_MINIFY,external:[/^@h3ravel\/.*/gi],clean:!0,shims:!0,copy:[{from:`public`,to:y},`src/resources`,`src/database`],env:v===`development`?{NODE_ENV:v,DIST_DIR:y}:{},watch:v===`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];d(u.join(y,n))&&await c(u.join(y,n),{recursive:!0})}})},plugins:v===`development`&&process.env.CLI_BUILD!==`true`?[_({env:Object.assign({},process.env,{NODE_ENV:v,DIST_DIR:y}),execArgv:[`-r`,`source-map-support/register`],allowRestarts:!1,input:process.cwd()+`/src/server.ts`})]:[]},x=class extends n{static priority=992;static runsInConsole=!0;runsInConsole=!0;register(){}boot(){let e=`/${env(`DIST_DIR`,`.h3ravel/serve`)}/`.replaceAll(`//`,``);i.init(this.app,{logo:g,resolver:new t(this.app).resolveMethodParams,tsDownConfig:b,packages:[{name:`@h3ravel/core`,alias:`H3ravel Framework`},{name:`@h3ravel/musket`,alias:`Musket CLI`}],cliName:`musket`,hideMusketInfo:!0,discoveryPaths:[app_path(`Console/Commands/*.js`).replace(`/src/`,e)]}),process.on(`SIGINT`,()=>{process.exit(0)}),process.on(`SIGTERM`,()=>{process.exit(0)})}};new class{async fire(){let t=process.env.DIST_DIR??`/.h3ravel/serve/`,n=[],r=new e(process.cwd()),i=base_path(u.join(t,`bootstrap/providers.js`));n.push(...(await import(i)).default),n.push(x),await r.quickStartup(n,[`CoreServiceProvider`])}}().fire();export{};
|
package/bin/spawn.cjs
DELETED
package/bin/spawn.js
DELETED
package/bin/zero-BGMatB6V.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{FileSystem as e,mainTsconfig as t}from"@h3ravel/shared";import{execa as n}from"execa";import r from"preferred-pm";import{mkdir as i,readdir as a,writeFile as o}from"node:fs/promises";import s,{join as c}from"node:path";var l=class{async spawn(l=`.h3ravel/serve`){let u=(await r(process.cwd()))?.name??`npm`,d=c(process.env.DIST_DIR??l);if(await e.fileExists(d)&&(await a(d)).length>0)return;await e.fileExists(s.join(d,`tsconfig.json`))||(await i(s.join(d.replace(`/serve`,``)),{recursive:!0}),await o(s.join(d.replace(`/serve`,``),`tsconfig.json`),JSON.stringify(t,null,2)));let f={EXTENDED_DEBUG:`false`,CLI_BUILD:`true`,NODE_ENV:`production`,DIST_DIR:d,LOG_LEVEL:`silent`};await n(u,[`tsdown`,`--silent`,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:c(process.cwd()),env:Object.assign({},process.env,f)})}};export{l as zero_default};
|
package/bin/zero-Ce9OzYZl.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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));let c=require(`@h3ravel/shared`);c=s(c);let l=require(`execa`);l=s(l);let u=require(`preferred-pm`);u=s(u);let d=require(`node:fs/promises`);d=s(d);let f=require(`node:path`);f=s(f);var p=class{async spawn(e=`.h3ravel/serve`){let t=(await(0,u.default)(process.cwd()))?.name??`npm`,n=(0,f.join)(process.env.DIST_DIR??e);if(await c.FileSystem.fileExists(n)&&(await(0,d.readdir)(n)).length>0)return;await c.FileSystem.fileExists(f.default.join(n,`tsconfig.json`))||(await(0,d.mkdir)(f.default.join(n.replace(`/serve`,``)),{recursive:!0}),await(0,d.writeFile)(f.default.join(n.replace(`/serve`,``),`tsconfig.json`),JSON.stringify(c.mainTsconfig,null,2)));let r={EXTENDED_DEBUG:`false`,CLI_BUILD:`true`,NODE_ENV:`production`,DIST_DIR:n,LOG_LEVEL:`silent`};await(0,l.execa)(t,[`tsdown`,`--silent`,`--config-loader`,`unconfig`,`-c`,`tsdown.default.config.ts`].filter(e=>e!==null),{stdout:`inherit`,stderr:`inherit`,cwd:(0,f.join)(process.cwd()),env:Object.assign({},process.env,r)})}};Object.defineProperty(exports,`__toESM`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`zero_default`,{enumerable:!0,get:function(){return p}});
|
package/dist/index.cjs
DELETED
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
let __h3ravel_shared = require("@h3ravel/shared");
|
|
25
|
-
__h3ravel_shared = __toESM(__h3ravel_shared);
|
|
26
|
-
let __h3ravel_musket = require("@h3ravel/musket");
|
|
27
|
-
__h3ravel_musket = __toESM(__h3ravel_musket);
|
|
28
|
-
let execa = require("execa");
|
|
29
|
-
execa = __toESM(execa);
|
|
30
|
-
let preferred_pm = require("preferred-pm");
|
|
31
|
-
preferred_pm = __toESM(preferred_pm);
|
|
32
|
-
let node_fs_promises = require("node:fs/promises");
|
|
33
|
-
node_fs_promises = __toESM(node_fs_promises);
|
|
34
|
-
let __h3ravel_support = require("@h3ravel/support");
|
|
35
|
-
__h3ravel_support = __toESM(__h3ravel_support);
|
|
36
|
-
let node_path = require("node:path");
|
|
37
|
-
node_path = __toESM(node_path);
|
|
38
|
-
let __h3ravel_core = require("@h3ravel/core");
|
|
39
|
-
__h3ravel_core = __toESM(__h3ravel_core);
|
|
40
|
-
let node_fs = require("node:fs");
|
|
41
|
-
node_fs = __toESM(node_fs);
|
|
42
|
-
let child_process = require("child_process");
|
|
43
|
-
child_process = __toESM(child_process);
|
|
44
|
-
let path = require("path");
|
|
45
|
-
path = __toESM(path);
|
|
46
|
-
|
|
47
|
-
//#region src/Commands/BuildCommand.ts
|
|
48
|
-
var BuildCommand = class BuildCommand extends __h3ravel_musket.Command {
|
|
49
|
-
/**
|
|
50
|
-
* The name and signature of the console command.
|
|
51
|
-
*
|
|
52
|
-
* @var string
|
|
53
|
-
*/
|
|
54
|
-
signature = `build
|
|
55
|
-
{--m|minify : Minify your bundle output}
|
|
56
|
-
{--d|dev : Build for dev but don't watch for changes}
|
|
57
|
-
`;
|
|
58
|
-
/**
|
|
59
|
-
* The console command description.
|
|
60
|
-
*
|
|
61
|
-
* @var string
|
|
62
|
-
*/
|
|
63
|
-
description = "Build the app for production";
|
|
64
|
-
async handle() {
|
|
65
|
-
try {
|
|
66
|
-
await this.fire();
|
|
67
|
-
} catch (e) {
|
|
68
|
-
__h3ravel_shared.Logger.error(e);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
async fire() {
|
|
72
|
-
const outDir$1 = this.option("dev") ? ".h3ravel/serve" : env("DIST_DIR", "dist");
|
|
73
|
-
const minify = this.option("minify");
|
|
74
|
-
const verbosity = this.getVerbosity();
|
|
75
|
-
const debug = verbosity > 0;
|
|
76
|
-
this.newLine();
|
|
77
|
-
await BuildCommand.build({
|
|
78
|
-
outDir: outDir$1,
|
|
79
|
-
minify,
|
|
80
|
-
verbosity,
|
|
81
|
-
debug,
|
|
82
|
-
mute: false
|
|
83
|
-
});
|
|
84
|
-
this.newLine();
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* build
|
|
88
|
-
*/
|
|
89
|
-
static async build({ debug, minify, mute, verbosity, outDir: outDir$1 } = {
|
|
90
|
-
mute: false,
|
|
91
|
-
debug: false,
|
|
92
|
-
minify: false,
|
|
93
|
-
verbosity: 0,
|
|
94
|
-
outDir: "dist"
|
|
95
|
-
}) {
|
|
96
|
-
const pm = (await (0, preferred_pm.default)(base_path()))?.name ?? "pnpm";
|
|
97
|
-
const ENV_VARS = {
|
|
98
|
-
EXTENDED_DEBUG: debug ? "true" : "false",
|
|
99
|
-
CLI_BUILD: "true",
|
|
100
|
-
NODE_ENV: "production",
|
|
101
|
-
DIST_DIR: outDir$1,
|
|
102
|
-
DIST_MINIFY: minify,
|
|
103
|
-
LOG_LEVEL: [
|
|
104
|
-
"silent",
|
|
105
|
-
"info",
|
|
106
|
-
"warn",
|
|
107
|
-
"error"
|
|
108
|
-
][verbosity]
|
|
109
|
-
};
|
|
110
|
-
const silent = ENV_VARS.LOG_LEVEL === "silent" ? "--silent" : null;
|
|
111
|
-
if (mute) return await (0, execa.execa)(pm, [
|
|
112
|
-
"tsdown",
|
|
113
|
-
silent,
|
|
114
|
-
"--config-loader",
|
|
115
|
-
"unconfig",
|
|
116
|
-
"-c",
|
|
117
|
-
"tsdown.default.config.ts"
|
|
118
|
-
].filter((e) => e !== null), {
|
|
119
|
-
stdout: "inherit",
|
|
120
|
-
stderr: "inherit",
|
|
121
|
-
cwd: base_path(),
|
|
122
|
-
env: Object.assign({}, process.env, ENV_VARS)
|
|
123
|
-
});
|
|
124
|
-
const type = outDir$1 === "dist" ? "Production" : "Development";
|
|
125
|
-
return await __h3ravel_shared.TaskManager.advancedTaskRunner([[`Creating ${type} Bundle`, "STARTED"], [`${type} Bundle Created`, "COMPLETED"]], async () => {
|
|
126
|
-
await (0, execa.execa)(pm, [
|
|
127
|
-
"tsdown",
|
|
128
|
-
silent,
|
|
129
|
-
"--config-loader",
|
|
130
|
-
"unconfig",
|
|
131
|
-
"-c",
|
|
132
|
-
"tsdown.default.config.ts"
|
|
133
|
-
].filter((e) => e !== null), {
|
|
134
|
-
stdout: "inherit",
|
|
135
|
-
stderr: "inherit",
|
|
136
|
-
cwd: base_path(),
|
|
137
|
-
env: Object.assign({}, process.env, ENV_VARS)
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
//#endregion
|
|
144
|
-
//#region src/Commands/MakeCommand.ts
|
|
145
|
-
var MakeCommand = class extends __h3ravel_musket.Command {
|
|
146
|
-
/**
|
|
147
|
-
* The name and signature of the console command.
|
|
148
|
-
*
|
|
149
|
-
* @var string
|
|
150
|
-
*/
|
|
151
|
-
signature = `#make:
|
|
152
|
-
{controller : Create a new controller class.
|
|
153
|
-
| {--a|api : Exclude the create and edit methods from the controller}
|
|
154
|
-
| {--m|model= : Generate a resource controller for the given model}
|
|
155
|
-
| {--r|resource : Generate a resource controller class}
|
|
156
|
-
| {--force : Create the controller even if it already exists}
|
|
157
|
-
}
|
|
158
|
-
{resource : Create a new resource.
|
|
159
|
-
| {--c|collection : Create a resource collection}
|
|
160
|
-
| {--force : Create the resource even if it already exists}
|
|
161
|
-
}
|
|
162
|
-
{command : Create a new Musket command.
|
|
163
|
-
| {--command : The terminal command that will be used to invoke the class}
|
|
164
|
-
| {--force : Create the class even if the console command already exists}
|
|
165
|
-
}
|
|
166
|
-
{view : Create a new view.
|
|
167
|
-
| {--force : Create the view even if it already exists}
|
|
168
|
-
}
|
|
169
|
-
{^name : The name of the [name] to generate}
|
|
170
|
-
`;
|
|
171
|
-
/**
|
|
172
|
-
* The console command description.
|
|
173
|
-
*
|
|
174
|
-
* @var string
|
|
175
|
-
*/
|
|
176
|
-
description = "Generate component classes";
|
|
177
|
-
async handle() {
|
|
178
|
-
const command = this.dictionary.baseCommand ?? this.dictionary.name;
|
|
179
|
-
if (!this.argument("name")) this.program.error("Please provide a valid name for the " + command);
|
|
180
|
-
await this[{
|
|
181
|
-
controller: "makeController",
|
|
182
|
-
resource: "makeResource",
|
|
183
|
-
view: "makeView",
|
|
184
|
-
command: "makeCommand"
|
|
185
|
-
}[command]]();
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Create a new controller class.
|
|
189
|
-
*/
|
|
190
|
-
async makeController() {
|
|
191
|
-
const type = this.option("api") ? "-resource" : "";
|
|
192
|
-
const name = this.argument("name");
|
|
193
|
-
const force = this.option("force");
|
|
194
|
-
const crtlrPath = __h3ravel_shared.FileSystem.findModulePkg("@h3ravel/http", this.kernel.cwd) ?? "";
|
|
195
|
-
const stubPath = node_path.default.join(crtlrPath, `dist/stubs/controller${type}.stub`);
|
|
196
|
-
const path$4 = app_path(`Http/Controllers/${name}.ts`);
|
|
197
|
-
/** The Controller is scoped to a path make sure to create the associated directories */
|
|
198
|
-
if (name.includes("/")) await (0, node_fs_promises.mkdir)(__h3ravel_support.Str.beforeLast(path$4, "/"), { recursive: true });
|
|
199
|
-
/** Check if the controller already exists */
|
|
200
|
-
if (!force && await __h3ravel_shared.FileSystem.fileExists(path$4)) __h3ravel_shared.Logger.error(`ERORR: ${name} controller already exists`);
|
|
201
|
-
let stub = await (0, node_fs_promises.readFile)(stubPath, "utf-8");
|
|
202
|
-
stub = stub.replace(/{{ name }}/g, name);
|
|
203
|
-
await (0, node_fs_promises.writeFile)(path$4, stub);
|
|
204
|
-
__h3ravel_shared.Logger.split("INFO: Controller Created", __h3ravel_shared.Logger.log(node_path.default.basename(path$4), "gray", false));
|
|
205
|
-
}
|
|
206
|
-
makeResource() {
|
|
207
|
-
__h3ravel_shared.Logger.success("Resource support is not yet available");
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Create a new Musket command
|
|
211
|
-
*/
|
|
212
|
-
makeCommand() {
|
|
213
|
-
__h3ravel_shared.Logger.success("Musket command creation is not yet available");
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Create a new view.
|
|
217
|
-
*/
|
|
218
|
-
async makeView() {
|
|
219
|
-
const name = this.argument("name");
|
|
220
|
-
const force = this.option("force");
|
|
221
|
-
const path$4 = base_path(`src/resources/views/${name}.edge`);
|
|
222
|
-
/** The view is scoped to a path make sure to create the associated directories */
|
|
223
|
-
if (name.includes("/")) await (0, node_fs_promises.mkdir)(__h3ravel_support.Str.beforeLast(path$4, "/"), { recursive: true });
|
|
224
|
-
/** Check if the view already exists */
|
|
225
|
-
if (!force && await __h3ravel_shared.FileSystem.fileExists(path$4)) __h3ravel_shared.Logger.error(`ERORR: ${name} view already exists`);
|
|
226
|
-
await (0, node_fs_promises.writeFile)(path$4, `{{-- src/resources/views/${name}.edge --}}`);
|
|
227
|
-
__h3ravel_shared.Logger.split("INFO: View Created", __h3ravel_shared.Logger.log(`src/resources/views/${name}.edge`, "gray", false));
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
//#endregion
|
|
232
|
-
//#region src/Commands/PostinstallCommand.ts
|
|
233
|
-
var PostinstallCommand = class extends __h3ravel_musket.Command {
|
|
234
|
-
/**
|
|
235
|
-
* The name and signature of the console command.
|
|
236
|
-
*
|
|
237
|
-
* @var string
|
|
238
|
-
*/
|
|
239
|
-
signature = "postinstall";
|
|
240
|
-
/**
|
|
241
|
-
* The console command description.
|
|
242
|
-
*
|
|
243
|
-
* @var string
|
|
244
|
-
*/
|
|
245
|
-
description = "Default post installation command";
|
|
246
|
-
async handle() {
|
|
247
|
-
this.createSqliteDB();
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Create sqlite database if none exist
|
|
251
|
-
*
|
|
252
|
-
* @returns
|
|
253
|
-
*/
|
|
254
|
-
async createSqliteDB() {
|
|
255
|
-
if (config("database.default") !== "sqlite") return;
|
|
256
|
-
if (!await __h3ravel_shared.FileSystem.fileExists(database_path())) await (0, node_fs_promises.mkdir)(database_path(), { recursive: true });
|
|
257
|
-
if (!await __h3ravel_shared.FileSystem.fileExists(database_path("db.sqlite"))) await (0, node_fs_promises.writeFile)(database_path("db.sqlite"), "");
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region src/logo.ts
|
|
263
|
-
const logo = String.raw`
|
|
264
|
-
111
|
|
265
|
-
111111111
|
|
266
|
-
1111111111 111111
|
|
267
|
-
111111 111 111111
|
|
268
|
-
111111 111 111111
|
|
269
|
-
11111 111 11111
|
|
270
|
-
1111111 111 1111111
|
|
271
|
-
111 11111 111 111111 111 1111 1111 11111111 1111
|
|
272
|
-
111 11111 1111 111111 111 1111 1111 1111 11111 1111
|
|
273
|
-
111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
|
|
274
|
-
111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
|
|
275
|
-
111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
|
|
276
|
-
111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
|
|
277
|
-
111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
|
|
278
|
-
1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
|
|
279
|
-
11011 111111 11 11111
|
|
280
|
-
111111 11101 111111
|
|
281
|
-
111111 111 111111
|
|
282
|
-
111111 111 111111
|
|
283
|
-
111111111
|
|
284
|
-
110
|
|
285
|
-
`;
|
|
286
|
-
const altLogo = String.raw`
|
|
287
|
-
_ _ _____ _
|
|
288
|
-
| | | |___ / _ __ __ ___ _____| |
|
|
289
|
-
| |_| | |_ \| '__/ _ \ \ / / _ \ |
|
|
290
|
-
| _ |___) | | | (_| |\ V / __/ |
|
|
291
|
-
|_| |_|____/|_| \__,_| \_/ \___|_|
|
|
292
|
-
|
|
293
|
-
`;
|
|
294
|
-
|
|
295
|
-
//#endregion
|
|
296
|
-
//#region ../../node_modules/.pnpm/@rollup+plugin-run@3.1.0_rollup@4.52.3/node_modules/@rollup/plugin-run/dist/es/index.js
|
|
297
|
-
function run(opts = {}) {
|
|
298
|
-
let input;
|
|
299
|
-
let proc;
|
|
300
|
-
const args = opts.args || [];
|
|
301
|
-
const allowRestarts = opts.allowRestarts || false;
|
|
302
|
-
const overrideInput = opts.input;
|
|
303
|
-
const forkOptions = opts.options || opts;
|
|
304
|
-
delete forkOptions.args;
|
|
305
|
-
delete forkOptions.allowRestarts;
|
|
306
|
-
return {
|
|
307
|
-
name: "run",
|
|
308
|
-
buildStart(options) {
|
|
309
|
-
let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;
|
|
310
|
-
if (typeof inputs === "string") inputs = [inputs];
|
|
311
|
-
if (typeof inputs === "object") inputs = Object.values(inputs);
|
|
312
|
-
if (inputs.length > 1) throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \`input\` option`);
|
|
313
|
-
input = (0, path.resolve)(inputs[0]);
|
|
314
|
-
},
|
|
315
|
-
generateBundle(_outputOptions, _bundle, isWrite) {
|
|
316
|
-
if (!isWrite) this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);
|
|
317
|
-
},
|
|
318
|
-
writeBundle(outputOptions, bundle) {
|
|
319
|
-
const forkBundle = (dir$1, entryFileName$1) => {
|
|
320
|
-
if (proc) proc.kill();
|
|
321
|
-
proc = (0, child_process.fork)((0, path.join)(dir$1, entryFileName$1), args, forkOptions);
|
|
322
|
-
};
|
|
323
|
-
const dir = outputOptions.dir || (0, path.dirname)(outputOptions.file);
|
|
324
|
-
const entryFileName = Object.keys(bundle).find((fileName) => {
|
|
325
|
-
const chunk = bundle[fileName];
|
|
326
|
-
return chunk.isEntry && chunk.facadeModuleId === input;
|
|
327
|
-
});
|
|
328
|
-
if (entryFileName) {
|
|
329
|
-
forkBundle(dir, entryFileName);
|
|
330
|
-
if (allowRestarts) {
|
|
331
|
-
process.stdin.resume();
|
|
332
|
-
process.stdin.setEncoding("utf8");
|
|
333
|
-
process.stdin.on("data", (data) => {
|
|
334
|
-
const line = data.toString().trim().toLowerCase();
|
|
335
|
-
if (line === "rs" || line === "restart" || data.toString().charCodeAt(0) === 11) forkBundle(dir, entryFileName);
|
|
336
|
-
else if (line === "cls" || line === "clear" || data.toString().charCodeAt(0) === 12) console.clear();
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
} else this.error(`@rollup/plugin-run could not find output chunk`);
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
//#endregion
|
|
345
|
-
//#region src/TsdownConfig.ts
|
|
346
|
-
const env$1 = process.env.NODE_ENV || "development";
|
|
347
|
-
let outDir = env$1 === "development" ? ".h3ravel/serve" : "dist";
|
|
348
|
-
if (process.env.DIST_DIR) outDir = process.env.DIST_DIR;
|
|
349
|
-
const TsDownConfig = {
|
|
350
|
-
outDir,
|
|
351
|
-
entry: ["src/**/*.ts"],
|
|
352
|
-
format: ["esm"],
|
|
353
|
-
target: "node22",
|
|
354
|
-
sourcemap: env$1 === "development",
|
|
355
|
-
minify: !!process.env.DIST_MINIFY,
|
|
356
|
-
external: [/^@h3ravel\/.*/gi],
|
|
357
|
-
clean: true,
|
|
358
|
-
shims: true,
|
|
359
|
-
copy: [
|
|
360
|
-
{
|
|
361
|
-
from: "public",
|
|
362
|
-
to: outDir
|
|
363
|
-
},
|
|
364
|
-
"src/resources",
|
|
365
|
-
"src/database"
|
|
366
|
-
],
|
|
367
|
-
env: env$1 === "development" ? {
|
|
368
|
-
NODE_ENV: env$1,
|
|
369
|
-
DIST_DIR: outDir
|
|
370
|
-
} : {},
|
|
371
|
-
watch: env$1 === "development" && process.env.CLI_BUILD !== "true" ? [
|
|
372
|
-
".env",
|
|
373
|
-
".env.*",
|
|
374
|
-
"src",
|
|
375
|
-
"../../packages"
|
|
376
|
-
] : false,
|
|
377
|
-
dts: false,
|
|
378
|
-
logLevel: "silent",
|
|
379
|
-
nodeProtocol: true,
|
|
380
|
-
skipNodeModulesBundle: true,
|
|
381
|
-
hooks(e) {
|
|
382
|
-
e.hook("build:done", async () => {
|
|
383
|
-
const paths = [
|
|
384
|
-
"database/migrations",
|
|
385
|
-
"database/factories",
|
|
386
|
-
"database/seeders"
|
|
387
|
-
];
|
|
388
|
-
for (let i = 0; i < paths.length; i++) {
|
|
389
|
-
const name = paths[i];
|
|
390
|
-
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 });
|
|
391
|
-
}
|
|
392
|
-
});
|
|
393
|
-
},
|
|
394
|
-
plugins: env$1 === "development" && process.env.CLI_BUILD !== "true" ? [run({
|
|
395
|
-
env: Object.assign({}, process.env, {
|
|
396
|
-
NODE_ENV: env$1,
|
|
397
|
-
DIST_DIR: outDir
|
|
398
|
-
}),
|
|
399
|
-
execArgv: ["-r", "source-map-support/register"],
|
|
400
|
-
allowRestarts: false,
|
|
401
|
-
input: process.cwd() + "/src/server.ts"
|
|
402
|
-
})] : []
|
|
403
|
-
};
|
|
404
|
-
var TsdownConfig_default = TsDownConfig;
|
|
405
|
-
|
|
406
|
-
//#endregion
|
|
407
|
-
//#region src/Providers/ConsoleServiceProvider.ts
|
|
408
|
-
/**
|
|
409
|
-
* Handles CLI commands and tooling.
|
|
410
|
-
*
|
|
411
|
-
* Auto-Registered when in CLI mode
|
|
412
|
-
*/
|
|
413
|
-
var ConsoleServiceProvider = class extends __h3ravel_core.ServiceProvider {
|
|
414
|
-
static priority = 992;
|
|
415
|
-
/**
|
|
416
|
-
* Indicate that this service provider only runs in console
|
|
417
|
-
*/
|
|
418
|
-
static runsInConsole = true;
|
|
419
|
-
runsInConsole = true;
|
|
420
|
-
register() {}
|
|
421
|
-
boot() {
|
|
422
|
-
const DIST_DIR = `/${env("DIST_DIR", ".h3ravel/serve")}/`.replaceAll("//", "");
|
|
423
|
-
__h3ravel_musket.Kernel.init(this.app, {
|
|
424
|
-
logo: altLogo,
|
|
425
|
-
resolver: new __h3ravel_core.ContainerResolver(this.app).resolveMethodParams,
|
|
426
|
-
tsDownConfig: TsdownConfig_default,
|
|
427
|
-
packages: [{
|
|
428
|
-
name: "@h3ravel/core",
|
|
429
|
-
alias: "H3ravel Framework"
|
|
430
|
-
}, {
|
|
431
|
-
name: "@h3ravel/musket",
|
|
432
|
-
alias: "Musket CLI"
|
|
433
|
-
}],
|
|
434
|
-
cliName: "musket",
|
|
435
|
-
hideMusketInfo: true,
|
|
436
|
-
discoveryPaths: [app_path("Console/Commands/*.js").replace("/src/", DIST_DIR)]
|
|
437
|
-
});
|
|
438
|
-
process.on("SIGINT", () => {
|
|
439
|
-
process.exit(0);
|
|
440
|
-
});
|
|
441
|
-
process.on("SIGTERM", () => {
|
|
442
|
-
process.exit(0);
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
//#endregion
|
|
448
|
-
exports.BuildCommand = BuildCommand;
|
|
449
|
-
exports.ConsoleServiceProvider = ConsoleServiceProvider;
|
|
450
|
-
exports.MakeCommand = MakeCommand;
|
|
451
|
-
exports.PostinstallCommand = PostinstallCommand;
|
|
452
|
-
exports.TsDownConfig = TsDownConfig;
|
|
453
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Command","outDir","TaskManager","Command","FileSystem","nodepath","path","Str","Logger","Command","FileSystem","dir","entryFileName","env","TsDownConfig: Options","path","ServiceProvider","ContainerResolver"],"sources":["../src/Commands/BuildCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/PostinstallCommand.ts","../src/logo.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0_rollup@4.52.3/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { Logger, TaskManager } from '@h3ravel/shared'\n\nimport { Command } from '@h3ravel/musket'\nimport { execa } from 'execa'\nimport preferredPM from 'preferred-pm'\n\nexport class BuildCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `build\n {--m|minify : Minify your bundle output}\n {--d|dev : Build for dev but don't watch for changes}\n `\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Build the app for production'\n\n public async handle () {\n try {\n await this.fire()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n protected async fire () {\n const outDir = this.option('dev') ? '.h3ravel/serve' : env('DIST_DIR', 'dist')\n const minify = this.option('minify')\n const verbosity = this.getVerbosity()\n const debug = verbosity > 0\n\n this.newLine()\n await BuildCommand.build({ outDir, minify, verbosity, debug, mute: false })\n this.newLine()\n }\n\n /**\n * build\n */\n public static async build ({ debug, minify, mute, verbosity, outDir } = {\n mute: false,\n debug: false,\n minify: false,\n verbosity: 0,\n outDir: 'dist'\n }) {\n\n const pm = (await preferredPM(base_path()))?.name ?? 'pnpm'\n\n const LOG_LEVELS = [\n 'silent',\n 'info',\n 'warn',\n 'error',\n ]\n\n const ENV_VARS = {\n EXTENDED_DEBUG: debug ? 'true' : 'false',\n CLI_BUILD: 'true',\n NODE_ENV: 'production',\n DIST_DIR: outDir,\n DIST_MINIFY: minify,\n LOG_LEVEL: LOG_LEVELS[verbosity]\n }\n\n const silent = ENV_VARS.LOG_LEVEL === 'silent' ? '--silent' : null\n\n if (mute) {\n return await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n\n const type = outDir === 'dist' ? 'Production' : 'Development'\n\n return await TaskManager.advancedTaskRunner(\n [[`Creating ${type} Bundle`, 'STARTED'], [`${type} Bundle Created`, 'COMPLETED']],\n async () => {\n await execa(\n pm,\n ['tsdown', silent, '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'].filter(e => e !== null),\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n )\n }\n )\n }\n}\n","import { FileSystem, Logger } from '@h3ravel/shared'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\nimport { Str } from '@h3ravel/support'\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 {command : Create a new Musket command. \n | {--command : The terminal command that will be used to invoke the class} \n | {--force : Create the class even if the console command already exists}\n }\n {view : Create a new view.\n | {--force : Create the view 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 (this: any) {\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 view: 'makeView',\n command: 'makeCommand',\n } as const\n\n await this[methods[command]]()\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 crtlrPath = FileSystem.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n const path = app_path(`Http/Controllers/${name}.ts`)\n\n /** The Controller is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.beforeLast(path, '/'), { recursive: true })\n }\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 * Create a new Musket command\n */\n protected makeCommand () {\n Logger.success('Musket command creation is not yet available')\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 /** The view is scoped to a path make sure to create the associated directories */\n if (name.includes('/')) {\n await mkdir(Str.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","import { mkdir, writeFile } from 'node:fs/promises'\n\nimport { Command } from '@h3ravel/musket'\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","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 { fork } from 'child_process';\nimport { resolve, dirname, join } from 'path';\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'\nlet outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\nif (process.env.DIST_DIR) {\n outDir = process.env.DIST_DIR\n}\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n minify: !!process.env.DIST_MINIFY,\n external: [\n /^@h3ravel\\/.*/gi,\n ],\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 DIST_DIR: 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 DIST_DIR: 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","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { ContainerResolver, ServiceProvider } from '@h3ravel/core'\n\nimport { Kernel } from '@h3ravel/musket'\nimport { altLogo } from '../logo'\nimport tsDownConfig from '../TsdownConfig'\n\n/**\n * Handles CLI commands and tooling.\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 runsInConsole = true\n public runsInConsole = true\n\n register () {\n }\n\n boot () {\n const DIST_DIR = `/${env('DIST_DIR', '.h3ravel/serve')}/`.replaceAll('//', '')\n\n Kernel.init(\n this.app,\n {\n logo: altLogo,\n resolver: new ContainerResolver(this.app).resolveMethodParams,\n tsDownConfig,\n packages: [\n { name: '@h3ravel/core', alias: 'H3ravel Framework' },\n { name: '@h3ravel/musket', alias: 'Musket CLI' }\n ],\n cliName: 'musket',\n hideMusketInfo: true,\n discoveryPaths: [app_path('Console/Commands/*.js').replace('/src/', DIST_DIR)],\n }\n )\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":[4],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAa,eAAb,MAAa,qBAAqBA,yBAAQ;;;;;;CAOtC,AAAU,YAAoB;;;;;;;;;CAU9B,AAAU,cAAsB;CAEhC,MAAa,SAAU;AACnB,MAAI;AACA,SAAM,KAAK,MAAM;WACZ,GAAG;AACR,2BAAO,MAAM,EAAS;;;CAI9B,MAAgB,OAAQ;EACpB,MAAMC,WAAS,KAAK,OAAO,MAAM,GAAG,mBAAmB,IAAI,YAAY,OAAO;EAC9E,MAAM,SAAS,KAAK,OAAO,SAAS;EACpC,MAAM,YAAY,KAAK,cAAc;EACrC,MAAM,QAAQ,YAAY;AAE1B,OAAK,SAAS;AACd,QAAM,aAAa,MAAM;GAAE;GAAQ;GAAQ;GAAW;GAAO,MAAM;GAAO,CAAC;AAC3E,OAAK,SAAS;;;;;CAMlB,aAAoB,MAAO,EAAE,OAAO,QAAQ,MAAM,WAAW,qBAAW;EACpE,MAAM;EACN,OAAO;EACP,QAAQ;EACR,WAAW;EACX,QAAQ;EACX,EAAE;EAEC,MAAM,MAAM,gCAAkB,WAAW,CAAC,GAAG,QAAQ;EASrD,MAAM,WAAW;GACb,gBAAgB,QAAQ,SAAS;GACjC,WAAW;GACX,UAAU;GACV,UAAUA;GACV,aAAa;GACb,WAbe;IACf;IACA;IACA;IACA;IACH,CAQyB;GACzB;EAED,MAAM,SAAS,SAAS,cAAc,WAAW,aAAa;AAE9D,MAAI,KACA,QAAO,uBACH,IACA;GAAC;GAAU;GAAQ;GAAmB;GAAY;GAAM;GAA2B,CAAC,QAAO,MAAK,M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