@h3ravel/console 11.0.7 → 11.2.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-CpiQZ3n9.cjs +122 -0
  4. package/dist/Utils-CpiQZ3n9.cjs.map +1 -0
  5. package/dist/Utils-Dvclc4Pc.js +73 -0
  6. package/dist/Utils-Dvclc4Pc.js.map +1 -0
  7. package/dist/Utils-cBgwEyTl.d.ts +20 -0
  8. package/dist/Utils-rIdzILgO.d.cts +20 -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 +790 -949
  14. package/dist/index.cjs.map +1 -0
  15. package/dist/index.d.cts +173 -295
  16. package/dist/index.d.ts +173 -295
  17. package/dist/index.js +789 -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,151 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-CCEWV2BR.js";
4
-
5
- // src/Signature.ts
6
- var Signature = class _Signature {
7
- static {
8
- __name(this, "Signature");
9
- }
10
- /**
11
- * Helper to parse options inside a block of text
12
- *
13
- * @param block
14
- * @returns
15
- */
16
- static parseOptions(block) {
17
- const options = [];
18
- const regex = /\{([^{}]+(?:\{[^{}]*\}[^{}]*)*)\}/g;
19
- let match;
20
- while ((match = regex.exec(block)) !== null) {
21
- const shared = "^" === match[1][0] || /:[#^]/.test(match[1]);
22
- const isHidden = ([
23
- "#",
24
- "^"
25
- ].includes(match[1][0]) || /:[#^]/.test(match[1])) && !shared;
26
- const content = match[1].trim().replace(/[#^]/, "");
27
- const colonIndex = content.indexOf(":");
28
- if (colonIndex === -1) {
29
- options.push({
30
- name: content
31
- });
32
- continue;
33
- }
34
- const namePart = content.substring(0, colonIndex).trim();
35
- let rest = content.substring(colonIndex + 1).trim();
36
- let description = rest;
37
- let nestedOptions;
38
- const pipeIndex = rest.indexOf("|");
39
- if (pipeIndex !== -1) {
40
- description = rest.substring(0, pipeIndex).trim();
41
- const nestedText = rest.substring(pipeIndex + 1).trim();
42
- const cleanedNestedText = nestedText.replace(/^\{/, "").trim();
43
- nestedOptions = _Signature.parseOptions("{" + cleanedNestedText + "}");
44
- } else {
45
- description = description.trim();
46
- }
47
- let name = namePart;
48
- let required = /[^a-zA-Z0-9_|-]/.test(name);
49
- let multiple = false;
50
- if (name.endsWith("?*")) {
51
- required = false;
52
- multiple = true;
53
- name = name.slice(0, -2);
54
- } else if (name.endsWith("*")) {
55
- multiple = true;
56
- name = name.slice(0, -1);
57
- } else if (name.endsWith("?")) {
58
- required = false;
59
- name = name.slice(0, -1);
60
- }
61
- const isFlag = name.startsWith("--");
62
- let flags;
63
- let defaultValue;
64
- if (isFlag) {
65
- const flagParts = name.split("|").map((s) => s.trim());
66
- flags = [];
67
- for (let part of flagParts) {
68
- if (part.startsWith("--") && part.slice(2).length === 1) {
69
- part = "-" + part.slice(2);
70
- } else if (part.startsWith("-") && !part.startsWith("--") && part.slice(1).length > 1) {
71
- part = "--" + part.slice(1);
72
- } else if (!part.startsWith("-") && part.slice(1).length > 1) {
73
- part = "--" + part;
74
- }
75
- const eqIndex = part.indexOf("=");
76
- if (eqIndex !== -1) {
77
- flags.push(part.substring(0, eqIndex));
78
- const val = part.substring(eqIndex + 1);
79
- if (val === "*") {
80
- defaultValue = [];
81
- } else if (val === "true" || val === "false" || !val && !required) {
82
- defaultValue = val === "true";
83
- } else if (!isNaN(Number(val))) {
84
- defaultValue = Number(val);
85
- } else {
86
- defaultValue = val;
87
- }
88
- } else {
89
- flags.push(part);
90
- }
91
- }
92
- }
93
- options.push({
94
- name: isFlag ? flags[flags.length - 1] : name,
95
- required,
96
- multiple,
97
- description,
98
- flags,
99
- shared,
100
- isFlag,
101
- isHidden,
102
- defaultValue,
103
- nestedOptions
104
- });
105
- }
106
- return options;
107
- }
108
- /**
109
- * Helper to parse a command's signature
110
- *
111
- * @param signature
112
- * @param commandClass
113
- * @returns
114
- */
115
- static parseSignature(signature, commandClass) {
116
- const lines = signature.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
117
- const isHidden = [
118
- "#",
119
- "^"
120
- ].includes(lines[0][0]) || /:[#^]/.test(lines[0]);
121
- const baseCommand = lines[0].replace(/[^\w=:-]/g, "");
122
- const description = commandClass.getDescription();
123
- const isNamespaceCommand = baseCommand.endsWith(":");
124
- const rest = lines.slice(1).join(" ");
125
- const allOptions = _Signature.parseOptions(rest);
126
- if (isNamespaceCommand) {
127
- return {
128
- baseCommand: baseCommand.slice(0, -1),
129
- isNamespaceCommand,
130
- subCommands: allOptions.filter((e) => !e.flags && !e.isHidden),
131
- description,
132
- commandClass,
133
- options: allOptions.filter((e) => !!e.flags),
134
- isHidden
135
- };
136
- } else {
137
- return {
138
- baseCommand,
139
- isNamespaceCommand,
140
- options: allOptions,
141
- description,
142
- commandClass,
143
- isHidden
144
- };
145
- }
146
- }
147
- };
148
-
149
- export {
150
- Signature
151
- };
@@ -1,83 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-CCEWV2BR.js";
4
-
5
- // src/Commands/Command.ts
6
- var Command = class {
7
- static {
8
- __name(this, "Command");
9
- }
10
- app;
11
- kernel;
12
- constructor(app, kernel) {
13
- this.app = app;
14
- this.kernel = kernel;
15
- }
16
- /**
17
- * The name and signature of the console command.
18
- *
19
- * @var string
20
- */
21
- signature;
22
- /**
23
- * A dictionary of signatures or what not.
24
- *
25
- * @var object
26
- */
27
- dictionary = {};
28
- /**
29
- * The console command description.
30
- *
31
- * @var string
32
- */
33
- description;
34
- /**
35
- * The console command input.
36
- *
37
- * @var object
38
- */
39
- input = {
40
- options: {},
41
- arguments: {}
42
- };
43
- /**
44
- * Execute the console command.
45
- */
46
- async handle(..._args) {
47
- }
48
- setApplication(app) {
49
- this.app = app;
50
- }
51
- setInput(options, args, regArgs, dictionary) {
52
- this.dictionary = dictionary;
53
- this.input.options = options;
54
- this.input.arguments = regArgs.map((e, i) => ({
55
- [e.name()]: args[i]
56
- })).reduce((e, x) => Object.assign(e, x), {});
57
- }
58
- getSignature() {
59
- return this.signature;
60
- }
61
- getDescription() {
62
- return this.description;
63
- }
64
- option(key, def) {
65
- return this.input.options[key] ?? def;
66
- }
67
- options(key) {
68
- if (key) {
69
- return this.input.options[key];
70
- }
71
- return this.input.options;
72
- }
73
- argument(key, def) {
74
- return this.input.arguments[key] ?? def;
75
- }
76
- arguments() {
77
- return this.input.arguments;
78
- }
79
- };
80
-
81
- export {
82
- Command
83
- };
@@ -1,36 +0,0 @@
1
- import {
2
- providers_default
3
- } from "./chunk-3VCNSA6P.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
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- export {
5
- __name
6
- };
@@ -1,63 +0,0 @@
1
- import {
2
- Command
3
- } from "./chunk-O45AB4MX.js";
4
- import {
5
- __name
6
- } from "./chunk-SHUYVCID.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: true
41
- });
42
- const cleanup = /* @__PURE__ */ __name(() => {
43
- console.log(111);
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,6 +0,0 @@
1
- import {
2
- app_default
3
- } from "./chunk-ORPRWIQ2.js";
4
-
5
- // src/run.ts
6
- new app_default().bootstrap();