@h3ravel/console 11.1.0 → 11.2.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.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["app: Application","kernel: Kernel","outDir","path","stub: string","path","options: CommandOption[]","nestedOptions: CommandOption[] | undefined","flags: string[] | undefined","defaultValue: string | number | boolean | undefined | string[]","app: Application","kernel: Kernel","commands: Command[]","path","i","cmd","app: Application","path","dir","entryFileName","TsDownConfig: Options"],"sources":["../src/Commands/Command.ts","../src/Commands/FireCommand.ts","../src/Commands/MakeCommand.ts","../src/Commands/MigrateCommand.ts","../src/Signature.ts","../src/Musket.ts","../src/Kernel.ts","../src/Providers/ConsoleServiceProvider.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts"],"sourcesContent":["import { Application } from \"@h3ravel/core\";\nimport type { Argument } from \"commander\";\nimport { Kernel } from \"../Kernel\";\nimport { XGeneric } from \"@h3ravel/support\";\n\nexport class Command {\n constructor(protected app: Application, protected kernel: Kernel) { }\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature!: string;\n\n /**\n * A dictionary of signatures or what not.\n *\n * @var object\n */\n protected dictionary: Record<string, any> = {}\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description?: string;\n\n /**\n * The console command input.\n *\n * @var object\n */\n private input: XGeneric<{ options: Record<string, any>, arguments: Record<string, any> }> = {\n options: {},\n arguments: {},\n }\n\n /**\n * Execute the console command.\n */\n public async handle (..._args: any[]): Promise<void> { }\n\n setApplication (app: Application) {\n this.app = app\n }\n\n setInput (options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>) {\n this.dictionary = dictionary\n this.input.options = options\n this.input.arguments = regArgs\n .map((e, i) => ({ [e.name()]: args[i] }))\n .reduce((e, x) => Object.assign(e, x), {})\n }\n\n getSignature () {\n return this.signature\n }\n\n getDescription () {\n return this.description\n }\n\n option (key: string, def?: any) {\n return this.input.options[key] ?? def\n }\n\n options (key?: string) {\n if (key) {\n return this.input.options[key]\n }\n return this.input.options\n }\n\n argument (key: string, def?: any) {\n return this.input.arguments[key] ?? def\n }\n\n arguments () {\n return this.input.arguments\n }\n}\n","import { Command } from \"./Command\";\nimport { execa } from 'execa';\nimport preferredPM from \"preferred-pm\"\n\nexport class FireCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `fire:\n {--a|host=localhost : The host address to serve the application on}\n {--p|port=3000 : The port to serve the application on}\n {--t|tries=10 : The max number of ports to attempt to serve from}\n {--d|debug : Show extra debug info, like registered service providers and more}\n `;\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Fire up the developement server';\n\n public async handle () {\n try {\n await this.fire()\n } catch (e) {\n this.kernel.output.error(e as any)\n }\n }\n\n protected async fire () {\n const outDir = '.h3ravel/serve'\n\n const pm = (await preferredPM(base_path()))?.name ?? 'pnpm'\n const port = this.option('port')\n const host = this.option('host')\n const tries = this.option('tries')\n const debug = this.option('debug')\n\n const ENV_VARS = {\n EXTENDED_DEBUG: debug ? 'true' : 'false',\n CLI_BUILD: 'false',\n NODE_ENV: 'development',\n SRC_PATH: outDir,\n HOSTNAME: host,\n RETRIES: tries,\n PORT: port,\n }\n\n await execa(\n pm,\n ['tsdown', '--silent', '--config-loader', 'unconfig', '-c', 'tsdown.default.config.ts'],\n { stdout: 'inherit', stderr: 'inherit', cwd: base_path(), env: Object.assign({}, process.env, ENV_VARS) }\n );\n }\n}\n","import { TableGuesser, Utils } from \"../Utils\";\nimport { readFile, writeFile } from \"node:fs/promises\";\n\nimport { Command } from \"./Command\";\nimport chalk from \"chalk\";\nimport dayjs from \"dayjs\";\nimport { existsSync } from \"node:fs\";\nimport nodepath from \"node:path\";\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Generates a new controller class. | {--a|api : Generate an API resource controller} | {--force : Overide existing controller.} }\n {resource : Generates a new API resource class.}\n {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} }\n {factory : Generates a new database factory class.}\n {seeder : Generates a new database seeder class.}\n {model : Generates a new Arquebus model class. | {--t|type=ts : The file type to generate}} \n {^name : The name of the [name] to generate}\n `;\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes';\n\n public async handle () {\n const command = this.dictionary.baseCommand as never\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n migration: 'makeMigration',\n factory: 'makeFactory',\n seeder: 'makeSeeder',\n model: 'makeModel',\n } as const;\n\n try {\n await (this as any)?.[methods[command]]()\n } catch (e) {\n this.kernel.output.error(e as any)\n }\n }\n\n /**\n * Generate a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : '';\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = nodepath.join(app_path('Http/Controllers'), name + '.ts')\n const crtlrPath = Utils.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n\n if (!force && existsSync(path)) {\n this.kernel.output.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n this.kernel.output.split(`INFO: Controller Created`, chalk.gray(nodepath.basename(path)))\n }\n\n protected makeResource () {\n this.kernel.output.success(`Resource support is not yet available`)\n }\n\n /**\n * Generate a new database migration class\n */\n protected async makeMigration () {\n const name = this.argument('name')\n const datePrefix = dayjs().format('YYYY_MM_DD_HHmmss')\n const path = nodepath.join(database_path('migrations'), `${datePrefix}_${name}.ts`)\n\n const crtlrPath = Utils.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n\n let create = this.option('create', false)\n let table = this.option('table')\n if (!table && typeof create === 'string') {\n table = create\n create = true\n }\n\n if (!table) {\n const guessed = TableGuesser.guess(name)\n table = guessed[0]\n create = !!guessed[1]\n }\n\n const stubPath = nodepath.join(crtlrPath, this.getMigrationStubName(table, create))\n let stub = await readFile(stubPath, 'utf-8')\n\n if (table !== null) {\n stub = stub.replace(/DummyTable|{{\\s*table\\s*}}/g, table)\n }\n\n this.kernel.output.info('INFO: Creating Migration')\n\n await this.kernel.ensureDirectoryExists(nodepath.dirname(path))\n await writeFile(path, stub)\n\n this.kernel.output.split(`INFO: Migration Created`, chalk.gray(nodepath.basename(path)))\n }\n\n protected makeFactory () {\n this.kernel.output.success(`Factory support is not yet available`)\n }\n\n protected makeSeeder () {\n this.kernel.output.success(`Seeder support is not yet available`)\n }\n\n /**\n * Generate a new Arquebus model class\n */\n protected async makeModel () {\n const type = this.option('type', 'ts')\n const name = this.argument('name')\n // const force = this.argument('force')\n\n const path = nodepath.join(app_path('Models'), name.toLowerCase() + '.' + type)\n const crtlrPath = Utils.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/model-${type}.stub`)\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n this.kernel.output.split(`INFO: Model Created`, chalk.gray(nodepath.basename(path)))\n }\n\n /**\n * Ge the database migration file name\n * \n * @param table \n * @param create \n * @param type \n * @returns \n */\n getMigrationStubName (table?: string, create: boolean = false, type: 'ts' | 'js' = 'ts') {\n let stub: string\n if (!table) {\n stub = `migration-${type}.stub`\n }\n else if (create) {\n stub = `migration.create-${type}.stub`\n }\n else {\n stub = `migration.update-${type}.stub`\n }\n return 'dist/stubs/' + stub\n }\n}\n","// import nodepath from \"node:path\";\nimport { Migrate, MigrationCreator } from \"@h3ravel/arquebus/migrations\";\nimport { TBaseConfig, arquebusConfig } from \"@h3ravel/database\";\n\nimport { Command } from \"./Command\";\nimport { Utils } from \"../Utils\";\nimport chalk from \"chalk\";\nimport path from \"node:path\";\n\nexport class MigrateCommand extends Command {\n /**\n * The current database connection\n */\n private connection!: TBaseConfig;\n\n /** \n * The base path for all database operations\n */\n private databasePath: string = database_path();\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `migrate:\n {fresh : Drop all tables and re-run all migrations.}\n {install : Create the migration repository.}\n {refresh : Reset and re-run all migrations.}\n {reset : Rollback all database migrations.}\n {rollback : Rollback the last database migration.}\n {status : Show the status of each migration.}\n {publish : Publish any migration files from installed packages. | {package : The package to publish migrations from}}\n {^--s|seed : Seed the database}\n {^--c|connection=mysql : The database connection to use}\n `;\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Run all pending migrations.';\n\n /**\n * Execute the console command.\n */\n public async handle () {\n const command = (this.dictionary.name ?? this.dictionary.baseCommand) as never\n\n this.connection = Object.entries(arquebusConfig(config('database')))\n .find(([client]) => client === config('database.default'))\n ?.at(1)\n\n this.connection.migrations = {\n path: 'migrations',\n table: 'migrations',\n }\n\n const methods = {\n migrate: 'migrateRun',\n fresh: 'migrateFresh',\n install: 'migrateInstall',\n refresh: 'migrateRefresh',\n reset: 'migrateReset',\n rollback: 'migrateRollback',\n status: 'migrateStatus',\n publish: 'migratePublish',\n } as const;\n\n await (this as any)?.[methods[command]]()\n }\n\n /**\n * Run all pending migrations.\n */\n protected async migrateRun () {\n try {\n await new Migrate(this.databasePath).run(this.connection, this.options(), true)\n } catch (e) {\n this.kernel.output.error('ERROR: ' + e)\n }\n }\n\n /**\n * Drop all tables and re-run all migrations.\n */\n protected async migrateFresh () {\n try {\n await new Migrate(this.databasePath).fresh(this.connection, this.options(), true)\n } catch (e) {\n this.kernel.output.error('ERROR: ' + e)\n }\n }\n\n /**\n * Create the migration repository.\n */\n protected async migrateInstall () {\n try {\n const migrate = new Migrate(this.databasePath)\n const { migrator } = await migrate.setupConnection(this.connection)\n await migrate.prepareDatabase(migrator)\n\n this.kernel.output.success(`Migration repository installed.`)\n } catch (e) {\n this.kernel.output.error('ERROR: ' + e)\n }\n }\n\n /**\n * Reset and re-run all migrations.\n */\n protected async migrateRefresh () {\n try {\n await new Migrate(this.databasePath).refresh(this.connection, this.options(), true)\n } catch (e) {\n this.kernel.output.error('ERROR: ' + e)\n }\n }\n\n /**\n * Rollback all database migrations.\n */\n protected async migrateReset () {\n try {\n await new Migrate(this.databasePath).reset(this.connection, this.options(), true)\n } catch (e) {\n this.kernel.output.error('ERROR: ' + e)\n }\n }\n\n /**\n * Rollback the last database migration.\n */\n protected async migrateRollback () {\n try {\n await new Migrate(this.databasePath).rollback(this.connection, this.options(), true)\n } catch (e) {\n this.kernel.output.error('ERROR: ' + e)\n }\n }\n\n /**\n * Show the status of each migration.\n */\n protected async migrateStatus () {\n const migrations = await new Migrate(this.databasePath, undefined, (msg, sts) => {\n const hint = this.kernel.output.parse([\n [' Did you forget to run', 'white'],\n ['`musket migrate:install`?', 'grey']\n ], ' ', false)\n\n if (sts) this.kernel.output[sts](msg + hint, sts === 'error', true)\n }).status(this.connection, this.options(), true)\n\n try {\n if (migrations.length > 0) {\n this.kernel.output.twoColumnLog('Migration name', 'Batch / Status')\n\n migrations.forEach(migration => {\n const status = migration.ran\n ? `[${migration.batch}] ${chalk.green('Ran')}`\n : chalk.yellow('Pending')\n this.kernel.output.twoColumnLog(migration.name, status)\n })\n }\n else {\n this.kernel.output.info('No migrations found')\n }\n } catch (e) {\n this.kernel.output.error(['ERROR: ' + e, 'Did you run musket migrate:install'])\n }\n }\n\n /**\n * Publish any migration files from installed packages.\n */\n protected async migratePublish () {\n const name = this.argument('package')\n\n try {\n /** Find the requested package */\n const packagePath = Utils.findModulePkg(name) ?? null\n if (!packagePath) throw new Error(\"Package not found\");\n\n /** Get the package,json and instanciate the migration creator */\n const pkgJson = (await import(path.join(packagePath, 'package.json')))\n const creator = new MigrationCreator(path.join(packagePath, pkgJson.migrations ?? 'migrations'))\n\n const info = this.kernel.output.parse([\n [' Publishing migrations from', 'white'],\n [`${pkgJson.name}@${pkgJson.version}`, chalk.italic.gray]\n ], ' ', false)\n\n this.kernel.output.info(`INFO: ${info}`)\n\n try {\n /** Publish any existing migrations */\n await creator.publish(this.databasePath, (fileName) => {\n this.kernel.output.twoColumnLog(fileName, chalk.green('PUBLISHED'))\n })\n } catch {\n this.kernel.output.error([`ERROR: ${name} has no publishable migrations.`])\n }\n } catch (e) {\n const hint = this.kernel.output.parse([\n [' Did you forget to run', 'white'],\n [`\\`${await Utils.installCommand(name)}\\``, 'grey']\n ], ' ', false)\n\n const error = this.kernel.output.parse([\n ['Package `', 'white'],\n [name, 'grey'],\n ['` not found', 'white']\n ], '', false)\n\n this.kernel.output.error(['ERROR: ' + error, hint + '?', String(e)])\n }\n }\n}\n","import { CommandOption, ParsedCommand } from \"./Contracts/ICommand\";\n\nimport { Command } from \"./Commands/Command\";\n\nexport class Signature {\n /**\n * Helper to parse options inside a block of text\n * \n * @param block \n * @returns \n */\n static parseOptions (block: string): CommandOption[] {\n const options: CommandOption[] = [];\n /**\n * Match { ... } blocks at top level \n */\n const regex = /\\{([^{}]+(?:\\{[^{}]*\\}[^{}]*)*)\\}/g;\n let match;\n\n while ((match = regex.exec(block)) !== null) {\n const shared = '^' === match[1][0]! || /:[#^]/.test(match[1]);\n const isHidden = (['#', '^'].includes(match[1][0]!) || /:[#^]/.test(match[1])) && !shared;\n const content = match[1].trim().replace(/[#^]/, '');\n /**\n * Split by first ':' to separate name and description+nested\n */\n const colonIndex = content.indexOf(':');\n if (colonIndex === -1) {\n /**\n * No description, treat whole as name\n */\n options.push({ name: content });\n continue;\n }\n\n const namePart = content.substring(0, colonIndex).trim();\n let rest = content.substring(colonIndex + 1).trim();\n\n /**\n * Check for nested options after '|'\n */\n let description = rest;\n let nestedOptions: CommandOption[] | undefined;\n\n const pipeIndex = rest.indexOf('|');\n if (pipeIndex !== -1) {\n description = rest.substring(0, pipeIndex).trim();\n const nestedText = rest.substring(pipeIndex + 1).trim();\n /**\n * nestedText should start with '{' and end with ')', clean it\n * Also Remove trailing ')' if present\n */\n const cleanedNestedText = nestedText.replace(/^\\{/, '').trim();\n\n /**\n * Parse nested options recursively\n */\n nestedOptions = Signature.parseOptions('{' + cleanedNestedText + '}');\n } else {\n /**\n * Trim the string\n */\n description = description.trim();\n }\n\n /**\n * Parse name modifiers (?, *, ?*)\n */\n let name = namePart;\n let required = /[^a-zA-Z0-9_|-]/.test(name);\n let multiple = false;\n\n if (name.endsWith('?*')) {\n required = false;\n multiple = true;\n name = name.slice(0, -2);\n } else if (name.endsWith('*')) {\n multiple = true;\n name = name.slice(0, -1);\n } else if (name.endsWith('?')) {\n required = false;\n name = name.slice(0, -1);\n }\n\n /**\n * Check if it's a flag option (starts with --)\n */\n const isFlag = name.startsWith('--');\n let flags: string[] | undefined;\n let defaultValue: string | number | boolean | undefined | string[];\n\n if (isFlag) {\n /**\n * Parse flags and default values\n */\n const flagParts = name.split('|').map(s => s.trim());\n\n flags = [];\n\n for (let part of flagParts) {\n if (part.startsWith('--') && part.slice(2).length === 1) {\n part = '-' + part.slice(2);\n } else if (part.startsWith('-') && !part.startsWith('--') && part.slice(1).length > 1) {\n part = '--' + part.slice(1);\n } else if (!part.startsWith('-') && part.slice(1).length > 1) {\n part = '--' + part\n }\n\n const eqIndex = part.indexOf('=');\n if (eqIndex !== -1) {\n flags.push(part.substring(0, eqIndex));\n const val = part.substring(eqIndex + 1);\n if (val === '*') {\n defaultValue = [];\n } else if (val === 'true' || val === 'false' || (!val && !required)) {\n defaultValue = val === 'true';\n } else if (!isNaN(Number(val))) {\n defaultValue = Number(val);\n } else {\n defaultValue = val;\n }\n } else {\n flags.push(part);\n }\n }\n }\n\n options.push({\n name: isFlag ? flags![flags!.length - 1] : name,\n required,\n multiple,\n description,\n flags,\n shared,\n isFlag,\n isHidden,\n defaultValue,\n nestedOptions,\n });\n }\n\n return options;\n }\n\n /**\n * Helper to parse a command's signature\n * \n * @param signature \n * @param commandClass \n * @returns \n */\n static parseSignature (signature: string, commandClass: Command): ParsedCommand {\n const lines = signature.split('\\n').map(l => l.trim()).filter(l => l.length > 0);\n const isHidden = ['#', '^'].includes(lines[0][0]!) || /:[#^]/.test(lines[0]);\n const baseCommand = lines[0].replace(/[^\\w=:-]/g, '')\n const description = commandClass.getDescription()\n const isNamespaceCommand = baseCommand.endsWith(':');\n\n /**\n * Join the rest lines to a single string for parsing\n */\n const rest = lines.slice(1).join(' ');\n\n /**\n * Parse all top-level options/subcommands\n */\n const allOptions = Signature.parseOptions(rest);\n\n if (isNamespaceCommand) {\n /**\n * Separate subcommands (those without flags) and base options (flags)\n * Here we assume subcommands are those without flags (isFlag false)\n * and base options are flags or options after subcommands\n\n * For simplicity, treat all top-level options as subcommands\n * and assume base command options come after subcommands in signature (not shown in example)\n */\n\n return {\n baseCommand: baseCommand.slice(0, -1),\n isNamespaceCommand,\n subCommands: allOptions.filter(e => !e.flags && !e.isHidden),\n description,\n commandClass,\n options: allOptions.filter(e => !!e.flags),\n isHidden,\n };\n } else {\n return {\n baseCommand,\n isNamespaceCommand,\n options: allOptions,\n description,\n commandClass,\n isHidden,\n };\n }\n }\n}\n","import { CommandOption, ParsedCommand } from \"./Contracts/ICommand\";\n\nimport { Application } from \"@h3ravel/core\";\nimport { Command } from \"./Commands/Command\";\nimport { FireCommand } from \"./Commands/FireCommand\";\nimport { Kernel } from \"./Kernel\";\nimport { Logger } from \"@h3ravel/shared\";\nimport { MakeCommand } from \"./Commands/MakeCommand\";\nimport { MigrateCommand } from \"./Commands/MigrateCommand\";\nimport { Signature } from \"./Signature\";\nimport chalk from \"chalk\";\nimport { glob } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { program } from \"commander\";\n\n/**\n * Musket is H3ravel's CLI tool\n */\nexport class Musket {\n private output = Logger.log()\n private commands: ParsedCommand[] = []\n\n constructor(private app: Application, private kernel: Kernel) { }\n\n async build () {\n this.loadBaseCommands()\n await this.loadDiscoveredCommands()\n return this.initialize()\n }\n\n private loadBaseCommands () {\n const commands: Command[] = [\n new FireCommand(this.app, this.kernel),\n new MakeCommand(this.app, this.kernel),\n new MigrateCommand(this.app, this.kernel),\n ]\n\n commands.forEach(e => this.addCommand(e))\n }\n\n private async loadDiscoveredCommands () {\n const commands: Command[] = [\n ...this.app.registeredCommands.map(cmd => new cmd(this.app, this.kernel))\n ]\n\n /**\n * Musket Commands auto registration\n */\n const providers_path = app_path('Console/Commands/*.js').replace('/src/', '/.h3ravel/serve/')\n\n /** Add the App Commands */\n for await (const cmd of glob(providers_path)) {\n const name = path.basename(cmd).replace('.js', '')\n try {\n const cmdClass = (await import(cmd))[name]\n commands.push(new cmdClass(this.app, this.kernel))\n } catch { /** */ }\n }\n\n commands.forEach(e => this.addCommand(e))\n }\n\n addCommand (command: Command) {\n this.commands.push(Signature.parseSignature(command.getSignature(), command))\n }\n\n private initialize () {\n const cliVersion = [\n 'H3ravel Version:',\n chalk.green(this.kernel.consolePackage.version),\n ].join(' ')\n\n const localVersion = [\n 'Musket Version:',\n chalk.green(this.kernel.modulePackage.version || 'None'),\n ].join(' ')\n\n program\n .name('musket')\n .version(`${cliVersion}\\n${localVersion}`)\n\n program\n .command('init')\n .description('Initialize H3ravel.')\n .action(async () => {\n this.output.success(`Initialized: H3ravel has been initialized!`)\n })\n\n for (let i = 0; i < this.commands.length; i++) {\n const command = this.commands[i];\n const instance = command.commandClass\n\n if (command.isNamespaceCommand && command.subCommands) {\n /**\n * Initialize the base command\n */\n const cmd = command.isHidden\n ? program\n : program\n .command(command.baseCommand)\n .description(command.description ?? '')\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command)\n await instance.handle()\n })\n\n /**\n * Add options to the base command if it has any\n */\n if ((command.options?.length ?? 0) > 0) {\n command.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n\n /**\n * Initialize the sub commands\n */\n command\n .subCommands\n .filter((v, i, a) => !v.shared && a.findIndex(t => t.name === v.name) === i)\n .forEach(sub => {\n const cmd = program\n .command(`${command.baseCommand}:${sub.name}`)\n .description(sub.description || '')\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, sub)\n await instance.handle()\n })\n\n /**\n * Add the shared arguments here\n */\n command.subCommands?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n });\n\n /**\n * Add the shared options here\n */\n command.options?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n });\n\n /**\n * Add options to the sub command if it has any\n */\n if (sub.nestedOptions) {\n sub.nestedOptions\n .filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n });\n } else {\n /**\n * Initialize command with options\n */\n const cmd = program\n .command(command.baseCommand)\n .description(command.description ?? '')\n\n command\n ?.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd, true)\n });\n\n cmd.action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command)\n await instance.handle()\n });\n }\n }\n\n return program\n\n }\n\n makeOption (opt: CommandOption, cmd: typeof program, parse?: boolean, parent?: any) {\n const description = opt.description?.replace(/\\[(\\w+)\\]/g, (_, k) => parent?.[k] ?? `[${k}]`) ?? ''\n const type = opt.name.replaceAll('-', '')\n\n if (opt.isFlag) {\n if (parse) {\n const flags = opt.flags\n ?.map(f => (f.length === 1 ? `-${f}` : `--${f}`)).join(', ')!\n .replaceAll('----', '--')\n .replaceAll('---', '-');\n\n cmd.option(flags || '', description!, String(opt.defaultValue) || undefined);\n } else {\n cmd.option(\n opt.flags?.join(', ')! + (opt.required ? ` <${type}>` : ''),\n description!,\n opt.defaultValue as any\n );\n }\n } else {\n cmd.argument(\n opt.required ? `<${opt.name}>` : `[${opt.name}]`,\n description,\n opt.defaultValue\n );\n }\n }\n\n static async parse (kernel: Kernel) {\n return (await new Musket(kernel.app, kernel).build()).parseAsync()\n }\n}\n","import { Application } from \"@h3ravel/core\";\nimport { Logger } from \"@h3ravel/shared\";\nimport { Musket } from \"./Musket\";\nimport { Utils } from \"./Utils\";\nimport { XGeneric } from \"@h3ravel/support\";\nimport { mkdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport class Kernel {\n public cwd!: string\n public output = Logger.log()\n public basePath: string = ''\n public modulePath!: string\n public consolePath!: string\n public modulePackage!: XGeneric<{ version: string }>\n public consolePackage!: XGeneric<{ version: string }>\n\n constructor(public app: Application) { }\n\n static init (app: Application) {\n const instance = new Kernel(app)\n\n Promise.all([instance.loadRequirements()])\n .then(([e]) => e.run())\n }\n\n\n private async run () {\n await Musket.parse(this);\n process.exit(0)\n }\n\n async ensureDirectoryExists (dir: string) {\n await mkdir(dir, { recursive: true })\n }\n\n private async loadRequirements () {\n this.cwd = path.join(process.cwd(), this.basePath)\n this.modulePath = Utils.findModulePkg('@h3ravel/core', this.cwd) ?? ''\n this.consolePath = Utils.findModulePkg('@h3ravel/console', this.cwd) ?? ''\n\n try {\n this.modulePackage = await import(path.join(this.modulePath, 'package.json'))\n } catch {\n this.modulePackage = { version: 'N/A' }\n }\n\n try {\n this.consolePackage = await import(path.join(this.consolePath, 'package.json'))\n } catch {\n this.consolePackage = { version: 'N/A' }\n }\n\n return this\n }\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { Kernel } from '../Kernel';\nimport { ServiceProvider } from '@h3ravel/core'\n/**\n * Handles CLI commands and tooling.\n * \n * Register DatabaseManager and QueryBuilder.\n * Set up ORM models and relationships.\n * Register migration and seeder commands.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992;\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = true;\n\n register () {\n }\n\n boot () {\n Kernel.init(this.app)\n\n process.on(\"SIGINT\", () => {\n process.exit(0);\n });\n process.on(\"SIGTERM\", () => {\n process.exit(0);\n });\n }\n}\n","import { dirname, join, resolve } from 'path';\n\nimport { fork } from 'child_process';\n\nfunction run (opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart (options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle (_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle (outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown';\nimport run from '@rollup/plugin-run';\n\nconst env = process.env.NODE_ENV || 'development';\nconst outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n SRC_PATH: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n SRC_PATH: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n};\n\nexport default TsDownConfig;\n"],"x_google_ignoreList":[8],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAa,UAAb,MAAqB;CACjB,YAAY,AAAUA,KAAkB,AAAUC,QAAgB;EAA5C;EAA4B;;;;;;;CAOlD,AAAU;;;;;;CAOV,AAAU,aAAkC,EAAE;;;;;;CAO9C,AAAU;;;;;;CAOV,AAAQ,QAAoF;EACxF,SAAS,EAAE;EACX,WAAW,EAAE;EAChB;;;;CAKD,MAAa,OAAQ,GAAG,OAA6B;CAErD,eAAgB,KAAkB;AAC9B,OAAK,MAAM;;CAGf,SAAU,SAAmB,MAAgB,SAA8B,YAAiC;AACxG,OAAK,aAAa;AAClB,OAAK,MAAM,UAAU;AACrB,OAAK,MAAM,YAAY,QAClB,KAAK,GAAG,OAAO,GAAG,EAAE,MAAM,GAAG,KAAK,IAAI,EAAE,CACxC,QAAQ,GAAG,MAAM,OAAO,OAAO,GAAG,EAAE,EAAE,EAAE,CAAC;;CAGlD,eAAgB;AACZ,SAAO,KAAK;;CAGhB,iBAAkB;AACd,SAAO,KAAK;;CAGhB,OAAQ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AK;CACL,UAAU;CACV,cAAc;CACd,uBAAuB;CACvB,SAAS,QAAQ,iBAAiB,QAAQ,IAAI,cAAc,SAAS,CACjE,IAAI;EACA,KAAK,OAAO,OAAO,EAAE,EAAE,QAAQ,KAAK;GAChC,UAAU;GACV,UAAU;GACb,CAAC;EACF,UAAU,CAAC,MAAM,8BAA8B;EAC/C,eAAe;EACf,OAAO,QAAQ,KAAK,GAAG;EAC1B,CAAC,CACL,GAAG,EAAE;CACT"}
1
+ {"version":3,"file":"index.js","names":["e","escalade","path","stub: string","options: CommandOption[]","nestedOptions: CommandOption[] | undefined","flags: string[] | undefined","defaultValue: string | number | boolean | undefined | string[]","dir","entryFileName","TsDownConfig: Options","app: Application","kernel: Kernel","commands: Command[]","path","i","cmd","TsDownConfig","app: Application","path"],"sources":["../src/Commands/Command.ts","../src/logo.ts","../src/Commands/ListCommand.ts","../../filesystem/dist/index.js","../src/Commands/MakeCommand.ts","../src/Signature.ts","../../../node_modules/.pnpm/@rollup+plugin-run@3.1.0/node_modules/@rollup/plugin-run/dist/es/index.js","../src/TsdownConfig.ts","../src/Musket.ts","../src/Kernel.ts","../src/Providers/ConsoleServiceProvider.ts"],"sourcesContent":["import { ConsoleCommand } from '@h3ravel/core'\n\nexport class Command extends ConsoleCommand { }\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","import { Command } from './Command'\nimport { Logger } from '@h3ravel/shared'\nimport { Option } from 'commander'\n/* eslint-disable no-control-regex */\nimport { altLogo } from '../logo'\n\nexport class ListCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = 'list'\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'List all available commands'\n\n public async handle () {\n const options = [\n {\n short: '-h',\n long: '--help',\n description: 'Display help for the given command. When no command is given display help for the list command'\n } as Option\n ]\n .concat(this.program.options)\n .map(e => {\n const desc = Logger.describe(Logger.log(\n ' ' + [e.short, e.long].filter(e => !!e).join(', '), 'green', false\n ), e.description, 25, false)\n return desc.join('')\n })\n\n /** Get the program commands */\n const commands = this.program.commands.map(e => {\n const desc = Logger.describe(Logger.log(' ' + e.name(), 'green', false), e.description(), 25, false)\n return desc.join('')\n })\n\n const grouped = commands.reduce<Record<string, string[]>>((acc, cmd) => {\n /** strip colors before checking prefix */\n const clean = cmd.replace(/\\x1b\\[\\d+m/g, '')\n const prefix = clean.includes(':') ? clean.split(':')[0].trim() : '__root__'\n acc[prefix] ??= []\n /** keep original with colors */\n acc[prefix].push(cmd)\n return acc\n }, {})\n\n const list = Object.entries(grouped).map(([group, cmds]) => {\n const label = group === '__root__' ? '' : group\n return [Logger.log(label, 'yellow', false), cmds.join('\\n')].join('\\n')\n })\n\n /** Ootput the app version */\n Logger.log([['H3ravel Framework', 'white'], [this.kernel.modulePackage.version, 'green']], ' ')\n\n console.log('')\n\n console.log(altLogo)\n\n console.log('')\n\n Logger.log('Usage:', 'yellow')\n Logger.log(' command [options] [arguments]', 'white')\n\n console.log('')\n\n /** Ootput the options */\n Logger.log('Options:', 'yellow')\n console.log(options.join('\\n').trim())\n\n console.log('')\n\n /** Ootput the commands */\n Logger.log('Available Commands:', 'yellow')\n console.log(list.join('\\n\\n').trim())\n }\n}\n","import { ServiceProvider } from \"@h3ravel/core\";\nimport { access } from \"fs/promises\";\nimport escalade from \"escalade/sync\";\nimport path from \"path\";\n\n//#region src/Providers/FilesystemProvider.ts\n/**\n* Sets up Filesystem management and lifecycle.\n* \n*/\nvar FilesystemProvider = class extends ServiceProvider {\n\tstatic priority = 997;\n\tregister() {}\n};\n\n//#endregion\n//#region src/Utils/Helpers.ts\nvar Helpers = class {\n\tstatic findModulePkg(moduleId, cwd) {\n\t\tconst parts = moduleId.replace(/\\\\/g, \"/\").split(\"/\");\n\t\tlet packageName = \"\";\n\t\tif (parts.length > 0 && parts[0][0] === \"@\") packageName += parts.shift() + \"/\";\n\t\tpackageName += parts.shift();\n\t\tconst packageJson = path.join(cwd ?? process.cwd(), \"node_modules\", packageName);\n\t\tconst resolved = this.findUpConfig(packageJson, \"package\", [\"json\"]);\n\t\tif (!resolved) return;\n\t\treturn path.join(path.dirname(resolved), parts.join(\"/\"));\n\t}\n\t/**\n\t* Check if file exists\n\t* \n\t* @param path \n\t* @returns \n\t*/\n\tstatic async fileExists(path$1) {\n\t\ttry {\n\t\t\tawait access(path$1);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\tstatic findUpConfig(cwd, name, extensions) {\n\t\treturn escalade(cwd, (_dir, names) => {\n\t\t\tfor (const ext of extensions) {\n\t\t\t\tconst filename = `${name}.${ext}`;\n\t\t\t\tif (names.includes(filename)) return filename;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\t}\n};\n\n//#endregion\nexport { FilesystemProvider, Helpers };\n//# sourceMappingURL=index.js.map","import { TableGuesser, Utils } from '../Utils'\nimport { mkdir, readFile, writeFile } from 'node:fs/promises'\n\nimport { Command } from './Command'\nimport { Helpers } from '@h3ravel/filesystem'\nimport { Logger } from '@h3ravel/shared'\nimport { beforeLast } from '@h3ravel/support'\nimport dayjs from 'dayjs'\nimport { existsSync } from 'node:fs'\nimport nodepath from 'node:path'\n\nexport class MakeCommand extends Command {\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature: string = `#make:\n {controller : Create a new controller class. \n | {--a|api : Exclude the create and edit methods from the controller} \n | {--m|model= : Generate a resource controller for the given model} \n | {--r|resource : Generate a resource controller class} \n | {--force : Create the controller even if it already exists}\n }\n {resource : Create a new resource. \n | {--c|collection : Create a resource collection}\n | {--force : Create the resource even if it already exists}\n }\n {migration : Generates a new database migration class. \n | {--l|type=ts : The file type to generate} \n | {--t|table : The table to migrate} \n | {--c|create : The table to be created} \n }\n {factory : Create a new model factory.}\n {seeder : Create a new seeder class.}\n {view : Create a new view.\n | {--force : Create the view even if it already exists}\n }\n {model : Create a new Eloquent model class. \n | {--api : Indicates if the generated controller should be an API resource controller} \n | {--c|controller : Create a new controller for the model} \n | {--f|factory : Create a new factory for the model} \n | {--m|migration : Create a new migration file for the model} \n | {--r|resource : Indicates if the generated controller should be a resource controller} \n | {--a|all : Generate a migration, seeder, factory, policy, resource controller, and form request classes for the model} \n | {--s|seed : Create a new seeder for the model} \n | {--t|type=ts : The file type to generate}\n | {--force : Create the model even if it already exists}\n } \n {^name : The name of the [name] to generate}\n `\n /**\n * The console command description.\n *\n * @var string\n */\n protected description: string = 'Generate component classes'\n\n public async handle () {\n const command = (this.dictionary.baseCommand ?? this.dictionary.name) as never\n\n const methods = {\n controller: 'makeController',\n resource: 'makeResource',\n migration: 'makeMigration',\n factory: 'makeFactory',\n seeder: 'makeSeeder',\n model: 'makeModel',\n view: 'makeView',\n } as const\n\n try {\n await (this as any)?.[methods[command]]()\n } catch (e) {\n Logger.error(e as any)\n }\n }\n\n /**\n * Create a new controller class.\n */\n protected async makeController () {\n const type = this.option('api') ? '-resource' : ''\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = nodepath.join(app_path('Http/Controllers'), name + '.ts')\n const crtlrPath = Helpers.findModulePkg('@h3ravel/http', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/controller${type}.stub`)\n\n /** Check if the controller already exists */\n if (!force && existsSync(path)) {\n Logger.error(`ERORR: ${name} controller already exists`)\n }\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Controller Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n protected makeResource () {\n Logger.success('Resource support is not yet available')\n }\n\n /**\n * Generate a new database migration class\n */\n protected async makeMigration () {\n const name = this.argument('name')\n const datePrefix = dayjs().format('YYYY_MM_DD_HHmmss')\n const path = nodepath.join(database_path('migrations'), `${datePrefix}_${name}.ts`)\n\n const crtlrPath = Utils.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n\n let create = this.option('create', false)\n let table = this.option('table')\n if (!table && typeof create === 'string') {\n table = create\n create = true\n }\n\n if (!table) {\n const guessed = TableGuesser.guess(name)\n table = guessed[0]\n create = !!guessed[1]\n }\n\n const stubPath = nodepath.join(crtlrPath, this.getMigrationStubName(table, create))\n let stub = await readFile(stubPath, 'utf-8')\n\n if (table !== null) {\n stub = stub.replace(/DummyTable|{{\\s*table\\s*}}/g, table)\n }\n\n Logger.info('INFO: Creating Migration')\n\n await this.kernel.ensureDirectoryExists(nodepath.dirname(path))\n await writeFile(path, stub)\n\n Logger.split('INFO: Migration Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new model factory\n */\n protected makeFactory () {\n Logger.success('Factory support is not yet available')\n }\n\n /**\n * Create a new seeder class\n */\n protected makeSeeder () {\n Logger.success('Seeder support is not yet available')\n }\n\n /**\n * Generate a new Arquebus model class\n */\n protected async makeModel () {\n const type = this.option('type', 'ts')\n const name = this.argument('name')\n const force = this.argument('force')\n\n const path = nodepath.join(app_path('Models'), name.toLowerCase(), '.' + type)\n\n /** Check if the model already exists */\n if (!force && existsSync(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n const crtlrPath = Utils.findModulePkg('@h3ravel/database', this.kernel.cwd) ?? ''\n const stubPath = nodepath.join(crtlrPath, `dist/stubs/model-${type}.stub`)\n\n let stub = await readFile(stubPath, 'utf-8')\n stub = stub.replace(/{{ name }}/g, name)\n\n await writeFile(path, stub)\n Logger.split('INFO: Model Created', Logger.log(nodepath.basename(path), 'gray', false))\n }\n\n /**\n * Create a new view.\n */\n protected async makeView () {\n const name = this.argument('name')\n const force = this.option('force')\n\n const path = nodepath.join(base_path('src/resources/views'), name + '.edge')\n\n if (name.includes('/')) {\n await mkdir(beforeLast(path, '/'), { recursive: true })\n }\n\n /** Check if the view already exists */\n if (!force && existsSync(path)) {\n Logger.error(`ERORR: ${name} view already exists`)\n }\n\n await writeFile(path, `{{-- src/resources/views/${name}.edge --}}`)\n Logger.split('INFO: View Created', Logger.log(`src/resources/views/${name}.edge`, 'gray', false))\n }\n\n /**\n * Ge the database migration file name\n * \n * @param table \n * @param create \n * @param type \n * @returns \n */\n getMigrationStubName (table?: string, create: boolean = false, type: 'ts' | 'js' = 'ts') {\n let stub: string\n if (!table) {\n stub = `migration-${type}.stub`\n }\n else if (create) {\n stub = `migration.create-${type}.stub`\n }\n else {\n stub = `migration.update-${type}.stub`\n }\n return 'dist/stubs/' + stub\n }\n}\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\n\nimport { Command } from './Commands/Command'\n\nexport class Signature {\n /**\n * Helper to parse options inside a block of text\n * \n * @param block \n * @returns \n */\n static parseOptions (block: string): CommandOption[] {\n const options: CommandOption[] = []\n /**\n * Match { ... } blocks at top level \n */\n const regex = /\\{([^{}]+(?:\\{[^{}]*\\}[^{}]*)*)\\}/g\n let match\n\n while ((match = regex.exec(block)) !== null) {\n const shared = '^' === match[1][0]! || /:[#^]/.test(match[1])\n const isHidden = (['#', '^'].includes(match[1][0]!) || /:[#^]/.test(match[1])) && !shared\n const content = match[1].trim().replace(/[#^]/, '')\n /**\n * Split by first ':' to separate name and description+nested\n */\n const colonIndex = content.indexOf(':')\n if (colonIndex === -1) {\n /**\n * No description, treat whole as name\n */\n options.push({ name: content })\n continue\n }\n\n const namePart = content.substring(0, colonIndex).trim()\n const rest = content.substring(colonIndex + 1).trim()\n\n /**\n * Check for nested options after '|'\n */\n let description = rest\n let nestedOptions: CommandOption[] | undefined\n\n const pipeIndex = rest.indexOf('|')\n if (pipeIndex !== -1) {\n description = rest.substring(0, pipeIndex).trim()\n const nestedText = rest.substring(pipeIndex + 1).trim()\n /**\n * nestedText should start with '{' and end with ')', clean it\n * Also Remove trailing ')' if present\n */\n const cleanedNestedText = nestedText.replace(/^\\{/, '').trim()\n\n /**\n * Parse nested options recursively\n */\n nestedOptions = Signature.parseOptions('{' + cleanedNestedText + '}')\n } else {\n /**\n * Trim the string\n */\n description = description.trim()\n }\n\n /**\n * Parse name modifiers (?, *, ?*)\n */\n let name = namePart\n let required = /[^a-zA-Z0-9_|-]/.test(name)\n let multiple = false\n\n if (name.endsWith('?*')) {\n required = false\n multiple = true\n name = name.slice(0, -2)\n } else if (name.endsWith('*')) {\n multiple = true\n name = name.slice(0, -1)\n } else if (name.endsWith('?')) {\n required = false\n name = name.slice(0, -1)\n }\n\n /**\n * Check if it's a flag option (starts with --)\n */\n const isFlag = name.startsWith('--')\n let flags: string[] | undefined\n let defaultValue: string | number | boolean | undefined | string[]\n\n if (isFlag) {\n /**\n * Parse flags and default values\n */\n const flagParts = name.split('|').map(s => s.trim())\n\n flags = []\n\n for (let part of flagParts) {\n if (part.startsWith('--') && part.slice(2).length === 1) {\n part = '-' + part.slice(2)\n } else if (part.startsWith('-') && !part.startsWith('--') && part.slice(1).length > 1) {\n part = '--' + part.slice(1)\n } else if (!part.startsWith('-') && part.slice(1).length > 1) {\n part = '--' + part\n }\n\n const eqIndex = part.indexOf('=')\n if (eqIndex !== -1) {\n flags.push(part.substring(0, eqIndex))\n const val = part.substring(eqIndex + 1)\n if (val === '*') {\n defaultValue = []\n } else if (val === 'true' || val === 'false' || (!val && !required)) {\n defaultValue = val === 'true'\n } else if (!isNaN(Number(val))) {\n defaultValue = Number(val)\n } else {\n defaultValue = val\n }\n } else {\n flags.push(part)\n }\n }\n }\n\n options.push({\n name: isFlag ? flags![flags!.length - 1] : name,\n required,\n multiple,\n description,\n flags,\n shared,\n isFlag,\n isHidden,\n defaultValue,\n nestedOptions,\n })\n }\n\n return options\n }\n\n /**\n * Helper to parse a command's signature\n * \n * @param signature \n * @param commandClass \n * @returns \n */\n static parseSignature (signature: string, commandClass: Command): ParsedCommand {\n const lines = signature.split('\\n').map(l => l.trim()).filter(l => l.length > 0)\n const isHidden = ['#', '^'].includes(lines[0][0]!) || /:[#^]/.test(lines[0])\n const baseCommand = lines[0].replace(/[^\\w=:-]/g, '')\n const description = commandClass.getDescription()\n const isNamespaceCommand = baseCommand.endsWith(':')\n\n /**\n * Join the rest lines to a single string for parsing\n */\n const rest = lines.slice(1).join(' ')\n\n /**\n * Parse all top-level options/subcommands\n */\n const allOptions = Signature.parseOptions(rest)\n\n if (isNamespaceCommand) {\n /**\n * Separate subcommands (those without flags) and base options (flags)\n * Here we assume subcommands are those without flags (isFlag false)\n * and base options are flags or options after subcommands\n\n * For simplicity, treat all top-level options as subcommands\n * and assume base command options come after subcommands in signature (not shown in example)\n */\n\n return {\n baseCommand: baseCommand.slice(0, -1),\n isNamespaceCommand,\n subCommands: allOptions.filter(e => !e.flags && !e.isHidden),\n description,\n commandClass,\n options: allOptions.filter(e => !!e.flags),\n isHidden,\n }\n } else {\n return {\n baseCommand,\n isNamespaceCommand,\n options: allOptions,\n description,\n commandClass,\n isHidden,\n }\n }\n }\n}\n","import { dirname, join, resolve } from 'path';\n\nimport { fork } from 'child_process';\n\nfunction run (opts = {}) {\n let input;\n let proc;\n const args = opts.args || [];\n const allowRestarts = opts.allowRestarts || false;\n const overrideInput = opts.input;\n const forkOptions = opts.options || opts;\n delete forkOptions.args;\n delete forkOptions.allowRestarts;\n return {\n name: 'run',\n buildStart (options) {\n let inputs = overrideInput !== null && overrideInput !== void 0 ? overrideInput : options.input;\n if (typeof inputs === 'string') {\n inputs = [inputs];\n }\n if (typeof inputs === 'object') {\n inputs = Object.values(inputs);\n }\n if (inputs.length > 1) {\n throw new Error(`@rollup/plugin-run must have a single entry point; consider setting the \\`input\\` option`);\n }\n input = resolve(inputs[0]);\n },\n generateBundle (_outputOptions, _bundle, isWrite) {\n if (!isWrite) {\n this.error(`@rollup/plugin-run currently only works with bundles that are written to disk`);\n }\n },\n writeBundle (outputOptions, bundle) {\n const forkBundle = (dir, entryFileName) => {\n if (proc)\n proc.kill();\n proc = fork(join(dir, entryFileName), args, forkOptions);\n };\n const dir = outputOptions.dir || dirname(outputOptions.file);\n const entryFileName = Object.keys(bundle).find((fileName) => {\n const chunk = bundle[fileName];\n return chunk.isEntry && chunk.facadeModuleId === input;\n });\n if (entryFileName) {\n forkBundle(dir, entryFileName);\n if (allowRestarts) {\n process.stdin.resume();\n process.stdin.setEncoding('utf8');\n process.stdin.on('data', (data) => {\n const line = data.toString().trim().toLowerCase();\n if (line === 'rs' || line === 'restart' || data.toString().charCodeAt(0) === 11) {\n forkBundle(dir, entryFileName);\n }\n else if (line === 'cls' || line === 'clear' || data.toString().charCodeAt(0) === 12) {\n // eslint-disable-next-line no-console\n console.clear();\n }\n });\n }\n }\n else {\n this.error(`@rollup/plugin-run could not find output chunk`);\n }\n }\n };\n}\n\nexport { run as default };\n//# sourceMappingURL=index.js.map\n","import { Options } from 'tsdown'\nimport run from '@rollup/plugin-run'\n\nconst env = process.env.NODE_ENV || 'development'\nconst outDir = env === 'development' ? '.h3ravel/serve' : 'dist'\n\nexport const TsDownConfig: Options = {\n outDir,\n entry: ['src/**/*.ts'],\n format: ['esm'],//, 'cjs'],\n target: 'node22',\n sourcemap: env === 'development',\n clean: true,\n shims: true,\n copy: [{ from: 'public', to: outDir }, 'src/resources', 'src/database'],\n env: env === 'development' ? {\n NODE_ENV: env,\n SRC_PATH: outDir,\n } : {},\n watch:\n env === 'development' && process.env.CLI_BUILD !== 'true'\n ? ['.env', '.env.*', 'src', '../../packages']\n : false,\n dts: false,\n logLevel: 'silent',\n nodeProtocol: true,\n skipNodeModulesBundle: true,\n plugins: env === 'development' && process.env.CLI_BUILD !== 'true' ? [\n run({\n env: Object.assign({}, process.env, {\n NODE_ENV: env,\n SRC_PATH: outDir,\n }),\n execArgv: ['-r', 'source-map-support/register'],\n allowRestarts: false,\n input: process.cwd() + '/src/server.ts'//\n })\n ] : [],\n}\n\nexport default TsDownConfig\n","import { CommandOption, ParsedCommand } from './Contracts/ICommand'\nimport { Option, program, type Command as Commander } from 'commander'\n\nimport { Application } from '@h3ravel/core'\nimport { Command } from './Commands/Command'\nimport { Kernel } from './Kernel'\nimport { ListCommand } from './Commands/ListCommand'\nimport { Logger } from '@h3ravel/shared'\nimport { MakeCommand } from './Commands/MakeCommand'\nimport { Signature } from './Signature'\nimport TsDownConfig from './TsdownConfig'\nimport { altLogo } from './logo'\nimport { build } from 'tsdown'\nimport { glob } from 'node:fs/promises'\nimport path from 'node:path'\n\n/**\n * Musket is H3ravel's CLI tool\n */\nexport class Musket {\n private commands: ParsedCommand[] = []\n\n constructor(private app: Application, private kernel: Kernel) { }\n\n async build () {\n this.loadBaseCommands()\n await this.loadDiscoveredCommands()\n return this.initialize()\n }\n\n private loadBaseCommands () {\n const commands: Command[] = [\n new MakeCommand(this.app, this.kernel),\n new ListCommand(this.app, this.kernel),\n ]\n\n commands.forEach(e => this.addCommand(e))\n }\n\n private async loadDiscoveredCommands () {\n const commands: Command[] = [\n ...this.app.registeredCommands.map(cmd => new cmd(this.app, this.kernel))\n ]\n\n /**\n * Musket Commands auto registration\n */\n const providers_path = app_path('Console/Commands/*.js').replace('/src/', '/.h3ravel/serve/')\n\n /** Add the App Commands */\n for await (const cmd of glob(providers_path)) {\n const name = path.basename(cmd).replace('.js', '')\n try {\n const cmdClass = (await import(cmd))[name]\n commands.push(new cmdClass(this.app, this.kernel))\n } catch { /** */ }\n }\n\n commands.forEach(e => this.addCommand(e))\n }\n\n addCommand (command: Command) {\n this.commands.push(Signature.parseSignature(command.getSignature(), command))\n }\n\n private initialize () {\n /** Init the Musket Version */\n const cliVersion = Logger.parse([\n ['Musket CLI:', 'white'],\n [this.kernel.consolePackage.version, 'green']\n ], ' ', false)\n\n /** Init the App Version */\n const localVersion = Logger.parse([\n ['H3ravel Framework:', 'white'],\n [this.kernel.modulePackage.version, 'green']\n ], ' ', false)\n\n const additional = {\n quiet: ['-q, --quiet', 'Do not output any message'],\n silent: ['--silent', 'Do not output any message'],\n verbose: ['-v, --verbose <number>', 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'],\n lock: ['--lock', 'Locked and loaded, do not ask any interactive question'],\n }\n\n /** Init Commander */\n program\n .name('musket')\n .version(`${cliVersion}\\n${localVersion}`)\n .description(altLogo)\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n const instance = new ListCommand(this.app, this.kernel)\n instance.setInput(program.opts(), program.args, program.registeredArguments, {}, program)\n instance.handle()\n })\n\n /** Create the init Command */\n program\n .command('init')\n .description('Initialize H3ravel.')\n .action(async () => {\n Logger.success('Initialized: H3ravel has been initialized!')\n })\n\n /** Loop through all the available commands */\n for (let i = 0; i < this.commands.length; i++) {\n const command = this.commands[i]\n const instance = command.commandClass\n\n if (command.isNamespaceCommand && command.subCommands) {\n /**\n * Initialize the base command\n */\n const cmd = command.isHidden\n ? program\n : program\n .command(command.baseCommand)\n .description(command.description ?? '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n\n /**\n * Add options to the base command if it has any\n */\n if ((command.options?.length ?? 0) > 0) {\n command.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n\n /**\n * Initialize the sub commands\n */\n command\n .subCommands\n .filter((v, i, a) => !v.shared && a.findIndex(t => t.name === v.name) === i)\n .forEach(sub => {\n const cmd = program\n .command(`${command.baseCommand}:${sub.name}`)\n .description(sub.description || '')\n .addOption(new Option(additional.quiet[0], additional.quiet[1]).implies({ silent: true }))\n .addOption(new Option(additional.silent[0], additional.silent[1]).implies({ quiet: true }))\n .addOption(new Option(additional.verbose[0], additional.verbose[1]).choices(['1', '2', '3']))\n .addOption(new Option(additional.lock[0], additional.lock[1]))\n .action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, sub, program)\n await instance.handle()\n })\n\n /**\n * Add the shared arguments here\n */\n command.subCommands?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add the shared options here\n */\n command.options?.filter(e => e.shared).forEach(opt => {\n this.makeOption(opt, cmd, false, sub)\n })\n\n /**\n * Add options to the sub command if it has any\n */\n if (sub.nestedOptions) {\n sub.nestedOptions\n .filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd)\n })\n }\n })\n } else {\n /**\n * Initialize command with options\n */\n const cmd = program\n .command(command.baseCommand)\n .description(command.description ?? '')\n\n command\n ?.options\n ?.filter((v, i, a) => a.findIndex(t => t.name === v.name) === i)\n .forEach(opt => {\n this.makeOption(opt, cmd, true)\n })\n\n cmd.action(async () => {\n instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command, program)\n await instance.handle()\n })\n }\n }\n\n /** Rebuild the app on every command except fire so we wont need TS */\n program.hook('preAction', async (_, cmd) => {\n if (cmd.name() !== 'fire') {\n await build({\n ...TsDownConfig,\n watch: false,\n plugins: []\n })\n }\n })\n\n return program\n }\n\n makeOption (opt: CommandOption, cmd: Commander, parse?: boolean, parent?: any) {\n const description = opt.description?.replace(/\\[(\\w+)\\]/g, (_, k) => parent?.[k] ?? `[${k}]`) ?? ''\n const type = opt.name.replaceAll('-', '')\n\n if (opt.isFlag) {\n if (parse) {\n const flags = opt.flags\n ?.map(f => (f.length === 1 ? `-${f}` : `--${f}`)).join(', ')!\n .replaceAll('----', '--')\n .replaceAll('---', '-')\n\n cmd.option(flags || '', description!, String(opt.defaultValue) || undefined)\n } else {\n cmd.option(\n opt.flags?.join(', ') + (opt.required ? ` <${type}>` : ''),\n description!,\n opt.defaultValue as any\n )\n }\n } else {\n cmd.argument(\n opt.required ? `<${opt.name}>` : `[${opt.name}]`,\n description,\n opt.defaultValue\n )\n }\n }\n\n static async parse (kernel: Kernel) {\n return (await new Musket(kernel.app, kernel).build()).parseAsync()\n }\n\n}\n","import { Application, ConsoleKernel } from '@h3ravel/core'\n\nimport { Helpers } from '@h3ravel/filesystem'\nimport { Musket } from './Musket'\nimport path from 'node:path'\n\nexport class Kernel extends ConsoleKernel {\n constructor(public app: Application) {\n super(app)\n }\n\n static init (app: Application) {\n const instance = new Kernel(app)\n\n Promise.all([instance.loadRequirements()])\n .then(([e]) => e.run())\n }\n\n\n private async run () {\n await Musket.parse(this)\n process.exit(0)\n }\n\n private async loadRequirements () {\n this.cwd = path.join(process.cwd(), this.basePath)\n this.modulePath = Helpers.findModulePkg('@h3ravel/core', this.cwd) ?? ''\n this.consolePath = Helpers.findModulePkg('@h3ravel/console', this.cwd) ?? ''\n\n try {\n this.modulePackage = await import(path.join(this.modulePath, 'package.json'))\n } catch {\n this.modulePackage = { version: 'N/A' }\n }\n\n try {\n this.consolePackage = await import(path.join(this.consolePath, 'package.json'))\n } catch {\n this.consolePackage = { version: 'N/A' }\n }\n\n return this\n }\n}\n","/// <reference path=\"../../../core/src/app.globals.d.ts\" />\n\nimport { Kernel } from '../Kernel'\nimport { ServiceProvider } from '@h3ravel/core'\n/**\n * Handles CLI commands and tooling.\n * \n * Register DatabaseManager and QueryBuilder.\n * Set up ORM models and relationships.\n * Register migration and seeder commands.\n * \n * Auto-Registered when in CLI mode\n */\nexport class ConsoleServiceProvider extends ServiceProvider {\n public static priority = 992\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = true\n\n register () {\n }\n\n boot () {\n Kernel.init(this.app)\n\n process.on('SIGINT', () => {\n process.exit(0)\n })\n process.on('SIGTERM', () => {\n process.exit(0)\n })\n }\n}\n"],"x_google_ignoreList":[6],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,UAAb,cAA6B,eAAe;;;;ACF5C,MAAa,OAAO,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;AAwB9B,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;AClBjC,IAAa,cAAb,cAAiC,QAAQ;;;;;;CAOrC,AAAU,YAAoB;;;;;;CAO9B,AAAU,cAAsB;CAEhC,MAAa,SAAU;EACnB,MAAM,UAAU,CACZ;GACI,OAAO;GACP,MAAM;GACN,aAAa;GAChB,CACJ,CACI,OAAO,KAAK,QAAQ,QAAQ,CAC5B,KAAI,MAAK;AAIN,UAHa,OAAO,SAAS,OAAO,IAChC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,QAAO,QAAK,CAAC,CAACA,IAAE,CAAC,KAAK,KAAK,EAAE,SAAS,MAClE,EAAE,EAAE,aAAa,IAAI,MAAM,CAChB,KAAK,GAAG;IACtB;EAQN,MAAM,UALW,KAAK,QAAQ,SAAS,KAAI,MAAK;AAE5C,UADa,OAAO,SAAS,OAAO,IAAI,OAAO,EAAE,MAAM,EAAE,SAAS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3B,MAAM,WAAW,IAAI,OAAO,IAAI;AAEhC,UAAQ,IAAI,CAAC,SAAS,kBAAkB,CAAC,CAAC,CACrC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC;;CAI/B,MAAc,MAAO;AACjB,QAAM,OAAO,MAAM,KAAK;AACxB,UAAQ,KAAK,EAAE;;CAGnB,MAAc,mBAAoB;AAC9B,OAAK,MAAMC,SAAK,KAAK,QAAQ,KAAK,EAAE,KAAK,SAAS;AAClD,OAAK,aAAa,QAAQ,cAAc,iBAAiB,KAAK,IAAI,IAAI;AACtE,OAAK,cAAc,QAAQ,cAAc,oBAAoB,KAAK,IAAI,IAAI;AAE1E,MAAI;AACA,QAAK,gBAAgB,MAAM,OAAOA,SAAK,KAAK,KAAK,YAAY,eAAe;UACxE;AACJ,QAAK,gBAAgB,EAAE,SAAS,OAAO;;AAG3C,MAAI;AACA,QAAK,iBAAiB,MAAM,OAAOA,SAAK,KAAK,KAAK,aAAa,eAAe;UAC1E;AACJ,QAAK,iBAAiB,EAAE,SAAS,OAAO;;AAG5C,SAAO;;;;;;;;;;;;;;;AC5Bf,IAAa,yBAAb,cAA4C,gBAAgB;CACxD,OAAc,WAAW;;;;CAKzB,OAAc,UAAU;CAExB,WAAY;CAGZ,OAAQ;AACJ,SAAO,KAAK,KAAK,IAAI;AAErB,UAAQ,GAAG,gBAAgB;AACvB,WAAQ,KAAK,EAAE;IACjB;AACF,UAAQ,GAAG,iBAAiB;AACxB,WAAQ,KAAK,EAAE;IACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/console",
3
- "version": "11.1.0",
3
+ "version": "11.2.1",
4
4
  "description": "CLI utilities for scaffolding, running migrations, tasks and for H3ravel.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -51,7 +51,7 @@
51
51
  ],
