commandkit 0.1.11-dev.20250308183646 → 0.1.11-dev.20250314022547
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 +2 -1
- package/dist/index.js +32 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1663,6 +1663,7 @@ interface CommandKitConfiguration {
|
|
|
1663
1663
|
localizationStrategy: LocalizationStrategy;
|
|
1664
1664
|
getMessageCommandPrefix: (message: Message$1) => Awaitable<string | string[]>;
|
|
1665
1665
|
}
|
|
1666
|
+
declare let commandkit: Commandkit;
|
|
1666
1667
|
declare class CommandKit extends EventEmitter {
|
|
1667
1668
|
#private;
|
|
1668
1669
|
private options;
|
|
@@ -1926,4 +1927,4 @@ declare const version: string;
|
|
|
1926
1927
|
*/
|
|
1927
1928
|
declare function bootstrapCommandkitCLI(argv: string[], options?: commander.ParseOptions | undefined): Promise<void>;
|
|
1928
1929
|
|
|
1929
|
-
export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, type ApiTranslatableCommandOptions, 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 CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandObject, type CommandOptions, type CommandProps, CommandsRouter, type CommandsRouterData, type CommandsRouterOptions, type CommandsRouterRawData, 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, type LoadedCommand, 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, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnModalKitEnd, type OnModalKitSubmit, ParagraphInput, type ParsedCommand, type ParsedEvent, type ParsedMessageCommand, type ParsedMiddleware, type ParsedSubCommand, type PreparedAppCommandExecution, type ReloadOptions, ReloadType, type RunCommand, 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 };
|
|
1930
|
+
export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, type ApiTranslatableCommandOptions, 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 CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandObject, type CommandOptions, type CommandProps, CommandsRouter, type CommandsRouterData, type CommandsRouterOptions, type CommandsRouterRawData, 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, type LoadedCommand, 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, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnModalKitEnd, type OnModalKitSubmit, ParagraphInput, type ParsedCommand, type ParsedEvent, type ParsedMessageCommand, type ParsedMiddleware, type ParsedSubCommand, type PreparedAppCommandExecution, type ReloadOptions, ReloadType, type RunCommand, 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, commandkit, 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.js
CHANGED
|
@@ -1372,9 +1372,9 @@ var init_CommandKitPluginRuntime = __esm({
|
|
|
1372
1372
|
init_Logger();
|
|
1373
1373
|
init_runtime_events();
|
|
1374
1374
|
_CommandKitPluginRuntime = class _CommandKitPluginRuntime extends EventTarget {
|
|
1375
|
-
constructor(
|
|
1375
|
+
constructor(commandkit2) {
|
|
1376
1376
|
super();
|
|
1377
|
-
this.commandkit =
|
|
1377
|
+
this.commandkit = commandkit2;
|
|
1378
1378
|
}
|
|
1379
1379
|
plugins = new import_discord7.Collection();
|
|
1380
1380
|
onClientLogin = /* @__PURE__ */ __name(() => {
|
|
@@ -1976,8 +1976,8 @@ var init_DefaultLocalizationStrategy = __esm({
|
|
|
1976
1976
|
init_config();
|
|
1977
1977
|
import_node_fs = require("fs");
|
|
1978
1978
|
_DefaultLocalizationStrategy = class _DefaultLocalizationStrategy {
|
|
1979
|
-
constructor(
|
|
1980
|
-
this.commandkit =
|
|
1979
|
+
constructor(commandkit2) {
|
|
1980
|
+
this.commandkit = commandkit2;
|
|
1981
1981
|
}
|
|
1982
1982
|
translations = /* @__PURE__ */ new Map();
|
|
1983
1983
|
async locateTranslation(scope, locale) {
|
|
@@ -2158,8 +2158,8 @@ var init_Localization = __esm({
|
|
|
2158
2158
|
* @param commandkit The command kit instance.
|
|
2159
2159
|
* @param config The localization configuration.
|
|
2160
2160
|
*/
|
|
2161
|
-
constructor(
|
|
2162
|
-
this.commandkit =
|
|
2161
|
+
constructor(commandkit2, config) {
|
|
2162
|
+
this.commandkit = commandkit2;
|
|
2163
2163
|
this.config = config;
|
|
2164
2164
|
const strategy = this.commandkit.config.localizationStrategy;
|
|
2165
2165
|
const { locale, target } = this.config;
|
|
@@ -2234,8 +2234,8 @@ var init_environment = __esm({
|
|
|
2234
2234
|
* Creates the commandkit execution environment.
|
|
2235
2235
|
* @param commandkit - The commandkit instance.
|
|
2236
2236
|
*/
|
|
2237
|
-
constructor(
|
|
2238
|
-
this.commandkit =
|
|
2237
|
+
constructor(commandkit2) {
|
|
2238
|
+
this.commandkit = commandkit2;
|
|
2239
2239
|
__privateAdd(this, _data, {
|
|
2240
2240
|
executionError: null,
|
|
2241
2241
|
type: null,
|
|
@@ -2398,8 +2398,8 @@ function md5(data) {
|
|
|
2398
2398
|
return (0, import_node_crypto2.createHash)("md5").update(data).digest("hex");
|
|
2399
2399
|
}
|
|
2400
2400
|
function getCacheProvider() {
|
|
2401
|
-
const
|
|
2402
|
-
const provider =
|
|
2401
|
+
const commandkit2 = getCommandKit(true);
|
|
2402
|
+
const provider = commandkit2.getCacheProvider();
|
|
2403
2403
|
if (!provider) {
|
|
2404
2404
|
throw new Error(
|
|
2405
2405
|
`Cache provider was not found, please provide a cache provider to commandkit.`
|
|
@@ -2566,8 +2566,8 @@ var init_Context = __esm({
|
|
|
2566
2566
|
* @param commandkit The command kit instance.
|
|
2567
2567
|
* @param config The context parameters.
|
|
2568
2568
|
*/
|
|
2569
|
-
constructor(
|
|
2570
|
-
this.commandkit =
|
|
2569
|
+
constructor(commandkit2, config) {
|
|
2570
|
+
this.commandkit = commandkit2;
|
|
2571
2571
|
this.config = config;
|
|
2572
2572
|
/**
|
|
2573
2573
|
* The interaction that triggered the command.
|
|
@@ -2585,7 +2585,7 @@ var init_Context = __esm({
|
|
|
2585
2585
|
__publicField(this, "_locale", null);
|
|
2586
2586
|
this.interaction = config.interaction;
|
|
2587
2587
|
this.message = config.message;
|
|
2588
|
-
this.client =
|
|
2588
|
+
this.client = commandkit2.client;
|
|
2589
2589
|
__privateSet(this, _store, config.store ?? /* @__PURE__ */ new Map());
|
|
2590
2590
|
}
|
|
2591
2591
|
/**
|
|
@@ -3091,8 +3091,8 @@ var init_CommandRegistrar = __esm({
|
|
|
3091
3091
|
* Creates an instance of CommandRegistrar.
|
|
3092
3092
|
* @param commandkit The commandkit instance.
|
|
3093
3093
|
*/
|
|
3094
|
-
constructor(
|
|
3095
|
-
this.commandkit =
|
|
3094
|
+
constructor(commandkit2) {
|
|
3095
|
+
this.commandkit = commandkit2;
|
|
3096
3096
|
this.api.setToken(
|
|
3097
3097
|
this.commandkit.client.token ?? process.env.DISCORD_TOKEN ?? process.env.TOKEN ?? ""
|
|
3098
3098
|
);
|
|
@@ -3318,8 +3318,8 @@ var init_AppCommandHandler = __esm({
|
|
|
3318
3318
|
afterExecute: /* @__PURE__ */ __name((c) => typeof c === "function", "afterExecute")
|
|
3319
3319
|
};
|
|
3320
3320
|
_AppCommandHandler = class _AppCommandHandler {
|
|
3321
|
-
constructor(
|
|
3322
|
-
this.commandkit =
|
|
3321
|
+
constructor(commandkit2) {
|
|
3322
|
+
this.commandkit = commandkit2;
|
|
3323
3323
|
__privateAdd(this, _AppCommandHandler_instances);
|
|
3324
3324
|
__publicField(this, "loadedCommands", new import_discord10.Collection());
|
|
3325
3325
|
__publicField(this, "loadedSubCommands", new import_discord10.Collection());
|
|
@@ -4173,8 +4173,8 @@ var init_AppEventsHandler = __esm({
|
|
|
4173
4173
|
init_Logger();
|
|
4174
4174
|
init_resolve_file_url();
|
|
4175
4175
|
_AppEventsHandler = class _AppEventsHandler {
|
|
4176
|
-
constructor(
|
|
4177
|
-
this.commandkit =
|
|
4176
|
+
constructor(commandkit2) {
|
|
4177
|
+
this.commandkit = commandkit2;
|
|
4178
4178
|
}
|
|
4179
4179
|
loadedEvents = /* @__PURE__ */ new Map();
|
|
4180
4180
|
async reloadEvents() {
|
|
@@ -4477,7 +4477,7 @@ var init_loader = __esm({
|
|
|
4477
4477
|
});
|
|
4478
4478
|
|
|
4479
4479
|
// src/utils/dev-hooks.ts
|
|
4480
|
-
function registerDevHooks(
|
|
4480
|
+
function registerDevHooks(commandkit2) {
|
|
4481
4481
|
if (!COMMANDKIT_IS_DEV) return;
|
|
4482
4482
|
process.on("message", (message) => {
|
|
4483
4483
|
if (typeof message !== "object" || message === null) return;
|
|
@@ -4488,13 +4488,13 @@ function registerDevHooks(commandkit) {
|
|
|
4488
4488
|
}
|
|
4489
4489
|
switch (event) {
|
|
4490
4490
|
case "reload-commands":
|
|
4491
|
-
|
|
4491
|
+
commandkit2.commandHandler.reloadCommands();
|
|
4492
4492
|
break;
|
|
4493
4493
|
case "reload-events":
|
|
4494
|
-
|
|
4494
|
+
commandkit2.eventHandler.reloadEvents();
|
|
4495
4495
|
break;
|
|
4496
4496
|
case "reload-locales":
|
|
4497
|
-
|
|
4497
|
+
commandkit2.commandHandler.reloadCommands();
|
|
4498
4498
|
break;
|
|
4499
4499
|
}
|
|
4500
4500
|
});
|
|
@@ -4517,8 +4517,8 @@ var init_CommandKitEventsChannel = __esm({
|
|
|
4517
4517
|
init_cjs_shims();
|
|
4518
4518
|
import_node_events = __toESM(require("events"));
|
|
4519
4519
|
_CommandKitEventsChannel = class _CommandKitEventsChannel {
|
|
4520
|
-
constructor(
|
|
4521
|
-
this.commandkit =
|
|
4520
|
+
constructor(commandkit2) {
|
|
4521
|
+
this.commandkit = commandkit2;
|
|
4522
4522
|
}
|
|
4523
4523
|
emitter = new import_node_events.default();
|
|
4524
4524
|
to(namespace) {
|
|
@@ -4556,7 +4556,7 @@ var init_CommandKitEventsChannel = __esm({
|
|
|
4556
4556
|
});
|
|
4557
4557
|
|
|
4558
4558
|
// src/CommandKit.ts
|
|
4559
|
-
var import_node_events2, import_discord12, import_node_path8, import_node_fs8, _started, _CommandKit_instances, init_fn, initCommands_fn, initEvents_fn, _CommandKit, CommandKit;
|
|
4559
|
+
var import_node_events2, import_discord12, import_node_path8, import_node_fs8, commandkit, _started, _CommandKit_instances, init_fn, initCommands_fn, initEvents_fn, _CommandKit, CommandKit;
|
|
4560
4560
|
var init_CommandKit = __esm({
|
|
4561
4561
|
"src/CommandKit.ts"() {
|
|
4562
4562
|
"use strict";
|
|
@@ -4634,6 +4634,7 @@ var init_CommandKit = __esm({
|
|
|
4634
4634
|
if (!_CommandKit.instance) {
|
|
4635
4635
|
_CommandKit.instance = this;
|
|
4636
4636
|
}
|
|
4637
|
+
commandkit = _CommandKit.instance;
|
|
4637
4638
|
}
|
|
4638
4639
|
/**
|
|
4639
4640
|
* Starts the commandkit application.
|
|
@@ -4868,7 +4869,7 @@ var init_version = __esm({
|
|
|
4868
4869
|
"use strict";
|
|
4869
4870
|
init_cjs_shims();
|
|
4870
4871
|
version = /* @__MACRO__ $version */
|
|
4871
|
-
"0.1.11-dev.
|
|
4872
|
+
"0.1.11-dev.20250314022547";
|
|
4872
4873
|
}
|
|
4873
4874
|
});
|
|
4874
4875
|
|
|
@@ -5181,10 +5182,7 @@ async function bootstrapDevelopmentServer(configPath) {
|
|
|
5181
5182
|
watcher.on("change", hmrHandler);
|
|
5182
5183
|
watcher.on("add", hmrHandler);
|
|
5183
5184
|
watcher.on("unlink", hmrHandler);
|
|
5184
|
-
watcher.on("unlinkDir",
|
|
5185
|
-
const hasChild = (0, import_node_fs10.readdirSync)(path3).length > 0;
|
|
5186
|
-
if (hasChild) return hmrHandler(path3);
|
|
5187
|
-
});
|
|
5185
|
+
watcher.on("unlinkDir", hmrHandler);
|
|
5188
5186
|
watcher.on("error", (e) => {
|
|
5189
5187
|
console.error(e);
|
|
5190
5188
|
});
|
|
@@ -5201,7 +5199,7 @@ ${colors_default.yellowBright("re")} - Reload all events
|
|
|
5201
5199
|
${colors_default.yellowBright("rl")} - Reload all locales`
|
|
5202
5200
|
);
|
|
5203
5201
|
}
|
|
5204
|
-
var import_path2, import_chokidar,
|
|
5202
|
+
var import_path2, import_chokidar, isCommandSource, isEventSource, isLocaleSource;
|
|
5205
5203
|
var init_development = __esm({
|
|
5206
5204
|
"src/cli/development.ts"() {
|
|
5207
5205
|
"use strict";
|
|
@@ -5212,7 +5210,6 @@ var init_development = __esm({
|
|
|
5212
5210
|
init_app_process();
|
|
5213
5211
|
init_build();
|
|
5214
5212
|
import_chokidar = require("chokidar");
|
|
5215
|
-
import_node_fs10 = require("fs");
|
|
5216
5213
|
init_utilities();
|
|
5217
5214
|
init_colors();
|
|
5218
5215
|
__name(buildAndStart, "buildAndStart");
|
|
@@ -5439,6 +5436,7 @@ __export(index_exports, {
|
|
|
5439
5436
|
cacheLife: () => cacheLife,
|
|
5440
5437
|
cacheTag: () => cacheTag,
|
|
5441
5438
|
cancelAfterCommand: () => cancelAfterCommand,
|
|
5439
|
+
commandkit: () => commandkit,
|
|
5442
5440
|
createElement: () => createElement,
|
|
5443
5441
|
createLogger: () => createLogger,
|
|
5444
5442
|
default: () => index_default,
|
|
@@ -5590,6 +5588,7 @@ var index_default = CommandKit;
|
|
|
5590
5588
|
cacheLife,
|
|
5591
5589
|
cacheTag,
|
|
5592
5590
|
cancelAfterCommand,
|
|
5591
|
+
commandkit,
|
|
5593
5592
|
createElement,
|
|
5594
5593
|
createLogger,
|
|
5595
5594
|
defineConfig,
|