@h3ravel/console 11.0.0 → 11.0.1

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 (48) hide show
  1. package/README.md +13 -1
  2. package/dist/Commands/Command.cjs +104 -0
  3. package/dist/Commands/Command.js +7 -0
  4. package/dist/Commands/MakeCommand.cjs +433 -0
  5. package/dist/Commands/MakeCommand.js +9 -0
  6. package/dist/Commands/MigrateCommand.cjs +202 -0
  7. package/dist/Commands/MigrateCommand.js +8 -0
  8. package/dist/Commands/ServeCommand.cjs +159 -0
  9. package/dist/Commands/ServeCommand.js +8 -0
  10. package/dist/Contracts/ICommand.cjs +18 -0
  11. package/dist/Contracts/ICommand.js +1 -0
  12. package/dist/IO/app.cjs +934 -0
  13. package/dist/IO/app.js +17 -0
  14. package/dist/IO/providers.cjs +909 -0
  15. package/dist/IO/providers.js +16 -0
  16. package/dist/Kernel.cjs +892 -0
  17. package/dist/Kernel.js +14 -0
  18. package/dist/Musket.cjs +837 -0
  19. package/dist/Musket.js +13 -0
  20. package/dist/Providers/ConsoleServiceProvider.cjs +904 -0
  21. package/dist/Providers/ConsoleServiceProvider.js +15 -0
  22. package/dist/Signature.cjs +172 -0
  23. package/dist/Signature.js +7 -0
  24. package/dist/Utils.cjs +218 -0
  25. package/dist/Utils.js +9 -0
  26. package/dist/chunk-3FVPHQCH.js +151 -0
  27. package/dist/chunk-FOSDCKCR.js +106 -0
  28. package/dist/chunk-IGEFNODG.js +22 -0
  29. package/dist/chunk-KMIFCLXG.js +16 -0
  30. package/dist/chunk-NADN2PHB.js +0 -0
  31. package/dist/chunk-O45AB4MX.js +83 -0
  32. package/dist/chunk-PMV4TMFS.js +151 -0
  33. package/dist/chunk-POF4JGTX.js +186 -0
  34. package/dist/chunk-SHUYVCID.js +6 -0
  35. package/dist/chunk-SP4JKAUC.js +63 -0
  36. package/dist/chunk-TN5SV7LF.js +133 -0
  37. package/dist/chunk-UCOXL3OM.js +0 -0
  38. package/dist/chunk-URLTFJET.js +68 -0
  39. package/dist/chunk-XSL373TG.js +36 -0
  40. package/dist/index.cjs +889 -3
  41. package/dist/index.d.cts +306 -2
  42. package/dist/index.d.ts +306 -2
  43. package/dist/index.js +43 -15
  44. package/dist/run.cjs +1 -0
  45. package/dist/run.js +1 -0
  46. package/package.json +21 -4
  47. package/dist/index.cjs.map +0 -1
  48. package/dist/index.js.map +0 -1
