commandkit 1.2.0-rc.5 → 1.2.0-rc.7
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/{ActionRow-CmTHbo2t.js → ActionRow-CbdGFWMT.js} +3 -2
- package/dist/{ActionRow-CmTHbo2t.js.map → ActionRow-CbdGFWMT.js.map} +1 -1
- package/dist/{CommandKitEventsChannel-Bgw0XCOl.js → CommandKitEventsChannel-B5vbINtP.js} +3 -2
- package/dist/{CommandKitEventsChannel-Bgw0XCOl.js.map → CommandKitEventsChannel-B5vbINtP.js.map} +1 -1
- package/dist/{CommandsRouter-tMAivEfv.js → CommandsRouter-DZAeB2v_.js} +10 -7
- package/dist/{CommandsRouter-tMAivEfv.js.map → CommandsRouter-DZAeB2v_.js.map} +1 -1
- package/dist/{CompilerPlugin-CjoZAAR8.js → CompilerPlugin-M8r3yNAl.js} +2 -2
- package/dist/{CompilerPlugin-CjoZAAR8.js.map → CompilerPlugin-M8r3yNAl.js.map} +1 -1
- package/dist/{EventInterceptor-CQ4PBpBJ.js → EventInterceptor-CQEXyUTp.js} +3 -5
- package/dist/{EventInterceptor-CQ4PBpBJ.js.map → EventInterceptor-CQEXyUTp.js.map} +1 -1
- package/dist/{EventWorkerContext-TZIKxVCu.js → EventWorkerContext-Dq29tieI.js} +3 -2
- package/dist/{EventWorkerContext-TZIKxVCu.js.map → EventWorkerContext-Dq29tieI.js.map} +1 -1
- package/dist/{EventWorkerContext-D9frVhVe.d.ts → EventWorkerContext-xgEc2N2T.d.ts} +2 -2
- package/dist/{EventsRouter-C_J0M3uO.js → EventsRouter-Dzpm7ubq.js} +9 -5
- package/dist/{EventsRouter-C_J0M3uO.js.map → EventsRouter-Dzpm7ubq.js.map} +1 -1
- package/dist/{MessageCommandParser-TPEPhjvx.js → MessageCommandParser-CEuO6Ex3.js} +3 -2
- package/dist/{MessageCommandParser-TPEPhjvx.js.map → MessageCommandParser-CEuO6Ex3.js.map} +1 -1
- package/dist/{PluginCommon-Di1xIa8d.js → PluginCommon-Cvl5yYM_.js} +3 -2
- package/dist/{PluginCommon-Di1xIa8d.js.map → PluginCommon-Cvl5yYM_.js.map} +1 -1
- package/dist/{RuntimePlugin-eTdFJwGd.js → RuntimePlugin-BUecuBIU.js} +2 -2
- package/dist/{RuntimePlugin-eTdFJwGd.js.map → RuntimePlugin-BUecuBIU.js.map} +1 -1
- package/dist/analytics/analytics-engine.d.ts +1 -1
- package/dist/analytics/analytics-engine.js +24 -24
- package/dist/analytics/analytics-provider.d.ts +1 -1
- package/dist/analytics/constants.js +1 -1
- package/dist/analytics/utils.js +24 -24
- package/dist/{analytics-engine-CtMbeudW.d.ts → analytics-engine-6_M8tCeD.d.ts} +16 -4
- package/dist/app/commands/AppCommandRunner.d.ts +1 -1
- package/dist/app/commands/AppCommandRunner.js +24 -24
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +24 -24
- package/dist/app/commands/MessageCommandParser.js +1 -1
- package/dist/app/commands/helpers.js +1 -1
- package/dist/app/events/EventWorkerContext.d.ts +2 -2
- package/dist/app/events/EventWorkerContext.js +1 -1
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
- package/dist/app/handlers/AppCommandHandler.js +24 -24
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +24 -24
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.js +25 -25
- package/dist/app/interrupt/signals.js +2 -2
- package/dist/app/middlewares/permissions.d.ts +1 -1
- package/dist/app/middlewares/permissions.js +24 -24
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +24 -24
- package/dist/app/router/CommandsRouter.js +1 -1
- package/dist/app/router/EventsRouter.js +1 -1
- package/dist/app/router/index.js +2 -2
- package/dist/{app-process-CjMovpoZ.js → app-process-u2DXakNv.js} +8 -5
- package/dist/{app-process-CjMovpoZ.js.map → app-process-u2DXakNv.js.map} +1 -1
- package/dist/{build-D52II1qS.js → build-e6PlVFfe.js} +15 -11
- package/dist/{build-D52II1qS.js.map → build-e6PlVFfe.js.map} +1 -1
- package/dist/cli/app-process.js +4 -4
- package/dist/cli/build.d.ts +1 -1
- package/dist/cli/build.js +26 -26
- package/dist/cli/common.d.ts +1 -1
- package/dist/cli/common.js +3 -3
- package/dist/cli/development.js +39 -39
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/generators.js +9 -6
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.js +14 -19
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.js +25 -25
- package/dist/cli/production.js +29 -28
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.js +4 -4
- package/dist/{colors-Cd4Oz-r-.js → colors-DL3ucTiT.js} +3 -2
- package/dist/{colors-Cd4Oz-r-.js.map → colors-DL3ucTiT.js.map} +1 -1
- package/dist/{commandkit-BPtNCbV8.js → commandkit-Dy4V-Rk2.js} +143 -156
- package/dist/commandkit-Dy4V-Rk2.js.map +1 -0
- package/dist/commandkit.d.ts +1 -1
- package/dist/commandkit.js +24 -24
- package/dist/{common-DNADUU3_.js → common-DVM_onKu.js} +15 -15
- package/dist/{common-DNADUU3_.js.map → common-DVM_onKu.js.map} +1 -1
- package/dist/common-vnMIelAE.js.map +1 -1
- package/dist/components/common/EventInterceptor.js +1 -1
- package/dist/components/index.js +24 -24
- package/dist/components/v1/action-row/ActionRow.js +1 -1
- package/dist/components/v1/button/Button.js +24 -24
- package/dist/components/v1/button/ButtonKit.js +24 -24
- package/dist/components/v1/modal/Modal.js +24 -24
- package/dist/components/v1/modal/ModalKit.js +24 -24
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +24 -24
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +24 -24
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +24 -24
- package/dist/components/v1/select-menu/SelectMenu.js +24 -24
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +24 -24
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +24 -24
- package/dist/components/v2/container.js +1 -1
- package/dist/components/v2/file.js +1 -1
- package/dist/components/v2/index.js +6 -6
- package/dist/components/v2/media-gallery.js +1 -1
- package/dist/components/v2/section.js +1 -1
- package/dist/components/v2/separator.js +1 -1
- package/dist/components/v2/text-display.js +1 -1
- package/dist/config/config.d.ts +2 -2
- package/dist/config/config.js +24 -24
- package/dist/config/default.d.ts +1 -1
- package/dist/config/default.js +24 -24
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.js +24 -24
- package/dist/config/types.d.ts +1 -1
- package/dist/config/utils.d.ts +1 -1
- package/dist/{config-E42bG1RK.d.ts → config-nD7V_D7G.d.ts} +2 -2
- package/dist/constants-B5_Ta7PR.js.map +1 -1
- package/dist/{constants-DxfYtA6t.js → constants-BOOGN85p.js} +3 -2
- package/dist/{constants-DxfYtA6t.js.map → constants-BOOGN85p.js.map} +1 -1
- package/dist/{container-z621KfH5.js → container-C6GtfAPW.js} +3 -2
- package/dist/{container-z621KfH5.js.map → container-C6GtfAPW.js.map} +1 -1
- package/dist/context/async-context.d.ts +2 -2
- package/dist/context/async-context.js +26 -25
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +24 -24
- package/dist/{dotprops-C_4L7RPD.js → dotprops-tnhpnszJ.js} +2 -2
- package/dist/{dotprops-C_4L7RPD.js.map → dotprops-tnhpnszJ.js.map} +1 -1
- package/dist/element-Bak9llw_.js.map +1 -1
- package/dist/env-_68PRRoA.js.map +1 -1
- package/dist/error-codes-Ds0bnPvT.js.map +1 -1
- package/dist/events/CommandKitEventsChannel.d.ts +1 -1
- package/dist/events/CommandKitEventsChannel.js +1 -1
- package/dist/{feature-flags-BZ3mW1xe.js → feature-flags-3TQSPAVn.js} +10 -15
- package/dist/{feature-flags-BZ3mW1xe.js.map → feature-flags-3TQSPAVn.js.map} +1 -1
- package/dist/{file-DVZC0QXI.js → file-DVOELoNv.js} +3 -2
- package/dist/{file-DVZC0QXI.js.map → file-DVOELoNv.js.map} +1 -1
- package/dist/flags/FlagProvider.d.ts +1 -1
- package/dist/flags/FlagProvider.js.map +1 -1
- package/dist/flags/feature-flags.d.ts +1 -1
- package/dist/flags/feature-flags.js +25 -25
- package/dist/flags/store.d.ts +1 -1
- package/dist/flags/store.js +1 -1
- package/dist/{helpers-BUlN3lIz.js → helpers-CiuN7y5B.js} +3 -2
- package/dist/{helpers-BUlN3lIz.js.map → helpers-CiuN7y5B.js.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +31 -29
- package/dist/index.js.map +1 -1
- package/dist/{init-BjFLN5XX.js → init-Bo01I_h_.js} +11 -8
- package/dist/{init-BjFLN5XX.js.map → init-Bo01I_h_.js.map} +1 -1
- package/dist/kv/dotprops.js +1 -1
- package/dist/kv/kv.js +8 -10
- package/dist/kv/kv.js.map +1 -1
- package/dist/kv/serde.js +1 -1
- package/dist/logger/DefaultLogger.js +24 -24
- package/dist/logger/Logger.js +24 -24
- package/dist/{media-gallery-CIKypjbJ.js → media-gallery-zDtJ3kxb.js} +3 -2
- package/dist/{media-gallery-CIKypjbJ.js.map → media-gallery-zDtJ3kxb.js.map} +1 -1
- package/dist/plugins/CompilerPlugin.d.ts +1 -1
- package/dist/plugins/CompilerPlugin.js +2 -2
- package/dist/plugins/PluginCommon.d.ts +1 -1
- package/dist/plugins/PluginCommon.js +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +1 -1
- package/dist/plugins/RuntimePlugin.js +2 -2
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +24 -24
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +24 -24
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +24 -24
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +24 -24
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +24 -24
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/{resolve-file-url-DYjaxg_S.js → resolve-file-url-ChIyw-Vf.js} +4 -4
- package/dist/{resolve-file-url-DYjaxg_S.js.map → resolve-file-url-ChIyw-Vf.js.map} +1 -1
- package/dist/{section-CuYr0Inu.js → section-DlvrDoJK.js} +4 -4
- package/dist/{section-CuYr0Inu.js.map → section-DlvrDoJK.js.map} +1 -1
- package/dist/{separator-DLdWBjSN.js → separator-DL6QH5H1.js} +4 -4
- package/dist/{separator-DLdWBjSN.js.map → separator-DL6QH5H1.js.map} +1 -1
- package/dist/{serde-CHySNpFr.js → serde-Cc8iUa9J.js} +2 -2
- package/dist/{serde-CHySNpFr.js.map → serde-Cc8iUa9J.js.map} +1 -1
- package/dist/{signals-r7qPAvOR.js → signals-ChFMD7mB.js} +2 -2
- package/dist/{signals-r7qPAvOR.js.map → signals-ChFMD7mB.js.map} +1 -1
- package/dist/{store-CiqLHedg.js → store-Hcgz7DSt.js} +3 -2
- package/dist/{store-CiqLHedg.js.map → store-Hcgz7DSt.js.map} +1 -1
- package/dist/{text-display--p2-BoUa.js → text-display-DbMumig_.js} +3 -2
- package/dist/{text-display--p2-BoUa.js.map → text-display-DbMumig_.js.map} +1 -1
- package/dist/{type-checker-1Iu1jJcy.js → type-checker-M1NIIoWL.js} +7 -5
- package/dist/{type-checker-1Iu1jJcy.js.map → type-checker-M1NIIoWL.js.map} +1 -1
- package/dist/{types-package-DrnIdWLg.js → types-package-BWArjyBF.js} +7 -4
- package/dist/{types-package-DrnIdWLg.js.map → types-package-BWArjyBF.js.map} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/dev-hooks.d.ts +1 -1
- package/dist/utils/dev-hooks.js +24 -24
- package/dist/utils/resolve-file-url.js +1 -1
- package/dist/utils/types-package.js +1 -1
- package/dist/utils/useful-stuff/async-queue.js.map +1 -1
- package/dist/utils/useful-stuff/mutex.js +1 -2
- package/dist/utils/useful-stuff/mutex.js.map +1 -1
- package/dist/utils/useful-stuff/ratelimiter.js +2 -4
- package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
- package/dist/utils/useful-stuff/semaphore.js +2 -4
- package/dist/utils/useful-stuff/semaphore.js.map +1 -1
- package/dist/utils/utilities.js +24 -24
- package/dist/utils/warn-unstable.js.map +1 -1
- package/dist/utils-DCSnVAZ6.js.map +1 -1
- package/dist/utils-KsNof0Xz.js.map +1 -1
- package/dist/{version-DBXZ4wRb.js → version-CphQqt4J.js} +2 -2
- package/dist/{version-DBXZ4wRb.js.map → version-CphQqt4J.js.map} +1 -1
- package/dist/version.js +1 -1
- package/hooks.cjs +2 -0
- package/package.json +2 -2
- package/dist/commandkit-BPtNCbV8.js.map +0 -1
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
-
const require_colors = require('./colors-
|
|
2
|
+
const require_colors = require('./colors-DL3ucTiT.js');
|
|
3
3
|
const require_error_codes = require('./error-codes-Ds0bnPvT.js');
|
|
4
4
|
const require_element = require('./element-Bak9llw_.js');
|
|
5
|
-
const require_EventInterceptor = require('./EventInterceptor-
|
|
5
|
+
const require_EventInterceptor = require('./EventInterceptor-CQEXyUTp.js');
|
|
6
6
|
const require_constants = require('./constants-B5_Ta7PR.js');
|
|
7
|
-
const require_CompilerPlugin = require('./CompilerPlugin-
|
|
8
|
-
const require_RuntimePlugin = require('./RuntimePlugin-
|
|
9
|
-
const require_resolve_file_url = require('./resolve-file-url-
|
|
7
|
+
const require_CompilerPlugin = require('./CompilerPlugin-M8r3yNAl.js');
|
|
8
|
+
const require_RuntimePlugin = require('./RuntimePlugin-BUecuBIU.js');
|
|
9
|
+
const require_resolve_file_url = require('./resolve-file-url-ChIyw-Vf.js');
|
|
10
10
|
const require_utils = require('./utils-KsNof0Xz.js');
|
|
11
|
-
const require_types_package = require('./types-package-
|
|
12
|
-
const require_constants$1 = require('./constants-
|
|
13
|
-
const require_EventWorkerContext = require('./EventWorkerContext-
|
|
14
|
-
const require_signals = require('./signals-
|
|
15
|
-
const require_MessageCommandParser = require('./MessageCommandParser-
|
|
16
|
-
const require_CommandsRouter = require('./CommandsRouter-
|
|
17
|
-
const require_EventsRouter = require('./EventsRouter-
|
|
18
|
-
const require_common = require('./common-
|
|
19
|
-
const require_CommandKitEventsChannel = require('./CommandKitEventsChannel-
|
|
20
|
-
const require_store = require('./store-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
const require_types_package = require('./types-package-BWArjyBF.js');
|
|
12
|
+
const require_constants$1 = require('./constants-BOOGN85p.js');
|
|
13
|
+
const require_EventWorkerContext = require('./EventWorkerContext-Dq29tieI.js');
|
|
14
|
+
const require_signals = require('./signals-ChFMD7mB.js');
|
|
15
|
+
const require_MessageCommandParser = require('./MessageCommandParser-CEuO6Ex3.js');
|
|
16
|
+
const require_CommandsRouter = require('./CommandsRouter-DZAeB2v_.js');
|
|
17
|
+
const require_EventsRouter = require('./EventsRouter-Dzpm7ubq.js');
|
|
18
|
+
const require_common = require('./common-DVM_onKu.js');
|
|
19
|
+
const require_CommandKitEventsChannel = require('./CommandKitEventsChannel-B5vbINtP.js');
|
|
20
|
+
const require_store = require('./store-Hcgz7DSt.js');
|
|
21
|
+
let node_events = require("node:events");
|
|
22
|
+
node_events = require_chunk.__toESM(node_events);
|
|
23
|
+
let discord_js = require("discord.js");
|
|
24
|
+
discord_js = require_chunk.__toESM(discord_js);
|
|
25
|
+
let node_async_hooks = require("node:async_hooks");
|
|
26
|
+
node_async_hooks = require_chunk.__toESM(node_async_hooks);
|
|
27
|
+
let node_fs = require("node:fs");
|
|
28
|
+
node_fs = require_chunk.__toESM(node_fs);
|
|
29
|
+
let node_path = require("node:path");
|
|
30
|
+
node_path = require_chunk.__toESM(node_path);
|
|
31
|
+
let node_crypto = require("node:crypto");
|
|
32
|
+
node_crypto = require_chunk.__toESM(node_crypto);
|
|
33
|
+
let util = require("util");
|
|
34
|
+
util = require_chunk.__toESM(util);
|
|
29
35
|
|
|
30
36
|
//#region src/context/async-context.ts
|
|
31
37
|
const kCommandWorker = Symbol("commandkitCommandWorker");
|
|
@@ -62,8 +68,7 @@ function makeContextAwareFunction(env, fn, finalizer) {
|
|
|
62
68
|
const _fn = (...args) => {
|
|
63
69
|
return provideContext(env, async () => {
|
|
64
70
|
try {
|
|
65
|
-
|
|
66
|
-
return result;
|
|
71
|
+
return await fn(...args);
|
|
67
72
|
} catch (e) {
|
|
68
73
|
if (!require_error_codes.isCommandKitError(e)) env.setExecutionError(e);
|
|
69
74
|
else throw e;
|
|
@@ -89,8 +94,7 @@ function getCommandKit(strict = false) {
|
|
|
89
94
|
* @internal
|
|
90
95
|
*/
|
|
91
96
|
function getContext() {
|
|
92
|
-
|
|
93
|
-
return ctx;
|
|
97
|
+
return context.getStore();
|
|
94
98
|
}
|
|
95
99
|
/**
|
|
96
100
|
* Use current commandkit context. Throws an error if no context is found.
|
|
@@ -100,6 +104,12 @@ function useEnvironment() {
|
|
|
100
104
|
if (!ctx) throw new Error("No commandkit environment found. Please make sure you are inside commandkit handler.");
|
|
101
105
|
return ctx;
|
|
102
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Use the shared data store in the current environment. Throws an error if no context is found.
|
|
109
|
+
*/
|
|
110
|
+
function useStore() {
|
|
111
|
+
return useEnvironment().store;
|
|
112
|
+
}
|
|
103
113
|
|
|
104
114
|
//#endregion
|
|
105
115
|
//#region src/components/v1/button/ButtonKit.ts
|
|
@@ -196,15 +206,13 @@ var ButtonKit = class extends discord_js.ButtonBuilder {
|
|
|
196
206
|
}
|
|
197
207
|
#setupInteractionCollector() {
|
|
198
208
|
if (this.data.style === discord_js.ButtonStyle.Link || !this.#contextData || !this.#onClickHandler) return;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const interceptor = this.#getEventInterceptor();
|
|
202
|
-
this.#unsub = interceptor.subscribe(discord_js.Events.InteractionCreate, async (interaction) => {
|
|
209
|
+
if ((this.customId ?? null) === null) throw new TypeError("Cannot setup \"onClick\" handler on a button without a custom id.");
|
|
210
|
+
this.#unsub = this.#getEventInterceptor().subscribe(discord_js.Events.InteractionCreate, async (interaction) => {
|
|
203
211
|
var _this$contextData5, _this$unsub;
|
|
204
212
|
if (!interaction.isButton()) return;
|
|
205
|
-
const myCustomId
|
|
213
|
+
const myCustomId = this.customId ?? null;
|
|
206
214
|
const interactionCustomId = interaction.customId;
|
|
207
|
-
if (myCustomId
|
|
215
|
+
if (myCustomId && interactionCustomId !== myCustomId) return;
|
|
208
216
|
const filter = (_this$contextData5 = this.#contextData) === null || _this$contextData5 === void 0 ? void 0 : _this$contextData5.filter;
|
|
209
217
|
if (filter && !await filter(interaction)) return;
|
|
210
218
|
const handler = this.#onClickHandler;
|
|
@@ -1279,13 +1287,11 @@ var DefaultLogger = class {
|
|
|
1279
1287
|
break;
|
|
1280
1288
|
default: label = "[LOG]";
|
|
1281
1289
|
}
|
|
1282
|
-
|
|
1283
|
-
return `${coloredLabel} `;
|
|
1290
|
+
return `${TextBgColorMap[level](require_colors.colors_default.whiteBright(` ${label} `))} `;
|
|
1284
1291
|
}
|
|
1285
1292
|
_getPrefix(level) {
|
|
1286
1293
|
const timestamp = this._formatTime(/* @__PURE__ */ new Date());
|
|
1287
|
-
|
|
1288
|
-
return `${label}${require_colors.colors_default.dim(BoxChars.vertical)} ${require_colors.colors_default.dim(timestamp)}`;
|
|
1294
|
+
return `${this._getLevelLabel(level)}${require_colors.colors_default.dim(BoxChars.vertical)} ${require_colors.colors_default.dim(timestamp)}`;
|
|
1289
1295
|
}
|
|
1290
1296
|
_log(level, message) {
|
|
1291
1297
|
const prefix = this._getPrefix(level);
|
|
@@ -1406,8 +1412,7 @@ var CommandKitPluginRuntime = class {
|
|
|
1406
1412
|
* @param plugin The plugin to be fetched.
|
|
1407
1413
|
*/
|
|
1408
1414
|
get(plugin) {
|
|
1409
|
-
|
|
1410
|
-
return p;
|
|
1415
|
+
return this.plugins.find((p) => p instanceof plugin) ?? null;
|
|
1411
1416
|
}
|
|
1412
1417
|
/**
|
|
1413
1418
|
* Pre-loads the specified entrypoints for the given plugin.
|
|
@@ -1679,9 +1684,8 @@ var CommonDirectiveTransformer = class extends require_CompilerPlugin.CompilerPl
|
|
|
1679
1684
|
if (!this.options.enabled) return null;
|
|
1680
1685
|
if (!this.transformer) return null;
|
|
1681
1686
|
if (/\.json$/.test(params.id)) return null;
|
|
1682
|
-
const result = await this.transformer(params.code.toString(), params.id);
|
|
1683
1687
|
return {
|
|
1684
|
-
code:
|
|
1688
|
+
code: (await this.transformer(params.code.toString(), params.id)).contents,
|
|
1685
1689
|
map: null
|
|
1686
1690
|
};
|
|
1687
1691
|
}
|
|
@@ -1705,8 +1709,7 @@ var MacroPlugin = class extends require_CompilerPlugin.CompilerPlugin {
|
|
|
1705
1709
|
name = "MacroPlugin";
|
|
1706
1710
|
macroTransformer;
|
|
1707
1711
|
async activate() {
|
|
1708
|
-
|
|
1709
|
-
this.macroTransformer = new transform.MacroTransformer();
|
|
1712
|
+
this.macroTransformer = new (await (import("use-macro"))).MacroTransformer();
|
|
1710
1713
|
}
|
|
1711
1714
|
async deactivate() {
|
|
1712
1715
|
this.macroTransformer = null;
|
|
@@ -1729,7 +1732,7 @@ var MacroPlugin = class extends require_CompilerPlugin.CompilerPlugin {
|
|
|
1729
1732
|
*/
|
|
1730
1733
|
const defaultConfig = {
|
|
1731
1734
|
plugins: [new MacroPlugin({ enabled: true })],
|
|
1732
|
-
rolldownPlugins: [
|
|
1735
|
+
rolldownPlugins: [],
|
|
1733
1736
|
compilerOptions: {
|
|
1734
1737
|
macro: { development: false },
|
|
1735
1738
|
tsdown: {},
|
|
@@ -1838,13 +1841,11 @@ function getCurrentDirectory() {
|
|
|
1838
1841
|
* @returns An array of possible source directories.
|
|
1839
1842
|
*/
|
|
1840
1843
|
function getSourceDirectories() {
|
|
1841
|
-
|
|
1842
|
-
const locations = [
|
|
1844
|
+
return [
|
|
1843
1845
|
"src",
|
|
1844
1846
|
".commandkit",
|
|
1845
|
-
|
|
1847
|
+
getConfig().distDir
|
|
1846
1848
|
].map((dir) => (0, node_path.join)(require_constants.COMMANDKIT_CWD, dir));
|
|
1847
|
-
return locations;
|
|
1848
1849
|
}
|
|
1849
1850
|
/**
|
|
1850
1851
|
* Returns the path to the app directory.
|
|
@@ -1948,49 +1949,48 @@ function devOnly(fn) {
|
|
|
1948
1949
|
*/
|
|
1949
1950
|
function createProxy(target) {
|
|
1950
1951
|
let _target = target;
|
|
1951
|
-
const proxy = new Proxy(_target, {
|
|
1952
|
-
get(target$1, prop, receiver) {
|
|
1953
|
-
return Reflect.get(_target, prop, receiver);
|
|
1954
|
-
},
|
|
1955
|
-
set(target$1, prop, value, receiver) {
|
|
1956
|
-
return Reflect.set(_target, prop, value, receiver);
|
|
1957
|
-
},
|
|
1958
|
-
deleteProperty(target$1, prop) {
|
|
1959
|
-
return Reflect.deleteProperty(_target, prop);
|
|
1960
|
-
},
|
|
1961
|
-
has(target$1, prop) {
|
|
1962
|
-
return Reflect.has(_target, prop);
|
|
1963
|
-
},
|
|
1964
|
-
ownKeys(target$1) {
|
|
1965
|
-
return Reflect.ownKeys(_target);
|
|
1966
|
-
},
|
|
1967
|
-
getOwnPropertyDescriptor(target$1, prop) {
|
|
1968
|
-
return Reflect.getOwnPropertyDescriptor(_target, prop);
|
|
1969
|
-
},
|
|
1970
|
-
defineProperty(target$1, prop, attributes) {
|
|
1971
|
-
return Reflect.defineProperty(_target, prop, attributes);
|
|
1972
|
-
},
|
|
1973
|
-
getPrototypeOf(target$1) {
|
|
1974
|
-
return Reflect.getPrototypeOf(_target);
|
|
1975
|
-
},
|
|
1976
|
-
setPrototypeOf(target$1, proto) {
|
|
1977
|
-
return Reflect.setPrototypeOf(_target, proto);
|
|
1978
|
-
},
|
|
1979
|
-
isExtensible(target$1) {
|
|
1980
|
-
return Reflect.isExtensible(_target);
|
|
1981
|
-
},
|
|
1982
|
-
preventExtensions(target$1) {
|
|
1983
|
-
return Reflect.preventExtensions(_target);
|
|
1984
|
-
},
|
|
1985
|
-
apply(target$1, thisArg, args) {
|
|
1986
|
-
return Reflect.apply(_target, thisArg, args);
|
|
1987
|
-
},
|
|
1988
|
-
construct(target$1, args, newTarget) {
|
|
1989
|
-
return Reflect.construct(_target, args, newTarget);
|
|
1990
|
-
}
|
|
1991
|
-
});
|
|
1992
1952
|
return {
|
|
1993
|
-
proxy,
|
|
1953
|
+
proxy: new Proxy(_target, {
|
|
1954
|
+
get(target$1, prop, receiver) {
|
|
1955
|
+
return Reflect.get(_target, prop, receiver);
|
|
1956
|
+
},
|
|
1957
|
+
set(target$1, prop, value, receiver) {
|
|
1958
|
+
return Reflect.set(_target, prop, value, receiver);
|
|
1959
|
+
},
|
|
1960
|
+
deleteProperty(target$1, prop) {
|
|
1961
|
+
return Reflect.deleteProperty(_target, prop);
|
|
1962
|
+
},
|
|
1963
|
+
has(target$1, prop) {
|
|
1964
|
+
return Reflect.has(_target, prop);
|
|
1965
|
+
},
|
|
1966
|
+
ownKeys(target$1) {
|
|
1967
|
+
return Reflect.ownKeys(_target);
|
|
1968
|
+
},
|
|
1969
|
+
getOwnPropertyDescriptor(target$1, prop) {
|
|
1970
|
+
return Reflect.getOwnPropertyDescriptor(_target, prop);
|
|
1971
|
+
},
|
|
1972
|
+
defineProperty(target$1, prop, attributes) {
|
|
1973
|
+
return Reflect.defineProperty(_target, prop, attributes);
|
|
1974
|
+
},
|
|
1975
|
+
getPrototypeOf(target$1) {
|
|
1976
|
+
return Reflect.getPrototypeOf(_target);
|
|
1977
|
+
},
|
|
1978
|
+
setPrototypeOf(target$1, proto) {
|
|
1979
|
+
return Reflect.setPrototypeOf(_target, proto);
|
|
1980
|
+
},
|
|
1981
|
+
isExtensible(target$1) {
|
|
1982
|
+
return Reflect.isExtensible(_target);
|
|
1983
|
+
},
|
|
1984
|
+
preventExtensions(target$1) {
|
|
1985
|
+
return Reflect.preventExtensions(_target);
|
|
1986
|
+
},
|
|
1987
|
+
apply(target$1, thisArg, args) {
|
|
1988
|
+
return Reflect.apply(_target, thisArg, args);
|
|
1989
|
+
},
|
|
1990
|
+
construct(target$1, args, newTarget) {
|
|
1991
|
+
return Reflect.construct(_target, args, newTarget);
|
|
1992
|
+
}
|
|
1993
|
+
}),
|
|
1994
1994
|
setTarget(newTarget) {
|
|
1995
1995
|
_target = newTarget;
|
|
1996
1996
|
}
|
|
@@ -2011,7 +2011,8 @@ var CommandKitEnvironment = class {
|
|
|
2011
2011
|
marker: "",
|
|
2012
2012
|
markStart: 0,
|
|
2013
2013
|
markEnd: 0,
|
|
2014
|
-
context: null
|
|
2014
|
+
context: null,
|
|
2015
|
+
store: new discord_js.Collection()
|
|
2015
2016
|
};
|
|
2016
2017
|
/**
|
|
2017
2018
|
* Creates the commandkit execution environment.
|
|
@@ -2073,6 +2074,12 @@ var CommandKitEnvironment = class {
|
|
|
2073
2074
|
return this.#data.variables;
|
|
2074
2075
|
}
|
|
2075
2076
|
/**
|
|
2077
|
+
* The shared store for this environment
|
|
2078
|
+
*/
|
|
2079
|
+
get store() {
|
|
2080
|
+
return this.#data.store;
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2076
2083
|
* Register a deferred function.
|
|
2077
2084
|
* @param fn - The deferred function to register.
|
|
2078
2085
|
* @returns The deferred function id.
|
|
@@ -2251,12 +2258,13 @@ var Context = class Context {
|
|
|
2251
2258
|
* @param config The context parameters.
|
|
2252
2259
|
*/
|
|
2253
2260
|
constructor(commandkit$1, config) {
|
|
2261
|
+
var _config$environment;
|
|
2254
2262
|
this.commandkit = commandkit$1;
|
|
2255
2263
|
this.config = config;
|
|
2256
2264
|
this.interaction = config.interaction;
|
|
2257
2265
|
this.message = config.message;
|
|
2258
2266
|
this.client = commandkit$1.client;
|
|
2259
|
-
this.#store = config.store ??
|
|
2267
|
+
this.#store = ((_config$environment = config.environment) === null || _config$environment === void 0 ? void 0 : _config$environment.store) ?? config.store ?? new discord_js.Collection();
|
|
2260
2268
|
this.command = config.command;
|
|
2261
2269
|
if (config.interaction) {
|
|
2262
2270
|
this.guild = config.interaction.guild;
|
|
@@ -2277,7 +2285,8 @@ var Context = class Context {
|
|
|
2277
2285
|
* This store is shared across all contexts in the same command execution, including the cloned contexts and middleware contexts.
|
|
2278
2286
|
*/
|
|
2279
2287
|
get store() {
|
|
2280
|
-
|
|
2288
|
+
var _this$config$environm;
|
|
2289
|
+
return ((_this$config$environm = this.config.environment) === null || _this$config$environm === void 0 ? void 0 : _this$config$environm.store) ?? this.#store;
|
|
2281
2290
|
}
|
|
2282
2291
|
/**
|
|
2283
2292
|
* Gets the name of the current command.
|
|
@@ -2290,13 +2299,8 @@ var Context = class Context {
|
|
|
2290
2299
|
* Gets the command options based on the execution mode.
|
|
2291
2300
|
*/
|
|
2292
2301
|
get options() {
|
|
2293
|
-
if (this.isMessage())
|
|
2294
|
-
|
|
2295
|
-
return parser.options;
|
|
2296
|
-
} else {
|
|
2297
|
-
const interaction = this.interaction;
|
|
2298
|
-
return interaction.options;
|
|
2299
|
-
}
|
|
2302
|
+
if (this.isMessage()) return this.config.messageCommandParser.options;
|
|
2303
|
+
else return this.interaction.options;
|
|
2300
2304
|
}
|
|
2301
2305
|
/**
|
|
2302
2306
|
* Whether this context was forwarded from another context. This happens when a command forwards its context to another command.
|
|
@@ -2419,12 +2423,11 @@ var Context = class Context {
|
|
|
2419
2423
|
*/
|
|
2420
2424
|
clone(config) {
|
|
2421
2425
|
if (!config) return new Context(this.commandkit, this.config);
|
|
2422
|
-
|
|
2426
|
+
return new Context(this.commandkit, {
|
|
2423
2427
|
...this.config,
|
|
2424
2428
|
...config,
|
|
2425
2429
|
store: this.#store
|
|
2426
2430
|
});
|
|
2427
|
-
return ctx;
|
|
2428
2431
|
}
|
|
2429
2432
|
/**
|
|
2430
2433
|
* Checks if this context is a middleware context.
|
|
@@ -2523,8 +2526,7 @@ var AppCommandRunner = class {
|
|
|
2523
2526
|
let result;
|
|
2524
2527
|
let stopMiddlewaresCalledInCmd = false;
|
|
2525
2528
|
if (!beforeMiddlewaresStopped) {
|
|
2526
|
-
const
|
|
2527
|
-
const fn = targetData[(options === null || options === void 0 ? void 0 : options.handler) || executionMode];
|
|
2529
|
+
const fn = prepared.command.data[(options === null || options === void 0 ? void 0 : options.handler) || executionMode];
|
|
2528
2530
|
if (!fn) Logger.warn(`Command ${prepared.command.command.name} has no handler for ${executionMode}`);
|
|
2529
2531
|
const analytics = commandkit$1.analytics;
|
|
2530
2532
|
if (fn) try {
|
|
@@ -2568,10 +2570,9 @@ var AppCommandRunner = class {
|
|
|
2568
2570
|
}, this.#finalizer.bind(this));
|
|
2569
2571
|
const executeCommand = runCommand != null ? runCommand(_executeCommand) : _executeCommand;
|
|
2570
2572
|
env.markStart(prepared.command.data.command.name);
|
|
2571
|
-
|
|
2573
|
+
if (!await commandkit$1.plugins.execute(async (ctx, plugin) => {
|
|
2572
2574
|
return plugin.executeCommand(ctx, env, source, prepared, executeCommand);
|
|
2573
|
-
});
|
|
2574
|
-
if (!res) result = await executeCommand();
|
|
2575
|
+
})) result = await executeCommand();
|
|
2575
2576
|
} catch (e) {
|
|
2576
2577
|
if (require_error_codes.isErrorType(e, require_error_codes.CommandKitErrorCodes.StopMiddlewares)) {
|
|
2577
2578
|
stopMiddlewaresCalledInCmd = true;
|
|
@@ -2653,25 +2654,23 @@ var CommandRegistrar = class {
|
|
|
2653
2654
|
* Gets the commands data.
|
|
2654
2655
|
*/
|
|
2655
2656
|
getCommandsData() {
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
return commands.flatMap((cmd) => {
|
|
2659
|
-
const json$1 = "toJSON" in cmd.data.command ? cmd.data.command.toJSON() : cmd.data.command;
|
|
2657
|
+
return this.commandkit.commandHandler.getCommandsArray().flatMap((cmd) => {
|
|
2658
|
+
const json = "toJSON" in cmd.data.command ? cmd.data.command.toJSON() : cmd.data.command;
|
|
2660
2659
|
const __metadata = cmd.metadata ?? cmd.data.metadata;
|
|
2661
2660
|
const collections = [{
|
|
2662
|
-
...json
|
|
2661
|
+
...json,
|
|
2663
2662
|
__metadata
|
|
2664
2663
|
}];
|
|
2665
|
-
if (cmd.data.userContextMenu && json
|
|
2666
|
-
...json
|
|
2664
|
+
if (cmd.data.userContextMenu && json.type !== discord_js.ApplicationCommandType.User) collections.push({
|
|
2665
|
+
...json,
|
|
2667
2666
|
type: discord_js.ApplicationCommandType.User,
|
|
2668
2667
|
options: void 0,
|
|
2669
2668
|
description_localizations: void 0,
|
|
2670
2669
|
description: void 0,
|
|
2671
2670
|
__metadata
|
|
2672
2671
|
});
|
|
2673
|
-
if (cmd.data.messageContextMenu && json
|
|
2674
|
-
...json
|
|
2672
|
+
if (cmd.data.messageContextMenu && json.type !== discord_js.ApplicationCommandType.Message) collections.push({
|
|
2673
|
+
...json,
|
|
2675
2674
|
type: discord_js.ApplicationCommandType.Message,
|
|
2676
2675
|
description_localizations: void 0,
|
|
2677
2676
|
description: void 0,
|
|
@@ -2832,13 +2831,11 @@ async function beforeExecute(ctx) {
|
|
|
2832
2831
|
let missingBotPermissions = [];
|
|
2833
2832
|
if (typeof botPermissionsRequired === "string") botPermissionsRequired = [botPermissionsRequired];
|
|
2834
2833
|
if (!userPermissionsRequired.length && !botPermissionsRequired.length) return;
|
|
2835
|
-
if (userPermissionsRequired.length)
|
|
2836
|
-
const
|
|
2837
|
-
if (!hasPermission) missingUserPermissions.push(permission);
|
|
2834
|
+
if (userPermissionsRequired.length) {
|
|
2835
|
+
for (const permission of userPermissionsRequired) if (!(userPermissions === null || userPermissions === void 0 ? void 0 : userPermissions.has(permission))) missingUserPermissions.push(permission);
|
|
2838
2836
|
}
|
|
2839
|
-
if (botPermissionsRequired.length)
|
|
2840
|
-
const
|
|
2841
|
-
if (!hasPermission) missingBotPermissions.push(permission);
|
|
2837
|
+
if (botPermissionsRequired.length) {
|
|
2838
|
+
for (const permission of botPermissionsRequired) if (!(botPermissions === null || botPermissions === void 0 ? void 0 : botPermissions.has(permission))) missingBotPermissions.push(permission);
|
|
2842
2839
|
}
|
|
2843
2840
|
if (!missingUserPermissions.length && !missingBotPermissions.length) return;
|
|
2844
2841
|
const pattern = /([a-z])([A-Z])|([A-Z]+)([A-Z][a-z])/g;
|
|
@@ -2996,12 +2993,10 @@ var AppCommandHandler = class {
|
|
|
2996
2993
|
console.log(require_colors.colors_default.cyan(`${indent}${thisPrefix} ${require_colors.colors_default.bold(displayName)}`));
|
|
2997
2994
|
}
|
|
2998
2995
|
commands.forEach((cmd, cmdIndex) => {
|
|
2999
|
-
const
|
|
3000
|
-
const cmdPrefix = cmdIsLast ? "└─" : "├─";
|
|
2996
|
+
const cmdPrefix = cmdIndex === commands.length - 1 && !hasChildren ? "└─" : "├─";
|
|
3001
2997
|
const cmdIndent = category !== uncategorized ? childIndent : indent;
|
|
3002
2998
|
const name = cmd.data.command.name;
|
|
3003
|
-
const
|
|
3004
|
-
const middlewareIcon = hasMw ? require_colors.colors_default.magenta(" (λ)") : "";
|
|
2999
|
+
const middlewareIcon = cmd.command.middlewares.length > 0 ? require_colors.colors_default.magenta(" (λ)") : "";
|
|
3005
3000
|
console.log(`${require_colors.colors_default.green(`${cmdIndent}${cmdPrefix}`)} ${require_colors.colors_default.yellow(name)}${middlewareIcon}`);
|
|
3006
3001
|
});
|
|
3007
3002
|
if (hasChildren) {
|
|
@@ -3041,21 +3036,18 @@ var AppCommandHandler = class {
|
|
|
3041
3036
|
*/
|
|
3042
3037
|
registerCommandHandler() {
|
|
3043
3038
|
this.onInteraction ??= async (interaction) => {
|
|
3044
|
-
|
|
3039
|
+
if (await this.commandkit.plugins.execute(async (ctx, plugin) => {
|
|
3045
3040
|
return plugin.onBeforeInteraction(ctx, interaction);
|
|
3046
|
-
});
|
|
3047
|
-
if (
|
|
3048
|
-
const isCommandLike = interaction.isCommand() || interaction.isAutocomplete() || interaction.isUserContextMenuCommand() || interaction.isMessageContextMenuCommand();
|
|
3049
|
-
if (!isCommandLike) return;
|
|
3041
|
+
})) return;
|
|
3042
|
+
if (!(interaction.isCommand() || interaction.isAutocomplete() || interaction.isUserContextMenuCommand() || interaction.isMessageContextMenuCommand())) return;
|
|
3050
3043
|
const prepared = await this.prepareCommandRun(interaction);
|
|
3051
3044
|
if (!prepared) return;
|
|
3052
3045
|
return this.commandRunner.runCommand(prepared, interaction);
|
|
3053
3046
|
};
|
|
3054
3047
|
this.onMessageCreate ??= async (message) => {
|
|
3055
|
-
|
|
3048
|
+
if (await this.commandkit.plugins.execute(async (ctx, plugin) => {
|
|
3056
3049
|
return plugin.onBeforeMessageCommand(ctx, message);
|
|
3057
|
-
});
|
|
3058
|
-
if (success) return;
|
|
3050
|
+
})) return;
|
|
3059
3051
|
if (message.author.bot) return;
|
|
3060
3052
|
const prepared = await this.prepareCommandRun(message);
|
|
3061
3053
|
if (!prepared) return;
|
|
@@ -3072,8 +3064,7 @@ var AppCommandHandler = class {
|
|
|
3072
3064
|
*/
|
|
3073
3065
|
async prepareCommandRun(source, cmdName) {
|
|
3074
3066
|
var _loadedCommand$metada3, _loadedCommand$metada4;
|
|
3075
|
-
|
|
3076
|
-
if (config.disablePrefixCommands && source instanceof discord_js.Message) return null;
|
|
3067
|
+
if (getConfig().disablePrefixCommands && source instanceof discord_js.Message) return null;
|
|
3077
3068
|
let parser;
|
|
3078
3069
|
if (!cmdName) if (source instanceof discord_js.Message) {
|
|
3079
3070
|
if (source.author.bot) return null;
|
|
@@ -3087,24 +3078,20 @@ var AppCommandHandler = class {
|
|
|
3087
3078
|
return null;
|
|
3088
3079
|
}
|
|
3089
3080
|
if (source.guildId && ((_loadedCommand$metada = loadedCommand$1.metadata) === null || _loadedCommand$metada === void 0 || (_loadedCommand$metada = _loadedCommand$metada.guilds) === null || _loadedCommand$metada === void 0 ? void 0 : _loadedCommand$metada.length) && !((_loadedCommand$metada2 = loadedCommand$1.metadata) === null || _loadedCommand$metada2 === void 0 ? void 0 : _loadedCommand$metada2.guilds.includes(source.guildId))) return null;
|
|
3090
|
-
|
|
3091
|
-
return ((_json$options = json$1.options) === null || _json$options === void 0 ? void 0 : _json$options.reduce((acc, opt) => {
|
|
3081
|
+
return ((_json$options = ("toJSON" in loadedCommand$1.data.command ? loadedCommand$1.data.command.toJSON() : loadedCommand$1.data.command).options) === null || _json$options === void 0 ? void 0 : _json$options.reduce((acc, opt) => {
|
|
3092
3082
|
acc[opt.name] = opt.type;
|
|
3093
3083
|
return acc;
|
|
3094
3084
|
}, {})) ?? {};
|
|
3095
3085
|
});
|
|
3096
3086
|
try {
|
|
3097
|
-
|
|
3098
|
-
const parts = fullCommand.split(" ");
|
|
3099
|
-
cmdName = parts[0];
|
|
3087
|
+
cmdName = parser.getFullCommand().split(" ")[0];
|
|
3100
3088
|
} catch (e) {
|
|
3101
3089
|
if (require_error_codes.isErrorType(e, require_error_codes.CommandKitErrorCodes.InvalidCommandPrefix)) return null;
|
|
3102
3090
|
Logger.error`${e}`;
|
|
3103
3091
|
return null;
|
|
3104
3092
|
}
|
|
3105
3093
|
} else {
|
|
3106
|
-
|
|
3107
|
-
if (!isAnyCommand) return null;
|
|
3094
|
+
if (!(source.isChatInputCommand() || source.isAutocomplete() || source.isContextMenuCommand())) return null;
|
|
3108
3095
|
cmdName = source.commandName;
|
|
3109
3096
|
}
|
|
3110
3097
|
const loadedCommand = this.findCommandByName(cmdName);
|
|
@@ -3355,8 +3342,7 @@ var AppEventsHandler = class {
|
|
|
3355
3342
|
*/
|
|
3356
3343
|
getEvents() {
|
|
3357
3344
|
if (this.loadedEvents.size === 0) return [];
|
|
3358
|
-
|
|
3359
|
-
return events.map((event) => ({
|
|
3345
|
+
return this.loadedEvents.toJSON().map((event) => ({
|
|
3360
3346
|
name: event.name,
|
|
3361
3347
|
namespace: event.namespace,
|
|
3362
3348
|
onceListeners: event.listeners.filter((listener) => listener.once).length,
|
|
@@ -3378,8 +3364,7 @@ var AppEventsHandler = class {
|
|
|
3378
3364
|
await this.commandkit.plugins.execute((ctx, plugin) => {
|
|
3379
3365
|
return plugin.onBeforeEventsLoad(ctx);
|
|
3380
3366
|
});
|
|
3381
|
-
const
|
|
3382
|
-
const events = await router.scan();
|
|
3367
|
+
const events = await this.commandkit.eventsRouter.scan();
|
|
3383
3368
|
for (const event of Object.values(events)) {
|
|
3384
3369
|
const listeners = [];
|
|
3385
3370
|
for (const listener of event.listeners) {
|
|
@@ -3644,8 +3629,7 @@ function registerDevHooks(commandkit$1) {
|
|
|
3644
3629
|
function getVariableStore() {
|
|
3645
3630
|
const ctx = getContext();
|
|
3646
3631
|
if (!ctx) try {
|
|
3647
|
-
|
|
3648
|
-
return eventContext.variables;
|
|
3632
|
+
return require_EventWorkerContext.getEventWorkerContext().variables;
|
|
3649
3633
|
} catch {
|
|
3650
3634
|
return null;
|
|
3651
3635
|
}
|
|
@@ -3753,8 +3737,7 @@ var AnalyticsEngine = class {
|
|
|
3753
3737
|
}
|
|
3754
3738
|
}
|
|
3755
3739
|
async #doNotTrack(event) {
|
|
3756
|
-
|
|
3757
|
-
if (dnt) return true;
|
|
3740
|
+
if (getDoNotTrack()) return true;
|
|
3758
3741
|
if (this.#filter) return !this.#filter(this, event);
|
|
3759
3742
|
return false;
|
|
3760
3743
|
}
|
|
@@ -3944,8 +3927,7 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
3944
3927
|
* Loads all the plugins.
|
|
3945
3928
|
*/
|
|
3946
3929
|
async loadPlugins() {
|
|
3947
|
-
const
|
|
3948
|
-
const plugins = config.plugins.flat(2).filter((p) => require_RuntimePlugin.isRuntimePlugin(p));
|
|
3930
|
+
const plugins = (await loadConfigFile()).plugins.flat(2).filter((p) => require_RuntimePlugin.isRuntimePlugin(p));
|
|
3949
3931
|
if (!plugins.length) return;
|
|
3950
3932
|
for (const plugin of plugins) await this.plugins.softRegisterPlugin(plugin);
|
|
3951
3933
|
}
|
|
@@ -3993,8 +3975,7 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
3993
3975
|
return this;
|
|
3994
3976
|
}
|
|
3995
3977
|
async #init() {
|
|
3996
|
-
|
|
3997
|
-
if (!appDir$1) return;
|
|
3978
|
+
if (!this.getAppDirectory()) return;
|
|
3998
3979
|
const commandsPath = this.getPath("commands");
|
|
3999
3980
|
const events = this.getPath("events");
|
|
4000
3981
|
this.commandHandler = new AppCommandHandler(this);
|
|
@@ -4473,4 +4454,10 @@ Object.defineProperty(exports, 'useEnvironment', {
|
|
|
4473
4454
|
return useEnvironment;
|
|
4474
4455
|
}
|
|
4475
4456
|
});
|
|
4476
|
-
|
|
4457
|
+
Object.defineProperty(exports, 'useStore', {
|
|
4458
|
+
enumerable: true,
|
|
4459
|
+
get: function () {
|
|
4460
|
+
return useStore;
|
|
4461
|
+
}
|
|
4462
|
+
});
|
|
4463
|
+
//# sourceMappingURL=commandkit-Dy4V-Rk2.js.map
|