commandkit 0.1.11-dev.20250213182706 → 0.1.11-dev.20250214180324

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.d.mts CHANGED
@@ -1293,7 +1293,7 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
1293
1293
  isMiddleware(): this is MiddlewareContext<ExecutionMode>;
1294
1294
  args(): string[];
1295
1295
  }
1296
- declare class MiddlewareContext<T extends CommandExecutionMode> extends Context<T> {
1296
+ declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutionMode> extends Context<T> {
1297
1297
  #private;
1298
1298
  /**
1299
1299
  * Whether the command execution was cancelled.
@@ -1592,6 +1592,49 @@ declare function exitMiddleware(): never;
1592
1592
  */
1593
1593
  declare function rethrow(error: unknown): void;
1594
1594
 
1595
+ interface ILogger {
1596
+ log(...args: any[]): void;
1597
+ error(...args: any[]): void;
1598
+ warn(...args: any[]): void;
1599
+ info(...args: any[]): void;
1600
+ debug(...args: any[]): void;
1601
+ }
1602
+
1603
+ declare class DefaultLogger implements ILogger {
1604
+ stdout: NodeJS.WriteStream & {
1605
+ fd: 1;
1606
+ };
1607
+ stderr: NodeJS.WriteStream & {
1608
+ fd: 2;
1609
+ };
1610
+ private logger;
1611
+ constructor(stdout?: NodeJS.WriteStream & {
1612
+ fd: 1;
1613
+ }, stderr?: NodeJS.WriteStream & {
1614
+ fd: 2;
1615
+ });
1616
+ private _getContext;
1617
+ private _getPrefix;
1618
+ private _log;
1619
+ debug(...args: any[]): void;
1620
+ error(...args: any[]): void;
1621
+ log(...args: any[]): void;
1622
+ info(...args: any[]): void;
1623
+ warn(...args: any[]): void;
1624
+ }
1625
+
1626
+ interface CommandKitLoggerOptions {
1627
+ /**
1628
+ * The logger provider to use.
1629
+ */
1630
+ provider: ILogger;
1631
+ }
1632
+ interface LoggerImpl extends ILogger {
1633
+ configure(options: CommandKitLoggerOptions): void;
1634
+ }
1635
+ declare function createLogger(options: CommandKitLoggerOptions): LoggerImpl;
1636
+ declare const Logger: LoggerImpl;
1637
+
1595
1638
  /**
1596
1639
  * Creates a command line interface for CommandKit.
1597
1640
  * @param argv The arguments passed to the CLI.
@@ -1604,4 +1647,4 @@ declare function bootstrapCommandkitCLI(argv: string[], options?: commander.Pars
1604
1647
  */
1605
1648
  declare const version: string;
1606
1649
 
1607
- export { ActionRow, type ActionRowProps, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheEntry, type CacheParams, CacheProvider, type CacheTag, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, type CommandFileObject, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfig, type CommandKitConfiguration, type CommandKitData, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandObject, type CommandOptions, type CommandProps, Context, type ContextMenuCommandProps, type ContextParameters, DefaultLocalizationStrategy, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, Fragment, type FragmentElementProps, type GenericFunction, type InteractionCommandContext, type InteractionCommandMiddlewareContext, Localization, type LocalizationConfig, type LocalizationStrategy, type LocalizationTranslationRequest, type MaybeArray, MemoryCache, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type MessageContextMenuCommandProps, MiddlewareContext, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnModalKitEnd, type OnModalKitSubmit, ParagraphInput, type ParsedMessageCommand, type PreparedAppCommandExecution, type ReloadOptions, ReloadType, ShortInput, type SlashCommandContext, type SlashCommandMiddlewareContext, type SlashCommandProps, TextInput, type TextInputProps, type TranslatableArguments, type TranslatableCommand, type TranslatableCommandOptions, type Translation, type TranslationResult, type Translator, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, type UserContextMenuCommandProps, type ValidationProps, afterCommand, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfterCommand, createElement, CommandKit as default, defineConfig, dmOnly, exitContext, exitMiddleware, getCommandKit, getConfig, getContext, getElement, guildOnly, invalidate, isCommandKitElement, makeContextAwareFunction, rethrow, revalidate, useCache as super_duper_secret_internal_for_use_cache_directive_of_commandkit_cli_do_not_use_it_directly_or_you_will_be_fired_from_your_job_kthxbai, useEnvironment, version };
1650
+ export { ActionRow, type ActionRowProps, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheEntry, type CacheParams, CacheProvider, type CacheTag, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, type CommandFileObject, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfig, type CommandKitConfiguration, type CommandKitData, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandObject, type CommandOptions, type CommandProps, Context, type ContextMenuCommandProps, type ContextParameters, DefaultLocalizationStrategy, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, Fragment, type FragmentElementProps, type GenericFunction, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, Localization, type LocalizationConfig, type LocalizationStrategy, type LocalizationTranslationRequest, Logger, type LoggerImpl, type MaybeArray, MemoryCache, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type MessageContextMenuCommandProps, MiddlewareContext, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnModalKitEnd, type OnModalKitSubmit, ParagraphInput, type ParsedMessageCommand, type PreparedAppCommandExecution, type ReloadOptions, ReloadType, ShortInput, type SlashCommandContext, type SlashCommandMiddlewareContext, type SlashCommandProps, TextInput, type TextInputProps, type TranslatableArguments, type TranslatableCommand, type TranslatableCommandOptions, type Translation, type TranslationResult, type Translator, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, type UserContextMenuCommandProps, type ValidationProps, afterCommand, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfterCommand, createElement, createLogger, CommandKit as default, defineConfig, dmOnly, exitContext, exitMiddleware, getCommandKit, getConfig, getContext, getElement, guildOnly, invalidate, isCommandKitElement, makeContextAwareFunction, rethrow, revalidate, useCache as super_duper_secret_internal_for_use_cache_directive_of_commandkit_cli_do_not_use_it_directly_or_you_will_be_fired_from_your_job_kthxbai, useEnvironment, version };
package/dist/index.d.ts CHANGED
@@ -1293,7 +1293,7 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
1293
1293
  isMiddleware(): this is MiddlewareContext<ExecutionMode>;
1294
1294
  args(): string[];
1295
1295
  }
1296
- declare class MiddlewareContext<T extends CommandExecutionMode> extends Context<T> {
1296
+ declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutionMode> extends Context<T> {
1297
1297
  #private;
1298
1298
  /**
1299
1299
  * Whether the command execution was cancelled.
@@ -1592,6 +1592,49 @@ declare function exitMiddleware(): never;
1592
1592
  */
1593
1593
  declare function rethrow(error: unknown): void;
1594
1594
 
1595
+ interface ILogger {
1596
+ log(...args: any[]): void;
1597
+ error(...args: any[]): void;
1598
+ warn(...args: any[]): void;
1599
+ info(...args: any[]): void;
1600
+ debug(...args: any[]): void;
1601
+ }
1602
+
1603
+ declare class DefaultLogger implements ILogger {
1604
+ stdout: NodeJS.WriteStream & {
1605
+ fd: 1;
1606
+ };
1607
+ stderr: NodeJS.WriteStream & {
1608
+ fd: 2;
1609
+ };
1610
+ private logger;
1611
+ constructor(stdout?: NodeJS.WriteStream & {
1612
+ fd: 1;
1613
+ }, stderr?: NodeJS.WriteStream & {
1614
+ fd: 2;
1615
+ });
1616
+ private _getContext;
1617
+ private _getPrefix;
1618
+ private _log;
1619
+ debug(...args: any[]): void;
1620
+ error(...args: any[]): void;
1621
+ log(...args: any[]): void;
1622
+ info(...args: any[]): void;
1623
+ warn(...args: any[]): void;
1624
+ }
1625
+
1626
+ interface CommandKitLoggerOptions {
1627
+ /**
1628
+ * The logger provider to use.
1629
+ */
1630
+ provider: ILogger;
1631
+ }
1632
+ interface LoggerImpl extends ILogger {
1633
+ configure(options: CommandKitLoggerOptions): void;
1634
+ }
1635
+ declare function createLogger(options: CommandKitLoggerOptions): LoggerImpl;
1636
+ declare const Logger: LoggerImpl;
1637
+
1595
1638
  /**
1596
1639
  * Creates a command line interface for CommandKit.
1597
1640
  * @param argv The arguments passed to the CLI.
@@ -1604,4 +1647,4 @@ declare function bootstrapCommandkitCLI(argv: string[], options?: commander.Pars
1604
1647
  */
1605
1648
  declare const version: string;
1606
1649
 
1607
- export { ActionRow, type ActionRowProps, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheEntry, type CacheParams, CacheProvider, type CacheTag, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, type CommandFileObject, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfig, type CommandKitConfiguration, type CommandKitData, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandObject, type CommandOptions, type CommandProps, Context, type ContextMenuCommandProps, type ContextParameters, DefaultLocalizationStrategy, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, Fragment, type FragmentElementProps, type GenericFunction, type InteractionCommandContext, type InteractionCommandMiddlewareContext, Localization, type LocalizationConfig, type LocalizationStrategy, type LocalizationTranslationRequest, type MaybeArray, MemoryCache, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type MessageContextMenuCommandProps, MiddlewareContext, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnModalKitEnd, type OnModalKitSubmit, ParagraphInput, type ParsedMessageCommand, type PreparedAppCommandExecution, type ReloadOptions, ReloadType, ShortInput, type SlashCommandContext, type SlashCommandMiddlewareContext, type SlashCommandProps, TextInput, type TextInputProps, type TranslatableArguments, type TranslatableCommand, type TranslatableCommandOptions, type Translation, type TranslationResult, type Translator, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, type UserContextMenuCommandProps, type ValidationProps, afterCommand, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfterCommand, createElement, CommandKit as default, defineConfig, dmOnly, exitContext, exitMiddleware, getCommandKit, getConfig, getContext, getElement, guildOnly, invalidate, isCommandKitElement, makeContextAwareFunction, rethrow, revalidate, useCache as super_duper_secret_internal_for_use_cache_directive_of_commandkit_cli_do_not_use_it_directly_or_you_will_be_fired_from_your_job_kthxbai, useEnvironment, version };
1650
+ export { ActionRow, type ActionRowProps, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheEntry, type CacheParams, CacheProvider, type CacheTag, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, type CommandFileObject, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfig, type CommandKitConfiguration, type CommandKitData, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandObject, type CommandOptions, type CommandProps, Context, type ContextMenuCommandProps, type ContextParameters, DefaultLocalizationStrategy, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, Fragment, type FragmentElementProps, type GenericFunction, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, Localization, type LocalizationConfig, type LocalizationStrategy, type LocalizationTranslationRequest, Logger, type LoggerImpl, type MaybeArray, MemoryCache, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type MessageContextMenuCommandProps, MiddlewareContext, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnModalKitEnd, type OnModalKitSubmit, ParagraphInput, type ParsedMessageCommand, type PreparedAppCommandExecution, type ReloadOptions, ReloadType, ShortInput, type SlashCommandContext, type SlashCommandMiddlewareContext, type SlashCommandProps, TextInput, type TextInputProps, type TranslatableArguments, type TranslatableCommand, type TranslatableCommandOptions, type Translation, type TranslationResult, type Translator, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, type UserContextMenuCommandProps, type ValidationProps, afterCommand, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfterCommand, createElement, createLogger, CommandKit as default, defineConfig, dmOnly, exitContext, exitMiddleware, getCommandKit, getConfig, getContext, getElement, guildOnly, invalidate, isCommandKitElement, makeContextAwareFunction, rethrow, revalidate, useCache as super_duper_secret_internal_for_use_cache_directive_of_commandkit_cli_do_not_use_it_directly_or_you_will_be_fired_from_your_job_kthxbai, useEnvironment, version };