reciple 10.0.10 → 10.0.11

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.
@@ -3,7 +3,6 @@ import { LogLevel, Logger, logger } from "@prtty/print";
3
3
  import { Command } from "commander";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import path from "node:path";
6
- import { coerce } from "semver";
7
6
  import { Format, isDebugging, recursiveDefaults } from "@reciple/utils";
8
7
  import { config } from "@dotenvx/dotenvx";
9
8
  import { readdir, stat } from "node:fs/promises";
@@ -25,7 +24,7 @@ var CLI = class {
25
24
  constructor(options) {
26
25
  this.options = options;
27
26
  this.build = options.build;
28
- this.version = String(coerce(this.build) ?? this.build);
27
+ this.version = String(this.build.split("-")[0]);
29
28
  this.command = new Command().name(options.name).description(options.description).version(options.build, "-v, --version", "Output the CLI version number").option("-D, --debug", "Enable debug mode", isDebugging()).option("--no-debug", "Disabled debug mode").option("--env <file>", "Load environment variables from .env file", (v, p) => p.concat(v), []).enablePositionalOptions(true).hook("preAction", this.handlePreAction.bind(this)).showHelpAfterError();
30
29
  this.logger = options.logger instanceof Logger ? options.logger : new Logger(options.logger);
31
30
  if (this.flags.debug) {
@@ -95,7 +94,7 @@ var CLI = class {
95
94
  (function(_CLI) {
96
95
  _CLI.root = path.join(path.dirname(fileURLToPath(import.meta.url)), "../../../");
97
96
  _CLI.bin = path.join(CLI.root, "dist/bin/reciple.mjs");
98
- _CLI.version = "10.0.10";
97
+ _CLI.version = "10.0.11";
99
98
  function stringifyFlags(flags, command, ignored = []) {
100
99
  let arr = [];
101
100
  for (const [key, value] of Object.entries(flags)) {
@@ -1 +1 @@
1
- {"version":3,"file":"CLI.mjs","names":[],"sources":["../../../src/classes/cli/CLI.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { fileURLToPath } from 'node:url';\nimport path from 'node:path';\nimport { coerce } from 'semver';\nimport { Format, isDebugging, recursiveDefaults } from '@reciple/utils';\nimport { logger, Logger, LogLevel } from '@prtty/print';\nimport { config as loadEnv } from '@dotenvx/dotenvx';\nimport { readdir, stat } from 'node:fs/promises';\nimport { CLISubcommand } from './CLISubcommand.js';\nimport { spinner, type SpinnerOptions } from '@clack/prompts';\nimport type { RolldownPlugin } from 'rolldown';\nimport { colors } from '@prtty/prtty';\n\nexport class CLI {\n public build: string;\n public version: string;\n public command: Command;\n public logger: Logger;\n\n get isDebugging(): boolean {\n return this.flags.debug;\n }\n\n get flags(): CLI.Flags {\n return this.command.opts();\n }\n\n constructor(public readonly options: CLI.Options) {\n this.build = options.build;\n this.version = String(coerce(this.build) ?? this.build);\n\n this.command = new Command()\n .name(options.name)\n .description(options.description)\n .version(options.build, '-v, --version', 'Output the CLI version number')\n .option('-D, --debug', 'Enable debug mode', isDebugging())\n .option('--no-debug', 'Disabled debug mode')\n .option('--env <file>', 'Load environment variables from .env file', (v, p) => p.concat(v), [] as string[])\n .enablePositionalOptions(true)\n .hook('preAction', this.handlePreAction.bind(this))\n .showHelpAfterError();\n\n this.logger = options.logger instanceof Logger ? options.logger : new Logger(options.logger);\n\n if (this.flags.debug) {\n this.logger.logLevel = LogLevel.Debug;\n this.logger.writeLevel = LogLevel.Debug;\n }\n }\n\n public async parse(argv?: string[]): Promise<this> {\n await this.loadCommands();\n await this.command.parseAsync(argv);\n return this;\n }\n\n public async loadCommands(): Promise<void> {\n this.logger.debug(`Loading cli commands from ${this.options.subcommandsDir}`);\n\n const dirStat = await stat(this.options.subcommandsDir).catch(() => undefined);\n if (!dirStat?.isDirectory()) return;\n\n const files = (await readdir(this.options.subcommandsDir))\n .map(f => path.join(this.options.subcommandsDir, f))\n .filter(f => f.endsWith('.mjs'));\n\n const hasParent: CLISubcommand[] = [];\n\n for (const file of files) {\n const Subommand = recursiveDefaults<CLISubcommand.Constructor>(await import(path.isAbsolute(file) ? `file://${file}` : file));\n if (!Subommand || typeof Subommand !== 'function') continue;\n\n const instance = new Subommand({ cli: this, command: this.command });\n\n if (instance.parent) {\n hasParent.push(instance);\n continue;\n }\n\n CLISubcommand.registerSubcommand(instance);\n }\n\n for (const instance of hasParent) {\n CLISubcommand.registerSubcommand(instance);\n }\n }\n\n public async handlePreAction(cmd: Command, action: Command): Promise<void> {\n this.logger.debug(`Executing ${action.name()}`);\n this.logger.debug(`Debug mode is ${this.flags.debug ? 'enabled' : 'disabled'}`);\n process.env.NODE_ENV = this.flags.debug ? 'development' : process.env.NODE_ENV;\n\n loadEnv({\n path: this.flags.env.length ? this.flags.env : [path.join(process.cwd(), '.env')],\n debug: this.flags.debug,\n quiet: !this.flags.debug,\n ignore: ['MISSING_ENV_FILE']\n });\n\n this.logger.debug(`Loaded environment variables from ${this.flags.env.join(', ')}`);\n }\n\n public async setCurrentDirectory(cwd?: string): Promise<void> {\n cwd ??= process.cwd();\n\n if (!(await stat(cwd).then(s => s.isDirectory()).catch(() => false))) {\n console.log(colors.red('Please specify a valid project directory'));\n process.exit(1);\n }\n\n process.chdir(cwd);\n }\n\n public getFlags<Flags extends Record<string, any> = Record<string, any>>(command: Command|string, mergeDefault?: false): Flags|undefined;\n public getFlags<Flags extends Record<string, any> = Record<string, any>>(command: Command|string, mergeDefault: true): Flags & CLI.Flags|undefined;\n public getFlags(command?: undefined): CLI.Flags;\n public getFlags(command?: Command|string, mergeDefault: boolean = false): Record<string, any>|undefined {\n if (!command) return this.flags;\n\n command = typeof command === 'string' ? this.command.commands.find(c => c.name() === command) : command;\n const flags = command?.opts();\n\n return mergeDefault ? { ...this.flags, ...flags } : flags;\n }\n\n public getCommand(name: string): Command|undefined;\n public getCommand(name?: undefined): Command;\n public getCommand(name?: string): Command|undefined {\n if (!name) return this.command;\n\n return this.command.commands.find(c => c.name() === name);\n }\n}\n\nexport namespace CLI {\n export interface Options {\n name: string;\n description: string;\n build: string;\n subcommandsDir: string;\n logger?: Logger|Logger.Options;\n }\n\n export interface Flags {\n debug: boolean;\n env: string[];\n }\n\n export const root: string = path.join(path.dirname(fileURLToPath(import.meta.url)), '../../../');\n export const bin: string = path.join(CLI.root, 'dist/bin/reciple.mjs');\n export const version = process.env.__VERSION__;\n\n export function stringifyFlags(flags: Record<string, any>, command: Command, ignored: string[] = []): string[] {\n let arr: string[] = [];\n\n for (const [key, value] of Object.entries(flags)) {\n const option = command.options.find(o => o.name() === key || o.attributeName() === key);\n if (!option || ignored.includes(key)) continue;\n\n const flag = option.long ?? option.short ?? `--${option.name()}`;\n\n if (!option.flags.endsWith('>') && !option.flags.endsWith(']') && typeof value === 'boolean') {\n if (value) arr.push(flag);\n continue;\n }\n\n arr.push(flag, String(value));\n }\n\n return arr;\n }\n\n export interface SpinnerPromiseOptions<T> {\n indicator?: SpinnerOptions['indicator'];\n promise: Promise<T>;\n message?: string;\n successMessage?: string;\n errorMessage?: string;\n }\n\n export function createSpinnerPromise<T>(options: SpinnerPromiseOptions<T>): [Promise<T>, ReturnType<typeof spinner>] {\n const loader = spinner({ indicator: options.indicator });\n\n return [\n new Promise<T>((resolve, reject) => {\n loader.start(options.message);\n\n options.promise\n .then((value) => {\n loader.stop(options.successMessage);\n resolve(value);\n })\n .catch((error) => {\n loader.stop(options.errorMessage);\n reject(error);\n });\n }),\n loader\n ];\n }\n\n export function createTsdownLogger(_logger: Logger = logger): RolldownPlugin {\n let startedAt: number;\n\n return {\n name: 'reciple:log-build-completion',\n buildStart: () => {\n _logger.log(colors.green('🚀 Building reciple modules...'));\n startedAt = Date.now();\n },\n renderChunk: (code, info) => {\n const size = Format.bytes(Buffer.byteLength(code, 'utf8'));\n _logger.log(` ├─ ${colors.cyan(size)}\\t${colors.bold(info.fileName)}`);\n\n return { code };\n },\n buildEnd: error => {\n if (error) _logger.error(error)\n },\n closeBundle: () => {\n const time = Format.duration(Date.now() - startedAt);\n _logger.log(colors.green(`✅ Build success in `) + colors.yellow(`${time}`));\n }\n };\n }\n\n export const ignoredDefault = [\n '.git',\n '.log',\n '.nyc_output',\n '.sass-cache',\n '.yarn',\n 'bower_components',\n 'coverage',\n 'node_modules'\n ]\n}\n"],"mappings":";;;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YAAQ,MAAM;KACjB,CACA,OAAO,UAAU;AACd,WAAO,KAAK,QAAQ,aAAa;AACjC,WAAO,MAAM;KACf;IACR,EACF,OACH;;;CAGE,SAAS,mBAAmB,UAAkB,QAAwB;EACzE,IAAI;AAEJ,SAAO;GACH,MAAM;GACN,kBAAkB;AACd,YAAQ,IAAI,OAAO,MAAM,iCAAiC,CAAC;AAC3D,gBAAY,KAAK,KAAK;;GAE1B,cAAc,MAAM,SAAS;IACzB,MAAM,OAAO,OAAO,MAAM,OAAO,WAAW,MAAM,OAAO,CAAC;AAC1D,YAAQ,IAAI,OAAO,OAAO,KAAK,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,SAAS,GAAG;AAEtE,WAAO,EAAE,MAAM;;GAEnB,WAAU,UAAS;AACf,QAAI,MAAO,SAAQ,MAAM,MAAK;;GAElC,mBAAmB;IACf,MAAM,OAAO,OAAO,SAAS,KAAK,KAAK,GAAG,UAAU;AACpD,YAAQ,IAAI,OAAO,MAAM,sBAAsB,GAAG,OAAO,OAAO,GAAG,OAAO,CAAC;;GAElF;;;uBAGyB;EAC1B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACJ"}
1
+ {"version":3,"file":"CLI.mjs","names":[],"sources":["../../../src/classes/cli/CLI.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { fileURLToPath } from 'node:url';\nimport path from 'node:path';\nimport { Format, isDebugging, recursiveDefaults } from '@reciple/utils';\nimport { logger, Logger, LogLevel } from '@prtty/print';\nimport { config as loadEnv } from '@dotenvx/dotenvx';\nimport { readdir, stat } from 'node:fs/promises';\nimport { CLISubcommand } from './CLISubcommand.js';\nimport { spinner, type SpinnerOptions } from '@clack/prompts';\nimport type { RolldownPlugin } from 'rolldown';\nimport { colors } from '@prtty/prtty';\n\nexport class CLI {\n public build: string;\n public version: string;\n public command: Command;\n public logger: Logger;\n\n get isDebugging(): boolean {\n return this.flags.debug;\n }\n\n get flags(): CLI.Flags {\n return this.command.opts();\n }\n\n constructor(public readonly options: CLI.Options) {\n this.build = options.build;\n this.version = String(this.build.split('-')[0]);\n\n this.command = new Command()\n .name(options.name)\n .description(options.description)\n .version(options.build, '-v, --version', 'Output the CLI version number')\n .option('-D, --debug', 'Enable debug mode', isDebugging())\n .option('--no-debug', 'Disabled debug mode')\n .option('--env <file>', 'Load environment variables from .env file', (v, p) => p.concat(v), [] as string[])\n .enablePositionalOptions(true)\n .hook('preAction', this.handlePreAction.bind(this))\n .showHelpAfterError();\n\n this.logger = options.logger instanceof Logger ? options.logger : new Logger(options.logger);\n\n if (this.flags.debug) {\n this.logger.logLevel = LogLevel.Debug;\n this.logger.writeLevel = LogLevel.Debug;\n }\n }\n\n public async parse(argv?: string[]): Promise<this> {\n await this.loadCommands();\n await this.command.parseAsync(argv);\n return this;\n }\n\n public async loadCommands(): Promise<void> {\n this.logger.debug(`Loading cli commands from ${this.options.subcommandsDir}`);\n\n const dirStat = await stat(this.options.subcommandsDir).catch(() => undefined);\n if (!dirStat?.isDirectory()) return;\n\n const files = (await readdir(this.options.subcommandsDir))\n .map(f => path.join(this.options.subcommandsDir, f))\n .filter(f => f.endsWith('.mjs'));\n\n const hasParent: CLISubcommand[] = [];\n\n for (const file of files) {\n const Subommand = recursiveDefaults<CLISubcommand.Constructor>(await import(path.isAbsolute(file) ? `file://${file}` : file));\n if (!Subommand || typeof Subommand !== 'function') continue;\n\n const instance = new Subommand({ cli: this, command: this.command });\n\n if (instance.parent) {\n hasParent.push(instance);\n continue;\n }\n\n CLISubcommand.registerSubcommand(instance);\n }\n\n for (const instance of hasParent) {\n CLISubcommand.registerSubcommand(instance);\n }\n }\n\n public async handlePreAction(cmd: Command, action: Command): Promise<void> {\n this.logger.debug(`Executing ${action.name()}`);\n this.logger.debug(`Debug mode is ${this.flags.debug ? 'enabled' : 'disabled'}`);\n process.env.NODE_ENV = this.flags.debug ? 'development' : process.env.NODE_ENV;\n\n loadEnv({\n path: this.flags.env.length ? this.flags.env : [path.join(process.cwd(), '.env')],\n debug: this.flags.debug,\n quiet: !this.flags.debug,\n ignore: ['MISSING_ENV_FILE']\n });\n\n this.logger.debug(`Loaded environment variables from ${this.flags.env.join(', ')}`);\n }\n\n public async setCurrentDirectory(cwd?: string): Promise<void> {\n cwd ??= process.cwd();\n\n if (!(await stat(cwd).then(s => s.isDirectory()).catch(() => false))) {\n console.log(colors.red('Please specify a valid project directory'));\n process.exit(1);\n }\n\n process.chdir(cwd);\n }\n\n public getFlags<Flags extends Record<string, any> = Record<string, any>>(command: Command|string, mergeDefault?: false): Flags|undefined;\n public getFlags<Flags extends Record<string, any> = Record<string, any>>(command: Command|string, mergeDefault: true): Flags & CLI.Flags|undefined;\n public getFlags(command?: undefined): CLI.Flags;\n public getFlags(command?: Command|string, mergeDefault: boolean = false): Record<string, any>|undefined {\n if (!command) return this.flags;\n\n command = typeof command === 'string' ? this.command.commands.find(c => c.name() === command) : command;\n const flags = command?.opts();\n\n return mergeDefault ? { ...this.flags, ...flags } : flags;\n }\n\n public getCommand(name: string): Command|undefined;\n public getCommand(name?: undefined): Command;\n public getCommand(name?: string): Command|undefined {\n if (!name) return this.command;\n\n return this.command.commands.find(c => c.name() === name);\n }\n}\n\nexport namespace CLI {\n export interface Options {\n name: string;\n description: string;\n build: string;\n subcommandsDir: string;\n logger?: Logger|Logger.Options;\n }\n\n export interface Flags {\n debug: boolean;\n env: string[];\n }\n\n export const root: string = path.join(path.dirname(fileURLToPath(import.meta.url)), '../../../');\n export const bin: string = path.join(CLI.root, 'dist/bin/reciple.mjs');\n export const version = process.env.__VERSION__;\n\n export function stringifyFlags(flags: Record<string, any>, command: Command, ignored: string[] = []): string[] {\n let arr: string[] = [];\n\n for (const [key, value] of Object.entries(flags)) {\n const option = command.options.find(o => o.name() === key || o.attributeName() === key);\n if (!option || ignored.includes(key)) continue;\n\n const flag = option.long ?? option.short ?? `--${option.name()}`;\n\n if (!option.flags.endsWith('>') && !option.flags.endsWith(']') && typeof value === 'boolean') {\n if (value) arr.push(flag);\n continue;\n }\n\n arr.push(flag, String(value));\n }\n\n return arr;\n }\n\n export interface SpinnerPromiseOptions<T> {\n indicator?: SpinnerOptions['indicator'];\n promise: Promise<T>;\n message?: string;\n successMessage?: string;\n errorMessage?: string;\n }\n\n export function createSpinnerPromise<T>(options: SpinnerPromiseOptions<T>): [Promise<T>, ReturnType<typeof spinner>] {\n const loader = spinner({ indicator: options.indicator });\n\n return [\n new Promise<T>((resolve, reject) => {\n loader.start(options.message);\n\n options.promise\n .then((value) => {\n loader.stop(options.successMessage);\n resolve(value);\n })\n .catch((error) => {\n loader.stop(options.errorMessage);\n reject(error);\n });\n }),\n loader\n ];\n }\n\n export function createTsdownLogger(_logger: Logger = logger): RolldownPlugin {\n let startedAt: number;\n\n return {\n name: 'reciple:log-build-completion',\n buildStart: () => {\n _logger.log(colors.green('🚀 Building reciple modules...'));\n startedAt = Date.now();\n },\n renderChunk: (code, info) => {\n const size = Format.bytes(Buffer.byteLength(code, 'utf8'));\n _logger.log(` ├─ ${colors.cyan(size)}\\t${colors.bold(info.fileName)}`);\n\n return { code };\n },\n buildEnd: error => {\n if (error) _logger.error(error)\n },\n closeBundle: () => {\n const time = Format.duration(Date.now() - startedAt);\n _logger.log(colors.green(`✅ Build success in `) + colors.yellow(`${time}`));\n }\n };\n }\n\n export const ignoredDefault = [\n '.git',\n '.log',\n '.nyc_output',\n '.sass-cache',\n '.yarn',\n 'bower_components',\n 'coverage',\n 'node_modules'\n ]\n}\n"],"mappings":";;;;;;;;;;;;AAYA,IAAa,MAAb,MAAiB;CACb,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CAEP,IAAI,cAAuB;AACvB,SAAO,KAAK,MAAM;;CAGtB,IAAI,QAAmB;AACnB,SAAO,KAAK,QAAQ,MAAM;;CAG9B,YAAY,AAAgB,SAAsB;EAAtB;AACxB,OAAK,QAAQ,QAAQ;AACrB,OAAK,UAAU,OAAO,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG;AAE/C,OAAK,UAAU,IA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O,WAAW,MAAM,OAAO,CAAC;AAC1D,YAAQ,IAAI,OAAO,OAAO,KAAK,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,SAAS,GAAG;AAEtE,WAAO,EAAE,MAAM;;GAEnB,WAAU,UAAS;AACf,QAAI,MAAO,SAAQ,MAAM,MAAK;;GAElC,mBAAmB;IACf,MAAM,OAAO,OAAO,SAAS,KAAK,KAAK,GAAG,UAAU;AACpD,YAAQ,IAAI,OAAO,MAAM,sBAAsB,GAAG,OAAO,OAAO,GAAG,OAAO,CAAC;;GAElF;;;uBAGyB;EAC1B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACJ"}
@@ -1,31 +1,31 @@
1
1
  import { ModuleType } from "../../helpers/constants.mjs";
2
2
  import { AnyModuleData } from "../../helpers/types.mjs";
3
3
  import { Validator } from "@reciple/core";
4
- import * as _sapphire_shapeshift23 from "@sapphire/shapeshift";
4
+ import * as _sapphire_shapeshift14 from "@sapphire/shapeshift";
5
5
 
6
6
  //#region src/classes/validation/BaseModuleValidator.d.ts
7
7
  declare class BaseModuleValidator extends Validator {
8
- static id: _sapphire_shapeshift23.StringValidator<string>;
9
- static moduleType: _sapphire_shapeshift23.NativeEnumValidator<typeof ModuleType>;
10
- static onEnable: _sapphire_shapeshift23.UnionValidator<Function | undefined>;
11
- static onReady: _sapphire_shapeshift23.UnionValidator<Function | undefined>;
12
- static onDisable: _sapphire_shapeshift23.UnionValidator<Function | undefined>;
13
- static object: _sapphire_shapeshift23.ObjectValidator<{
8
+ static id: _sapphire_shapeshift14.StringValidator<string>;
9
+ static moduleType: _sapphire_shapeshift14.NativeEnumValidator<typeof ModuleType>;
10
+ static onEnable: _sapphire_shapeshift14.UnionValidator<Function | undefined>;
11
+ static onReady: _sapphire_shapeshift14.UnionValidator<Function | undefined>;
12
+ static onDisable: _sapphire_shapeshift14.UnionValidator<Function | undefined>;
13
+ static object: _sapphire_shapeshift14.ObjectValidator<{
14
14
  id: string | undefined;
15
15
  moduleType: ModuleType | undefined;
16
16
  onEnable: Function | undefined;
17
17
  onReady: Function | undefined;
18
18
  onDisable: Function | undefined;
19
- }, _sapphire_shapeshift23.UndefinedToOptional<{
19
+ }, _sapphire_shapeshift14.UndefinedToOptional<{
20
20
  id: string | undefined;
21
21
  moduleType: ModuleType | undefined;
22
22
  onEnable: Function | undefined;
23
23
  onReady: Function | undefined;
24
24
  onDisable: Function | undefined;
25
25
  }>>;
26
- static resolvable: _sapphire_shapeshift23.UnionValidator<_sapphire_shapeshift23.UndefinedToOptional<{
26
+ static resolvable: _sapphire_shapeshift14.UnionValidator<_sapphire_shapeshift14.UndefinedToOptional<{
27
27
  toJSON: Function;
28
- }> | _sapphire_shapeshift23.UndefinedToOptional<{
28
+ }> | _sapphire_shapeshift14.UndefinedToOptional<{
29
29
  id: string | undefined;
30
30
  moduleType: ModuleType | undefined;
31
31
  onEnable: Function | undefined;
@@ -3,19 +3,19 @@ import { EventModule } from "../modules/events/EventModule.mjs";
3
3
  import "../../index.mjs";
4
4
  import { Validator } from "@reciple/core";
5
5
  import { EventEmitter } from "node:events";
6
- import * as _sapphire_shapeshift14 from "@sapphire/shapeshift";
6
+ import * as _sapphire_shapeshift24 from "@sapphire/shapeshift";
7
7
 
8
8
  //#region src/classes/validation/EventModuleValidator.d.ts
9
9
  declare class EventModuleValidator extends Validator {
10
- static emitter: _sapphire_shapeshift14.InstanceValidator<EventEmitter<{
10
+ static emitter: _sapphire_shapeshift24.InstanceValidator<EventEmitter<{
11
11
  [x: string]: any[];
12
12
  [x: number]: any[];
13
13
  [x: symbol]: any[];
14
14
  }>>;
15
- static event: _sapphire_shapeshift14.StringValidator<string>;
16
- static once: _sapphire_shapeshift14.UnionValidator<boolean | undefined>;
17
- static onEvent: _sapphire_shapeshift14.InstanceValidator<Function>;
18
- static object: _sapphire_shapeshift14.ObjectValidator<{
15
+ static event: _sapphire_shapeshift24.StringValidator<string>;
16
+ static once: _sapphire_shapeshift24.UnionValidator<boolean | undefined>;
17
+ static onEvent: _sapphire_shapeshift24.InstanceValidator<Function>;
18
+ static object: _sapphire_shapeshift24.ObjectValidator<{
19
19
  id: string | undefined;
20
20
  moduleType: ModuleType | undefined;
21
21
  onEnable: Function | undefined;
@@ -30,7 +30,7 @@ declare class EventModuleValidator extends Validator {
30
30
  event: string;
31
31
  once: boolean | undefined;
32
32
  onEvent: Function;
33
- }, _sapphire_shapeshift14.UndefinedToOptional<{
33
+ }, _sapphire_shapeshift24.UndefinedToOptional<{
34
34
  id: string | undefined;
35
35
  moduleType: ModuleType | undefined;
36
36
  onEnable: Function | undefined;
@@ -46,9 +46,9 @@ declare class EventModuleValidator extends Validator {
46
46
  once: boolean | undefined;
47
47
  onEvent: Function;
48
48
  }>>;
49
- static resolvable: _sapphire_shapeshift14.UnionValidator<_sapphire_shapeshift14.UndefinedToOptional<{
49
+ static resolvable: _sapphire_shapeshift24.UnionValidator<_sapphire_shapeshift24.UndefinedToOptional<{
50
50
  toJSON: Function;
51
- }> | _sapphire_shapeshift14.UndefinedToOptional<{
51
+ }> | _sapphire_shapeshift24.UndefinedToOptional<{
52
52
  id: string | undefined;
53
53
  moduleType: ModuleType | undefined;
54
54
  onEnable: Function | undefined;
@@ -1,24 +1,24 @@
1
1
  import { PostconditionModule } from "../modules/PostconditionModule.mjs";
2
2
  import { CommandPostconditionReason, CommandType, Validator } from "@reciple/core";
3
- import * as _sapphire_shapeshift0 from "@sapphire/shapeshift";
3
+ import * as _sapphire_shapeshift6 from "@sapphire/shapeshift";
4
4
 
5
5
  //#region src/classes/validation/PostconditionModule.d.ts
6
6
  declare class PostconditionModuleValidator extends Validator {
7
- static scope: _sapphire_shapeshift0.UnionValidator<CommandType[] | undefined>;
8
- static accepts: _sapphire_shapeshift0.UnionValidator<CommandPostconditionReason[] | undefined>;
9
- static execute: _sapphire_shapeshift0.InstanceValidator<Function>;
10
- static object: _sapphire_shapeshift0.ObjectValidator<{
7
+ static scope: _sapphire_shapeshift6.UnionValidator<CommandType[] | undefined>;
8
+ static accepts: _sapphire_shapeshift6.UnionValidator<CommandPostconditionReason[] | undefined>;
9
+ static execute: _sapphire_shapeshift6.InstanceValidator<Function>;
10
+ static object: _sapphire_shapeshift6.ObjectValidator<{
11
11
  scope: CommandType[] | undefined;
12
12
  execute: Function;
13
- }, _sapphire_shapeshift0.UndefinedToOptional<{
13
+ }, _sapphire_shapeshift6.UndefinedToOptional<{
14
14
  scope: CommandType[] | undefined;
15
15
  execute: Function;
16
16
  }>>;
17
- static resolvable: _sapphire_shapeshift0.UnionValidator<_sapphire_shapeshift0.UndefinedToOptional<{
17
+ static resolvable: _sapphire_shapeshift6.UnionValidator<_sapphire_shapeshift6.UndefinedToOptional<{
18
+ toJSON: Function;
19
+ }> | _sapphire_shapeshift6.UndefinedToOptional<{
18
20
  scope: CommandType[] | undefined;
19
21
  execute: Function;
20
- }> | _sapphire_shapeshift0.UndefinedToOptional<{
21
- toJSON: Function;
22
22
  }>>;
23
23
  static isValidScope(scope: unknown): asserts scope is CommandType[];
24
24
  static isValidAccepts(accepts: unknown): asserts accepts is CommandPostconditionReason[];
@@ -1,23 +1,23 @@
1
1
  import { PreconditionModule } from "../modules/PreconditionModule.mjs";
2
2
  import { CommandType, Validator } from "@reciple/core";
3
- import * as _sapphire_shapeshift7 from "@sapphire/shapeshift";
3
+ import * as _sapphire_shapeshift0 from "@sapphire/shapeshift";
4
4
 
5
5
  //#region src/classes/validation/PreconditionModule.d.ts
6
6
  declare class PreconditionModuleValidator extends Validator {
7
- static scope: _sapphire_shapeshift7.UnionValidator<CommandType[] | undefined>;
8
- static execute: _sapphire_shapeshift7.InstanceValidator<Function>;
9
- static object: _sapphire_shapeshift7.ObjectValidator<{
7
+ static scope: _sapphire_shapeshift0.UnionValidator<CommandType[] | undefined>;
8
+ static execute: _sapphire_shapeshift0.InstanceValidator<Function>;
9
+ static object: _sapphire_shapeshift0.ObjectValidator<{
10
10
  scope: CommandType[] | undefined;
11
11
  execute: Function;
12
- }, _sapphire_shapeshift7.UndefinedToOptional<{
12
+ }, _sapphire_shapeshift0.UndefinedToOptional<{
13
13
  scope: CommandType[] | undefined;
14
14
  execute: Function;
15
15
  }>>;
16
- static resolvable: _sapphire_shapeshift7.UnionValidator<_sapphire_shapeshift7.UndefinedToOptional<{
17
- toJSON: Function;
18
- }> | _sapphire_shapeshift7.UndefinedToOptional<{
16
+ static resolvable: _sapphire_shapeshift0.UnionValidator<_sapphire_shapeshift0.UndefinedToOptional<{
19
17
  scope: CommandType[] | undefined;
20
18
  execute: Function;
19
+ }> | _sapphire_shapeshift0.UndefinedToOptional<{
20
+ toJSON: Function;
21
21
  }>>;
22
22
  static isValidScope(scope: unknown): asserts scope is CommandType[];
23
23
  static isValidExecute(execute: unknown): asserts execute is (...args: unknown[]) => Promise<void>;
package/dist/package.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  //#region package.json
2
2
  var package_default = {
3
3
  name: "reciple",
4
- version: "10.0.10",
4
+ version: "10.0.11",
5
5
  license: "LGPL-3.0-only",
6
6
  description: "The CLI for reciple",
7
7
  module: "./dist/index.mjs",
@@ -50,7 +50,6 @@ var package_default = {
50
50
  "micromatch": "^4.0.8",
51
51
  "nypm": "^0.6.4",
52
52
  "pkg-types": "^2.3.0",
53
- "semver": "^7.7.3",
54
53
  "ts-mixer": "^6.0.4",
55
54
  "tsdown": "^0.20.1"
56
55
  },
@@ -58,7 +57,6 @@ var package_default = {
58
57
  "@reciple/jsx": "^10.0.1",
59
58
  "@types/micromatch": "^4.0.10",
60
59
  "@types/node": "catalog:",
61
- "@types/semver": "^7.7.1",
62
60
  "nodemon": "^3.1.11",
63
61
  "rolldown": "^1.0.0-rc.1",
64
62
  "typescript": "catalog:"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reciple",
3
- "version": "10.0.10",
3
+ "version": "10.0.11",
4
4
  "license": "LGPL-3.0-only",
5
5
  "description": "The CLI for reciple",
6
6
  "module": "./dist/index.mjs",
@@ -49,7 +49,6 @@
49
49
  "micromatch": "^4.0.8",
50
50
  "nypm": "^0.6.4",
51
51
  "pkg-types": "^2.3.0",
52
- "semver": "^7.7.3",
53
52
  "ts-mixer": "^6.0.4",
54
53
  "tsdown": "^0.20.1"
55
54
  },
@@ -57,7 +56,6 @@
57
56
  "@reciple/jsx": "^10.0.1",
58
57
  "@types/micromatch": "^4.0.10",
59
58
  "@types/node": "^25.0.9",
60
- "@types/semver": "^7.7.1",
61
59
  "nodemon": "^3.1.11",
62
60
  "rolldown": "^1.0.0-rc.1",
63
61
  "typescript": "^5.9.3"