commandkit 0.1.11-dev.20250407135241 → 0.1.11-dev.20250411164423

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.ts CHANGED
@@ -1178,11 +1178,10 @@ declare function revalidate<T = unknown>(tag: string, ...args: any[]): Promise<T
1178
1178
  */
1179
1179
  declare function isCachedFunction(fn: GenericFunction): boolean;
1180
1180
  /**
1181
- * **WARNING!!!! DO NOT USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING!**
1182
1181
  * @private
1183
1182
  * @internal
1184
1183
  */
1185
- declare const zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired: any;
1184
+ declare const zxcvbnm____: any;
1186
1185
 
1187
1186
  interface Command {
1188
1187
  id: string;
@@ -1999,4 +1998,4 @@ declare function devOnly<T extends (...args: any[]) => any>(fn: T): T;
1999
1998
  */
2000
1999
  declare function bootstrapCommandkitCLI(argv: string[], options?: commander.ParseOptions | undefined): Promise<void>;
2001
2000
 
2002
- export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type BootstrapFunction, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, COMMANDKIT_BOOTSTRAP_MODE, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, ChannelSelectMenu, ChannelSelectMenuKit, type ChannelSelectMenuKitPredicate, type ChannelSelectMenuProps, type Command, type CommandBuilderLike, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitHMREvent, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandKitPlugin, CommandKitPluginRuntime, type CommandKitSelectMenuBuilderInteractionCollectorDispatch, type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, type CommandKitSelectMenuBuilderOnEnd, CommandRegistrar, type CommandSource, type CommandTypeData, CommandsRouter, type CommandsRouterOptions, type CommonBuilderKit, type CommonPluginRuntime, type CommonSelectMenuProps, CompilerPlugin, CompilerPluginRuntime, Context, type ContextParameters, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, Fragment, type FragmentElementProps, type GenericFunction, HMREventType, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, MemoryCache, MentionableSelectMenu, MentionableSelectMenuKit, type MentionableSelectMenuKitPredicate, type MentionableSelectMenuProps, type Message, type MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type Middleware, MiddlewareContext, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnChannelSelectMenuKitSubmit, type OnLoadArgs, type OnLoadOptions, type OnLoadResult, type OnMentionableSelectMenuKitSubmit, type OnModalKitEnd, type OnModalKitSubmit, type OnResolveArgs, type OnResolveOptions, type OnResolveResult, type OnRoleSelectMenuKitSubmit, type OnSelectMenuKitEnd, type OnSelectMenuKitSubmit, type OnStringSelectMenuKitSubmit, type OnUserSelectMenuKitSubmit, ParagraphInput, type ParsedCommandData, type ParsedEvent, type ParsedMessageCommand, type PluginTransformParameters, type PreRegisterCommandsEvent, type PreparedAppCommandExecution, type ResolvableCommand, type ResolveBuilderInteraction, type ResolveKind, type ResolveResult, RoleSelectMenu, RoleSelectMenuKit, type RoleSelectMenuKitPredicate, type RoleSelectMenuProps, type RunCommand, RuntimePlugin, type SelectMenuKitPredicate, type SelectMenuProps, type Setup, ShortInput, type SlashCommand, type SlashCommandContext, type SlashCommandMiddlewareContext, StringSelectMenu, StringSelectMenuKit, type StringSelectMenuKitPredicate, StringSelectMenuOption, type StringSelectMenuOptionProps, type StringSelectMenuProps, TextInput, type TextInputProps, type TransformedResult, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, UserSelectMenu, UserSelectMenuKit, type UserSelectMenuKitPredicate, type UserSelectMenuProps, afterCommand, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfterCommand, commandkit, createElement, createLogger, debounce, CommandKit as default, defineConfig, devOnly, exitContext, exitMiddleware, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getCurrentDirectory, getElement, getSourceDirectories, invalidate, isCachedFunction, isCommandKitElement, isCompilerPlugin, isInteractionSource, isMessageSource, isRuntimePlugin, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, redirect, rethrow, revalidate, useEnvironment, version, zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired };
2001
+ export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type BootstrapFunction, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, COMMANDKIT_BOOTSTRAP_MODE, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, ChannelSelectMenu, ChannelSelectMenuKit, type ChannelSelectMenuKitPredicate, type ChannelSelectMenuProps, type Command, type CommandBuilderLike, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitHMREvent, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandKitPlugin, CommandKitPluginRuntime, type CommandKitSelectMenuBuilderInteractionCollectorDispatch, type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, type CommandKitSelectMenuBuilderOnEnd, CommandRegistrar, type CommandSource, type CommandTypeData, CommandsRouter, type CommandsRouterOptions, type CommonBuilderKit, type CommonPluginRuntime, type CommonSelectMenuProps, CompilerPlugin, CompilerPluginRuntime, Context, type ContextParameters, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, Fragment, type FragmentElementProps, type GenericFunction, HMREventType, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, MemoryCache, MentionableSelectMenu, MentionableSelectMenuKit, type MentionableSelectMenuKitPredicate, type MentionableSelectMenuProps, type Message, type MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type Middleware, MiddlewareContext, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnChannelSelectMenuKitSubmit, type OnLoadArgs, type OnLoadOptions, type OnLoadResult, type OnMentionableSelectMenuKitSubmit, type OnModalKitEnd, type OnModalKitSubmit, type OnResolveArgs, type OnResolveOptions, type OnResolveResult, type OnRoleSelectMenuKitSubmit, type OnSelectMenuKitEnd, type OnSelectMenuKitSubmit, type OnStringSelectMenuKitSubmit, type OnUserSelectMenuKitSubmit, ParagraphInput, type ParsedCommandData, type ParsedEvent, type ParsedMessageCommand, type PluginTransformParameters, type PreRegisterCommandsEvent, type PreparedAppCommandExecution, type ResolvableCommand, type ResolveBuilderInteraction, type ResolveKind, type ResolveResult, RoleSelectMenu, RoleSelectMenuKit, type RoleSelectMenuKitPredicate, type RoleSelectMenuProps, type RunCommand, RuntimePlugin, type SelectMenuKitPredicate, type SelectMenuProps, type Setup, ShortInput, type SlashCommand, type SlashCommandContext, type SlashCommandMiddlewareContext, StringSelectMenu, StringSelectMenuKit, type StringSelectMenuKitPredicate, StringSelectMenuOption, type StringSelectMenuOptionProps, type StringSelectMenuProps, TextInput, type TextInputProps, type TransformedResult, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, UserSelectMenu, UserSelectMenuKit, type UserSelectMenuKitPredicate, type UserSelectMenuProps, afterCommand, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfterCommand, commandkit, createElement, createLogger, debounce, CommandKit as default, defineConfig, devOnly, exitContext, exitMiddleware, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getCurrentDirectory, getElement, getSourceDirectories, invalidate, isCachedFunction, isCommandKitElement, isCompilerPlugin, isInteractionSource, isMessageSource, isRuntimePlugin, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, redirect, rethrow, revalidate, useEnvironment, version, zxcvbnm____ };
package/dist/index.js CHANGED
@@ -2585,7 +2585,7 @@ var init_UseCacheTransformer = __esm({
2585
2585
  generate = import_generator.default.default || import_generator.default;
2586
2586
  IMPORT_PATH = "commandkit";
2587
2587
  DIRECTIVE = "use cache";
2588
- CACHE_IDENTIFIER = "zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired";
2588
+ CACHE_IDENTIFIER = "zxcvbnm____";
2589
2589
  generateRandomString = /* @__PURE__ */ __name((length = 6) => {
2590
2590
  const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
2591
2591
  return Array.from(
@@ -3740,7 +3740,7 @@ async function revalidate(tag, ...args) {
3740
3740
  function isCachedFunction(fn) {
3741
3741
  return Object.prototype.hasOwnProperty.call(fn, CACHED_FN_SYMBOL);
3742
3742
  }
3743
- var import_node_async_hooks2, import_node_crypto3, import_ms, cacheContext, fnStore, DEFAULT_TTL, CACHE_FN_ID, CACHED_FN_SYMBOL, zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired;
3743
+ var import_node_async_hooks2, import_node_crypto3, import_ms, cacheContext, fnStore, DEFAULT_TTL, CACHE_FN_ID, CACHED_FN_SYMBOL, zxcvbnm____;
3744
3744
  var init_use_cache = __esm({
3745
3745
  "src/cache/use-cache.ts"() {
3746
3746
  "use strict";
@@ -3763,7 +3763,7 @@ var init_use_cache = __esm({
3763
3763
  __name(invalidate, "invalidate");
3764
3764
  __name(revalidate, "revalidate");
3765
3765
  __name(isCachedFunction, "isCachedFunction");
3766
- zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired = useCache;
3766
+ zxcvbnm____ = useCache;
3767
3767
  }
3768
3768
  });
3769
3769
 
@@ -4354,9 +4354,10 @@ var init_AppCommandHandler = __esm({
4354
4354
  externalCommandData = new import_discord16.Collection();
4355
4355
  externalMiddlewareData = new import_discord16.Collection();
4356
4356
  printBanner() {
4357
+ const uncategorized = crypto.randomUUID();
4357
4358
  const categorizedCommands = this.getCommandsArray().reduce(
4358
4359
  (acc, cmd) => {
4359
- const category = cmd.command.category || "uncategorized";
4360
+ const category = cmd.command.category || uncategorized;
4360
4361
  acc[category] = acc[category] || [];
4361
4362
  acc[category].push(cmd);
4362
4363
  return acc;
@@ -4373,12 +4374,12 @@ var init_AppCommandHandler = __esm({
4373
4374
  const commands = categorizedCommands[category];
4374
4375
  const isLastCategory = index === categories.length - 1;
4375
4376
  const categoryPrefix = isLastCategory ? "\u2514\u2500" : "\u251C\u2500";
4376
- if (category !== "uncategorized") {
4377
+ if (category !== uncategorized) {
4377
4378
  console.log(colors_default.cyan(`${categoryPrefix} ${colors_default.bold(category)}`));
4378
4379
  }
4379
4380
  commands.forEach((cmd, cmdIndex) => {
4380
4381
  const isLastCommand = cmdIndex === commands.length - 1;
4381
- const commandPrefix = category !== "uncategorized" ? (isLastCategory ? " " : "\u2502 ") + (isLastCommand ? "\u2514\u2500" : "\u251C\u2500") : isLastCommand ? "\u2514\u2500" : "\u251C\u2500";
4382
+ const commandPrefix = category !== uncategorized ? (isLastCategory ? " " : "\u2502 ") + (isLastCommand ? "\u2514\u2500" : "\u251C\u2500") : isLastCommand ? "\u2514\u2500" : "\u251C\u2500";
4382
4383
  const name = cmd.data.command.name;
4383
4384
  const hasMw = cmd.command.middlewares.length > 0;
4384
4385
  const middlewareIcon = hasMw ? colors_default.magenta(" (\u03BB)") : "";
@@ -5489,9 +5490,8 @@ var init_CommandKit = __esm({
5489
5490
  var _a;
5490
5491
  return (_a = plugin.onBeforeClientLogin) == null ? void 0 : _a.call(plugin, ctx);
5491
5492
  });
5492
- await this.options.client.login(
5493
- token ?? this.options.client.token ?? process.env.TOKEN ?? process.env.DISCORD_TOKEN
5494
- );
5493
+ const botToken = token ?? this.options.client.token ?? process.env.TOKEN ?? process.env.DISCORD_TOKEN;
5494
+ await this.options.client.login(botToken);
5495
5495
  await this.plugins.execute((ctx, plugin) => {
5496
5496
  var _a;
5497
5497
  return (_a = plugin.onAfterClientLogin) == null ? void 0 : _a.call(plugin, ctx);
@@ -5695,16 +5695,26 @@ var init_version = __esm({
5695
5695
  "use strict";
5696
5696
  init_cjs_shims();
5697
5697
  version = /* @__MACRO__ $version */
5698
- "0.1.11-dev.20250407135241";
5698
+ "0.1.11-dev.20250411164423";
5699
5699
  }
5700
5700
  });
5701
5701
 
5702
5702
  // src/cli/env.ts
5703
- function DevEnv() {
5704
- return Object.assign({}, process.env, {
5703
+ function DevEnv(_static = false) {
5704
+ const common = {
5705
5705
  NODE_ENV: "development",
5706
5706
  COMMANDKIT_IS_DEV: "true"
5707
- });
5707
+ };
5708
+ if (_static) return Object.assign({}, common);
5709
+ return Object.assign({}, process.env, common);
5710
+ }
5711
+ function ProdEnv(_static = false) {
5712
+ const common = {
5713
+ NODE_ENV: "production",
5714
+ COMMANDKIT_IS_DEV: "false"
5715
+ };
5716
+ if (_static) return Object.assign({}, common);
5717
+ return Object.assign({}, process.env, common);
5708
5718
  }
5709
5719
  var CommonEnvFiles, DevEnvFiles, ProdEnvFiles, devEnvFileArgs, prodEnvFileArgs;
5710
5720
  var init_env = __esm({
@@ -5712,17 +5722,10 @@ var init_env = __esm({
5712
5722
  "use strict";
5713
5723
  init_cjs_shims();
5714
5724
  __name(DevEnv, "DevEnv");
5715
- CommonEnvFiles = [".env"];
5716
- DevEnvFiles = [
5717
- ".env.development",
5718
- ".env.development.local",
5719
- ".env.local"
5720
- ];
5721
- ProdEnvFiles = [
5722
- ".env.production",
5723
- ".env.production.local",
5724
- ".env.local"
5725
- ];
5725
+ __name(ProdEnv, "ProdEnv");
5726
+ CommonEnvFiles = [".env", ".env.local"];
5727
+ DevEnvFiles = [".env.development", ".env.development.local"];
5728
+ ProdEnvFiles = [".env.production", ".env.production.local"];
5726
5729
  devEnvFileArgs = [...CommonEnvFiles, ...DevEnvFiles];
5727
5730
  prodEnvFileArgs = [...CommonEnvFiles, ...ProdEnvFiles];
5728
5731
  }
@@ -5751,7 +5754,7 @@ function createAppProcess(fileName, cwd, isDev) {
5751
5754
  {
5752
5755
  cwd,
5753
5756
  windowsHide: true,
5754
- env: DevEnv(),
5757
+ env: isDev ? DevEnv() : ProdEnv(),
5755
5758
  stdio
5756
5759
  }
5757
5760
  );
@@ -5927,6 +5930,7 @@ async function buildApplication({
5927
5930
  sourcemap: true,
5928
5931
  target: "node16",
5929
5932
  outDir: dest,
5933
+ env: isDev ? DevEnv(true) : ProdEnv(true),
5930
5934
  entry: [
5931
5935
  "src",
5932
5936
  `!${config.distDir}`,
@@ -6263,7 +6267,7 @@ async function bootstrapProductionServer(configPath) {
6263
6267
  `Could not locate the entrypoint. Did you forget to build the application? Run 'commandkit build' to build the application first.`
6264
6268
  );
6265
6269
  }
6266
- return createAppProcess(mainFile, cwd, true);
6270
+ return createAppProcess(mainFile, cwd, false);
6267
6271
  }
6268
6272
  async function createProductionBuild(configPath) {
6269
6273
  process.env.COMMANDKIT_BOOTSTRAP_MODE = "production";
@@ -6651,7 +6655,7 @@ __export(index_exports, {
6651
6655
  revalidate: () => revalidate,
6652
6656
  useEnvironment: () => useEnvironment,
6653
6657
  version: () => version,
6654
- zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired: () => zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired
6658
+ zxcvbnm____: () => zxcvbnm____
6655
6659
  });
6656
6660
  module.exports = __toCommonJS(index_exports);
6657
6661
  init_cjs_shims();
@@ -6843,6 +6847,6 @@ var index_default = CommandKit;
6843
6847
  revalidate,
6844
6848
  useEnvironment,
6845
6849
  version,
6846
- zzz_commandkit_secret_internal_use_cache_wrapper_do_not_use_or_you_will_be_fired
6850
+ zxcvbnm____
6847
6851
  });
6848
6852
  //# sourceMappingURL=index.js.map