@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.
- package/bin/fire.cjs +2 -0
- package/bin/fire.js +2 -0
- package/dist/Utils-CpiQZ3n9.cjs +122 -0
- package/dist/Utils-CpiQZ3n9.cjs.map +1 -0
- package/dist/Utils-Dvclc4Pc.js +73 -0
- package/dist/Utils-Dvclc4Pc.js.map +1 -0
- package/dist/Utils-cBgwEyTl.d.ts +20 -0
- package/dist/Utils-rIdzILgO.d.cts +20 -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 +790 -949
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +173 -295
- package/dist/index.d.ts +173 -295
- package/dist/index.js +789 -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
package/dist/chunk-PMV4TMFS.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TableGuesser,
|
|
3
|
-
Utils
|
|
4
|
-
} from "./chunk-POF4JGTX.js";
|
|
5
|
-
import {
|
|
6
|
-
Command
|
|
7
|
-
} from "./chunk-O45AB4MX.js";
|
|
8
|
-
import {
|
|
9
|
-
__name
|
|
10
|
-
} from "./chunk-SHUYVCID.js";
|
|
11
|
-
|
|
12
|
-
// src/Commands/MakeCommand.ts
|
|
13
|
-
import { readFile, writeFile } from "fs/promises";
|
|
14
|
-
import chalk from "chalk";
|
|
15
|
-
import dayjs from "dayjs";
|
|
16
|
-
import { existsSync } from "fs";
|
|
17
|
-
import nodepath from "path";
|
|
18
|
-
var MakeCommand = class extends Command {
|
|
19
|
-
static {
|
|
20
|
-
__name(this, "MakeCommand");
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* The name and signature of the console command.
|
|
24
|
-
*
|
|
25
|
-
* @var string
|
|
26
|
-
*/
|
|
27
|
-
signature = `#make:
|
|
28
|
-
{controller : Generates a new controller class. | {--a|api : Generate an API resource controller} | {--force : Overide existing controller.} }
|
|
29
|
-
{resource : Generates a new API resource class.}
|
|
30
|
-
{migration : Generates a new database migration class. | {--l|type=ts : The file type to generate} | {--t|table : The table to migrate} | {--c|create : The table to be created} }
|
|
31
|
-
{factory : Generates a new database factory class.}
|
|
32
|
-
{seeder : Generates a new database seeder class.}
|
|
33
|
-
{model : Generates a new Arquebus model class. | {--t|type=ts : The file type to generate}}
|
|
34
|
-
{^name : The name of the [name] to generate}
|
|
35
|
-
`;
|
|
36
|
-
/**
|
|
37
|
-
* The console command description.
|
|
38
|
-
*
|
|
39
|
-
* @var string
|
|
40
|
-
*/
|
|
41
|
-
description = "Generate component classes";
|
|
42
|
-
async handle() {
|
|
43
|
-
const command = this.dictionary.baseCommand;
|
|
44
|
-
const methods = {
|
|
45
|
-
controller: "makeController",
|
|
46
|
-
resource: "makeResource",
|
|
47
|
-
migration: "makeMigration",
|
|
48
|
-
factory: "makeFactory",
|
|
49
|
-
seeder: "makeSeeder",
|
|
50
|
-
model: "makeModel"
|
|
51
|
-
};
|
|
52
|
-
try {
|
|
53
|
-
await this?.[methods[command]]();
|
|
54
|
-
} catch (e) {
|
|
55
|
-
this.kernel.output.error(e);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Generate a new controller class.
|
|
60
|
-
*/
|
|
61
|
-
async makeController() {
|
|
62
|
-
const type = this.option("api") ? "-resource" : "";
|
|
63
|
-
const name = this.argument("name");
|
|
64
|
-
const force = this.option("force");
|
|
65
|
-
const path = nodepath.join(app_path("Http/Controllers"), name + ".ts");
|
|
66
|
-
const dbPath = Utils.findModulePkg("@h3ravel/http", this.kernel.cwd) ?? "";
|
|
67
|
-
const stubPath = nodepath.join(dbPath, `dist/stubs/controller${type}.stub`);
|
|
68
|
-
if (!force && existsSync(path)) {
|
|
69
|
-
this.kernel.output.error(`ERORR: ${name} controller already exists`);
|
|
70
|
-
}
|
|
71
|
-
let stub = await readFile(stubPath, "utf-8");
|
|
72
|
-
stub = stub.replace(/{{ name }}/g, name);
|
|
73
|
-
await writeFile(path, stub);
|
|
74
|
-
this.kernel.output.split(`INFO: Controller Created`, chalk.gray(nodepath.basename(path)));
|
|
75
|
-
}
|
|
76
|
-
makeResource() {
|
|
77
|
-
this.kernel.output.success(`Resource support is not yet available`);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Generate a new database migration class
|
|
81
|
-
*/
|
|
82
|
-
async makeMigration() {
|
|
83
|
-
const name = this.argument("name");
|
|
84
|
-
const datePrefix = dayjs().format("YYYY_MM_DD_HHmmss");
|
|
85
|
-
const path = nodepath.join(database_path("migrations"), `${datePrefix}_${name}.ts`);
|
|
86
|
-
const dbPath = Utils.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
|
|
87
|
-
let create = this.option("create", false);
|
|
88
|
-
let table = this.option("table");
|
|
89
|
-
if (!table && typeof create === "string") {
|
|
90
|
-
table = create;
|
|
91
|
-
create = true;
|
|
92
|
-
}
|
|
93
|
-
if (!table) {
|
|
94
|
-
const guessed = TableGuesser.guess(name);
|
|
95
|
-
table = guessed[0];
|
|
96
|
-
create = !!guessed[1];
|
|
97
|
-
}
|
|
98
|
-
const stubPath = nodepath.join(dbPath, this.getMigrationStubName(table, create));
|
|
99
|
-
let stub = await readFile(stubPath, "utf-8");
|
|
100
|
-
if (table !== null) {
|
|
101
|
-
stub = stub.replace(/DummyTable|{{\s*table\s*}}/g, table);
|
|
102
|
-
}
|
|
103
|
-
this.kernel.output.info("INFO: Creating Migration");
|
|
104
|
-
await this.kernel.ensureDirectoryExists(nodepath.dirname(path));
|
|
105
|
-
await writeFile(path, stub);
|
|
106
|
-
this.kernel.output.split(`INFO: Migration Created`, chalk.gray(nodepath.basename(path)));
|
|
107
|
-
}
|
|
108
|
-
makeFactory() {
|
|
109
|
-
this.kernel.output.success(`Factory support is not yet available`);
|
|
110
|
-
}
|
|
111
|
-
makeSeeder() {
|
|
112
|
-
this.kernel.output.success(`Seeder support is not yet available`);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Generate a new Arquebus model class
|
|
116
|
-
*/
|
|
117
|
-
async makeModel() {
|
|
118
|
-
const type = this.option("type", "ts");
|
|
119
|
-
const name = this.argument("name");
|
|
120
|
-
const path = nodepath.join(app_path("Models"), name.toLowerCase() + "." + type);
|
|
121
|
-
const dbPath = Utils.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
|
|
122
|
-
const stubPath = nodepath.join(dbPath, `dist/stubs/model-${type}.stub`);
|
|
123
|
-
let stub = await readFile(stubPath, "utf-8");
|
|
124
|
-
stub = stub.replace(/{{ name }}/g, name);
|
|
125
|
-
await writeFile(path, stub);
|
|
126
|
-
this.kernel.output.split(`INFO: Model Created`, chalk.gray(nodepath.basename(path)));
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Ge the database migration file name
|
|
130
|
-
*
|
|
131
|
-
* @param table
|
|
132
|
-
* @param create
|
|
133
|
-
* @param type
|
|
134
|
-
* @returns
|
|
135
|
-
*/
|
|
136
|
-
getMigrationStubName(table, create = false, type = "ts") {
|
|
137
|
-
let stub;
|
|
138
|
-
if (!table) {
|
|
139
|
-
stub = `migration-${type}.stub`;
|
|
140
|
-
} else if (create) {
|
|
141
|
-
stub = `migration.create-${type}.stub`;
|
|
142
|
-
} else {
|
|
143
|
-
stub = `migration.update-${type}.stub`;
|
|
144
|
-
}
|
|
145
|
-
return "dist/stubs/" + stub;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export {
|
|
150
|
-
MakeCommand
|
|
151
|
-
};
|
package/dist/chunk-POF4JGTX.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-SHUYVCID.js";
|
|
4
|
-
|
|
5
|
-
// src/Utils.ts
|
|
6
|
-
import { access } from "fs/promises";
|
|
7
|
-
import chalk from "chalk";
|
|
8
|
-
|
|
9
|
-
// ../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs
|
|
10
|
-
import { dirname, resolve } from "path";
|
|
11
|
-
import { readdirSync, statSync } from "fs";
|
|
12
|
-
function sync_default(start, callback) {
|
|
13
|
-
let dir = resolve(".", start);
|
|
14
|
-
let tmp, stats = statSync(dir);
|
|
15
|
-
if (!stats.isDirectory()) {
|
|
16
|
-
dir = dirname(dir);
|
|
17
|
-
}
|
|
18
|
-
while (true) {
|
|
19
|
-
tmp = callback(dir, readdirSync(dir));
|
|
20
|
-
if (tmp) return resolve(dir, tmp);
|
|
21
|
-
dir = dirname(tmp = dir);
|
|
22
|
-
if (tmp === dir) break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
__name(sync_default, "default");
|
|
26
|
-
|
|
27
|
-
// src/Utils.ts
|
|
28
|
-
import path from "path";
|
|
29
|
-
var join = path.join;
|
|
30
|
-
var Utils = class {
|
|
31
|
-
static {
|
|
32
|
-
__name(this, "Utils");
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Wraps text with chalk
|
|
36
|
-
*
|
|
37
|
-
* @param txt
|
|
38
|
-
* @param color
|
|
39
|
-
* @returns
|
|
40
|
-
*/
|
|
41
|
-
static textFormat(txt, color) {
|
|
42
|
-
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Ouput formater object
|
|
46
|
-
*
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
static output() {
|
|
50
|
-
return {
|
|
51
|
-
success: /* @__PURE__ */ __name((msg, exit = false) => {
|
|
52
|
-
console.log(chalk.green("\u2713"), this.textFormat(msg, chalk.bgGreen), "\n");
|
|
53
|
-
if (exit) process.exit(0);
|
|
54
|
-
}, "success"),
|
|
55
|
-
info: /* @__PURE__ */ __name((msg, exit = false) => {
|
|
56
|
-
console.log(chalk.blue("\u2139"), this.textFormat(msg, chalk.bgBlue), "\n");
|
|
57
|
-
if (exit) process.exit(0);
|
|
58
|
-
}, "info"),
|
|
59
|
-
error: /* @__PURE__ */ __name((msg, exit = true) => {
|
|
60
|
-
if (msg instanceof Error) {
|
|
61
|
-
if (msg.message) {
|
|
62
|
-
console.error(chalk.red("\u2716"), this.textFormat("ERROR:" + msg.message, chalk.bgRed));
|
|
63
|
-
}
|
|
64
|
-
console.error(chalk.red(`${msg.detail ? `${msg.detail}
|
|
65
|
-
` : ""}${msg.stack}`), "\n");
|
|
66
|
-
} else {
|
|
67
|
-
console.error(chalk.red("\u2716"), this.textFormat(msg, chalk.bgRed), "\n");
|
|
68
|
-
}
|
|
69
|
-
if (exit) process.exit(1);
|
|
70
|
-
}, "error"),
|
|
71
|
-
split: /* @__PURE__ */ __name((name, value, status, exit = false) => {
|
|
72
|
-
status ??= "info";
|
|
73
|
-
const color = {
|
|
74
|
-
success: chalk.bgGreen,
|
|
75
|
-
info: chalk.bgBlue,
|
|
76
|
-
error: chalk.bgRed
|
|
77
|
-
};
|
|
78
|
-
const regex = /\x1b\[\d+m/g;
|
|
79
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
80
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
81
|
-
console.log(this.textFormat(name, color[status]), chalk.gray(".".repeat(dots)), value);
|
|
82
|
-
if (exit) process.exit(0);
|
|
83
|
-
}, "split"),
|
|
84
|
-
quiet: /* @__PURE__ */ __name(() => {
|
|
85
|
-
process.exit(0);
|
|
86
|
-
}, "quiet")
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
static findModulePkg(moduleId, cwd) {
|
|
90
|
-
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
91
|
-
let packageName = "";
|
|
92
|
-
if (parts.length > 0 && parts[0][0] === "@") {
|
|
93
|
-
packageName += parts.shift() + "/";
|
|
94
|
-
}
|
|
95
|
-
packageName += parts.shift();
|
|
96
|
-
const packageJson = path.join(cwd ?? process.cwd(), "node_modules", packageName);
|
|
97
|
-
const resolved = this.findUpConfig(packageJson, "package", [
|
|
98
|
-
"json"
|
|
99
|
-
]);
|
|
100
|
-
if (!resolved) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
return path.join(path.dirname(resolved), parts.join("/"));
|
|
104
|
-
}
|
|
105
|
-
static async getMigrationPaths(cwd, migrator, defaultPath, path2) {
|
|
106
|
-
if (path2) {
|
|
107
|
-
return [
|
|
108
|
-
join(cwd, path2)
|
|
109
|
-
];
|
|
110
|
-
}
|
|
111
|
-
return [
|
|
112
|
-
...migrator.getPaths(),
|
|
113
|
-
join(cwd, defaultPath)
|
|
114
|
-
];
|
|
115
|
-
}
|
|
116
|
-
static twoColumnDetail(name, value) {
|
|
117
|
-
const regex = /\x1b\[\d+m/g;
|
|
118
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
119
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
120
|
-
return console.log(name, chalk.gray(".".repeat(dots)), value);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Check if file exists
|
|
124
|
-
*
|
|
125
|
-
* @param path
|
|
126
|
-
* @returns
|
|
127
|
-
*/
|
|
128
|
-
static async fileExists(path2) {
|
|
129
|
-
try {
|
|
130
|
-
await access(path2);
|
|
131
|
-
return true;
|
|
132
|
-
} catch {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
static findUpConfig(cwd, name, extensions) {
|
|
137
|
-
return sync_default(cwd, (_dir, names) => {
|
|
138
|
-
for (const ext of extensions) {
|
|
139
|
-
const filename = `${name}.${ext}`;
|
|
140
|
-
if (names.includes(filename)) {
|
|
141
|
-
return filename;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
var TableGuesser = class TableGuesser2 {
|
|
149
|
-
static {
|
|
150
|
-
__name(this, "TableGuesser");
|
|
151
|
-
}
|
|
152
|
-
static CREATE_PATTERNS = [
|
|
153
|
-
/^create_(\w+)_table$/,
|
|
154
|
-
/^create_(\w+)$/
|
|
155
|
-
];
|
|
156
|
-
static CHANGE_PATTERNS = [
|
|
157
|
-
/.+_(to|from|in)_(\w+)_table$/,
|
|
158
|
-
/.+_(to|from|in)_(\w+)$/
|
|
159
|
-
];
|
|
160
|
-
static guess(migration) {
|
|
161
|
-
for (const pattern of TableGuesser2.CREATE_PATTERNS) {
|
|
162
|
-
const matches = migration.match(pattern);
|
|
163
|
-
if (matches) {
|
|
164
|
-
return [
|
|
165
|
-
matches[1],
|
|
166
|
-
true
|
|
167
|
-
];
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
for (const pattern of TableGuesser2.CHANGE_PATTERNS) {
|
|
171
|
-
const matches = migration.match(pattern);
|
|
172
|
-
if (matches) {
|
|
173
|
-
return [
|
|
174
|
-
matches[2],
|
|
175
|
-
false
|
|
176
|
-
];
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return [];
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export {
|
|
184
|
-
Utils,
|
|
185
|
-
TableGuesser
|
|
186
|
-
};
|
package/dist/chunk-PYSJMSNM.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConsoleServiceProvider
|
|
3
|
-
} from "./chunk-3RX6CLNR.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-Q3OMG6YH.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-CCEWV2BR.js";
|
|
4
|
-
|
|
5
|
-
// src/Utils.ts
|
|
6
|
-
import { access } from "fs/promises";
|
|
7
|
-
import chalk from "chalk";
|
|
8
|
-
|
|
9
|
-
// ../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs
|
|
10
|
-
import { dirname, resolve } from "path";
|
|
11
|
-
import { readdirSync, statSync } from "fs";
|
|
12
|
-
function sync_default(start, callback) {
|
|
13
|
-
let dir = resolve(".", start);
|
|
14
|
-
let tmp, stats = statSync(dir);
|
|
15
|
-
if (!stats.isDirectory()) {
|
|
16
|
-
dir = dirname(dir);
|
|
17
|
-
}
|
|
18
|
-
while (true) {
|
|
19
|
-
tmp = callback(dir, readdirSync(dir));
|
|
20
|
-
if (tmp) return resolve(dir, tmp);
|
|
21
|
-
dir = dirname(tmp = dir);
|
|
22
|
-
if (tmp === dir) break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
__name(sync_default, "default");
|
|
26
|
-
|
|
27
|
-
// src/Utils.ts
|
|
28
|
-
import path from "path";
|
|
29
|
-
var join = path.join;
|
|
30
|
-
var Utils = class {
|
|
31
|
-
static {
|
|
32
|
-
__name(this, "Utils");
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Wraps text with chalk
|
|
36
|
-
*
|
|
37
|
-
* @param txt
|
|
38
|
-
* @param color
|
|
39
|
-
* @returns
|
|
40
|
-
*/
|
|
41
|
-
static textFormat(txt, color) {
|
|
42
|
-
return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Ouput formater object
|
|
46
|
-
*
|
|
47
|
-
* @returns
|
|
48
|
-
*/
|
|
49
|
-
static output() {
|
|
50
|
-
return {
|
|
51
|
-
success: /* @__PURE__ */ __name((msg, exit = false) => {
|
|
52
|
-
console.log(chalk.green("\u2713"), this.textFormat(msg, chalk.bgGreen), "\n");
|
|
53
|
-
if (exit) process.exit(0);
|
|
54
|
-
}, "success"),
|
|
55
|
-
info: /* @__PURE__ */ __name((msg, exit = false) => {
|
|
56
|
-
console.log(chalk.blue("\u2139"), this.textFormat(msg, chalk.bgBlue), "\n");
|
|
57
|
-
if (exit) process.exit(0);
|
|
58
|
-
}, "info"),
|
|
59
|
-
error: /* @__PURE__ */ __name((msg, exit = true) => {
|
|
60
|
-
if (msg instanceof Error) {
|
|
61
|
-
if (msg.message) {
|
|
62
|
-
console.error(chalk.red("\u2716"), this.textFormat("ERROR:" + msg.message, chalk.bgRed));
|
|
63
|
-
}
|
|
64
|
-
console.error(chalk.red(`${msg.detail ? `${msg.detail}
|
|
65
|
-
` : ""}${msg.stack}`), "\n");
|
|
66
|
-
} else {
|
|
67
|
-
console.error(chalk.red("\u2716"), this.textFormat(msg, chalk.bgRed), "\n");
|
|
68
|
-
}
|
|
69
|
-
if (exit) process.exit(1);
|
|
70
|
-
}, "error"),
|
|
71
|
-
split: /* @__PURE__ */ __name((name, value, status, exit = false) => {
|
|
72
|
-
status ??= "info";
|
|
73
|
-
const color = {
|
|
74
|
-
success: chalk.bgGreen,
|
|
75
|
-
info: chalk.bgBlue,
|
|
76
|
-
error: chalk.bgRed
|
|
77
|
-
};
|
|
78
|
-
const regex = /\x1b\[\d+m/g;
|
|
79
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
80
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
81
|
-
console.log(this.textFormat(name, color[status]), chalk.gray(".".repeat(dots)), value);
|
|
82
|
-
if (exit) process.exit(0);
|
|
83
|
-
}, "split"),
|
|
84
|
-
quiet: /* @__PURE__ */ __name(() => {
|
|
85
|
-
process.exit(0);
|
|
86
|
-
}, "quiet")
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
static findModulePkg(moduleId, cwd) {
|
|
90
|
-
const parts = moduleId.replace(/\\/g, "/").split("/");
|
|
91
|
-
let packageName = "";
|
|
92
|
-
if (parts.length > 0 && parts[0][0] === "@") {
|
|
93
|
-
packageName += parts.shift() + "/";
|
|
94
|
-
}
|
|
95
|
-
packageName += parts.shift();
|
|
96
|
-
const packageJson = path.join(cwd ?? process.cwd(), "node_modules", packageName);
|
|
97
|
-
const resolved = this.findUpConfig(packageJson, "package", [
|
|
98
|
-
"json"
|
|
99
|
-
]);
|
|
100
|
-
if (!resolved) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
return path.join(path.dirname(resolved), parts.join("/"));
|
|
104
|
-
}
|
|
105
|
-
static async getMigrationPaths(cwd, migrator, defaultPath, path2) {
|
|
106
|
-
if (path2) {
|
|
107
|
-
return [
|
|
108
|
-
join(cwd, path2)
|
|
109
|
-
];
|
|
110
|
-
}
|
|
111
|
-
return [
|
|
112
|
-
...migrator.getPaths(),
|
|
113
|
-
join(cwd, defaultPath)
|
|
114
|
-
];
|
|
115
|
-
}
|
|
116
|
-
static twoColumnDetail(name, value) {
|
|
117
|
-
const regex = /\x1b\[\d+m/g;
|
|
118
|
-
const width = Math.min(process.stdout.columns, 100);
|
|
119
|
-
const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
|
|
120
|
-
return console.log(name, chalk.gray(".".repeat(dots)), value);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Check if file exists
|
|
124
|
-
*
|
|
125
|
-
* @param path
|
|
126
|
-
* @returns
|
|
127
|
-
*/
|
|
128
|
-
static async fileExists(path2) {
|
|
129
|
-
try {
|
|
130
|
-
await access(path2);
|
|
131
|
-
return true;
|
|
132
|
-
} catch {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
static findUpConfig(cwd, name, extensions) {
|
|
137
|
-
return sync_default(cwd, (_dir, names) => {
|
|
138
|
-
for (const ext of extensions) {
|
|
139
|
-
const filename = `${name}.${ext}`;
|
|
140
|
-
if (names.includes(filename)) {
|
|
141
|
-
return filename;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
var TableGuesser = class TableGuesser2 {
|
|
149
|
-
static {
|
|
150
|
-
__name(this, "TableGuesser");
|
|
151
|
-
}
|
|
152
|
-
static CREATE_PATTERNS = [
|
|
153
|
-
/^create_(\w+)_table$/,
|
|
154
|
-
/^create_(\w+)$/
|
|
155
|
-
];
|
|
156
|
-
static CHANGE_PATTERNS = [
|
|
157
|
-
/.+_(to|from|in)_(\w+)_table$/,
|
|
158
|
-
/.+_(to|from|in)_(\w+)$/
|
|
159
|
-
];
|
|
160
|
-
static guess(migration) {
|
|
161
|
-
for (const pattern of TableGuesser2.CREATE_PATTERNS) {
|
|
162
|
-
const matches = migration.match(pattern);
|
|
163
|
-
if (matches) {
|
|
164
|
-
return [
|
|
165
|
-
matches[1],
|
|
166
|
-
true
|
|
167
|
-
];
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
for (const pattern of TableGuesser2.CHANGE_PATTERNS) {
|
|
171
|
-
const matches = migration.match(pattern);
|
|
172
|
-
if (matches) {
|
|
173
|
-
return [
|
|
174
|
-
matches[2],
|
|
175
|
-
false
|
|
176
|
-
];
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return [];
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export {
|
|
184
|
-
Utils,
|
|
185
|
-
TableGuesser
|
|
186
|
-
};
|
package/dist/chunk-QCNBVSFO.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Musket
|
|
3
|
-
} from "./chunk-KCJKQP37.js";
|
|
4
|
-
import {
|
|
5
|
-
Utils
|
|
6
|
-
} from "./chunk-POF4JGTX.js";
|
|
7
|
-
import {
|
|
8
|
-
__name
|
|
9
|
-
} from "./chunk-SHUYVCID.js";
|
|
10
|
-
|
|
11
|
-
// src/Kernel.ts
|
|
12
|
-
import { mkdir } from "fs/promises";
|
|
13
|
-
import path from "path";
|
|
14
|
-
var Kernel = class _Kernel {
|
|
15
|
-
static {
|
|
16
|
-
__name(this, "Kernel");
|
|
17
|
-
}
|
|
18
|
-
app;
|
|
19
|
-
cwd;
|
|
20
|
-
output = Utils.output();
|
|
21
|
-
basePath = "";
|
|
22
|
-
modulePath;
|
|
23
|
-
consolePath;
|
|
24
|
-
modulePackage;
|
|
25
|
-
consolePackage;
|
|
26
|
-
constructor(app, basePath) {
|
|
27
|
-
this.app = app;
|
|
28
|
-
}
|
|
29
|
-
static init(app) {
|
|
30
|
-
const instance = new _Kernel(app);
|
|
31
|
-
Promise.all([
|
|
32
|
-
instance.loadRequirements()
|
|
33
|
-
]).then(([e]) => e.run());
|
|
34
|
-
}
|
|
35
|
-
async run() {
|
|
36
|
-
await Musket.parse(this);
|
|
37
|
-
process.exit(0);
|
|
38
|
-
}
|
|
39
|
-
async ensureDirectoryExists(dir) {
|
|
40
|
-
await mkdir(dir, {
|
|
41
|
-
recursive: true
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
async loadRequirements() {
|
|
45
|
-
this.cwd = path.join(process.cwd(), this.basePath);
|
|
46
|
-
this.modulePath = Utils.findModulePkg("@h3ravel/core", this.cwd) ?? "";
|
|
47
|
-
this.consolePath = Utils.findModulePkg("@h3ravel/console", this.cwd) ?? "";
|
|
48
|
-
try {
|
|
49
|
-
this.modulePackage = await import(path.join(this.modulePath, "package.json"));
|
|
50
|
-
} catch {
|
|
51
|
-
this.modulePackage = {
|
|
52
|
-
version: "N/A"
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
try {
|
|
56
|
-
this.consolePackage = await import(path.join(this.consolePath, "package.json"));
|
|
57
|
-
} catch {
|
|
58
|
-
this.consolePackage = {
|
|
59
|
-
version: "N/A"
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export {
|
|
67
|
-
Kernel
|
|
68
|
-
};
|