@@ -0,0 +1,202 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/Commands/MigrateCommand.ts
22
+ var MigrateCommand_exports = {};
23
+ __export(MigrateCommand_exports, {
24
+ MigrateCommand: () => MigrateCommand
25
+ });
26
+ module.exports = __toCommonJS(MigrateCommand_exports);
27
+
28
+ // src/Commands/Command.ts
29
+ var Command = class {
30
+ static {
31
+ __name(this, "Command");
32
+ }
33
+ app;
34
+ kernel;
35
+ constructor(app, kernel) {
36
+ this.app = app;
37
+ this.kernel = kernel;
38
+ }
39
+ /**
40
+ * The name and signature of the console command.
41
+ *
42
+ * @var string
43
+ */
44
+ signature;
45
+ /**
46
+ * A dictionary of signatures or what not.
47
+ *
48
+ * @var object
49
+ */
50
+ dictionary = {};
51
+ /**
52
+ * The console command description.
53
+ *
54
+ * @var string
55
+ */
56
+ description;
57
+ /**
58
+ * The console command input.
59
+ *
60
+ * @var object
61
+ */
62
+ input = {
63
+ options: {},
64
+ arguments: {}
65
+ };
66
+ /**
67
+ * Execute the console command.
68
+ */
69
+ async handle(..._args) {
70
+ }
71
+ setApplication(app) {
72
+ this.app = app;
73
+ }
74
+ setInput(options, args, regArgs, dictionary) {
75
+ this.dictionary = dictionary;
76
+ this.input.options = options;
77
+ this.input.arguments = regArgs.map((e, i) => ({
78
+ [e.name()]: args[i]
79
+ })).reduce((e, x) => Object.assign(e, x), {});
80
+ }
81
+ getSignature() {
82
+ return this.signature;
83
+ }
84
+ getDescription() {
85
+ return this.description;
86
+ }
87
+ option(key, def) {
88
+ return this.input.options[key] ?? def;
89
+ }
90
+ options(key) {
91
+ if (key) {
92
+ return this.input.options[key];
93
+ }
94
+ return this.input.options;
95
+ }
96
+ argument(key, def) {
97
+ return this.input.arguments[key] ?? def;
98
+ }
99
+ arguments() {
100
+ return this.input.arguments;
101
+ }
102
+ };
103
+
104
+ // src/Commands/MigrateCommand.ts
105
+ var import_arquebus = require("@h3ravel/arquebus");
106
+ var MigrateCommand = class extends Command {
107
+ static {
108
+ __name(this, "MigrateCommand");
109
+ }
110
+ /**
111
+ * The name and signature of the console command.
112
+ *
113
+ * @var string
114
+ */
115
+ signature = `migrate:
116
+ {fresh : Drop all tables and re-run all migrations.}
117
+ {install : Create the migration repository.}
118
+ {refresh : Reset and re-run all migrations.}
119
+ {reset : Rollback all database migrations.}
120
+ {rollback : Rollback the last database migration.}
121
+ {status : Show the status of each migration.}
122
+ {publish : Publish any migration files from installed packages.}
123
+ {^--s|seed : Seed the database}
124
+ `;
125
+ /**
126
+ * The console command description.
127
+ *
128
+ * @var string
129
+ */
130
+ description = "Run all pending migrations.";
131
+ /**
132
+ * Execute the console command.
133
+ */
134
+ async handle() {
135
+ const command = this.dictionary.name ?? this.dictionary.baseCommand;
136
+ const methods = {
137
+ migrate: "migrateRun",
138
+ fresh: "migrateFresh",
139
+ install: "migrateInstall",
140
+ refresh: "migrateRefresh",
141
+ reset: "migrateReset",
142
+ rollback: "migrateRollback",
143
+ status: "migrateStatus",
144
+ publish: "migratePublish"
145
+ };
146
+ await this?.[methods[command]]();
147
+ }
148
+ /**
149
+ * Run all pending migrations.
150
+ */
151
+ async migrateRun() {
152
+ this.kernel.output.success(`Running migrations are not yet supported.`);
153
+ }
154
+ /**
155
+ * Drop all tables and re-run all migrations.
156
+ */
157
+ async migrateFresh() {
158
+ this.kernel.output.success(`Drop all tables and re-run all migrations.`);
159
+ }
160
+ /**
161
+ * Create the migration repository.
162
+ */
163
+ async migrateInstall() {
164
+ this.kernel.output.success(`Create the migration repository.`);
165
+ }
166
+ /**
167
+ * Reset and re-run all migrations.
168
+ */
169
+ async migrateRefresh() {
170
+ this.kernel.output.success(`Resetting and re-running migrations is not yet supported.`);
171
+ }
172
+ /**
173
+ * Rollback all database migrations.
174
+ */
175
+ async migrateReset() {
176
+ this.kernel.output.success(`Rolling back all migration is not yet supported.`);
177
+ }
178
+ /**
179
+ * Rollback the last database migration.
180
+ */
181
+ async migrateRollback() {
182
+ this.kernel.output.success(`Rolling back the last migration is not yet supported.`);
183
+ }
184
+ /**
185
+ * Show the status of each migration.
186
+ */
187
+ async migrateStatus() {
188
+ const path = app_path();
189
+ console.log(import_arquebus.arquebus.connection());
190
+ this.kernel.output.success(`Show the status of each migration.`);
191
+ }
192
+ /**
193
+ * Publish any migration files from installed packages.
194
+ */
195
+ async migratePublish() {
196
+ this.kernel.output.success(`Publish any migration files from installed packages.`);
197
+ }
198
+ };
199
+ // Annotate the CommonJS export names for ESM import in node:
200
+ 0 && (module.exports = {
201
+ MigrateCommand
202
+ });
@@ -0,0 +1,8 @@
1
+ import {
2
+ MigrateCommand
3
+ } from "../chunk-FOSDCKCR.js";
4
+ import "../chunk-O45AB4MX.js";
5
+ import "../chunk-SHUYVCID.js";
6
+ export {
7
+ MigrateCommand
8
+ };
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/Commands/ServeCommand.ts
22
+ var ServeCommand_exports = {};
23
+ __export(ServeCommand_exports, {
24
+ ServeCommand: () => ServeCommand
25
+ });
26
+ module.exports = __toCommonJS(ServeCommand_exports);
27
+
28
+ // src/Commands/Command.ts
29
+ var Command = class {
30
+ static {
31
+ __name(this, "Command");
32
+ }
33
+ app;
34
+ kernel;
35
+ constructor(app, kernel) {
36
+ this.app = app;
37
+ this.kernel = kernel;
38
+ }
39
+ /**
40
+ * The name and signature of the console command.
41
+ *
42
+ * @var string
43
+ */
44
+ signature;
45
+ /**
46
+ * A dictionary of signatures or what not.
47
+ *
48
+ * @var object
49
+ */
50
+ dictionary = {};
51
+ /**
52
+ * The console command description.
53
+ *
54
+ * @var string
55
+ */
56
+ description;
57
+ /**
58
+ * The console command input.
59
+ *
60
+ * @var object
61
+ */
62
+ input = {
63
+ options: {},
64
+ arguments: {}
65
+ };
66
+ /**
67
+ * Execute the console command.
68
+ */
69
+ async handle(..._args) {
70
+ }
71
+ setApplication(app) {
72
+ this.app = app;
73
+ }
74
+ setInput(options, args, regArgs, dictionary) {
75
+ this.dictionary = dictionary;
76
+ this.input.options = options;
77
+ this.input.arguments = regArgs.map((e, i) => ({
78
+ [e.name()]: args[i]
79
+ })).reduce((e, x) => Object.assign(e, x), {});
80
+ }
81
+ getSignature() {
82
+ return this.signature;
83
+ }
84
+ getDescription() {
85
+ return this.description;
86
+ }
87
+ option(key, def) {
88
+ return this.input.options[key] ?? def;
89
+ }
90
+ options(key) {
91
+ if (key) {
92
+ return this.input.options[key];
93
+ }
94
+ return this.input.options;
95
+ }
96
+ argument(key, def) {
97
+ return this.input.arguments[key] ?? def;
98
+ }
99
+ arguments() {
100
+ return this.input.arguments;
101
+ }
102
+ };
103
+
104
+ // src/Commands/ServeCommand.ts
105
+ var import_node_child_process = require("child_process");
106
+ var ServeCommand = class extends Command {
107
+ static {
108
+ __name(this, "ServeCommand");
109
+ }
110
+ /**
111
+ * The name and signature of the console command.
112
+ *
113
+ * @var string
114
+ */
115
+ signature = "serve";
116
+ /**
117
+ * The console command description.
118
+ *
119
+ * @var string
120
+ */
121
+ description = "Start the Developement Server";
122
+ async handle() {
123
+ try {
124
+ await this.serve();
125
+ } catch (e) {
126
+ this.kernel.output.error(e);
127
+ }
128
+ }
129
+ async serve() {
130
+ const child = (0, import_node_child_process.spawn)("tsup-node", {
131
+ stdio: "inherit",
132
+ shell: true,
133
+ env: Object.assign({}, process.env, {
134
+ NODE_ENV: "development"
135
+ }),
136
+ detached: true
137
+ });
138
+ const cleanup = /* @__PURE__ */ __name(() => {
139
+ console.log(111);
140
+ if (child.pid) {
141
+ process.kill(child.pid, "SIGTERM");
142
+ }
143
+ }, "cleanup");
144
+ process.on("SIGINT", () => child.kill("SIGINT"));
145
+ process.on("SIGTERM", () => child.kill("SIGTERM"));
146
+ process.on("SIGINT", () => {
147
+ cleanup();
148
+ process.exit(0);
149
+ });
150
+ process.on("SIGTERM", () => {
151
+ cleanup();
152
+ process.exit(0);
153
+ });
154
+ }
155
+ };
156
+ // Annotate the CommonJS export names for ESM import in node:
157
+ 0 && (module.exports = {
158
+ ServeCommand
159
+ });
@@ -0,0 +1,8 @@
1
+ import {
2
+ ServeCommand
3
+ } from "../chunk-SP4JKAUC.js";
4
+ import "../chunk-O45AB4MX.js";
5
+ import "../chunk-SHUYVCID.js";
6
+ export {
7
+ ServeCommand
8
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/Contracts/ICommand.ts
17
+ var ICommand_exports = {};
18
+ module.exports = __toCommonJS(ICommand_exports);
@@ -0,0 +1 @@
1
+ import "../chunk-NADN2PHB.js";