commandkit 0.1.11-dev.20250215122009 → 0.1.11-dev.20250216074741

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
@@ -1202,6 +1202,12 @@ type MessageContextMenuCommandMiddlewareContext = MiddlewareContext<'messageCont
1202
1202
  type UserContextMenuCommandContext = Context<'userContextMenu'>;
1203
1203
  type UserContextMenuCommandMiddlewareContext = MiddlewareContext<'userContextMenu'>;
1204
1204
  type CommandContextOptions<T extends CommandExecutionMode> = T extends 'message' ? MessageCommandOptions : T extends 'chatInput' ? ChatInputCommandInteraction['options'] : T extends 'autocomplete' ? AutocompleteInteraction['options'] : T extends 'messageContextMenu' ? MessageContextMenuCommandInteraction['options'] : T extends 'userContextMenu' ? UserContextMenuCommandInteraction['options'] : never;
1205
+ type AnyCommandExecute<ContextType extends Context = Context> = (ctx: ContextType) => Awaitable<unknown>;
1206
+ type SlashCommand = AnyCommandExecute<SlashCommandContext>;
1207
+ type AutocompleteCommand = AnyCommandExecute<AutocompleteCommandContext>;
1208
+ type MessageContextMenuCommand = AnyCommandExecute<MessageContextMenuCommandContext>;
1209
+ type UserContextMenuCommand = AnyCommandExecute<UserContextMenuCommandContext>;
1210
+ type MessageCommand = AnyCommandExecute<MessageCommandContext>;
1205
1211
  declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecutionMode> {
1206
1212
  #private;
1207
1213
  readonly commandkit: CommandKit;
@@ -1498,21 +1504,13 @@ declare class CommandKit extends EventEmitter {
1498
1504
 
1499
1505
  interface CommandKitConfig {
1500
1506
  /**
1501
- * The source directory of the project.
1502
- */
1503
- src: string;
1504
- /**
1505
- * The main "javascript" file of the project.
1507
+ * The output directory of the project. Defaults to `dist`.
1506
1508
  */
1507
- main: string;
1509
+ outDir: string;
1508
1510
  /**
1509
1511
  * Whether or not to use the watch mode. Defaults to `true`.
1510
1512
  */
1511
1513
  watch: boolean;
1512
- /**
1513
- * The output directory of the project. Defaults to `dist`.
1514
- */
1515
- outDir: string;
1516
1514
  /**
1517
1515
  * Whether or not to include extra env utilities. Defaults to `true`.
1518
1516
  */
@@ -1543,10 +1541,17 @@ interface CommandKitConfig {
1543
1541
  requirePolyfill: boolean;
1544
1542
  }
1545
1543
  declare function getConfig(): CommandKitConfig;
1546
- declare const requiredProps: readonly ["src", "main"];
1547
- type R = (typeof requiredProps)[number];
1548
- type PartialConfig<T extends CommandKitConfig> = Partial<Omit<T, R>> & Pick<T, R>;
1549
- declare function defineConfig(config: PartialConfig<CommandKitConfig>): Partial<CommandKitConfig>;
1544
+ declare function defineConfig(config: Partial<CommandKitConfig>): {
1545
+ outDir: string;
1546
+ watch: boolean;
1547
+ envExtra: boolean;
1548
+ nodeOptions: string[];
1549
+ clearRestartLogs: boolean;
1550
+ minify: boolean;
1551
+ sourcemap: boolean | "inline";
1552
+ antiCrash: boolean;
1553
+ requirePolyfill: boolean;
1554
+ };
1550
1555
 
1551
1556
  declare class MemoryCache extends CacheProvider {
1552
1557
  #private;
@@ -1588,6 +1593,15 @@ interface CacheMetadata {
1588
1593
  * Internal cache implementation
1589
1594
  * @internal
1590
1595
  * @private
1596
+ * This is used directly by the compiler if the function is annotated with `"use cache"` directive.
1597
+ * @example
1598
+ * ```ts
1599
+ * async function myCachedFunction() {
1600
+ * "use cache";
1601
+ * // can use cacheTag() and cacheLife() here to customize cache behavior
1602
+ * return await db.query('SELECT * FROM users');
1603
+ * }
1604
+ * ```
1591
1605
  */
1592
1606
  declare function useCache<R extends any[], F extends AsyncFunction<R>>(fn: F, id?: string, params?: CacheMetadata): F;
1593
1607
  /**
@@ -1752,4 +1766,4 @@ declare function bootstrapCommandkitCLI(argv: string[], options?: commander.Pars
1752
1766
  */
1753
1767
  declare const version: string;
1754
1768
 
1755
- export { ActionRow, type ActionRowProps, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, 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 CommandMatchResult, type CommandObject, type CommandOptions, type CommandProps, CommandsRouter, type CommandsRouterMatcher, type CommandsRouterMatchersMap, type CommandsRouterOptions, type CommandsTree, Context, type ContextMenuCommandProps, type ContextParameters, DefaultLocalizationStrategy, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, 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 ParsedCommand, type ParsedEvent, type ParsedMessageCommand, type ParsedMiddleware, 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, isCachedFunction, isCommandKitElement, makeContextAwareFunction, redirect, 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 };
1769
+ export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, 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 CommandMatchResult, type CommandObject, type CommandOptions, type CommandProps, CommandsRouter, type CommandsRouterMatcher, type CommandsRouterMatchersMap, type CommandsRouterOptions, type CommandsTree, Context, type ContextMenuCommandProps, type ContextParameters, DefaultLocalizationStrategy, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, 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 MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type MessageContextMenuCommandProps, MiddlewareContext, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnModalKitEnd, type OnModalKitSubmit, ParagraphInput, type ParsedCommand, type ParsedEvent, type ParsedMessageCommand, type ParsedMiddleware, type PreparedAppCommandExecution, type ReloadOptions, ReloadType, ShortInput, type SlashCommand, type SlashCommandContext, type SlashCommandMiddlewareContext, type SlashCommandProps, TextInput, type TextInputProps, type TranslatableArguments, type TranslatableCommand, type TranslatableCommandOptions, type Translation, type TranslationResult, type Translator, type UserContextMenuCommand, 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, isCachedFunction, isCommandKitElement, makeContextAwareFunction, redirect, 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
@@ -1202,6 +1202,12 @@ type MessageContextMenuCommandMiddlewareContext = MiddlewareContext<'messageCont
1202
1202
  type UserContextMenuCommandContext = Context<'userContextMenu'>;
1203
1203
  type UserContextMenuCommandMiddlewareContext = MiddlewareContext<'userContextMenu'>;
1204
1204
  type CommandContextOptions<T extends CommandExecutionMode> = T extends 'message' ? MessageCommandOptions : T extends 'chatInput' ? ChatInputCommandInteraction['options'] : T extends 'autocomplete' ? AutocompleteInteraction['options'] : T extends 'messageContextMenu' ? MessageContextMenuCommandInteraction['options'] : T extends 'userContextMenu' ? UserContextMenuCommandInteraction['options'] : never;
1205
+ type AnyCommandExecute<ContextType extends Context = Context> = (ctx: ContextType) => Awaitable<unknown>;
1206
+ type SlashCommand = AnyCommandExecute<SlashCommandContext>;
1207
+ type AutocompleteCommand = AnyCommandExecute<AutocompleteCommandContext>;
1208
+ type MessageContextMenuCommand = AnyCommandExecute<MessageContextMenuCommandContext>;
1209
+ type UserContextMenuCommand = AnyCommandExecute<UserContextMenuCommandContext>;
1210
+ type MessageCommand = AnyCommandExecute<MessageCommandContext>;
1205
1211
  declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecutionMode> {
1206
1212
  #private;
1207
1213
  readonly commandkit: CommandKit;
@@ -1498,21 +1504,13 @@ declare class CommandKit extends EventEmitter {
1498
1504
 
1499
1505
  interface CommandKitConfig {
1500
1506
  /**
1501
- * The source directory of the project.
1502
- */
1503
- src: string;
1504
- /**
1505
- * The main "javascript" file of the project.
1507
+ * The output directory of the project. Defaults to `dist`.
1506
1508
  */
1507
- main: string;
1509
+ outDir: string;
1508
1510
  /**
1509
1511
  * Whether or not to use the watch mode. Defaults to `true`.
1510
1512
  */
1511
1513
  watch: boolean;
1512
- /**
1513
- * The output directory of the project. Defaults to `dist`.
1514
- */
1515
- outDir: string;
1516
1514
  /**
1517
1515
  * Whether or not to include extra env utilities. Defaults to `true`.
1518
1516
  */
@@ -1543,10 +1541,17 @@ interface CommandKitConfig {
1543
1541
  requirePolyfill: boolean;
1544
1542
  }
1545
1543
  declare function getConfig(): CommandKitConfig;
1546
- declare const requiredProps: readonly ["src", "main"];
1547
- type R = (typeof requiredProps)[number];
1548
- type PartialConfig<T extends CommandKitConfig> = Partial<Omit<T, R>> & Pick<T, R>;
1549
- declare function defineConfig(config: PartialConfig<CommandKitConfig>): Partial<CommandKitConfig>;
1544
+ declare function defineConfig(config: Partial<CommandKitConfig>): {
1545
+ outDir: string;
1546
+ watch: boolean;
1547
+ envExtra: boolean;
1548
+ nodeOptions: string[];
1549
+ clearRestartLogs: boolean;
1550
+ minify: boolean;
1551
+ sourcemap: boolean | "inline";
1552
+ antiCrash: boolean;
1553
+ requirePolyfill: boolean;
1554
+ };
1550
1555
 
1551
1556
  declare class MemoryCache extends CacheProvider {
1552
1557
  #private;
@@ -1588,6 +1593,15 @@ interface CacheMetadata {
1588
1593
  * Internal cache implementation
1589
1594
  * @internal
1590
1595
  * @private
1596
+ * This is used directly by the compiler if the function is annotated with `"use cache"` directive.
1597
+ * @example
1598
+ * ```ts
1599
+ * async function myCachedFunction() {
1600
+ * "use cache";
1601
+ * // can use cacheTag() and cacheLife() here to customize cache behavior
1602
+ * return await db.query('SELECT * FROM users');
1603
+ * }
1604
+ * ```
1591
1605
  */
1592
1606
  declare function useCache<R extends any[], F extends AsyncFunction<R>>(fn: F, id?: string, params?: CacheMetadata): F;
1593
1607
  /**
@@ -1752,4 +1766,4 @@ declare function bootstrapCommandkitCLI(argv: string[], options?: commander.Pars
1752
1766
  */
1753
1767
  declare const version: string;
1754
1768
 
1755
- export { ActionRow, type ActionRowProps, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, 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 CommandMatchResult, type CommandObject, type CommandOptions, type CommandProps, CommandsRouter, type CommandsRouterMatcher, type CommandsRouterMatchersMap, type CommandsRouterOptions, type CommandsTree, Context, type ContextMenuCommandProps, type ContextParameters, DefaultLocalizationStrategy, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, 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 ParsedCommand, type ParsedEvent, type ParsedMessageCommand, type ParsedMiddleware, 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, isCachedFunction, isCommandKitElement, makeContextAwareFunction, redirect, 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 };
1769
+ export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type AutocompleteProps, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, 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 CommandMatchResult, type CommandObject, type CommandOptions, type CommandProps, CommandsRouter, type CommandsRouterMatcher, type CommandsRouterMatchersMap, type CommandsRouterOptions, type CommandsTree, Context, type ContextMenuCommandProps, type ContextParameters, DefaultLocalizationStrategy, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, 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 MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type MessageContextMenuCommandProps, MiddlewareContext, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnModalKitEnd, type OnModalKitSubmit, ParagraphInput, type ParsedCommand, type ParsedEvent, type ParsedMessageCommand, type ParsedMiddleware, type PreparedAppCommandExecution, type ReloadOptions, ReloadType, ShortInput, type SlashCommand, type SlashCommandContext, type SlashCommandMiddlewareContext, type SlashCommandProps, TextInput, type TextInputProps, type TranslatableArguments, type TranslatableCommand, type TranslatableCommandOptions, type Translation, type TranslationResult, type Translator, type UserContextMenuCommand, 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, isCachedFunction, isCommandKitElement, makeContextAwareFunction, redirect, 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 };