52
52
  "peerDependencies": {
53
53
  "@h3ravel/arquebus": "^0.4.0",
54
- "@h3ravel/core": "^1.8.0",
54
+ "@h3ravel/core": "^1.9.1",
55
55
  "@h3ravel/support": "^0.10.0"
56
56
  },
57
57
  "devDependencies": {
@@ -66,14 +66,14 @@
66
66
  "radashi": "^12.6.2",
67
67
  "resolve-from": "^5.0.0",
68
68
  "tsx": "^4.20.5",
69
- "@h3ravel/http": "^11.1.0",
70
- "@h3ravel/database": "^11.1.0",
71
- "@h3ravel/queue": "^11.0.1",
72
- "@h3ravel/shared": "^0.18.0",
69
+ "@h3ravel/cache": "^11.0.1",
70
+ "@h3ravel/database": "^11.2.0",
71
+ "@h3ravel/mail": "^11.0.1",
73
72
  "@h3ravel/router": "^1.9.0",
73
+ "@h3ravel/queue": "^11.0.1",
74
74
  "@h3ravel/config": "^1.4.0",
75
- "@h3ravel/cache": "^11.0.1",
76
- "@h3ravel/mail": "^11.0.1"
75
+ "@h3ravel/shared": "^0.19.0",
76
+ "@h3ravel/http": "^11.2.0"
77
77
  },
