commandkit 1.2.1-dev.20260414125348 → 1.2.1-dev.20260920033200
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/README.md +1 -1
- package/cache.cjs +2 -0
- package/cache.d.ts +1 -0
- package/dist/{ActionRow-Bt9qi0Mb.d.ts → ActionRow-DSh9roc5.d.ts} +2 -3
- package/dist/{Button-DxJLcZIU.d.ts → Button-BPsE5ju0.d.ts} +5 -6
- package/dist/{ButtonKit-BfcyvWfj.d.ts → ButtonKit-CNPmVg3h.d.ts} +2 -3
- package/dist/{ChannelSelectMenuKit-DYkudikb.d.ts → ChannelSelectMenuKit-CcOdaLQ6.d.ts} +3 -4
- package/dist/{CommandTree-DwfiCsOl.d.ts → CommandTree-qu-8oAEV.d.ts} +1 -1
- package/dist/{CommandsRouter-D-b3xv38.d.ts → CommandsRouter-Co225Ae5.d.ts} +24 -4
- package/dist/{EventInterceptor-D9JKMcfi.d.ts → EventInterceptor-wg378vJp.d.ts} +1 -2
- package/dist/{EventsRouter-Dyr_oJJD.d.ts → EventsRouter-Bt63ZuEF.d.ts} +21 -2
- package/dist/{MentionableSelectMenuKit-Mu4xqP6B.d.ts → MentionableSelectMenuKit-8_Nkgn_a.d.ts} +3 -4
- package/dist/{MessageCommandParser-UTKsRvb9.d.ts → MessageCommandParser-BYbxHOSK.d.ts} +1 -2
- package/dist/{Modal-v9rrcMl-.d.ts → Modal-DbWK6VmV.d.ts} +5 -6
- package/dist/{ModalKit-XJSM65SV.d.ts → ModalKit-CnmUVpw-.d.ts} +2 -3
- package/dist/{RoleSelectMenuKit-CCjcp3HY.d.ts → RoleSelectMenuKit-Bei7DHqD.d.ts} +3 -4
- package/dist/{SelectMenu-CY0vvoSu.d.ts → SelectMenu-Bce_PClo.d.ts} +8 -9
- package/dist/{StringSelectMenuKit-G5nBTicX.d.ts → StringSelectMenuKit-CBeB9HqT.d.ts} +3 -4
- package/dist/TreeArtifact-D6FZ5SVd.d.ts +27 -0
- package/dist/{UserSelectMenuKit-D3SO_fXA.d.ts → UserSelectMenuKit-DZmeZ_Tp.d.ts} +3 -4
- package/dist/analytics/analytics-engine.d.ts +1 -1
- package/dist/analytics/analytics-engine.js +1 -1
- package/dist/analytics/analytics-provider.d.ts +1 -1
- package/dist/analytics/constants.js +0 -1
- package/dist/analytics/constants.js.map +1 -1
- package/dist/analytics/utils.js +1 -1
- package/dist/{analytics-engine-BYA0ongA.d.ts → analytics-engine-Bz1p7ud3.d.ts} +51 -15
- package/dist/app/commands/AppCommandRunner.d.ts +1 -1
- package/dist/app/commands/AppCommandRunner.js +1 -1
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +1 -1
- package/dist/app/commands/MessageCommandParser.d.ts +1 -1
- package/dist/app/commands/MessageCommandParser.js +4 -1
- package/dist/app/commands/MessageCommandParser.js.map +1 -1
- package/dist/app/commands/helpers.d.ts +1 -1
- package/dist/app/commands/helpers.js +0 -1
- package/dist/app/commands/helpers.js.map +1 -1
- package/dist/app/events/EventWorkerContext.d.ts +3 -3
- package/dist/app/events/EventWorkerContext.js +0 -1
- package/dist/app/events/EventWorkerContext.js.map +1 -1
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
- package/dist/app/handlers/AppCommandHandler.js +1 -1
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +1 -1
- package/dist/app/index.d.ts +5 -5
- package/dist/app/index.js +1 -1
- package/dist/app/interrupt/signals.d.ts +1 -1
- package/dist/app/interrupt/signals.js.map +1 -1
- package/dist/app/middlewares/permissions.d.ts +1 -2
- package/dist/app/middlewares/permissions.js +1 -1
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +1 -1
- package/dist/app/router/CommandTree.d.ts +1 -1
- package/dist/app/router/CommandsRouter.d.ts +2 -2
- package/dist/app/router/CommandsRouter.js +60 -1
- package/dist/app/router/CommandsRouter.js.map +1 -1
- package/dist/app/router/EventsRouter.d.ts +2 -2
- package/dist/app/router/EventsRouter.js +56 -3
- package/dist/app/router/EventsRouter.js.map +1 -1
- package/dist/app/router/TreeArtifact.d.ts +2 -0
- package/dist/app/router/TreeArtifact.js +87 -0
- package/dist/app/router/TreeArtifact.js.map +1 -0
- package/dist/app/router/index.d.ts +6 -4
- package/dist/app/router/index.js +8 -1
- package/dist/{checkbox-CvQGiyRe.d.ts → checkbox-DoR0Pcxm.d.ts} +2 -3
- package/dist/cli/app-process.d.ts +2 -4
- package/dist/cli/app-process.js +0 -1
- package/dist/cli/app-process.js.map +1 -1
- package/dist/cli/build.d.ts +4 -9
- package/dist/cli/build.js +30 -4
- package/dist/cli/build.js.map +1 -1
- package/dist/cli/common.d.ts +3 -6
- package/dist/cli/common.js +2 -2
- package/dist/cli/common.js.map +1 -1
- package/dist/cli/development.d.ts +4 -5
- package/dist/cli/development.js +11 -11
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.js.map +1 -1
- package/dist/cli/generators.js +0 -1
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.js +4 -5
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +1 -3
- package/dist/cli/init.js +37 -12
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/production.d.ts +1 -3
- package/dist/cli/production.js +1 -2
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.js +0 -1
- package/dist/cli/type-checker.js.map +1 -1
- package/dist/cli/utils.d.ts +0 -1
- package/dist/cli/utils.js.map +1 -1
- package/dist/{commandkit-DTqT800J.js → commandkit-gJ4YjTy4.js} +165 -87
- package/dist/commandkit-gJ4YjTy4.js.map +1 -0
- package/dist/commandkit.d.ts +1 -1
- package/dist/commandkit.js +1 -1
- package/dist/{common-CCvvgnxi.d.ts → common-CIbPzguv.d.ts} +2 -3
- package/dist/components/common/EventInterceptor.d.ts +1 -1
- package/dist/components/common/EventInterceptor.js +1 -0
- package/dist/components/common/EventInterceptor.js.map +1 -1
- package/dist/components/common/element.d.ts +1 -1
- package/dist/components/common/element.js +1 -1
- package/dist/components/common/types.d.ts +1 -1
- package/dist/components/display/common.d.ts +0 -1
- package/dist/components/display/common.js +1 -1
- package/dist/components/display/container.d.ts +1 -1
- package/dist/components/display/container.js +1 -1
- package/dist/components/display/file.d.ts +1 -1
- package/dist/components/display/file.js +0 -1
- package/dist/components/display/file.js.map +1 -1
- package/dist/components/display/index.d.ts +9 -8
- package/dist/components/display/index.js +1 -1
- package/dist/components/display/label.d.ts +1 -1
- package/dist/components/display/label.js +1 -1
- package/dist/components/display/media-gallery.d.ts +1 -1
- package/dist/components/display/media-gallery.js +1 -1
- package/dist/components/display/poll.d.ts +1 -1
- package/dist/components/display/poll.js +4 -10
- package/dist/components/display/poll.js.map +1 -1
- package/dist/components/display/section.d.ts +1 -1
- package/dist/components/display/section.js +1 -1
- package/dist/components/display/separator.d.ts +1 -1
- package/dist/components/display/separator.js +0 -1
- package/dist/components/display/separator.js.map +1 -1
- package/dist/components/display/text-display.d.ts +1 -1
- package/dist/components/display/text-display.js +0 -1
- package/dist/components/display/text-display.js.map +1 -1
- package/dist/components/index.d.ts +25 -24
- package/dist/components/index.js +1 -1
- package/dist/components/interactive/action-row/ActionRow.d.ts +1 -1
- package/dist/components/interactive/action-row/ActionRow.js +0 -1
- package/dist/components/interactive/action-row/ActionRow.js.map +1 -1
- package/dist/components/interactive/button/Button.d.ts +1 -1
- package/dist/components/interactive/button/Button.js +1 -1
- package/dist/components/interactive/button/ButtonKit.d.ts +1 -1
- package/dist/components/interactive/button/ButtonKit.js +1 -1
- package/dist/components/interactive/checkbox/checkbox.d.ts +1 -1
- package/dist/components/interactive/checkbox/checkbox.js +1 -1
- package/dist/components/interactive/modal/Modal.d.ts +1 -1
- package/dist/components/interactive/modal/Modal.js +1 -1
- package/dist/components/interactive/modal/ModalKit.d.ts +1 -1
- package/dist/components/interactive/modal/ModalKit.js +1 -1
- package/dist/components/interactive/radio/radio.d.ts +1 -1
- package/dist/components/interactive/radio/radio.js +1 -1
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +1 -1
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +1 -1
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +1 -1
- package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -1
- package/dist/components/interactive/select-menu/SelectMenu.js +1 -1
- package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/StringSelectMenuKit.js +1 -1
- package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/UserSelectMenuKit.js +1 -1
- package/dist/components/interactive/select-menu/common.d.ts +1 -1
- package/dist/config/config.d.ts +1 -2
- package/dist/config/config.js +1 -1
- package/dist/config/default.d.ts +1 -2
- package/dist/config/default.js +1 -1
- package/dist/config/loader.d.ts +1 -2
- package/dist/config/loader.js +1 -1
- package/dist/config/types.d.ts +1 -1
- package/dist/config/utils.d.ts +1 -1
- package/dist/config/utils.js.map +1 -1
- package/dist/{constants-D_sgdBHy.d.ts → constants-B7AfnOFa.d.ts} +1 -1
- package/dist/{constants-GWSfiS4h.d.ts → constants-kWgE3L9F.d.ts} +15 -2
- package/dist/{container-B7Kmw__R.d.ts → container-NVgblXmw.d.ts} +1 -2
- package/dist/context/async-context.d.ts +1 -1
- package/dist/context/async-context.js +1 -1
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +1 -1
- package/dist/{element-DeLvTMfZ.d.ts → element-BMZYAAQ-.d.ts} +3 -4
- package/dist/events/CommandKitEventsChannel.d.ts +1 -1
- package/dist/events/CommandKitEventsChannel.js +3 -2
- package/dist/events/CommandKitEventsChannel.js.map +1 -1
- package/dist/{file-BP8aoN3A.d.ts → file-DYAmr697.d.ts} +1 -2
- package/dist/flags/FlagProvider.d.ts +1 -1
- package/dist/flags/FlagProvider.js +1 -0
- package/dist/flags/FlagProvider.js.map +1 -1
- package/dist/flags/feature-flags.d.ts +1 -1
- package/dist/flags/feature-flags.js +1 -1
- package/dist/flags/store.d.ts +1 -1
- package/dist/flags/store.js +0 -1
- package/dist/flags/store.js.map +1 -1
- package/dist/{helpers-C5jRrAM1.d.ts → helpers-vlnRvNJv.d.ts} +1 -2
- package/dist/index-CAFaKBs_.d.ts +8 -0
- package/dist/index-COt7nfC9.d.ts +2 -0
- package/dist/index-DvqHpiuh.d.ts +16 -0
- package/dist/index.d.ts +37 -34
- package/dist/index.js +9 -2
- package/dist/kv/constants.d.ts +1 -1
- package/dist/kv/constants.js.map +1 -1
- package/dist/kv/dotprops.js.map +1 -1
- package/dist/kv/kv.d.ts +0 -1
- package/dist/kv/kv.js +1 -1
- package/dist/kv/kv.js.map +1 -1
- package/dist/kv/serde.d.ts +1 -2
- package/dist/kv/serde.js +27 -27
- package/dist/kv/serde.js.map +1 -1
- package/dist/{label-CqHiBMXP.d.ts → label-DClaYktn.d.ts} +1 -2
- package/dist/logger/DefaultLogger.d.ts +0 -1
- package/dist/logger/DefaultLogger.js +1 -1
- package/dist/logger/Logger.d.ts +0 -1
- package/dist/logger/Logger.js +1 -1
- package/dist/logger/NoopLogger.d.ts +0 -1
- package/dist/logger/NoopLogger.js.map +1 -1
- package/dist/{media-gallery-hFfa57Kd.d.ts → media-gallery-z2Snzz-u.d.ts} +1 -2
- package/dist/plugins/CompilerPlugin.d.ts +1 -1
- package/dist/plugins/CompilerPlugin.js +2 -2
- package/dist/plugins/CompilerPlugin.js.map +1 -1
- package/dist/plugins/PluginCommon.d.ts +1 -1
- package/dist/plugins/PluginCommon.js +1 -1
- package/dist/plugins/PluginCommon.js.map +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +1 -1
- package/dist/plugins/RuntimePlugin.js +2 -2
- package/dist/plugins/RuntimePlugin.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -2
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +1 -1
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/{poll-ElAd5Z2K.d.ts → poll-D2QDStsw.d.ts} +4 -14
- package/dist/{radio-Dcd4YIZx.d.ts → radio-CJH_N4lq.d.ts} +2 -3
- package/dist/{section-BqDLXlp3.d.ts → section-DrFBT5b-.d.ts} +1 -2
- package/dist/{separator-DSaCa1Tc.d.ts → separator-BVm3w6yd.d.ts} +1 -2
- package/dist/{signals-DVOXPkQK.d.ts → signals-DRMDrCOn.d.ts} +1 -1
- package/dist/{text-display-D-0dD7bR.d.ts → text-display-BG0nNqy3.d.ts} +1 -2
- package/dist/{types-DZy7U-Ld.d.ts → types-ur7SvktF.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/colors.d.ts +1 -3
- package/dist/utils/colors.js +0 -1
- package/dist/utils/colors.js.map +1 -1
- package/dist/utils/constants.d.ts +2 -2
- package/dist/utils/constants.js +19 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/dev-hooks.d.ts +1 -1
- package/dist/utils/dev-hooks.js +1 -1
- package/dist/utils/error-codes.js +15 -0
- package/dist/utils/error-codes.js.map +1 -1
- package/dist/utils/resolve-file-url.js +2 -2
- package/dist/utils/resolve-file-url.js.map +1 -1
- package/dist/utils/types-package.d.ts +6 -2
- package/dist/utils/types-package.js +31 -38
- package/dist/utils/types-package.js.map +1 -1
- package/dist/utils/useful-stuff/async-queue.js.map +1 -1
- package/dist/utils/useful-stuff/mutex.js.map +1 -1
- package/dist/utils/useful-stuff/ratelimiter.js +4 -1
- package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
- package/dist/utils/useful-stuff/semaphore.js.map +1 -1
- package/dist/utils/utilities.js +1 -1
- package/dist/utils/warning.d.ts +1 -5
- package/dist/utils/warning.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +17 -17
- package/dist/commandkit-DTqT800J.js.map +0 -1
- package/dist/index-CQiOqvUC.d.ts +0 -1
- package/dist/index-CTLjHn5u.d.ts +0 -1
- package/dist/index-LKrIp3Oo.d.ts +0 -1
- /package/dist/{chunk-BE-pF4vm.js → rolldown-runtime-C_NdSu1c.js} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.js');
|
|
2
2
|
const require_utils_colors = require('./utils/colors.js');
|
|
3
|
+
require('./components/interactive/action-row/ActionRow.js');
|
|
3
4
|
const require_utils_error_codes = require('./utils/error-codes.js');
|
|
4
5
|
const require_plugins_CompilerPlugin = require('./plugins/CompilerPlugin.js');
|
|
5
6
|
const require_plugins_RuntimePlugin = require('./plugins/RuntimePlugin.js');
|
|
@@ -16,11 +17,18 @@ const require_app_commands_helpers = require('./app/commands/helpers.js');
|
|
|
16
17
|
const require_app_commands_MessageCommandParser = require('./app/commands/MessageCommandParser.js');
|
|
17
18
|
const require_app_router_CommandsRouter = require('./app/router/CommandsRouter.js');
|
|
18
19
|
const require_app_router_EventsRouter = require('./app/router/EventsRouter.js');
|
|
20
|
+
const require_app_router_TreeArtifact = require('./app/router/TreeArtifact.js');
|
|
21
|
+
require('./app/router/index.js');
|
|
22
|
+
const require_version = require('./version.js');
|
|
23
|
+
require('./components/display/file.js');
|
|
24
|
+
require('./components/display/separator.js');
|
|
25
|
+
require('./components/display/text-display.js');
|
|
26
|
+
require('./components/display/poll.js');
|
|
19
27
|
const require_cli_common = require('./cli/common.js');
|
|
20
28
|
const require_events_CommandKitEventsChannel = require('./events/CommandKitEventsChannel.js');
|
|
21
29
|
const require_flags_store = require('./flags/store.js');
|
|
22
30
|
let node_events = require("node:events");
|
|
23
|
-
node_events =
|
|
31
|
+
node_events = require_rolldown_runtime.__toESM(node_events);
|
|
24
32
|
let discord_js = require("discord.js");
|
|
25
33
|
let node_async_hooks = require("node:async_hooks");
|
|
26
34
|
let node_crypto = require("node:crypto");
|
|
@@ -28,6 +36,7 @@ let node_console = require("node:console");
|
|
|
28
36
|
let util = require("util");
|
|
29
37
|
let node_fs = require("node:fs");
|
|
30
38
|
let node_path = require("node:path");
|
|
39
|
+
let node_fs_promises = require("node:fs/promises");
|
|
31
40
|
|
|
32
41
|
//#region src/context/async-context.ts
|
|
33
42
|
const kCommandWorker = Symbol("commandkitCommandWorker");
|
|
@@ -387,17 +396,6 @@ var ModalKit = class extends discord_js.ModalBuilder {
|
|
|
387
396
|
|
|
388
397
|
//#endregion
|
|
389
398
|
//#region src/logger/DefaultLogger.ts
|
|
390
|
-
/**
|
|
391
|
-
* Log levels for the logger.
|
|
392
|
-
*/
|
|
393
|
-
var LogLevel = /* @__PURE__ */ function(LogLevel) {
|
|
394
|
-
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
395
|
-
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
396
|
-
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
397
|
-
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
398
|
-
LogLevel[LogLevel["DEFAULT"] = 4] = "DEFAULT";
|
|
399
|
-
return LogLevel;
|
|
400
|
-
}(LogLevel || {});
|
|
401
399
|
const execHandlerKind = {
|
|
402
400
|
autocomplete: "Autocomplete",
|
|
403
401
|
messageContextMenu: "MessageContextMenu",
|
|
@@ -406,18 +404,18 @@ const execHandlerKind = {
|
|
|
406
404
|
message: "Message"
|
|
407
405
|
};
|
|
408
406
|
const TextColorMap = {
|
|
409
|
-
[
|
|
410
|
-
[
|
|
411
|
-
[
|
|
412
|
-
[
|
|
413
|
-
[
|
|
407
|
+
[0]: require_utils_colors.default.blue,
|
|
408
|
+
[1]: require_utils_colors.default.green,
|
|
409
|
+
[2]: require_utils_colors.default.yellow,
|
|
410
|
+
[3]: require_utils_colors.default.red,
|
|
411
|
+
[4]: require_utils_colors.default.white
|
|
414
412
|
};
|
|
415
413
|
const TextBgColorMap = {
|
|
416
|
-
[
|
|
417
|
-
[
|
|
418
|
-
[
|
|
419
|
-
[
|
|
420
|
-
[
|
|
414
|
+
[0]: require_utils_colors.default.bgBlue,
|
|
415
|
+
[1]: require_utils_colors.default.bgGreen,
|
|
416
|
+
[2]: require_utils_colors.default.bgYellow,
|
|
417
|
+
[3]: require_utils_colors.default.bgRed,
|
|
418
|
+
[4]: require_utils_colors.default.bgWhite
|
|
421
419
|
};
|
|
422
420
|
const BoxChars = {
|
|
423
421
|
vertical: "│",
|
|
@@ -431,6 +429,8 @@ const BoxChars = {
|
|
|
431
429
|
* It formats the log messages with timestamps, log levels, and context information.
|
|
432
430
|
*/
|
|
433
431
|
var DefaultLogger = class {
|
|
432
|
+
stdout;
|
|
433
|
+
stderr;
|
|
434
434
|
logger;
|
|
435
435
|
/**
|
|
436
436
|
* Creates a new instance of DefaultLogger.
|
|
@@ -463,16 +463,16 @@ var DefaultLogger = class {
|
|
|
463
463
|
_getLevelLabel(level) {
|
|
464
464
|
let label;
|
|
465
465
|
switch (level) {
|
|
466
|
-
case
|
|
466
|
+
case 0:
|
|
467
467
|
label = "[DEBUG]";
|
|
468
468
|
break;
|
|
469
|
-
case
|
|
469
|
+
case 1:
|
|
470
470
|
label = "[INFO]";
|
|
471
471
|
break;
|
|
472
|
-
case
|
|
472
|
+
case 2:
|
|
473
473
|
label = "[WARN]";
|
|
474
474
|
break;
|
|
475
|
-
case
|
|
475
|
+
case 3:
|
|
476
476
|
label = "[ERROR]";
|
|
477
477
|
break;
|
|
478
478
|
default: label = "[LOG]";
|
|
@@ -513,24 +513,24 @@ var DefaultLogger = class {
|
|
|
513
513
|
else this.logger.log(`${prefix} ${require_utils_colors.default.dim(BoxChars.corner)}`, colorFn(result));
|
|
514
514
|
}
|
|
515
515
|
debug(messageOrStrings, ...values) {
|
|
516
|
-
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(
|
|
517
|
-
else this._log(
|
|
516
|
+
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(0, messageOrStrings, ...values);
|
|
517
|
+
else this._log(0, messageOrStrings);
|
|
518
518
|
}
|
|
519
519
|
error(messageOrStrings, ...values) {
|
|
520
|
-
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(
|
|
521
|
-
else this._log(
|
|
520
|
+
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(3, messageOrStrings, ...values);
|
|
521
|
+
else this._log(3, messageOrStrings);
|
|
522
522
|
}
|
|
523
523
|
log(messageOrStrings, ...values) {
|
|
524
|
-
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(
|
|
525
|
-
else this._log(
|
|
524
|
+
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(4, messageOrStrings, ...values);
|
|
525
|
+
else this._log(4, messageOrStrings);
|
|
526
526
|
}
|
|
527
527
|
info(messageOrStrings, ...values) {
|
|
528
|
-
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(
|
|
529
|
-
else this._log(
|
|
528
|
+
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(1, messageOrStrings, ...values);
|
|
529
|
+
else this._log(1, messageOrStrings);
|
|
530
530
|
}
|
|
531
531
|
warn(messageOrStrings, ...values) {
|
|
532
|
-
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(
|
|
533
|
-
else this._log(
|
|
532
|
+
if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(2, messageOrStrings, ...values);
|
|
533
|
+
else this._log(2, messageOrStrings);
|
|
534
534
|
}
|
|
535
535
|
_isTemplateStringsArray(value) {
|
|
536
536
|
return Array.isArray(value) && "raw" in value && Array.isArray(value.raw);
|
|
@@ -801,6 +801,7 @@ function createProxy(target) {
|
|
|
801
801
|
* Represents the runtime environment for CommandKit plugins.
|
|
802
802
|
*/
|
|
803
803
|
var CommandKitPluginRuntime = class {
|
|
804
|
+
commandkit;
|
|
804
805
|
plugins = new discord_js.Collection();
|
|
805
806
|
/**
|
|
806
807
|
* Creates a new instance of CommandKitPluginRuntime.
|
|
@@ -836,7 +837,12 @@ var CommandKitPluginRuntime = class {
|
|
|
836
837
|
* @param plugin The plugin to pre-load.
|
|
837
838
|
*/
|
|
838
839
|
async preload(plugin) {
|
|
839
|
-
for (const entrypoint of plugin.preload)
|
|
840
|
+
for (const entrypoint of plugin.preload) {
|
|
841
|
+
const path = entrypoint.startsWith("module:") ? entrypoint.slice(7) : require_utils_resolve_file_url.toFileURL(`${getCurrentDirectory()}/${entrypoint}`);
|
|
842
|
+
Logger.debug`Preloading plugin entrypoint: ${path}`;
|
|
843
|
+
const result = await import(path);
|
|
844
|
+
Logger.debug`Preloaded plugin entrypoint: ${path} with result: ${result}`;
|
|
845
|
+
}
|
|
840
846
|
}
|
|
841
847
|
/**
|
|
842
848
|
* Soft registers a plugin in the runtime.
|
|
@@ -918,19 +924,11 @@ var CommandKitPluginRuntime = class {
|
|
|
918
924
|
//#endregion
|
|
919
925
|
//#region src/plugins/plugin-runtime/CompilerPluginRuntime.ts
|
|
920
926
|
/**
|
|
921
|
-
* Enum representing the execution mode of a plugin.
|
|
922
|
-
* It can be either 'activate' or 'deactivate'.
|
|
923
|
-
* @private
|
|
924
|
-
*/
|
|
925
|
-
var PluginExecutionMode = /* @__PURE__ */ function(PluginExecutionMode) {
|
|
926
|
-
PluginExecutionMode["Activate"] = "activate";
|
|
927
|
-
PluginExecutionMode["Deactivate"] = "deactivate";
|
|
928
|
-
return PluginExecutionMode;
|
|
929
|
-
}(PluginExecutionMode || {});
|
|
930
|
-
/**
|
|
931
927
|
* CompilerPluginRuntime is a runtime for managing compiler plugins in CommandKit.
|
|
932
928
|
*/
|
|
933
929
|
var CompilerPluginRuntime = class {
|
|
930
|
+
plugins;
|
|
931
|
+
isDevMode;
|
|
934
932
|
name = "CompilerPluginRuntime";
|
|
935
933
|
initialized = false;
|
|
936
934
|
templates = /* @__PURE__ */ new Map();
|
|
@@ -965,7 +963,7 @@ var CompilerPluginRuntime = class {
|
|
|
965
963
|
*/
|
|
966
964
|
registerTemplate(name, handler) {
|
|
967
965
|
const ctx = this.#pluginContext.getStore();
|
|
968
|
-
if (!ctx || ctx.mode !==
|
|
966
|
+
if (!ctx || ctx.mode !== "activate") throw new Error("registerTemplate() must be called inside activate() method");
|
|
969
967
|
if (this.templates.has(name)) throw new Error(`Template "${name}" already exists`);
|
|
970
968
|
this.templates.set(name, {
|
|
971
969
|
handler,
|
|
@@ -979,7 +977,7 @@ var CompilerPluginRuntime = class {
|
|
|
979
977
|
*/
|
|
980
978
|
unregisterTemplate(name) {
|
|
981
979
|
const ctx = this.#pluginContext.getStore();
|
|
982
|
-
if (!ctx || ctx.mode !==
|
|
980
|
+
if (!ctx || ctx.mode !== "deactivate") throw new Error("unregisterTemplate() must be called inside deactivate() method");
|
|
983
981
|
const template = this.templates.get(name);
|
|
984
982
|
if (!template) throw new Error(`Template "${name}" does not exist`);
|
|
985
983
|
if (template.plugin !== ctx.plugin) throw new Error(`Template "${name}" is owned by plugin "${template.plugin.name}" and cannot be unregistered by "${ctx.plugin.name}"`);
|
|
@@ -1043,7 +1041,7 @@ var CompilerPluginRuntime = class {
|
|
|
1043
1041
|
for (const plugin of this.plugins) try {
|
|
1044
1042
|
await this.#pluginContext.run({
|
|
1045
1043
|
plugin,
|
|
1046
|
-
mode:
|
|
1044
|
+
mode: "activate"
|
|
1047
1045
|
}, async () => {
|
|
1048
1046
|
var _plugin$activate;
|
|
1049
1047
|
await ((_plugin$activate = plugin.activate) === null || _plugin$activate === void 0 ? void 0 : _plugin$activate.call(plugin, this));
|
|
@@ -1062,7 +1060,7 @@ var CompilerPluginRuntime = class {
|
|
|
1062
1060
|
for (const plugin of this.plugins) try {
|
|
1063
1061
|
await this.#pluginContext.run({
|
|
1064
1062
|
plugin,
|
|
1065
|
-
mode:
|
|
1063
|
+
mode: "deactivate"
|
|
1066
1064
|
}, async () => {
|
|
1067
1065
|
var _plugin$deactivate;
|
|
1068
1066
|
await ((_plugin$deactivate = plugin.deactivate) === null || _plugin$deactivate === void 0 ? void 0 : _plugin$deactivate.call(plugin, this));
|
|
@@ -1129,7 +1127,8 @@ var MacroPlugin = class extends require_plugins_CompilerPlugin.CompilerPlugin {
|
|
|
1129
1127
|
name = "MacroPlugin";
|
|
1130
1128
|
macroTransformer;
|
|
1131
1129
|
async activate() {
|
|
1132
|
-
|
|
1130
|
+
const transform = await import("use-macro");
|
|
1131
|
+
this.macroTransformer = new transform.MacroTransformer();
|
|
1133
1132
|
}
|
|
1134
1133
|
async deactivate() {
|
|
1135
1134
|
this.macroTransformer = null;
|
|
@@ -1177,7 +1176,11 @@ const defaultConfig = {
|
|
|
1177
1176
|
production: false
|
|
1178
1177
|
},
|
|
1179
1178
|
jsxDefaultOptionalComponents: true,
|
|
1180
|
-
experimental: {
|
|
1179
|
+
experimental: {
|
|
1180
|
+
devServerRuntime: null,
|
|
1181
|
+
pregenerateCommands: false,
|
|
1182
|
+
incrementalRouter: false
|
|
1183
|
+
}
|
|
1181
1184
|
};
|
|
1182
1185
|
|
|
1183
1186
|
//#endregion
|
|
@@ -1194,7 +1197,7 @@ function getConfig() {
|
|
|
1194
1197
|
* @param config The configuration to use.
|
|
1195
1198
|
*/
|
|
1196
1199
|
function defineConfig(config = {}) {
|
|
1197
|
-
var _config$compilerOptio, _config$compilerOptio2, _config$compilerOptio3;
|
|
1200
|
+
var _config$compilerOptio, _config$compilerOptio2, _config$compilerOptio3, _config$experimental, _config$experimental2;
|
|
1198
1201
|
defined = require_config_utils.mergeDeep(config, require_config_utils.mergeDeep({}, defaultConfig));
|
|
1199
1202
|
defined = {
|
|
1200
1203
|
compilerOptions: {
|
|
@@ -1236,7 +1239,9 @@ function defineConfig(config = {}) {
|
|
|
1236
1239
|
jsxDefaultOptionalComponents: config.jsxDefaultOptionalComponents ?? defaultConfig.jsxDefaultOptionalComponents,
|
|
1237
1240
|
experimental: {
|
|
1238
1241
|
...defaultConfig.experimental,
|
|
1239
|
-
...config.experimental
|
|
1242
|
+
...config.experimental,
|
|
1243
|
+
pregenerateCommands: ((_config$experimental = config.experimental) === null || _config$experimental === void 0 ? void 0 : _config$experimental.pregenerateCommands) ?? defaultConfig.experimental.pregenerateCommands,
|
|
1244
|
+
incrementalRouter: ((_config$experimental2 = config.experimental) === null || _config$experimental2 === void 0 ? void 0 : _config$experimental2.incrementalRouter) ?? defaultConfig.experimental.incrementalRouter
|
|
1240
1245
|
}
|
|
1241
1246
|
};
|
|
1242
1247
|
return defined;
|
|
@@ -1305,6 +1310,7 @@ function applyDefaultOptionalComponentBehavior(props) {
|
|
|
1305
1310
|
* Represents the execution environment for CommandKit commands.
|
|
1306
1311
|
*/
|
|
1307
1312
|
var CommandKitEnvironment = class {
|
|
1313
|
+
commandkit;
|
|
1308
1314
|
#data = {
|
|
1309
1315
|
executionError: null,
|
|
1310
1316
|
type: null,
|
|
@@ -1512,6 +1518,8 @@ const CommandExecutionMode = {
|
|
|
1512
1518
|
* command metadata, and various utility methods for command execution.
|
|
1513
1519
|
*/
|
|
1514
1520
|
var Context = class Context {
|
|
1521
|
+
commandkit;
|
|
1522
|
+
config;
|
|
1515
1523
|
/**
|
|
1516
1524
|
* The interaction that triggered the command.
|
|
1517
1525
|
*/
|
|
@@ -1783,6 +1791,7 @@ var MiddlewareContext = class extends Context {
|
|
|
1783
1791
|
* Manages middleware execution, environment setup, and command invocation.
|
|
1784
1792
|
*/
|
|
1785
1793
|
var AppCommandRunner = class {
|
|
1794
|
+
handler;
|
|
1786
1795
|
/**
|
|
1787
1796
|
* Creates a new AppCommandRunner instance.
|
|
1788
1797
|
* @param handler - The app command handler instance to use for command execution
|
|
@@ -1803,7 +1812,7 @@ var AppCommandRunner = class {
|
|
|
1803
1812
|
const executionMode = this.getExecutionMode(source);
|
|
1804
1813
|
let runCommand = null;
|
|
1805
1814
|
const env = new CommandKitEnvironment(commandkit);
|
|
1806
|
-
env.setType(
|
|
1815
|
+
env.setType("COMMAND_HANDLER");
|
|
1807
1816
|
env.variables.set("commandHandlerType", "app");
|
|
1808
1817
|
env.variables.set("currentCommandName", prepared.command.data.command.__routeKey ?? prepared.command.command.name);
|
|
1809
1818
|
env.variables.set("execHandlerKind", executionMode);
|
|
@@ -2025,6 +2034,7 @@ async function beforeExecute(ctx) {
|
|
|
2025
2034
|
* Handles registration of Discord application commands (slash commands, context menus).
|
|
2026
2035
|
*/
|
|
2027
2036
|
var CommandRegistrar = class {
|
|
2037
|
+
commandkit;
|
|
2028
2038
|
/**
|
|
2029
2039
|
* @private
|
|
2030
2040
|
* @internal
|
|
@@ -2380,6 +2390,7 @@ const middlewareDataSchema = {
|
|
|
2380
2390
|
* Manages both slash commands and message commands with middleware support.
|
|
2381
2391
|
*/
|
|
2382
2392
|
var AppCommandHandler = class {
|
|
2393
|
+
commandkit;
|
|
2383
2394
|
/**
|
|
2384
2395
|
* @private
|
|
2385
2396
|
* @internal
|
|
@@ -2459,7 +2470,9 @@ var AppCommandHandler = class {
|
|
|
2459
2470
|
const children = node.childIds;
|
|
2460
2471
|
children.forEach((childId, idx) => {
|
|
2461
2472
|
const isLastChild = idx === children.length - 1;
|
|
2462
|
-
|
|
2473
|
+
const childPrefix = indent + (isLastChild ? "└─" : "├─");
|
|
2474
|
+
const childIndent = indent + (isLastChild ? " " : "│ ");
|
|
2475
|
+
printHierarchicalNode(childId, childPrefix, childIndent);
|
|
2463
2476
|
});
|
|
2464
2477
|
};
|
|
2465
2478
|
const categoryBuckets = {};
|
|
@@ -2525,14 +2538,17 @@ var AppCommandHandler = class {
|
|
|
2525
2538
|
console.log(`${require_utils_colors.default.green(rootPrefix)} ${require_utils_colors.default.yellow(root.token)}${hasMw}`);
|
|
2526
2539
|
root.childIds.forEach((childId, idx) => {
|
|
2527
2540
|
const isLastChild = idx === root.childIds.length - 1;
|
|
2528
|
-
|
|
2541
|
+
const childPrefix = rootChildIndent + (isLastChild ? "└─" : "├─");
|
|
2542
|
+
const childIndentNext = rootChildIndent + (isLastChild ? " " : "│ ");
|
|
2543
|
+
printHierarchicalNode(childId, childPrefix, childIndentNext);
|
|
2529
2544
|
});
|
|
2530
2545
|
entryIndex++;
|
|
2531
2546
|
});
|
|
2532
2547
|
if (hasChildren) {
|
|
2533
2548
|
const children = categoryTree[category].sort();
|
|
2534
2549
|
children.forEach((childCategory, idx) => {
|
|
2535
|
-
|
|
2550
|
+
const childIsLast = idx === children.length - 1;
|
|
2551
|
+
printCategory(childCategory, childIndent, childIsLast, childIndent);
|
|
2536
2552
|
});
|
|
2537
2553
|
}
|
|
2538
2554
|
};
|
|
@@ -2549,7 +2565,8 @@ var AppCommandHandler = class {
|
|
|
2549
2565
|
return true;
|
|
2550
2566
|
}).sort();
|
|
2551
2567
|
topLevelCategories.forEach((category, index) => {
|
|
2552
|
-
|
|
2568
|
+
const isLast = index === topLevelCategories.length - 1;
|
|
2569
|
+
printCategory(category, "", isLast);
|
|
2553
2570
|
});
|
|
2554
2571
|
}
|
|
2555
2572
|
/**
|
|
@@ -2638,11 +2655,7 @@ var AppCommandHandler = class {
|
|
|
2638
2655
|
if (getConfig().disablePrefixCommands && source instanceof discord_js.Message) return null;
|
|
2639
2656
|
let parser;
|
|
2640
2657
|
let routeKey;
|
|
2641
|
-
|
|
2642
|
-
if (cmdName) {
|
|
2643
|
-
routeKey = this.normalizeRouteKey(cmdName);
|
|
2644
|
-
usedCommandOverride = true;
|
|
2645
|
-
}
|
|
2658
|
+
if (cmdName) routeKey = this.normalizeRouteKey(cmdName);
|
|
2646
2659
|
if (!routeKey) if (source instanceof discord_js.Message) {
|
|
2647
2660
|
if (source.author.bot) return null;
|
|
2648
2661
|
const prefix = await this.commandkit.appConfig.getMessageCommandPrefix(source);
|
|
@@ -2672,7 +2685,7 @@ var AppCommandHandler = class {
|
|
|
2672
2685
|
routeKey = this.buildInteractionRouteKey(source);
|
|
2673
2686
|
}
|
|
2674
2687
|
const hint = require_app_commands_helpers.isInteractionSource(source) ? source.isUserContextMenuCommand() ? "user" : source.isMessageContextMenuCommand() ? "message" : void 0 : void 0;
|
|
2675
|
-
const loadedCommand = hint ? this.findCommandByName(routeKey, hint) : this.findCommandByRoute(routeKey
|
|
2688
|
+
const loadedCommand = hint ? this.findCommandByName(routeKey, hint) : this.findCommandByRoute(routeKey);
|
|
2676
2689
|
if (!loadedCommand) return null;
|
|
2677
2690
|
if ((source instanceof discord_js.CommandInteraction || source instanceof discord_js.AutocompleteInteraction) && source.guildId && ((_loadedCommand$metada3 = loadedCommand.metadata) === null || _loadedCommand$metada3 === void 0 || (_loadedCommand$metada3 = _loadedCommand$metada3.guilds) === null || _loadedCommand$metada3 === void 0 ? void 0 : _loadedCommand$metada3.length) && !((_loadedCommand$metada4 = loadedCommand.metadata) === null || _loadedCommand$metada4 === void 0 ? void 0 : _loadedCommand$metada4.guilds.includes(source.guildId))) return null;
|
|
2678
2691
|
if (source instanceof discord_js.Message) {
|
|
@@ -2756,9 +2769,14 @@ var AppCommandHandler = class {
|
|
|
2756
2769
|
/**
|
|
2757
2770
|
* Reloads all commands and middleware from scratch.
|
|
2758
2771
|
*/
|
|
2759
|
-
async reloadCommands() {
|
|
2760
|
-
|
|
2761
|
-
|
|
2772
|
+
async reloadCommands(path, changeType) {
|
|
2773
|
+
if (this.commandkit.config.experimental.incrementalRouter && path) {
|
|
2774
|
+
var _this$commandkit$comm2;
|
|
2775
|
+
await ((_this$commandkit$comm2 = this.commandkit.commandsRouter) === null || _this$commandkit$comm2 === void 0 ? void 0 : _this$commandkit$comm2.scanIncremental(path, changeType));
|
|
2776
|
+
} else {
|
|
2777
|
+
var _this$commandkit$comm3;
|
|
2778
|
+
await ((_this$commandkit$comm3 = this.commandkit.commandsRouter) === null || _this$commandkit$comm3 === void 0 ? void 0 : _this$commandkit$comm3.scan());
|
|
2779
|
+
}
|
|
2762
2780
|
this.loadedCommands.clear();
|
|
2763
2781
|
this.loadedMiddlewares.clear();
|
|
2764
2782
|
this.runtimeRouteIndex.clear();
|
|
@@ -2826,7 +2844,7 @@ var AppCommandHandler = class {
|
|
|
2826
2844
|
if (require_utils_constants.COMMANDKIT_IS_DEV) {
|
|
2827
2845
|
const commandNames = Array.from(this.runtimeRouteIndex.keys());
|
|
2828
2846
|
const aliases = Array.from(this.runtimeRouteIndex.values()).flatMap((v) => v.metadata.aliases || []);
|
|
2829
|
-
await require_utils_types_package.rewriteCommandDeclaration(
|
|
2847
|
+
await require_utils_types_package.rewriteCommandDeclaration(Array.from(/* @__PURE__ */ new Set([...commandNames, ...aliases])));
|
|
2830
2848
|
}
|
|
2831
2849
|
await this.commandkit.plugins.execute((ctx, plugin) => {
|
|
2832
2850
|
return plugin.onAfterCommandsLoad(ctx);
|
|
@@ -2991,15 +3009,21 @@ var AppCommandHandler = class {
|
|
|
2991
3009
|
const isRootHierarchyLeaf = node.kind === "command";
|
|
2992
3010
|
const hasContextMenuHandlers = !!(commandFileData.userContextMenu || commandFileData.messageContextMenu);
|
|
2993
3011
|
const hasExecutableSlashHandlers = !!(commandFileData.chatInput || commandFileData.message || commandFileData.autocomplete);
|
|
3012
|
+
const sanitizedCommandFileData = { ...commandFileData };
|
|
2994
3013
|
if (!isRootHierarchyLeaf && hasContextMenuHandlers) throw new Error(`Invalid export for hierarchical node ${routeKey}: context menu handlers are only supported for top-level root commands.`);
|
|
2995
3014
|
if (node.executable && handlerCount === 0) throw new Error(`Invalid export for hierarchical node ${routeKey}: executable leaves must provide at least one handler function`);
|
|
2996
|
-
if (!node.executable && hasExecutableSlashHandlers)
|
|
3015
|
+
if (!node.executable && hasExecutableSlashHandlers) {
|
|
3016
|
+
Logger.warn`Ignoring ${require_utils_colors.default.yellow("executable handlers")} exported by ${require_utils_colors.default.cyan("[non-leaf]")} hierarchical node ${require_utils_colors.default.magenta(`[${routeKey}]`)}. Move ${require_utils_colors.default.yellow("chatInput")}, ${require_utils_colors.default.yellow("message")}, or ${require_utils_colors.default.yellow("autocomplete")} handlers to a ${require_utils_colors.default.green("[leaf]")} command node.`;
|
|
3017
|
+
delete sanitizedCommandFileData.chatInput;
|
|
3018
|
+
delete sanitizedCommandFileData.message;
|
|
3019
|
+
delete sanitizedCommandFileData.autocomplete;
|
|
3020
|
+
}
|
|
2997
3021
|
const loadedCommand = {
|
|
2998
3022
|
discordId: null,
|
|
2999
3023
|
command,
|
|
3000
3024
|
metadata: resolvedMetadata,
|
|
3001
3025
|
data: {
|
|
3002
|
-
...
|
|
3026
|
+
...sanitizedCommandFileData,
|
|
3003
3027
|
metadata: resolvedMetadata,
|
|
3004
3028
|
command: {
|
|
3005
3029
|
...commandJson,
|
|
@@ -3102,6 +3126,7 @@ function setFlagProvider(provider) {
|
|
|
3102
3126
|
* Class representing a feature flag in CommandKit.
|
|
3103
3127
|
*/
|
|
3104
3128
|
var FeatureFlag = class {
|
|
3129
|
+
options;
|
|
3105
3130
|
commandkit;
|
|
3106
3131
|
/**
|
|
3107
3132
|
* Create a new feature flag.
|
|
@@ -4269,6 +4294,7 @@ function Label(props) {
|
|
|
4269
4294
|
* Handles Discord.js events and CommandKit custom events with support for namespacing and middleware.
|
|
4270
4295
|
*/
|
|
4271
4296
|
var AppEventsHandler = class {
|
|
4297
|
+
commandkit;
|
|
4272
4298
|
/**
|
|
4273
4299
|
* @private
|
|
4274
4300
|
* @internal
|
|
@@ -4298,8 +4324,19 @@ var AppEventsHandler = class {
|
|
|
4298
4324
|
/**
|
|
4299
4325
|
* Reloads all events by unregistering existing ones and loading them again.
|
|
4300
4326
|
*/
|
|
4301
|
-
async reloadEvents() {
|
|
4327
|
+
async reloadEvents(path, changeType) {
|
|
4302
4328
|
this.unregisterAll();
|
|
4329
|
+
if (this.commandkit.config.experimental.incrementalRouter && path) {
|
|
4330
|
+
await this.commandkit.plugins.execute((ctx, plugin) => {
|
|
4331
|
+
return plugin.onBeforeEventsLoad(ctx);
|
|
4332
|
+
});
|
|
4333
|
+
await this.commandkit.eventsRouter.scanIncremental(path, changeType);
|
|
4334
|
+
await this.loadEventsFromTree(this.commandkit.eventsRouter.toJSON());
|
|
4335
|
+
await this.commandkit.plugins.execute((ctx, plugin) => {
|
|
4336
|
+
return plugin.onAfterEventsLoad(ctx);
|
|
4337
|
+
});
|
|
4338
|
+
return;
|
|
4339
|
+
}
|
|
4303
4340
|
await this.loadEvents();
|
|
4304
4341
|
}
|
|
4305
4342
|
/**
|
|
@@ -4310,6 +4347,17 @@ var AppEventsHandler = class {
|
|
|
4310
4347
|
return plugin.onBeforeEventsLoad(ctx);
|
|
4311
4348
|
});
|
|
4312
4349
|
const events = await this.commandkit.eventsRouter.scan();
|
|
4350
|
+
await this.loadEventsFromTree(events);
|
|
4351
|
+
await this.commandkit.plugins.execute((ctx, plugin) => {
|
|
4352
|
+
return plugin.onAfterEventsLoad(ctx);
|
|
4353
|
+
});
|
|
4354
|
+
}
|
|
4355
|
+
/**
|
|
4356
|
+
* @private
|
|
4357
|
+
* @internal
|
|
4358
|
+
*/
|
|
4359
|
+
async loadEventsFromTree(events) {
|
|
4360
|
+
this.loadedEvents.clear();
|
|
4313
4361
|
for (const event of Object.values(events)) {
|
|
4314
4362
|
const listeners = [];
|
|
4315
4363
|
for (const listener of event.listeners) {
|
|
@@ -4336,9 +4384,6 @@ var AppEventsHandler = class {
|
|
|
4336
4384
|
Logger.info(`✨ Loaded event ${event.event}${event.namespace ? ` of namespace ${event.namespace}` : ""} with ${len} listener${len === 1 ? "" : "s"}`);
|
|
4337
4385
|
}
|
|
4338
4386
|
this.registerAllClientEvents();
|
|
4339
|
-
await this.commandkit.plugins.execute((ctx, plugin) => {
|
|
4340
|
-
return plugin.onAfterEventsLoad(ctx);
|
|
4341
|
-
});
|
|
4342
4387
|
}
|
|
4343
4388
|
/**
|
|
4344
4389
|
* Unregisters all event listeners and clears loaded events.
|
|
@@ -4477,6 +4522,11 @@ var AppEventsHandler = class {
|
|
|
4477
4522
|
once: false,
|
|
4478
4523
|
parallel: false
|
|
4479
4524
|
} : void 0,
|
|
4525
|
+
onceListener: onceListeners.length > 0 ? {
|
|
4526
|
+
handler: onceHandler,
|
|
4527
|
+
once: true,
|
|
4528
|
+
parallel: false
|
|
4529
|
+
} : void 0,
|
|
4480
4530
|
executedOnceListeners
|
|
4481
4531
|
});
|
|
4482
4532
|
if (namespace) {
|
|
@@ -4494,11 +4544,11 @@ var AppEventsHandler = class {
|
|
|
4494
4544
|
*/
|
|
4495
4545
|
unregisterAllClientListeners() {
|
|
4496
4546
|
const client = this.commandkit.client;
|
|
4497
|
-
for (const [key, { name, mainListener, namespace }] of this.loadedEvents.entries()) {
|
|
4547
|
+
for (const [key, { name, mainListener, onceListener, namespace }] of this.loadedEvents.entries()) {
|
|
4498
4548
|
if (mainListener) if (namespace) this.commandkit.events.off(namespace, name, mainListener.handler);
|
|
4499
4549
|
else client.off(name, mainListener.handler);
|
|
4500
|
-
|
|
4501
|
-
else client.
|
|
4550
|
+
if (onceListener) if (namespace) this.commandkit.events.off(namespace, name, onceListener.handler);
|
|
4551
|
+
else client.off(name, onceListener.handler);
|
|
4502
4552
|
this.loadedEvents.delete(key);
|
|
4503
4553
|
Logger.info(`🗑️ Unregistered event ${name}${namespace ? ` of namespace ${namespace}` : ""}`);
|
|
4504
4554
|
}
|
|
@@ -4554,8 +4604,9 @@ function registerDevHooks(commandkit) {
|
|
|
4554
4604
|
if (!require_utils_constants.COMMANDKIT_IS_DEV) return;
|
|
4555
4605
|
process.on("message", async (message) => {
|
|
4556
4606
|
if (typeof message !== "object" || message === null) return;
|
|
4557
|
-
const { event, path, id } = message;
|
|
4607
|
+
const { event, path: maybePath, id, changeType } = message;
|
|
4558
4608
|
if (!event) return;
|
|
4609
|
+
const path = maybePath ?? "";
|
|
4559
4610
|
if (process.env.COMMANDKIT_DEBUG_HMR === "true") Logger.info(`Received HMR event: ${event}${path ? ` for ${path}` : ""}`);
|
|
4560
4611
|
let accepted = false, prevented = false, handled = false;
|
|
4561
4612
|
const hmrEvent = {
|
|
@@ -4566,7 +4617,8 @@ function registerDevHooks(commandkit) {
|
|
|
4566
4617
|
prevented = true;
|
|
4567
4618
|
},
|
|
4568
4619
|
path,
|
|
4569
|
-
event
|
|
4620
|
+
event,
|
|
4621
|
+
changeType
|
|
4570
4622
|
};
|
|
4571
4623
|
try {
|
|
4572
4624
|
await commandkit.plugins.execute(async (ctx, plugin) => {
|
|
@@ -4577,11 +4629,11 @@ function registerDevHooks(commandkit) {
|
|
|
4577
4629
|
if (prevented) return;
|
|
4578
4630
|
switch (event) {
|
|
4579
4631
|
case require_utils_constants.HMREventType.ReloadCommands:
|
|
4580
|
-
await commandkit.commandHandler.reloadCommands();
|
|
4632
|
+
await commandkit.commandHandler.reloadCommands(path, changeType);
|
|
4581
4633
|
handled = true;
|
|
4582
4634
|
break;
|
|
4583
4635
|
case require_utils_constants.HMREventType.ReloadEvents:
|
|
4584
|
-
await commandkit.eventHandler.reloadEvents();
|
|
4636
|
+
await commandkit.eventHandler.reloadEvents(path, changeType);
|
|
4585
4637
|
handled = true;
|
|
4586
4638
|
break;
|
|
4587
4639
|
case require_utils_constants.HMREventType.Unknown:
|
|
@@ -4644,6 +4696,7 @@ function noAnalytics() {
|
|
|
4644
4696
|
* This class allows you to register a provider, set a filter for events, and track or identify events.
|
|
4645
4697
|
*/
|
|
4646
4698
|
var AnalyticsEngine = class {
|
|
4699
|
+
commandkit;
|
|
4647
4700
|
#provider = null;
|
|
4648
4701
|
#filter = null;
|
|
4649
4702
|
/**
|
|
@@ -4763,6 +4816,7 @@ function onApplicationBootstrap(fn) {
|
|
|
4763
4816
|
*/
|
|
4764
4817
|
var CommandKit = class CommandKit extends node_events.default {
|
|
4765
4818
|
#started = false;
|
|
4819
|
+
#hydratedFromArtifact = false;
|
|
4766
4820
|
#clientProxy = createProxy({});
|
|
4767
4821
|
#client;
|
|
4768
4822
|
/**
|
|
@@ -4967,11 +5021,35 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
4967
5021
|
await this.plugins.execute((ctx, plugin) => {
|
|
4968
5022
|
return plugin.onEventsRouterInit(ctx);
|
|
4969
5023
|
});
|
|
5024
|
+
this.#hydratedFromArtifact = await this.#hydrateRoutersFromArtifact();
|
|
4970
5025
|
await this.#initEvents();
|
|
4971
5026
|
await this.#initCommands();
|
|
4972
5027
|
}
|
|
5028
|
+
async #hydrateRoutersFromArtifact() {
|
|
5029
|
+
if (require_utils_constants.COMMANDKIT_IS_DEV) return false;
|
|
5030
|
+
if (require_utils_constants.COMMANDKIT_BOOTSTRAP_MODE !== "production") return false;
|
|
5031
|
+
if (!this.config.experimental.pregenerateCommands) return false;
|
|
5032
|
+
const outputRoot = getCurrentDirectory();
|
|
5033
|
+
const artifactPath = (0, node_path.join)(outputRoot, require_app_router_TreeArtifact.ROUTER_TREE_ARTIFACT_DIRECTORY, require_app_router_TreeArtifact.ROUTER_TREE_ARTIFACT_FILE);
|
|
5034
|
+
if (!(0, node_fs.existsSync)(artifactPath)) return false;
|
|
5035
|
+
try {
|
|
5036
|
+
const json = await (0, node_fs_promises.readFile)(artifactPath, "utf8");
|
|
5037
|
+
const parsed = JSON.parse(json);
|
|
5038
|
+
if (!require_app_router_TreeArtifact.validateRouterTreeArtifact(parsed, "1.2.1-dev.20260920033200")) {
|
|
5039
|
+
Logger.warn(`Ignoring router tree artifact at ${artifactPath}: schema/version mismatch. Falling back to dynamic filesystem resolution.`);
|
|
5040
|
+
return false;
|
|
5041
|
+
}
|
|
5042
|
+
const hydrated = require_app_router_TreeArtifact.hydrateRouterTreeArtifact(parsed, outputRoot);
|
|
5043
|
+
this.commandsRouter.populate(hydrated.commands);
|
|
5044
|
+
this.eventsRouter.populate(hydrated.events);
|
|
5045
|
+
return true;
|
|
5046
|
+
} catch (error) {
|
|
5047
|
+
Logger.warn(`Failed to load router tree artifact at ${artifactPath}. Falling back to dynamic filesystem resolution. ${error}`);
|
|
5048
|
+
return false;
|
|
5049
|
+
}
|
|
5050
|
+
}
|
|
4973
5051
|
async #initCommands() {
|
|
4974
|
-
if (this.commandsRouter.isValidPath()) {
|
|
5052
|
+
if (!this.#hydratedFromArtifact && this.commandsRouter.isValidPath()) {
|
|
4975
5053
|
const result = await this.commandsRouter.scan();
|
|
4976
5054
|
if (require_utils_constants.COMMANDKIT_IS_DEV) (0, node_fs.writeFileSync)("./.commandkit/commands.json", JSON.stringify(result, null, 2));
|
|
4977
5055
|
}
|
|
@@ -4979,7 +5057,7 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
4979
5057
|
this.commandHandler.printBanner();
|
|
4980
5058
|
}
|
|
4981
5059
|
async #initEvents() {
|
|
4982
|
-
if (this.eventsRouter.isValidPath()) await this.eventsRouter.scan();
|
|
5060
|
+
if (!this.#hydratedFromArtifact && this.eventsRouter.isValidPath()) await this.eventsRouter.scan();
|
|
4983
5061
|
await this.eventHandler.loadEvents();
|
|
4984
5062
|
}
|
|
4985
5063
|
/**
|
|
@@ -5588,4 +5666,4 @@ Object.defineProperty(exports, 'useStore', {
|
|
|
5588
5666
|
return useStore;
|
|
5589
5667
|
}
|
|
5590
5668
|
});
|
|
5591
|
-
//# sourceMappingURL=commandkit-
|
|
5669
|
+
//# sourceMappingURL=commandkit-gJ4YjTy4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandkit-gJ4YjTy4.js","names":[],"sources":[],"mappings":""}
|
package/dist/commandkit.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as CommandKitConfiguration, d as onBootstrap, l as commandkit, o as BootstrapFunction, s as CommandKit, u as onApplicationBootstrap } from "./analytics-engine-
|
|
1
|
+
import { c as CommandKitConfiguration, d as onBootstrap, l as commandkit, o as BootstrapFunction, s as CommandKit, u as onApplicationBootstrap } from "./analytics-engine-Bz1p7ud3.js";
|
|
2
2
|
export { BootstrapFunction, CommandKit, CommandKitConfiguration, commandkit, onApplicationBootstrap, onBootstrap };
|
package/dist/commandkit.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_commandkit = require('./commandkit-
|
|
2
|
+
const require_commandkit = require('./commandkit-gJ4YjTy4.js');
|
|
3
3
|
|
|
4
4
|
exports.CommandKit = require_commandkit.CommandKit;
|
|
5
5
|
exports.commandkit = require_commandkit.commandkit;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { n as EventInterceptorContextData } from "./EventInterceptor-
|
|
1
|
+
import { n as EventInterceptorContextData } from "./EventInterceptor-wg378vJp.js";
|
|
2
2
|
import { Awaitable, Events } from "discord.js";
|
|
3
|
-
|
|
4
3
|
//#region src/components/interactive/select-menu/common.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The predicate function that filters select menu interactions.
|
|
@@ -26,4 +25,4 @@ type CommandKitSelectMenuBuilderOnEnd = (reason: string) => Awaitable<void>;
|
|
|
26
25
|
type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData = EventInterceptorContextData<Events.InteractionCreate>;
|
|
27
26
|
//#endregion
|
|
28
27
|
export { OnSelectMenuKitSubmit as a, OnSelectMenuKitEnd as i, CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData as n, SelectMenuKitPredicate as o, CommandKitSelectMenuBuilderOnEnd as r, CommandKitSelectMenuBuilderInteractionCollectorDispatch as t };
|
|
29
|
-
//# sourceMappingURL=common-
|
|
28
|
+
//# sourceMappingURL=common-CIbPzguv.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as EventInterceptorContextData, r as EventInterceptorErrorHandler, t as EventInterceptor } from "../../EventInterceptor-
|
|
1
|
+
import { n as EventInterceptorContextData, r as EventInterceptorErrorHandler, t as EventInterceptor } from "../../EventInterceptor-wg378vJp.js";
|
|
2
2
|
export { EventInterceptor, EventInterceptorContextData, EventInterceptorErrorHandler };
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
6
6
|
* It also supports automatic cleanup of expired subscriptions.
|
|
7
7
|
*/
|
|
8
8
|
var EventInterceptor = class {
|
|
9
|
+
client;
|
|
9
10
|
subscribers = /* @__PURE__ */ new Map();
|
|
10
11
|
globalHandlers = /* @__PURE__ */ new Map();
|
|
11
12
|
cleanupTimer = null;
|