@h3ravel/console 11.0.7 → 11.1.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.
Files changed (119) hide show
  1. package/bin/fire.cjs +2 -0
  2. package/bin/fire.js +2 -0
  3. package/dist/Utils-7OrjoB1C.d.cts +22 -0
  4. package/dist/Utils-B1kpj9-1.cjs +130 -0
  5. package/dist/Utils-B1kpj9-1.cjs.map +1 -0
  6. package/dist/Utils-DAJvoXlr.js +86 -0
  7. package/dist/Utils-DAJvoXlr.js.map +1 -0
  8. package/dist/Utils-DxnHOGMz.d.ts +22 -0
  9. package/dist/Utils.cjs +3 -217
  10. package/dist/Utils.d.cts +2 -0
  11. package/dist/Utils.d.ts +2 -0
  12. package/dist/Utils.js +3 -9
  13. package/dist/index.cjs +885 -933
  14. package/dist/index.cjs.map +1 -0
  15. package/dist/index.d.cts +270 -290
  16. package/dist/index.d.ts +270 -290
  17. package/dist/index.js +899 -44
  18. package/dist/index.js.map +1 -0
  19. package/package.json +35 -23
  20. package/bin/chunk-6Z5DP356.js +0 -1
  21. package/bin/lexer-DQCqS3nf-XQPNMZG6.js +0 -4
  22. package/bin/run.cjs +0 -26
  23. package/bin/run.js +0 -26
  24. package/dist/Commands/Command.cjs +0 -104
  25. package/dist/Commands/Command.js +0 -7
  26. package/dist/Commands/MakeCommand.cjs +0 -433
  27. package/dist/Commands/MakeCommand.js +0 -9
  28. package/dist/Commands/MigrateCommand.cjs +0 -200
  29. package/dist/Commands/MigrateCommand.js +0 -8
  30. package/dist/Commands/ServeCommand.cjs +0 -159
  31. package/dist/Commands/ServeCommand.js +0 -8
  32. package/dist/Contracts/ICommand.cjs +0 -18
  33. package/dist/Contracts/ICommand.js +0 -1
  34. package/dist/IO/app.cjs +0 -946
  35. package/dist/IO/app.js +0 -17
  36. package/dist/IO/providers.cjs +0 -930
  37. package/dist/IO/providers.js +0 -16
  38. package/dist/Kernel.cjs +0 -890
  39. package/dist/Kernel.js +0 -14
  40. package/dist/Musket.cjs +0 -835
  41. package/dist/Musket.js +0 -13
  42. package/dist/Providers/ConsoleServiceProvider.cjs +0 -912
  43. package/dist/Providers/ConsoleServiceProvider.js +0 -15
  44. package/dist/Signature.cjs +0 -172
  45. package/dist/Signature.js +0 -7
  46. package/dist/chunk-23QH5R54.js +0 -27
  47. package/dist/chunk-2O2AYFAG.js +0 -63
  48. package/dist/chunk-3ASEWMRX.js +0 -37
  49. package/dist/chunk-3FVPHQCH.js +0 -151
  50. package/dist/chunk-3RX6CLNR.js +0 -32
  51. package/dist/chunk-3VCNSA6P.js +0 -14
  52. package/dist/chunk-3WHUADTN.js +0 -6
  53. package/dist/chunk-6OCHCPBP.js +0 -36
  54. package/dist/chunk-6OIH6FS4.js +0 -32
  55. package/dist/chunk-7EWRZPTX.js +0 -63
  56. package/dist/chunk-7PUQ5ZIN.js +0 -6
  57. package/dist/chunk-A5AONVOH.js +0 -6
  58. package/dist/chunk-ADIVRUAJ.js +0 -27
  59. package/dist/chunk-CCEWV2BR.js +0 -39
  60. package/dist/chunk-CTQ6DUT2.js +0 -8
  61. package/dist/chunk-DXQTBFGG.js +0 -31
  62. package/dist/chunk-E4SSLXFT.js +0 -63
  63. package/dist/chunk-E5XIGIEX.js +0 -14
  64. package/dist/chunk-EIOQKTRM.js +0 -104
  65. package/dist/chunk-FOSDCKCR.js +0 -106
  66. package/dist/chunk-G4OE26TZ.js +0 -33
  67. package/dist/chunk-GVGO5OAK.js +0 -8
  68. package/dist/chunk-GXRCTWKL.js +0 -16
  69. package/dist/chunk-HVKW7JK4.js +0 -8
  70. package/dist/chunk-IGEFNODG.js +0 -22
  71. package/dist/chunk-JXL4VJHZ.js +0 -36
  72. package/dist/chunk-K3GOQSS3.js +0 -6
  73. package/dist/chunk-KCJKQP37.js +0 -133
  74. package/dist/chunk-KMIFCLXG.js +0 -16
  75. package/dist/chunk-KZA3MC77.js +0 -151
  76. package/dist/chunk-LLL3V7LB.js +0 -6
  77. package/dist/chunk-LQ6DL2HS.js +0 -68
  78. package/dist/chunk-M4ZRDJJ2.js +0 -68
  79. package/dist/chunk-MAQAT3PU.js +0 -32
  80. package/dist/chunk-MPXPSSLJ.js +0 -133
  81. package/dist/chunk-NADN2PHB.js +0 -0
  82. package/dist/chunk-NFRXMBRP.js +0 -24
  83. package/dist/chunk-NVPKTRMT.js +0 -7
  84. package/dist/chunk-O45AB4MX.js +0 -83
  85. package/dist/chunk-ORPRWIQ2.js +0 -33
  86. package/dist/chunk-P7M5PEDY.js +0 -18
  87. package/dist/chunk-PBNCVQZC.js +0 -6
  88. package/dist/chunk-PMV4TMFS.js +0 -151
  89. package/dist/chunk-POF4JGTX.js +0 -186
  90. package/dist/chunk-PYSJMSNM.js +0 -27
  91. package/dist/chunk-Q3OMG6YH.js +0 -186
  92. package/dist/chunk-QCNBVSFO.js +0 -68
  93. package/dist/chunk-QMEO4OUR.js +0 -151
  94. package/dist/chunk-QSQNELZQ.js +0 -83
  95. package/dist/chunk-RRP7K5LI.js +0 -36
  96. package/dist/chunk-SHUYVCID.js +0 -6
  97. package/dist/chunk-SP4JKAUC.js +0 -63
  98. package/dist/chunk-T6OOKENF.js +0 -6
  99. package/dist/chunk-TBDROT3I.js +0 -6356
  100. package/dist/chunk-TH2RWMWA.js +0 -133
  101. package/dist/chunk-TJZCDDEV.js +0 -36
  102. package/dist/chunk-TN5SV7LF.js +0 -133
  103. package/dist/chunk-U6TOLKGJ.js +0 -22
  104. package/dist/chunk-UCOXL3OM.js +0 -0
  105. package/dist/chunk-URLTFJET.js +0 -68
  106. package/dist/chunk-UWCTG2LX.js +0 -24
  107. package/dist/chunk-WO2BXMBQ.js +0 -6
  108. package/dist/chunk-XAWZUZVP.js +0 -32
  109. package/dist/chunk-XCOSZXAE.js +0 -133
  110. package/dist/chunk-XD2Q7LWE.js +0 -24
  111. package/dist/chunk-XSL373TG.js +0 -36
  112. package/dist/chunk-XUYTJO6X.js +0 -104
  113. package/dist/chunk-YAYU7VOK.js +0 -8
  114. package/dist/chunk-YRUCICBV.js +0 -24
  115. package/dist/chunk-Z5XE72Q5.js +0 -68
  116. package/dist/chunk-ZTIO25VB.js +0 -8
  117. package/dist/lexer-DQCqS3nf-6W2BHF4T.js +0 -68
  118. package/dist/run.cjs +0 -943
  119. package/dist/run.js +0 -14