78
78
  "scripts": {
79
79
  "barrelx": "barrelsby --directory src --delete --singleQuotes",
@@ -1 +0,0 @@
1
- {"version":3,"file":"Utils-B1kpj9-1.cjs","names":["path","escalade"],"sources":["../../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs","../src/Utils.ts"],"sourcesContent":["import { dirname, resolve } from 'path';\nimport { readdirSync, statSync } from 'fs';\n\nexport default function (start, callback) {\n\tlet dir = resolve('.', start);\n\tlet tmp, stats = statSync(dir);\n\n\tif (!stats.isDirectory()) {\n\t\tdir = dirname(dir);\n\t}\n\n\twhile (true) {\n\t\ttmp = callback(dir, readdirSync(dir));\n\t\tif (tmp) return resolve(dir, tmp);\n\t\tdir = dirname(tmp = dir);\n\t\tif (tmp === dir) break;\n\t}\n}\n","import { access } from 'fs/promises'\nimport escalade from 'escalade/sync'\nimport path from 'path'\nimport preferredPM from 'preferred-pm'\n\nconst join = path.join\n\nexport class Utils {\n static findModulePkg (moduleId: string, cwd?: string) {\n const parts = moduleId.replace(/\\\\/g, '/').split('/')\n\n let packageName = ''\n // Handle scoped package name\n if (parts.length > 0 && parts[0][0] === '@') {\n packageName += parts.shift() + '/'\n }\n packageName += parts.shift()\n\n const packageJson = path.join(cwd ?? process.cwd(), 'node_modules', packageName)\n\n const resolved = this.findUpConfig(packageJson, 'package', ['json'])\n\n if (!resolved) {\n return\n }\n\n return path.join(path.dirname(resolved), parts.join('/'))\n }\n\n static async getMigrationPaths (cwd: string, migrator: any, defaultPath: string, path: string) {\n if (path) {\n return [join(cwd, path)]\n }\n return [\n ...migrator.getPaths(),\n join(cwd, defaultPath),\n ]\n }\n\n /**\n * Check if file exists\n * \n * @param path \n * @returns \n */\n static async fileExists (path: string): Promise<boolean> {\n try {\n await access(path)\n return true\n } catch {\n return false\n }\n }\n\n static findUpConfig (cwd: string, name: string, extensions: string[]) {\n return escalade(cwd, (_dir, names) => {\n for (const ext of extensions) {\n const filename = `${name}.${ext}`\n if (names.includes(filename)) {\n return filename\n }\n }\n return false\n })\n }\n\n static async installCommand (pkg: string) {\n const pm = (await preferredPM(process.cwd()))?.name ?? 'pnpm'\n\n let cmd = 'install'\n if (pm === 'yarn' || pm === 'pnpm')\n cmd = 'add'\n else if (pm === 'bun')\n cmd = 'create'\n\n return `${pm} ${cmd} ${pkg}`\n }\n}\n\nclass TableGuesser {\n static CREATE_PATTERNS = [\n /^create_(\\w+)_table$/,\n /^create_(\\w+)$/\n ]\n static CHANGE_PATTERNS = [\n /.+_(to|from|in)_(\\w+)_table$/,\n /.+_(to|from|in)_(\\w+)$/\n ]\n static guess (migration: string) {\n for (const pattern of TableGuesser.CREATE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[1], true]\n }\n }\n for (const pattern of TableGuesser.CHANGE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[2], false]\n }\n }\n return []\n }\n}\n\nexport { TableGuesser }\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sBAAyB,OAAO,UAAU;CACzC,IAAI,wB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AAa;EACxC,MAAM,MAAM,gCAAkB,QAAQ,KAAK,CAAC,GAAG,QAAQ;EAEvD,IAAI,MAAM;AACV,MAAI,OAAO,UAAU,OAAO,OAC1B,OAAM;WACC,OAAO,MACd,OAAM;AAER,SAAO,GAAG,GAAG,GAAG,IAAI,GAAG;;;AAI3B,IAAM,eAAN,MAAM,aAAa;CACjB,OAAO,kBAAkB,CACvB,wBACA,iBACD;CACD,OAAO,kBAAkB,CACvB,gCACA,yBACD;CACD,OAAO,MAAO,WAAmB;AAC/B,OAAK,MAAM,WAAW,aAAa,iBAAiB;GAClD,MAAM,UAAU,UAAU,MAAM,QAAQ;AACxC,OAAI,QACF,QAAO,CAAC,QAAQ,IAAI,KAAK;;AAG7B,OAAK,MAAM,WAAW,aAAa,iBAAiB;GAClD,MAAM,UAAU,UAAU,MAAM,QAAQ;AACxC,OAAI,QACF,QAAO,CAAC,QAAQ,IAAI,MAAM;;AAG9B,SAAO,EAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Utils-DAJvoXlr.js","names":["join","path","escalade"],"sources":["../../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs","../src/Utils.ts"],"sourcesContent":["import { dirname, resolve } from 'path';\nimport { readdirSync, statSync } from 'fs';\n\nexport default function (start, callback) {\n\tlet dir = resolve('.', start);\n\tlet tmp, stats = statSync(dir);\n\n\tif (!stats.isDirectory()) {\n\t\tdir = dirname(dir);\n\t}\n\n\twhile (true) {\n\t\ttmp = callback(dir, readdirSync(dir));\n\t\tif (tmp) return resolve(dir, tmp);\n\t\tdir = dirname(tmp = dir);\n\t\tif (tmp === dir) break;\n\t}\n}\n","import { access } from 'fs/promises'\nimport escalade from 'escalade/sync'\nimport path from 'path'\nimport preferredPM from 'preferred-pm'\n\nconst join = path.join\n\nexport class Utils {\n static findModulePkg (moduleId: string, cwd?: string) {\n const parts = moduleId.replace(/\\\\/g, '/').split('/')\n\n let packageName = ''\n // Handle scoped package name\n if (parts.length > 0 && parts[0][0] === '@') {\n packageName += parts.shift() + '/'\n }\n packageName += parts.shift()\n\n const packageJson = path.join(cwd ?? process.cwd(), 'node_modules', packageName)\n\n const resolved = this.findUpConfig(packageJson, 'package', ['json'])\n\n if (!resolved) {\n return\n }\n\n return path.join(path.dirname(resolved), parts.join('/'))\n }\n\n static async getMigrationPaths (cwd: string, migrator: any, defaultPath: string, path: string) {\n if (path) {\n return [join(cwd, path)]\n }\n return [\n ...migrator.getPaths(),\n join(cwd, defaultPath),\n ]\n }\n\n /**\n * Check if file exists\n * \n * @param path \n * @returns \n */\n static async fileExists (path: string): Promise<boolean> {\n try {\n await access(path)\n return true\n } catch {\n return false\n }\n }\n\n static findUpConfig (cwd: string, name: string, extensions: string[]) {\n return escalade(cwd, (_dir, names) => {\n for (const ext of extensions) {\n const filename = `${name}.${ext}`\n if (names.includes(filename)) {\n return filename\n }\n }\n return false\n })\n }\n\n static async installCommand (pkg: string) {\n const pm = (await preferredPM(process.cwd()))?.name ?? 'pnpm'\n\n let cmd = 'install'\n if (pm === 'yarn' || pm === 'pnpm')\n cmd = 'add'\n else if (pm === 'bun')\n cmd = 'create'\n\n return `${pm} ${cmd} ${pkg}`\n }\n}\n\nclass TableGuesser {\n static CREATE_PATTERNS = [\n /^create_(\\w+)_table$/,\n /^create_(\\w+)$/\n ]\n static CHANGE_PATTERNS = [\n /.+_(to|from|in)_(\\w+)_table$/,\n /.+_(to|from|in)_(\\w+)$/\n ]\n static guess (migration: string) {\n for (const pattern of TableGuesser.CREATE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[1], true]\n }\n }\n for (const pattern of TableGuesser.CHANGE_PATTERNS) {\n const matches = migration.match(pattern)\n if (matches) {\n return [matches[2], false]\n }\n }\n return []\n }\n}\n\nexport { TableGuesser }\n"],"x_google_ignoreList":[0],"mappings":";;;;;;AAGA,sBAAyB,OAAO,UAAU;CACzC,IAAI,MAAM,QAAQ,KAAK,MAAM;CAC7B,IAAI;AAEJ,KAA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