@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.
- package/bin/fire.cjs +2 -0
- package/bin/fire.js +2 -0
- package/dist/Utils-7OrjoB1C.d.cts +22 -0
- package/dist/Utils-B1kpj9-1.cjs +130 -0
- package/dist/Utils-B1kpj9-1.cjs.map +1 -0
- package/dist/Utils-DAJvoXlr.js +86 -0
- package/dist/Utils-DAJvoXlr.js.map +1 -0
- package/dist/Utils-DxnHOGMz.d.ts +22 -0
- package/dist/Utils.cjs +3 -217
- package/dist/Utils.d.cts +2 -0
- package/dist/Utils.d.ts +2 -0
- package/dist/Utils.js +3 -9
- package/dist/index.cjs +885 -933
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +270 -290
- package/dist/index.d.ts +270 -290
- package/dist/index.js +899 -44
- package/dist/index.js.map +1 -0
- package/package.json +35 -23
- package/bin/chunk-6Z5DP356.js +0 -1
- package/bin/lexer-DQCqS3nf-XQPNMZG6.js +0 -4
- package/bin/run.cjs +0 -26
- package/bin/run.js +0 -26
- package/dist/Commands/Command.cjs +0 -104
- package/dist/Commands/Command.js +0 -7
- package/dist/Commands/MakeCommand.cjs +0 -433
- package/dist/Commands/MakeCommand.js +0 -9
- package/dist/Commands/MigrateCommand.cjs +0 -200
- package/dist/Commands/MigrateCommand.js +0 -8
- package/dist/Commands/ServeCommand.cjs +0 -159
- package/dist/Commands/ServeCommand.js +0 -8
- package/dist/Contracts/ICommand.cjs +0 -18
- package/dist/Contracts/ICommand.js +0 -1
- package/dist/IO/app.cjs +0 -946
- package/dist/IO/app.js +0 -17
- package/dist/IO/providers.cjs +0 -930
- package/dist/IO/providers.js +0 -16
- package/dist/Kernel.cjs +0 -890
- package/dist/Kernel.js +0 -14
- package/dist/Musket.cjs +0 -835
- package/dist/Musket.js +0 -13
- package/dist/Providers/ConsoleServiceProvider.cjs +0 -912
- package/dist/Providers/ConsoleServiceProvider.js +0 -15
- package/dist/Signature.cjs +0 -172
- package/dist/Signature.js +0 -7
- package/dist/chunk-23QH5R54.js +0 -27
- package/dist/chunk-2O2AYFAG.js +0 -63
- package/dist/chunk-3ASEWMRX.js +0 -37
- package/dist/chunk-3FVPHQCH.js +0 -151
- package/dist/chunk-3RX6CLNR.js +0 -32
- package/dist/chunk-3VCNSA6P.js +0 -14
- package/dist/chunk-3WHUADTN.js +0 -6
- package/dist/chunk-6OCHCPBP.js +0 -36
- package/dist/chunk-6OIH6FS4.js +0 -32
- package/dist/chunk-7EWRZPTX.js +0 -63
- package/dist/chunk-7PUQ5ZIN.js +0 -6
- package/dist/chunk-A5AONVOH.js +0 -6
- package/dist/chunk-ADIVRUAJ.js +0 -27
- package/dist/chunk-CCEWV2BR.js +0 -39
- package/dist/chunk-CTQ6DUT2.js +0 -8
- package/dist/chunk-DXQTBFGG.js +0 -31
- package/dist/chunk-E4SSLXFT.js +0 -63
- package/dist/chunk-E5XIGIEX.js +0 -14
- package/dist/chunk-EIOQKTRM.js +0 -104
- package/dist/chunk-FOSDCKCR.js +0 -106
- package/dist/chunk-G4OE26TZ.js +0 -33
- package/dist/chunk-GVGO5OAK.js +0 -8
- package/dist/chunk-GXRCTWKL.js +0 -16
- package/dist/chunk-HVKW7JK4.js +0 -8
- package/dist/chunk-IGEFNODG.js +0 -22
- package/dist/chunk-JXL4VJHZ.js +0 -36
- package/dist/chunk-K3GOQSS3.js +0 -6
- package/dist/chunk-KCJKQP37.js +0 -133
- package/dist/chunk-KMIFCLXG.js +0 -16
- package/dist/chunk-KZA3MC77.js +0 -151
- package/dist/chunk-LLL3V7LB.js +0 -6
- package/dist/chunk-LQ6DL2HS.js +0 -68
- package/dist/chunk-M4ZRDJJ2.js +0 -68
- package/dist/chunk-MAQAT3PU.js +0 -32
- package/dist/chunk-MPXPSSLJ.js +0 -133
- package/dist/chunk-NADN2PHB.js +0 -0
- package/dist/chunk-NFRXMBRP.js +0 -24
- package/dist/chunk-NVPKTRMT.js +0 -7
- package/dist/chunk-O45AB4MX.js +0 -83
- package/dist/chunk-ORPRWIQ2.js +0 -33
- package/dist/chunk-P7M5PEDY.js +0 -18
- package/dist/chunk-PBNCVQZC.js +0 -6
- package/dist/chunk-PMV4TMFS.js +0 -151
- package/dist/chunk-POF4JGTX.js +0 -186
- package/dist/chunk-PYSJMSNM.js +0 -27
- package/dist/chunk-Q3OMG6YH.js +0 -186
- package/dist/chunk-QCNBVSFO.js +0 -68
- package/dist/chunk-QMEO4OUR.js +0 -151
- package/dist/chunk-QSQNELZQ.js +0 -83
- package/dist/chunk-RRP7K5LI.js +0 -36
- package/dist/chunk-SHUYVCID.js +0 -6
- package/dist/chunk-SP4JKAUC.js +0 -63
- package/dist/chunk-T6OOKENF.js +0 -6
- package/dist/chunk-TBDROT3I.js +0 -6356
- package/dist/chunk-TH2RWMWA.js +0 -133
- package/dist/chunk-TJZCDDEV.js +0 -36
- package/dist/chunk-TN5SV7LF.js +0 -133
- package/dist/chunk-U6TOLKGJ.js +0 -22
- package/dist/chunk-UCOXL3OM.js +0 -0
- package/dist/chunk-URLTFJET.js +0 -68
- package/dist/chunk-UWCTG2LX.js +0 -24
- package/dist/chunk-WO2BXMBQ.js +0 -6
- package/dist/chunk-XAWZUZVP.js +0 -32
- package/dist/chunk-XCOSZXAE.js +0 -133
- package/dist/chunk-XD2Q7LWE.js +0 -24
- package/dist/chunk-XSL373TG.js +0 -36
- package/dist/chunk-XUYTJO6X.js +0 -104
- package/dist/chunk-YAYU7VOK.js +0 -8
- package/dist/chunk-YRUCICBV.js +0 -24
- package/dist/chunk-Z5XE72Q5.js +0 -68
- package/dist/chunk-ZTIO25VB.js +0 -8
- package/dist/lexer-DQCqS3nf-6W2BHF4T.js +0 -68
- package/dist/run.cjs +0 -943
- package/dist/run.js +0 -14
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConsoleServiceProvider
|
|
3
|
-
} from "../chunk-6OIH6FS4.js";
|
|
4
|
-
import "../chunk-QCNBVSFO.js";
|
|
5
|
-
import "../chunk-KCJKQP37.js";
|
|
6
|
-
import "../chunk-EIOQKTRM.js";
|
|
7
|
-
import "../chunk-7EWRZPTX.js";
|
|
8
|
-
import "../chunk-3FVPHQCH.js";
|
|
9
|
-
import "../chunk-PMV4TMFS.js";
|
|
10
|
-
import "../chunk-POF4JGTX.js";
|
|
11
|
-
import "../chunk-O45AB4MX.js";
|
|
12
|
-
import "../chunk-SHUYVCID.js";
|
|
13
|
-
export {
|
|
14
|
-
ConsoleServiceProvider
|
|
15
|
-
};
|
package/dist/Signature.cjs
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
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/Signature.ts
|
|
22
|
-
var Signature_exports = {};
|
|
23
|
-
__export(Signature_exports, {
|
|
24
|
-
Signature: () => Signature
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(Signature_exports);
|
|
27
|
-
var Signature = class _Signature {
|
|
28
|
-
static {
|
|
29
|
-
__name(this, "Signature");
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Helper to parse options inside a block of text
|
|
33
|
-
*
|
|
34
|
-
* @param block
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
static parseOptions(block) {
|
|
38
|
-
const options = [];
|
|
39
|
-
const regex = /\{([^{}]+(?:\{[^{}]*\}[^{}]*)*)\}/g;
|
|
40
|
-
let match;
|
|
41
|
-
while ((match = regex.exec(block)) !== null) {
|
|
42
|
-
const shared = "^" === match[1][0] || /:[#^]/.test(match[1]);
|
|
43
|
-
const isHidden = ([
|
|
44
|
-
"#",
|
|
45
|
-
"^"
|
|
46
|
-
].includes(match[1][0]) || /:[#^]/.test(match[1])) && !shared;
|
|
47
|
-
const content = match[1].trim().replace(/[#^]/, "");
|
|
48
|
-
const colonIndex = content.indexOf(":");
|
|
49
|
-
if (colonIndex === -1) {
|
|
50
|
-
options.push({
|
|
51
|
-
name: content
|
|
52
|
-
});
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
const namePart = content.substring(0, colonIndex).trim();
|
|
56
|
-
let rest = content.substring(colonIndex + 1).trim();
|
|
57
|
-
let description = rest;
|
|
58
|
-
let nestedOptions;
|
|
59
|
-
const pipeIndex = rest.indexOf("|");
|
|
60
|
-
if (pipeIndex !== -1) {
|
|
61
|
-
description = rest.substring(0, pipeIndex).trim();
|
|
62
|
-
const nestedText = rest.substring(pipeIndex + 1).trim();
|
|
63
|
-
const cleanedNestedText = nestedText.replace(/^\{/, "").trim();
|
|
64
|
-
nestedOptions = _Signature.parseOptions("{" + cleanedNestedText + "}");
|
|
65
|
-
} else {
|
|
66
|
-
description = description.trim();
|
|
67
|
-
}
|
|
68
|
-
let name = namePart;
|
|
69
|
-
let required = /[^a-zA-Z0-9_|-]/.test(name);
|
|
70
|
-
let multiple = false;
|
|
71
|
-
if (name.endsWith("?*")) {
|
|
72
|
-
required = false;
|
|
73
|
-
multiple = true;
|
|
74
|
-
name = name.slice(0, -2);
|
|
75
|
-
} else if (name.endsWith("*")) {
|
|
76
|
-
multiple = true;
|
|
77
|
-
name = name.slice(0, -1);
|
|
78
|
-
} else if (name.endsWith("?")) {
|
|
79
|
-
required = false;
|
|
80
|
-
name = name.slice(0, -1);
|
|
81
|
-
}
|
|
82
|
-
const isFlag = name.startsWith("--");
|
|
83
|
-
let flags;
|
|
84
|
-
let defaultValue;
|
|
85
|
-
if (isFlag) {
|
|
86
|
-
const flagParts = name.split("|").map((s) => s.trim());
|
|
87
|
-
flags = [];
|
|
88
|
-
for (let part of flagParts) {
|
|
89
|
-
if (part.startsWith("--") && part.slice(2).length === 1) {
|
|
90
|
-
part = "-" + part.slice(2);
|
|
91
|
-
} else if (part.startsWith("-") && !part.startsWith("--") && part.slice(1).length > 1) {
|
|
92
|
-
part = "--" + part.slice(1);
|
|
93
|
-
} else if (!part.startsWith("-") && part.slice(1).length > 1) {
|
|
94
|
-
part = "--" + part;
|
|
95
|
-
}
|
|
96
|
-
const eqIndex = part.indexOf("=");
|
|
97
|
-
if (eqIndex !== -1) {
|
|
98
|
-
flags.push(part.substring(0, eqIndex));
|
|
99
|
-
const val = part.substring(eqIndex + 1);
|
|
100
|
-
if (val === "*") {
|
|
101
|
-
defaultValue = [];
|
|
102
|
-
} else if (val === "true" || val === "false" || !val && !required) {
|
|
103
|
-
defaultValue = val === "true";
|
|
104
|
-
} else if (!isNaN(Number(val))) {
|
|
105
|
-
defaultValue = Number(val);
|
|
106
|
-
} else {
|
|
107
|
-
defaultValue = val;
|
|
108
|
-
}
|
|
109
|
-
} else {
|
|
110
|
-
flags.push(part);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
options.push({
|
|
115
|
-
name: isFlag ? flags[flags.length - 1] : name,
|
|
116
|
-
required,
|
|
117
|
-
multiple,
|
|
118
|
-
description,
|
|
119
|
-
flags,
|
|
120
|
-
shared,
|
|
121
|
-
isFlag,
|
|
122
|
-
isHidden,
|
|
123
|
-
defaultValue,
|
|
124
|
-
nestedOptions
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
return options;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Helper to parse a command's signature
|
|
131
|
-
*
|
|
132
|
-
* @param signature
|
|
133
|
-
* @param commandClass
|
|
134
|
-
* @returns
|
|
135
|
-
*/
|
|
136
|
-
static parseSignature(signature, commandClass) {
|
|
137
|
-
const lines = signature.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
138
|
-
const isHidden = [
|
|
139
|
-
"#",
|
|
140
|
-
"^"
|
|
141
|
-
].includes(lines[0][0]) || /:[#^]/.test(lines[0]);
|
|
142
|
-
const baseCommand = lines[0].replace(/[^\w=:-]/g, "");
|
|
143
|
-
const description = commandClass.getDescription();
|
|
144
|
-
const isNamespaceCommand = baseCommand.endsWith(":");
|
|
145
|
-
const rest = lines.slice(1).join(" ");
|
|
146
|
-
const allOptions = _Signature.parseOptions(rest);
|
|
147
|
-
if (isNamespaceCommand) {
|
|
148
|
-
return {
|
|
149
|
-
baseCommand: baseCommand.slice(0, -1),
|
|
150
|
-
isNamespaceCommand,
|
|
151
|
-
subCommands: allOptions.filter((e) => !e.flags && !e.isHidden),
|
|
152
|
-
description,
|
|
153
|
-
commandClass,
|
|
154
|
-
options: allOptions.filter((e) => !!e.flags),
|
|
155
|
-
isHidden
|
|
156
|
-
};
|
|
157
|
-
} else {
|
|
158
|
-
return {
|
|
159
|
-
baseCommand,
|
|
160
|
-
isNamespaceCommand,
|
|
161
|
-
options: allOptions,
|
|
162
|
-
description,
|
|
163
|
-
commandClass,
|
|
164
|
-
isHidden
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
170
|
-
0 && (module.exports = {
|
|
171
|
-
Signature
|
|
172
|
-
});
|
package/dist/Signature.js
DELETED
package/dist/chunk-23QH5R54.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConsoleServiceProvider
|
|
3
|
-
} from "./chunk-XAWZUZVP.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
|
-
};
|
package/dist/chunk-2O2AYFAG.js
DELETED
|
@@ -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(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
|
-
};
|
package/dist/chunk-3ASEWMRX.js
DELETED
|
@@ -1,37 +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, Kernel } from "@h3ravel/core";
|
|
10
|
-
import { Request, Response } from "@h3ravel/http";
|
|
11
|
-
import { HttpContext } from "@h3ravel/shared";
|
|
12
|
-
var app_default = class {
|
|
13
|
-
static {
|
|
14
|
-
__name(this, "default");
|
|
15
|
-
}
|
|
16
|
-
async bootstrap() {
|
|
17
|
-
const app = new Application(process.cwd());
|
|
18
|
-
app.registerProviders(providers_default);
|
|
19
|
-
await app.registerConfiguredProviders();
|
|
20
|
-
await app.boot();
|
|
21
|
-
const h3App = app.make("http.app");
|
|
22
|
-
const serve = app.make("http.serve");
|
|
23
|
-
const kernel = new Kernel((event) => HttpContext.init({
|
|
24
|
-
app,
|
|
25
|
-
request: new Request(event, app),
|
|
26
|
-
response: new Response(event, app)
|
|
27
|
-
}));
|
|
28
|
-
h3App.use((event) => kernel.handle(event, async () => void 0));
|
|
29
|
-
serve(h3App, {
|
|
30
|
-
port: 3001
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export {
|
|
36
|
-
app_default
|
|
37
|
-
};
|
package/dist/chunk-3FVPHQCH.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-SHUYVCID.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
|
-
};
|
package/dist/chunk-3RX6CLNR.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Kernel
|
|
3
|
-
} from "./chunk-LQ6DL2HS.js";
|
|
4
|
-
import {
|
|
5
|
-
__name
|
|
6
|
-
} from "./chunk-SHUYVCID.js";
|
|
7
|
-
|
|
8
|
-
// src/Providers/ConsoleServiceProvider.ts
|
|
9
|
-
import { EventEmitter } from "events";
|
|
10
|
-
import { ServiceProvider } from "@h3ravel/core";
|
|
11
|
-
var ConsoleServiceProvider = class extends ServiceProvider {
|
|
12
|
-
static {
|
|
13
|
-
__name(this, "ConsoleServiceProvider");
|
|
14
|
-
}
|
|
15
|
-
static priority = 992;
|
|
16
|
-
register() {
|
|
17
|
-
}
|
|
18
|
-
boot() {
|
|
19
|
-
Kernel.init(this.app);
|
|
20
|
-
new EventEmitter().once("SIGINT", () => process.exit(0));
|
|
21
|
-
process.on("SIGINT", () => {
|
|
22
|
-
process.exit(0);
|
|
23
|
-
});
|
|
24
|
-
process.on("SIGTERM", () => {
|
|
25
|
-
process.exit(0);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
ConsoleServiceProvider
|
|
32
|
-
};
|
package/dist/chunk-3VCNSA6P.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConsoleServiceProvider
|
|
3
|
-
} from "./chunk-U6TOLKGJ.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
|
-
};
|
package/dist/chunk-3WHUADTN.js
DELETED
package/dist/chunk-6OCHCPBP.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
providers_default
|
|
3
|
-
} from "./chunk-E5XIGIEX.js";
|
|
4
|
-
import {
|
|
5
|
-
Kernel
|
|
6
|
-
} from "./chunk-URLTFJET.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
|
-
};
|
package/dist/chunk-6OIH6FS4.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Kernel
|
|
3
|
-
} from "./chunk-QCNBVSFO.js";
|
|
4
|
-
import {
|
|
5
|
-
__name
|
|
6
|
-
} from "./chunk-SHUYVCID.js";
|
|
7
|
-
|
|
8
|
-
// src/Providers/ConsoleServiceProvider.ts
|
|
9
|
-
import { EventEmitter } from "events";
|
|
10
|
-
import { ServiceProvider } from "@h3ravel/core";
|
|
11
|
-
var ConsoleServiceProvider = class extends ServiceProvider {
|
|
12
|
-
static {
|
|
13
|
-
__name(this, "ConsoleServiceProvider");
|
|
14
|
-
}
|
|
15
|
-
static priority = 992;
|
|
16
|
-
register() {
|
|
17
|
-
}
|
|
18
|
-
boot() {
|
|
19
|
-
Kernel.init(this.app);
|
|
20
|
-
new EventEmitter().once("SIGINT", () => process.exit(0));
|
|
21
|
-
process.on("SIGINT", () => {
|
|
22
|
-
process.exit(0);
|
|
23
|
-
});
|
|
24
|
-
process.on("SIGTERM", () => {
|
|
25
|
-
process.exit(0);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
ConsoleServiceProvider
|
|
32
|
-
};
|
package/dist/chunk-7EWRZPTX.js
DELETED
|
@@ -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: 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
|
-
};
|
package/dist/chunk-7PUQ5ZIN.js
DELETED