@@ -1,27 +0,0 @@
1
- import {
2
- ConsoleServiceProvider
3
- } from "./chunk-6OIH6FS4.js";
4
-
5
- // src/IO/providers.ts
6
- import { HttpServiceProvider } from "@h3ravel/http";
7
- import { RouteServiceProvider, AssetsServiceProvider } from "@h3ravel/router";
8
- import { DatabaseServiceProvider } from "@h3ravel/database";
9
- import { CacheServiceProvider } from "@h3ravel/cache";
10
- import { QueueServiceProvider } from "@h3ravel/queue";
11
- import { MailServiceProvider } from "@h3ravel/mail";
12
- import { ConfigServiceProvider } from "@h3ravel/config";
13
- var providers_default = [
14
- HttpServiceProvider,
15
- ConfigServiceProvider,
16
- RouteServiceProvider,
17
- AssetsServiceProvider,
18
- DatabaseServiceProvider,
19
- CacheServiceProvider,
20
- QueueServiceProvider,
21
- MailServiceProvider,
22
- ConsoleServiceProvider
23
- ];
24
-
25
- export {
26
- providers_default
27
- };
@@ -1,39 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined") return require.apply(this, arguments);
12
- throw Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __commonJS = (cb, mod) => function __require2() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
- };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") {
19
- for (let key of __getOwnPropNames(from))
20
- if (!__hasOwnProp.call(to, key) && key !== except)
21
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
- // If the importer is in node compatibility mode or this is not an ESM
27
- // file that has been converted to a CommonJS file using a Babel-
28
- // compatible transform (i.e. "__esModule" has not been set), then set
29
- // "default" to the CommonJS "module.exports" for node compatibility.
30
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
- mod
32
- ));
33
-
34
- export {
35
- __name,
36
- __require,
37
- __commonJS,
38
- __toESM
39
- };
@@ -1,8 +0,0 @@
1
- import {
2
- app_default
3
- } from "./chunk-XSL373TG.js";
4
-
5
- // src/run.ts
6
- import { EventEmitter } from "events";
7
- new app_default().bootstrap();
8
- new EventEmitter().once("SIGINT", () => process.exit(0));
@@ -1,31 +0,0 @@
1
- import {
2
- providers_default
3
- } from "./chunk-P7M5PEDY.js";
4
- import {
5
- __name
6
- } from "./chunk-SHUYVCID.js";
7
-
8
- // src/IO/app.ts
9
- import { EventEmitter } from "events";
10
- var app_default = class {
11
- static {
12
- __name(this, "default");
13
- }
14
- async bootstrap() {
15
- dd("app");
16
- app.registerProviders(providers_default);
17
- await app.registerConfiguredProviders();
18
- await app.boot();
19
- new EventEmitter().once("SIGINT", () => process.exit(0));
20
- process.on("SIGINT", () => {
21
- process.exit(0);
22
- });
23
- process.on("SIGTERM", () => {
24
- process.exit(0);
25
- });
26
- }
27
- };
28
-
29
- export {
30
- app_default
31
- };
@@ -1,63 +0,0 @@
1
- import {
2
- Command
3
- } from "./chunk-QSQNELZQ.js";
4
- import {
5
- __name
6
- } from "./chunk-CCEWV2BR.js";
7
-
8
- // src/Commands/ServeCommand.ts
9
- import { spawn } from "child_process";
10
- var ServeCommand = class extends Command {
11
- static {
12
- __name(this, "ServeCommand");
13
- }
14
- /**
15
- * The name and signature of the console command.
16
- *
17
- * @var string
18
- */
19
- signature = "serve";
20
- /**
21
- * The console command description.
22
- *
23
- * @var string
24
- */
25
- description = "Start the Developement Server";
26
- async handle() {
27
- try {
28
- await this.serve();
29
- } catch (e) {
30
- this.kernel.output.error(e);
31
- }
32
- }
33
- async serve() {
34
- const child = spawn("tsup-node", {
35
- stdio: "inherit",
36
- shell: true,
37
- env: Object.assign({}, process.env, {
38
- NODE_ENV: "development"
39
- }),
40
- detached: false
41
- });
42
- const cleanup = /* @__PURE__ */ __name(() => {
43
- console.log(111111);
44
- if (child.pid) {
45
- process.kill(child.pid, "SIGTERM");
46
- }
47
- }, "cleanup");
48
- process.on("SIGINT", () => child.kill("SIGINT"));
49
- process.on("SIGTERM", () => child.kill("SIGTERM"));
50
- process.on("SIGINT", () => {
51
- cleanup();
52
- process.exit(0);
53
- });
54
- process.on("SIGTERM", () => {
55
- cleanup();
56
- process.exit(0);
57
- });
58
- }
59
- };
60
-
61
- export {
62
- ServeCommand
63
- };
@@ -1,14 +0,0 @@
1
- import {
2
- ConsoleServiceProvider
3
- } from "./chunk-IGEFNODG.js";
4
-
5
- // src/IO/providers.ts
6
- import { DatabaseServiceProvider } from "@h3ravel/database";
7
- var providers_default = [
8
- DatabaseServiceProvider,
9
- ConsoleServiceProvider
10
- ];
11
-
12
- export {
13
- providers_default
14
- };
@@ -1,104 +0,0 @@
1
- import {
2
- Command
3
- } from "./chunk-O45AB4MX.js";
4
- import {
5
- __name
6
- } from "./chunk-SHUYVCID.js";
7
-
8
- // src/Commands/MigrateCommand.ts
9
- var MigrateCommand = class extends Command {
10
- static {
11
- __name(this, "MigrateCommand");
12
- }
13
- /**
14
- * The name and signature of the console command.
15
- *
16
- * @var string
17
- */
18
- signature = `migrate:
19
- {fresh : Drop all tables and re-run all migrations.}
20
- {install : Create the migration repository.}
21
- {refresh : Reset and re-run all migrations.}
22
- {reset : Rollback all database migrations.}
23
- {rollback : Rollback the last database migration.}
24
- {status : Show the status of each migration.}
25
- {publish : Publish any migration files from installed packages.}
26
- {^--s|seed : Seed the database}
27
- `;
28
- /**
29
- * The console command description.
30
- *
31
- * @var string
32
- */
33
- description = "Run all pending migrations.";
34
- /**
35
- * Execute the console command.
36
- */
37
- async handle() {
38
- const command = this.dictionary.name ?? this.dictionary.baseCommand;
39
- const methods = {
40
- migrate: "migrateRun",
41
- fresh: "migrateFresh",
42
- install: "migrateInstall",
43
- refresh: "migrateRefresh",
44
- reset: "migrateReset",
45
- rollback: "migrateRollback",
46
- status: "migrateStatus",
47
- publish: "migratePublish"
48
- };
49
- await this?.[methods[command]]();
50
- }
51
- /**
52
- * Run all pending migrations.
53
- */
54
- async migrateRun() {
55
- this.kernel.output.success(`Running migrations are not yet supported.`);
56
- }
57
- /**
58
- * Drop all tables and re-run all migrations.
59
- */
60
- async migrateFresh() {
61
- this.kernel.output.success(`Drop all tables and re-run all migrations.`);
62
- }
63
- /**
64
- * Create the migration repository.
65
- */
66
- async migrateInstall() {
67
- this.kernel.output.success(`Create the migration repository.`);
68
- }
69
- /**
70
- * Reset and re-run all migrations.
71
- */
72
- async migrateRefresh() {
73
- this.kernel.output.success(`Resetting and re-running migrations is not yet supported.`);
74
- }
75
- /**
76
- * Rollback all database migrations.
77
- */
78
- async migrateReset() {
79
- this.kernel.output.success(`Rolling back all migration is not yet supported.`);
80
- }
81
- /**
82
- * Rollback the last database migration.
83
- */
84
- async migrateRollback() {
85
- this.kernel.output.success(`Rolling back the last migration is not yet supported.`);
86
- }
87
- /**
88
- * Show the status of each migration.
89
- */
90
- async migrateStatus() {
91
- const path = app_path();
92
- this.kernel.output.success(`Show the status of each migration.`);
93
- }
94
- /**
95
- * Publish any migration files from installed packages.
96
- */
97
- async migratePublish() {
98
- this.kernel.output.success(`Publish any migration files from installed packages.`);
99
- }
100
- };
101
-
102
- export {
103
- MigrateCommand
104
- };
@@ -1,106 +0,0 @@
1
- import {
2
- Command
3
- } from "./chunk-O45AB4MX.js";
4
- import {
5
- __name
6
- } from "./chunk-SHUYVCID.js";
7
-
8
- // src/Commands/MigrateCommand.ts
9
- import { arquebus } from "@h3ravel/arquebus";
10
- var MigrateCommand = class extends Command {
11
- static {
12
- __name(this, "MigrateCommand");
13
- }
14
- /**
15
- * The name and signature of the console command.
16
- *
17
- * @var string
18
- */
19
- signature = `migrate:
20
- {fresh : Drop all tables and re-run all migrations.}
21
- {install : Create the migration repository.}
22
- {refresh : Reset and re-run all migrations.}
23
- {reset : Rollback all database migrations.}
24
- {rollback : Rollback the last database migration.}
25
- {status : Show the status of each migration.}
26
- {publish : Publish any migration files from installed packages.}
27
- {^--s|seed : Seed the database}
28
- `;
29
- /**
30
- * The console command description.
31
- *
32
- * @var string
33
- */
34
- description = "Run all pending migrations.";
35
- /**
36
- * Execute the console command.
37
- */
38
- async handle() {
39
- const command = this.dictionary.name ?? this.dictionary.baseCommand;
40
- const methods = {
41
- migrate: "migrateRun",
42
- fresh: "migrateFresh",
43
- install: "migrateInstall",
44
- refresh: "migrateRefresh",
45
- reset: "migrateReset",
46
- rollback: "migrateRollback",
47
- status: "migrateStatus",
48
- publish: "migratePublish"
49
- };
50
- await this?.[methods[command]]();
51
- }
52
- /**
53
- * Run all pending migrations.
54
- */
55
- async migrateRun() {
56
- this.kernel.output.success(`Running migrations are not yet supported.`);
57
- }
58
- /**
59
- * Drop all tables and re-run all migrations.
60
- */
61
- async migrateFresh() {
62
- this.kernel.output.success(`Drop all tables and re-run all migrations.`);
63
- }
64
- /**
65
- * Create the migration repository.
66
- */
67
- async migrateInstall() {
68
- this.kernel.output.success(`Create the migration repository.`);
69
- }
70
- /**
71
- * Reset and re-run all migrations.
72
- */
73
- async migrateRefresh() {
74
- this.kernel.output.success(`Resetting and re-running migrations is not yet supported.`);
75
- }
76
- /**
77
- * Rollback all database migrations.
78
- */
79
- async migrateReset() {
80
- this.kernel.output.success(`Rolling back all migration is not yet supported.`);
81
- }
82
- /**
83
- * Rollback the last database migration.
84
- */
85
- async migrateRollback() {
86
- this.kernel.output.success(`Rolling back the last migration is not yet supported.`);
87
- }
88
- /**
89
- * Show the status of each migration.
90
- */
91
- async migrateStatus() {
92
- const path = app_path();
93
- console.log(arquebus.connection());
94
- this.kernel.output.success(`Show the status of each migration.`);
95
- }
96
- /**
97
- * Publish any migration files from installed packages.
98
- */
99
- async migratePublish() {
100
- this.kernel.output.success(`Publish any migration files from installed packages.`);
101
- }
102
- };
103
-
104
- export {
105
- MigrateCommand
106
- };
@@ -1,33 +0,0 @@
1
- import {
2
- providers_default
3
- } from "./chunk-P7M5PEDY.js";
4
- import {
5
- __name
6
- } from "./chunk-SHUYVCID.js";
7
-
8
- // src/IO/app.ts
9
- import { Application } from "@h3ravel/core";
10
- import { EventEmitter } from "events";
11
- var app_default = class {
12
- static {
13
- __name(this, "default");
14
- }
15
- async bootstrap() {
16
- const app = new Application(process.cwd());
17
- app.registerProviders(providers_default);
18
- await app.registerConfiguredProviders();
19
- dd("app");
20
- await app.boot();
21
- new EventEmitter().once("SIGINT", () => process.exit(0));
22
- process.on("SIGINT", () => {
23
- process.exit(0);
24
- });
25
- process.on("SIGTERM", () => {
26
- process.exit(0);
27
- });
28
- }
29
- };
30
-
31
- export {
32
- app_default
33
- };
@@ -1,8 +0,0 @@
1
- import {
2
- app_default
3
- } from "./chunk-TJZCDDEV.js";
4
-
5
- // src/run.ts
6
- import { EventEmitter } from "events";
7
- new app_default().bootstrap();
8
- new EventEmitter().once("SIGINT", () => process.exit(0));
@@ -1,16 +0,0 @@
1
- import {
2
- ConsoleServiceProvider
3
- } from "./chunk-U6TOLKGJ.js";
4
-
5
- // src/IO/providers.ts
6
- import { ConfigServiceProvider } from "@h3ravel/config";
7
- import { DatabaseServiceProvider } from "@h3ravel/database";
8
- var providers_default = [
9
- ConfigServiceProvider,
10
- DatabaseServiceProvider,
11
- ConsoleServiceProvider
12
- ];
13
-
14
- export {
15
- providers_default
16
- };
@@ -1,8 +0,0 @@
1
- import {
2
- app_default
3
- } from "./chunk-JXL4VJHZ.js";
4
-
5
- // src/run.ts
6
- import { EventEmitter } from "events";
7
- new app_default().bootstrap();
8
- new EventEmitter().once("SIGINT", () => process.exit(0));
@@ -1,22 +0,0 @@
1
- import {
2
- Kernel
3
- } from "./chunk-URLTFJET.js";
4
- import {
5
- __name
6
- } from "./chunk-SHUYVCID.js";
7
-
8
- // src/Providers/ConsoleServiceProvider.ts
9
- import { ServiceProvider } from "@h3ravel/core";
10
- var ConsoleServiceProvider = class extends ServiceProvider {
11
- static {
12
- __name(this, "ConsoleServiceProvider");
13
- }
14
- static priority = 992;
15
- register() {
16
- Kernel.init(this.app);
17
- }
18
- };
19
-
20
- export {
21
- ConsoleServiceProvider
22
- };
@@ -1,36 +0,0 @@
1
- import {
2
- providers_default
3
- } from "./chunk-P7M5PEDY.js";
4
- import {
5
- Kernel
6
- } from "./chunk-M4ZRDJJ2.js";
7
- import {
8
- __name
9
- } from "./chunk-SHUYVCID.js";
10
-
11
- // src/IO/app.ts
12
- import { Application } from "@h3ravel/core";
13
- import { EventEmitter } from "events";
14
- var app_default = class {
15
- static {
16
- __name(this, "default");
17
- }
18
- async bootstrap() {
19
- const app = new Application(process.cwd());
20
- app.registerProviders(providers_default);
21
- await app.registerConfiguredProviders();
22
- await app.boot();
23
- new Kernel(app);
24
- new EventEmitter().once("SIGINT", () => process.exit(0));
25
- process.on("SIGINT", () => {
26
- process.exit(0);
27
- });
28
- process.on("SIGTERM", () => {
29
- process.exit(0);
30
- });
31
- }
32
- };
33
-
34
- export {
35
- app_default
36
- };
@@ -1,6 +0,0 @@
1
- import {
2
- app_default
3
- } from "./chunk-YRUCICBV.js";
4
-
5
- // src/run.ts
6
- new app_default().bootstrap();
@@ -1,133 +0,0 @@
1
- import {
2
- MigrateCommand
3
- } from "./chunk-EIOQKTRM.js";
4
- import {
5
- ServeCommand
6
- } from "./chunk-7EWRZPTX.js";
7
- import {
8
- Signature
9
- } from "./chunk-3FVPHQCH.js";
10
- import {
11
- MakeCommand
12
- } from "./chunk-PMV4TMFS.js";
13
- import {
14
- Utils
15
- } from "./chunk-POF4JGTX.js";
16
- import {
17
- __name
18
- } from "./chunk-SHUYVCID.js";
19
-
20
- // src/Musket.ts
21
- import chalk from "chalk";
22
- import { program } from "commander";
23
- var Musket = class _Musket {
24
- static {
25
- __name(this, "Musket");
26
- }
27
- app;
28
- kernel;
29
- output = Utils.output();
30
- commands = [];
31
- constructor(app, kernel) {
32
- this.app = app;
33
- this.kernel = kernel;
34
- }
35
- async build() {
36
- this.loadBaseCommands();
37
- await this.loadDiscoveredCommands();
38
- return this.initialize();
39
- }
40
- loadBaseCommands() {
41
- const commands = [
42
- new ServeCommand(this.app, this.kernel),
43
- new MakeCommand(this.app, this.kernel),
44
- new MigrateCommand(this.app, this.kernel)
45
- ];
46
- commands.forEach((e) => this.addCommand(e));
47
- }
48
- async loadDiscoveredCommands() {
49
- const commands = [];
50
- commands.forEach((e) => this.addCommand(e));
51
- }
52
- addCommand(command) {
53
- this.commands.push(Signature.parseSignature(command.getSignature(), command));
54
- }
55
- initialize() {
56
- const cliVersion = [
57
- "H3ravel Version:",
58
- chalk.green(this.kernel.consolePackage.version)
59
- ].join(" ");
60
- const localVersion = [
61
- "Musket Version:",
62
- chalk.green(this.kernel.modulePackage.version || "None")
63
- ].join(" ");
64
- program.name("musket").version(`${cliVersion}
65
- ${localVersion}`);
66
- program.command("init").description("Initialize H3ravel.").action(async () => {
67
- this.output.success(`Initialized: H3ravel has been initialized!`);
68
- });
69
- for (let i = 0; i < this.commands.length; i++) {
70
- const command = this.commands[i];
71
- const instance = command.commandClass;
72
- if (command.isNamespaceCommand && command.subCommands) {
73
- const cmd = command.isHidden ? program : program.command(command.baseCommand).description(command.description ?? "").action(async () => {
74
- instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command);
75
- await instance.handle();
76
- });
77
- if ((command.options?.length ?? 0) > 0) {
78
- command.options?.filter((v, i2, a) => a.findIndex((t) => t.name === v.name) === i2).forEach((opt) => {
79
- this.makeOption(opt, cmd);
80
- });
81
- }
82
- command.subCommands.filter((v, i2, a) => !v.shared && a.findIndex((t) => t.name === v.name) === i2).forEach((sub) => {
83
- const cmd2 = program.command(`${command.baseCommand}:${sub.name}`).description(sub.description || "").action(async () => {
84
- instance.setInput(cmd2.opts(), cmd2.args, cmd2.registeredArguments, sub);
85
- await instance.handle();
86
- });
87
- command.subCommands?.filter((e) => e.shared).forEach((opt) => {
88
- this.makeOption(opt, cmd2, false, sub);
89
- });
90
- command.options?.filter((e) => e.shared).forEach((opt) => {
91
- this.makeOption(opt, cmd2, false, sub);
92
- });
93
- if (sub.nestedOptions) {
94
- sub.nestedOptions.filter((v, i2, a) => a.findIndex((t) => t.name === v.name) === i2).forEach((opt) => {
95
- this.makeOption(opt, cmd2);
96
- });
97
- }
98
- });
99
- } else {
100
- const cmd = program.command(command.baseCommand).description(command.description ?? "");
101
- command?.options?.filter((v, i2, a) => a.findIndex((t) => t.name === v.name) === i2).forEach((opt) => {
102
- this.makeOption(opt, cmd, true);
103
- });
104
- cmd.action(async () => {
105
- instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command);
106
- await instance.handle();
107
- });
108
- }
109
- }
110
- return program;
111
- }
112
- makeOption(opt, cmd, parse, parent) {
113
- const description = opt.description?.replace(/\[(\w+)\]/g, (_, k) => parent?.[k] ?? `[${k}]`) ?? "";
114
- const type = opt.name.replaceAll("-", "");
115
- if (opt.isFlag) {
116
- if (parse) {
117
- const flags = opt.flags?.map((f) => f.length === 1 ? `-${f}` : `--${f}`).join(", ");
118
- cmd.option(flags || "", description, String(opt.defaultValue) || void 0);
119
- } else {
120
- cmd.option(opt.flags?.join(", ") + (opt.required ? ` <${type}>` : ""), description, opt.defaultValue);
121
- }
122
- } else {
123
- cmd.argument(opt.required ? `<${opt.name}>` : `[${opt.name}]`, description, opt.defaultValue);
124
- }
125
- }
126
- static async parse(kernel) {
127
- return (await new _Musket(kernel.app, kernel).build()).parseAsync();
128
- }
129
- };
130
-
131
- export {
132
- Musket
133
- };
@@ -1,16 +0,0 @@
1
- import {
2
- ConsoleServiceProvider
3
- } from "./chunk-IGEFNODG.js";
4
-
5
- // src/IO/providers.ts
6
- import { ConfigServiceProvider } from "@h3ravel/config";
7
- import { DatabaseServiceProvider } from "@h3ravel/database";
8
- var providers_default = [
9
- ConfigServiceProvider,
10
- DatabaseServiceProvider,
11
- ConsoleServiceProvider
12
- ];
13
-
14
- export {
15
- providers_default
16
- };