commandkit 1.0.0-dev.20250610125321 → 1.0.0-dev.20250611125312
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.map +1 -1
- package/dist/{ActionRow-D0wafJhZ.d.ts → ActionRow-DKnFVDME.d.ts} +6 -2
- package/dist/{Button-Bl5nbwTS.d.ts → Button-4ZUXdA56.d.ts} +11 -4
- package/dist/{ButtonKit-BSI7lCI0.d.ts → ButtonKit-C7r7RPNf.d.ts} +21 -2
- package/dist/{ChannelSelectMenuKit-L15A2jpT.d.ts → ChannelSelectMenuKit-BrXvBYNH.d.ts} +19 -3
- package/dist/{CommandKit-B-mjdP5x.d.ts → CommandKit-BkMUDbou.d.ts} +806 -9
- package/dist/{CommandKit-CnLBu_7m.js → CommandKit-C0W3U6jh.js} +621 -20
- package/dist/CommandKit-C0W3U6jh.js.map +1 -0
- package/dist/CommandKit.d.ts +25 -25
- package/dist/CommandKit.js +26 -26
- package/dist/CommandKitEventsChannel-BL_YN3Rm.js +87 -0
- package/dist/CommandKitEventsChannel-BL_YN3Rm.js.map +1 -0
- package/dist/CommandsRouter-CoOA7hkf.d.ts +146 -0
- package/dist/{CommandsRouter-BHaPno8o.js → CommandsRouter-DFRh47qD.js} +87 -1
- package/dist/CommandsRouter-DFRh47qD.js.map +1 -0
- package/dist/{CompilerPlugin-DrnhOC1c.js → CompilerPlugin-Bmy4izKz.js} +13 -2
- package/dist/CompilerPlugin-Bmy4izKz.js.map +1 -0
- package/dist/{CompilerPluginRuntime-C9wmPMQf.js → CompilerPluginRuntime-CgVU_gU0.js} +59 -1
- package/dist/CompilerPluginRuntime-CgVU_gU0.js.map +1 -0
- package/dist/DefaultLogger-pWzrSxMd.d.ts +60 -0
- package/dist/{EventInterceptor-Bvh05z7n.js → EventInterceptor-DWCHCGRh.js} +5 -1
- package/dist/EventInterceptor-DWCHCGRh.js.map +1 -0
- package/dist/{EventInterceptor-D_oEWSnF.d.ts → EventInterceptor-x-R2qshQ.d.ts} +8 -1
- package/dist/{EventWorkerContext-BYXamZ_4.d.ts → EventWorkerContext-DoFZMT8u.d.ts} +25 -2
- package/dist/{EventWorkerContext-BAKiTqJz.js → EventWorkerContext-DxfS_0fJ.js} +24 -1
- package/dist/EventWorkerContext-DxfS_0fJ.js.map +1 -0
- package/dist/ILogger-Cs5SFzqd.d.ts +34 -0
- package/dist/Logger-5ew_YS4P.d.ts +37 -0
- package/dist/{MentionableSelectMenuKit-BiUSKUtZ.d.ts → MentionableSelectMenuKit-CPTKqx-O.d.ts} +14 -3
- package/dist/{MessageCommandParser-D02-wpZN.js → MessageCommandParser-Cz-3I-wL.js} +70 -2
- package/dist/MessageCommandParser-Cz-3I-wL.js.map +1 -0
- package/dist/MessageCommandParser-ROLibZPX.d.ts +195 -0
- package/dist/{Modal-Cxm6cs5c.d.ts → Modal-C6UTRdYQ.d.ts} +8 -4
- package/dist/{ModalKit-CKtQ8eXW.d.ts → ModalKit-Btz58KYn.d.ts} +23 -2
- package/dist/{PluginCommon-DPqnQngK.js → PluginCommon-D_Z8Oiic.js} +23 -1
- package/dist/PluginCommon-D_Z8Oiic.js.map +1 -0
- package/dist/{RoleSelectMenuKit-BSMKkru2.d.ts → RoleSelectMenuKit-C26lU3sN.d.ts} +19 -3
- package/dist/{RuntimePlugin-BJoDa8ZR.js → RuntimePlugin-CehKbceZ.js} +5 -2
- package/dist/RuntimePlugin-CehKbceZ.js.map +1 -0
- package/dist/SelectMenu-Diy87_ba.d.ts +137 -0
- package/dist/{StringSelectMenuKit-B9FHTe48.d.ts → StringSelectMenuKit-Bhs8U6WI.d.ts} +19 -3
- package/dist/{UserSelectMenuKit-DiP0imyo.d.ts → UserSelectMenuKit-CfqFJdxz.d.ts} +19 -3
- package/dist/analytics/analytics-engine.d.ts +25 -25
- package/dist/analytics/analytics-engine.js +26 -26
- package/dist/analytics/analytics-provider.d.ts +25 -25
- package/dist/analytics/constants.d.ts +13 -0
- package/dist/analytics/constants.js +1 -1
- package/dist/analytics/utils.d.ts +13 -0
- package/dist/analytics/utils.js +26 -26
- package/dist/app/commands/AppCommandRunner.d.ts +25 -25
- package/dist/app/commands/AppCommandRunner.js +26 -26
- package/dist/app/commands/Context.d.ts +25 -25
- package/dist/app/commands/Context.js +26 -26
- package/dist/app/commands/MessageCommandParser.d.ts +1 -1
- package/dist/app/commands/MessageCommandParser.js +2 -2
- package/dist/app/commands/helpers.d.ts +1 -1
- package/dist/app/commands/helpers.js +1 -1
- package/dist/app/events/EventWorkerContext.d.ts +26 -26
- package/dist/app/events/EventWorkerContext.js +1 -1
- package/dist/app/handlers/AppCommandHandler.d.ts +25 -25
- package/dist/app/handlers/AppCommandHandler.js +26 -26
- package/dist/app/handlers/AppEventsHandler.d.ts +25 -25
- package/dist/app/handlers/AppEventsHandler.js +26 -26
- package/dist/app/index.d.ts +25 -25
- package/dist/app/index.js +27 -27
- package/dist/app/middleware/signals.js +2 -2
- package/dist/app/register/CommandRegistrar.d.ts +25 -25
- package/dist/app/register/CommandRegistrar.js +26 -26
- package/dist/app/router/CommandsRouter.d.ts +1 -1
- package/dist/app/router/CommandsRouter.js +1 -1
- package/dist/app/router/index.d.ts +1 -1
- package/dist/app/router/index.js +1 -1
- package/dist/{app-process-YbSHvqf-.js → app-process-Bo-LedP8.js} +11 -3
- package/dist/app-process-Bo-LedP8.js.map +1 -0
- package/dist/{build-BejatFZX.js → build-CWrpkal-.js} +14 -6
- package/dist/build-CWrpkal-.js.map +1 -0
- package/dist/cli/app-process.d.ts +5 -0
- package/dist/cli/app-process.js +5 -5
- package/dist/cli/build.d.ts +33 -25
- package/dist/cli/build.js +29 -29
- package/dist/cli/common.d.ts +57 -27
- package/dist/cli/common.js +3 -3
- package/dist/cli/development.d.ts +4 -0
- package/dist/cli/development.js +46 -30
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.d.ts +32 -0
- package/dist/cli/env.js +1 -1
- package/dist/cli/generators.d.ts +8 -0
- package/dist/cli/generators.js +27 -3
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.d.ts +4 -0
- package/dist/cli/information.js +17 -1
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.js +27 -27
- package/dist/cli/production.d.ts +9 -0
- package/dist/cli/production.js +39 -31
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.d.ts +2 -0
- package/dist/cli/type-checker.js +4 -4
- package/dist/cli/utils.d.ts +5 -0
- package/dist/cli/utils.js +1 -1
- package/dist/{common-pvPJVTfe.d.ts → common-DOCvOVC4.d.ts} +7 -2
- package/dist/{common-CW8v7gAn.js → common-Dasi9oKU.js} +44 -2
- package/dist/common-Dasi9oKU.js.map +1 -0
- package/dist/{common-CeO-vn8Y.js → common-vnMIelAE.js} +4 -1
- package/dist/common-vnMIelAE.js.map +1 -0
- package/dist/components/common/EventInterceptor.d.ts +1 -1
- package/dist/components/common/EventInterceptor.js +1 -1
- package/dist/components/common/element.d.ts +4 -4
- package/dist/components/common/element.js +2 -2
- package/dist/components/index.d.ts +20 -20
- package/dist/components/index.js +26 -26
- package/dist/components/v1/action-row/ActionRow.d.ts +5 -5
- package/dist/components/v1/button/Button.d.ts +5 -5
- package/dist/components/v1/button/Button.js +26 -26
- package/dist/components/v1/button/ButtonKit.d.ts +2 -2
- package/dist/components/v1/button/ButtonKit.js +26 -26
- package/dist/components/v1/modal/Modal.d.ts +5 -5
- package/dist/components/v1/modal/Modal.js +26 -26
- package/dist/components/v1/modal/ModalKit.d.ts +2 -2
- package/dist/components/v1/modal/ModalKit.js +26 -26
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/RoleSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/SelectMenu.d.ts +8 -8
- package/dist/components/v1/select-menu/SelectMenu.js +26 -26
- package/dist/components/v1/select-menu/StringSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/UserSelectMenuKit.d.ts +3 -3
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +26 -26
- package/dist/components/v1/select-menu/common.d.ts +2 -2
- package/dist/components/v2/common.d.ts +4 -0
- package/dist/components/v2/common.js +1 -1
- package/dist/components/v2/container.d.ts +1 -1
- package/dist/components/v2/container.js +2 -2
- package/dist/components/v2/file.d.ts +1 -1
- package/dist/components/v2/file.js +1 -1
- package/dist/components/v2/index.d.ts +6 -6
- package/dist/components/v2/index.js +7 -7
- package/dist/components/v2/media-gallery.d.ts +1 -1
- package/dist/components/v2/media-gallery.js +2 -2
- package/dist/components/v2/section.d.ts +1 -1
- package/dist/components/v2/section.js +2 -2
- package/dist/components/v2/separator.d.ts +1 -1
- package/dist/components/v2/separator.js +1 -1
- package/dist/components/v2/text-display.d.ts +1 -1
- package/dist/components/v2/text-display.js +1 -1
- package/dist/config/config.d.ts +28 -28
- package/dist/config/config.js +26 -26
- package/dist/config/default.d.ts +30 -27
- package/dist/config/default.js +26 -26
- package/dist/config/loader.d.ts +33 -27
- package/dist/config/loader.js +26 -26
- package/dist/config/types.d.ts +26 -26
- package/dist/config/utils.d.ts +27 -27
- package/dist/config/utils.js +3 -0
- package/dist/config/utils.js.map +1 -1
- package/dist/{config-BjmEZYpx.d.ts → config-aCpqqs1C.d.ts} +3 -3
- package/dist/constants-BTttfrm3.d.ts +42 -0
- package/dist/{constants-DWe181uQ.js → constants-CXwjhIYH.js} +9 -1
- package/dist/constants-CXwjhIYH.js.map +1 -0
- package/dist/{constants-CCqS_v55.js → constants-DDRctWlU.js} +14 -8
- package/dist/constants-DDRctWlU.js.map +1 -0
- package/dist/{container-CpuiLsZM.js → container-DCjIgp-B.js} +12 -2
- package/dist/container-DCjIgp-B.js.map +1 -0
- package/dist/container-DaUKKPm-.d.ts +24 -0
- package/dist/context/async-context.d.ts +25 -25
- package/dist/context/async-context.js +26 -26
- package/dist/context/environment.d.ts +25 -25
- package/dist/context/environment.js +26 -26
- package/dist/element-CAXu1XtK.d.ts +72 -0
- package/dist/{element-DcqNz1dV.js → element-Cq-LoDjk.js} +27 -2
- package/dist/element-Cq-LoDjk.js.map +1 -0
- package/dist/{env-ERkaRfQO.js → env-DemeP-uq.js} +33 -1
- package/dist/env-DemeP-uq.js.map +1 -0
- package/dist/{error-codes-C_UO39jz.js → error-codes-CxlUBdF6.js} +20 -1
- package/dist/error-codes-CxlUBdF6.js.map +1 -0
- package/dist/events/CommandKitEventsChannel.d.ts +25 -25
- package/dist/events/CommandKitEventsChannel.js +1 -1
- package/dist/{feature-flags-BFiGn38a.js → feature-flags-CLZLGnAs.js} +4 -4
- package/dist/feature-flags-CLZLGnAs.js.map +1 -0
- package/dist/file-DTrr-p09.d.ts +24 -0
- package/dist/{file-DE69SSOP.js → file-DVZC0QXI.js} +11 -1
- package/dist/file-DVZC0QXI.js.map +1 -0
- package/dist/flags/FlagProvider.d.ts +25 -25
- package/dist/flags/feature-flags.d.ts +25 -25
- package/dist/flags/feature-flags.js +27 -27
- package/dist/flags/store.d.ts +25 -25
- package/dist/flags/store.js +1 -1
- package/dist/{helpers-CswC9gKF.js → helpers-CnfXqF_k.js} +11 -1
- package/dist/helpers-CnfXqF_k.js.map +1 -0
- package/dist/helpers-Wg6P5fRQ.d.ts +23 -0
- package/dist/index.d.ts +34 -34
- package/dist/index.js +30 -31
- package/dist/{init-BDgyvx9E.js → init-_FwacDcI.js} +6 -6
- package/dist/{init-BDgyvx9E.js.map → init-_FwacDcI.js.map} +1 -1
- package/dist/logger/DefaultLogger.d.ts +2 -2
- package/dist/logger/DefaultLogger.js +26 -26
- package/dist/logger/ILogger.d.ts +1 -1
- package/dist/logger/Logger.d.ts +2 -2
- package/dist/logger/Logger.js +26 -26
- package/dist/media-gallery-BMsXSot3.d.ts +49 -0
- package/dist/{media-gallery-nUEHqKVF.js → media-gallery-CIKypjbJ.js} +27 -2
- package/dist/media-gallery-CIKypjbJ.js.map +1 -0
- package/dist/plugins/CompilerPlugin.d.ts +25 -25
- package/dist/plugins/CompilerPlugin.js +2 -2
- package/dist/plugins/PluginCommon.d.ts +25 -25
- package/dist/plugins/PluginCommon.js +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +25 -25
- package/dist/plugins/RuntimePlugin.js +2 -2
- package/dist/plugins/index.d.ts +25 -25
- package/dist/plugins/index.js +26 -26
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +25 -25
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +26 -26
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +25 -25
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +25 -25
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +26 -26
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +37 -25
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +26 -26
- package/dist/plugins/plugin-runtime/runtime.d.ts +25 -25
- package/dist/plugins/types.d.ts +25 -25
- package/dist/{section-D6t7tyEZ.js → section-CuYr0Inu.js} +22 -2
- package/dist/section-CuYr0Inu.js.map +1 -0
- package/dist/section-Dh_FhPeC.d.ts +45 -0
- package/dist/separator-CMf6Cyy5.d.ts +22 -0
- package/dist/{separator-DYAFK-Jj.js → separator-DLdWBjSN.js} +11 -1
- package/dist/separator-DLdWBjSN.js.map +1 -0
- package/dist/{signals-scJdEbly.js → signals-CSSSZAZ6.js} +2 -2
- package/dist/{signals-scJdEbly.js.map → signals-CSSSZAZ6.js.map} +1 -1
- package/dist/{store-Ci6ib2C9.js → store-x93NXUy_.js} +5 -1
- package/dist/store-x93NXUy_.js.map +1 -0
- package/dist/{text-display-Dy6JHB5X.js → text-display--p2-BoUa.js} +13 -1
- package/dist/text-display--p2-BoUa.js.map +1 -0
- package/dist/text-display-DRw3r_lK.d.ts +33 -0
- package/dist/{type-checker-CXVdS7qc.js → type-checker-P8oyY259.js} +6 -2
- package/dist/type-checker-P8oyY259.js.map +1 -0
- package/dist/{types-DjL43eQS.d.ts → types-DwmPE0nY.d.ts} +2 -2
- package/dist/{types-package-CTSNSM93.js → types-package-BpY3acyl.js} +8 -2
- package/dist/types-package-BpY3acyl.js.map +1 -0
- package/dist/types.d.ts +25 -25
- package/dist/{utilities-DQT4lzAB.d.ts → utilities-D_MFPmTe.d.ts} +45 -2
- package/dist/utils/colors.d.ts +2 -2
- package/dist/utils/constants.d.ts +2 -2
- package/dist/utils/constants.js +1 -2
- package/dist/utils/dev-hooks.d.ts +26 -26
- package/dist/utils/dev-hooks.js +26 -26
- package/dist/utils/error-codes.d.ts +34 -0
- package/dist/utils/error-codes.js +1 -1
- package/dist/utils/types-package.d.ts +6 -0
- package/dist/utils/types-package.js +2 -2
- package/dist/utils/utilities.d.ts +1 -1
- package/dist/utils/utilities.js +26 -26
- package/dist/utils/warn-unstable.d.ts +10 -0
- package/dist/utils/warn-unstable.js +1 -1
- package/dist/{utils-IYtoeTur.js → utils-C8a_hMvn.js} +5 -1
- package/dist/utils-C8a_hMvn.js.map +1 -0
- package/dist/{utils-VCdd7XhD.d.ts → utils-DS6OiGvg.d.ts} +12 -2
- package/dist/{version-BSsOib4x.js → version-IoXx-oYe.js} +5 -2
- package/dist/version-IoXx-oYe.js.map +1 -0
- package/dist/version.js +1 -1
- package/dist/{warn-unstable-DHLaxPC8.js → warn-unstable-CttBdmlS.js} +11 -1
- package/dist/warn-unstable-CttBdmlS.js.map +1 -0
- package/package.json +2 -2
- package/dist/CommandKit-CnLBu_7m.js.map +0 -1
- package/dist/CommandKitEventsChannel-B6LKgxmv.js +0 -44
- package/dist/CommandKitEventsChannel-B6LKgxmv.js.map +0 -1
- package/dist/CommandsRouter-BHaPno8o.js.map +0 -1
- package/dist/CommandsRouter-C7X-eXE2.d.ts +0 -67
- package/dist/CompilerPlugin-DrnhOC1c.js.map +0 -1
- package/dist/CompilerPluginRuntime-C9wmPMQf.js.map +0 -1
- package/dist/DefaultLogger-CcW-Fuq5.d.ts +0 -30
- package/dist/EventInterceptor-Bvh05z7n.js.map +0 -1
- package/dist/EventWorkerContext-BAKiTqJz.js.map +0 -1
- package/dist/ILogger-kqwb2kUu.d.ts +0 -11
- package/dist/Logger-B4B_URL-.d.ts +0 -17
- package/dist/MessageCommandParser-D02-wpZN.js.map +0 -1
- package/dist/MessageCommandParser-tzroBwij.d.ts +0 -62
- package/dist/PluginCommon-DPqnQngK.js.map +0 -1
- package/dist/RuntimePlugin-BJoDa8ZR.js.map +0 -1
- package/dist/SelectMenu-b7jgrkjO.d.ts +0 -36
- package/dist/app-process-YbSHvqf-.js.map +0 -1
- package/dist/build-BejatFZX.js.map +0 -1
- package/dist/common-CW8v7gAn.js.map +0 -1
- package/dist/common-CeO-vn8Y.js.map +0 -1
- package/dist/constants-BPWSrMkn.d.ts +0 -18
- package/dist/constants-CCqS_v55.js.map +0 -1
- package/dist/constants-DWe181uQ.js.map +0 -1
- package/dist/container-CpuiLsZM.js.map +0 -1
- package/dist/container-CwEATQy2.d.ts +0 -10
- package/dist/element-D_nyVwgB.d.ts +0 -30
- package/dist/element-DcqNz1dV.js.map +0 -1
- package/dist/env-ERkaRfQO.js.map +0 -1
- package/dist/error-codes-C_UO39jz.js.map +0 -1
- package/dist/feature-flags-BFiGn38a.js.map +0 -1
- package/dist/file-BdyYwkaI.d.ts +0 -10
- package/dist/file-DE69SSOP.js.map +0 -1
- package/dist/helpers-CswC9gKF.js.map +0 -1
- package/dist/helpers-DAmE106r.d.ts +0 -9
- package/dist/media-gallery-DCu02VXc.d.ts +0 -17
- package/dist/media-gallery-nUEHqKVF.js.map +0 -1
- package/dist/section-D6t7tyEZ.js.map +0 -1
- package/dist/section-fktaECHL.d.ts +0 -18
- package/dist/separator-CuesaLrC.d.ts +0 -8
- package/dist/separator-DYAFK-Jj.js.map +0 -1
- package/dist/store-Ci6ib2C9.js.map +0 -1
- package/dist/text-display-DNMwmGHJ.d.ts +0 -12
- package/dist/text-display-Dy6JHB5X.js.map +0 -1
- package/dist/type-checker-CXVdS7qc.js.map +0 -1
- package/dist/types-package-CTSNSM93.js.map +0 -1
- package/dist/utils/clone.d.ts +0 -5
- package/dist/utils/clone.js +0 -9
- package/dist/utils/clone.js.map +0 -1
- package/dist/utils/get-paths.d.ts +0 -6
- package/dist/utils/get-paths.js +0 -34
- package/dist/utils/get-paths.js.map +0 -1
- package/dist/utils-IYtoeTur.js.map +0 -1
- package/dist/version-BSsOib4x.js.map +0 -1
- package/dist/warn-unstable-DHLaxPC8.js.map +0 -1
|
@@ -2,25 +2,49 @@ const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
|
2
2
|
const node_async_hooks = require_chunk.__toESM(require("node:async_hooks"));
|
|
3
3
|
|
|
4
4
|
//#region src/plugins/plugin-runtime/CompilerPluginRuntime.ts
|
|
5
|
+
/**
|
|
6
|
+
* Enum representing the execution mode of a plugin.
|
|
7
|
+
* It can be either 'activate' or 'deactivate'.
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
5
10
|
var PluginExecutionMode = /* @__PURE__ */ function(PluginExecutionMode$1) {
|
|
6
11
|
PluginExecutionMode$1["Activate"] = "activate";
|
|
7
12
|
PluginExecutionMode$1["Deactivate"] = "deactivate";
|
|
8
13
|
return PluginExecutionMode$1;
|
|
9
14
|
}(PluginExecutionMode || {});
|
|
15
|
+
/**
|
|
16
|
+
* CompilerPluginRuntime is a runtime for managing compiler plugins in CommandKit.
|
|
17
|
+
*/
|
|
10
18
|
var CompilerPluginRuntime = class {
|
|
11
19
|
name = "CompilerPluginRuntime";
|
|
12
20
|
initialized = false;
|
|
13
21
|
templates = /* @__PURE__ */ new Map();
|
|
14
22
|
#pluginContext = new node_async_hooks.AsyncLocalStorage();
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new instance of CompilerPluginRuntime.
|
|
25
|
+
* @param plugins An array of compiler plugins to be managed by this runtime.
|
|
26
|
+
*/
|
|
15
27
|
constructor(plugins) {
|
|
16
28
|
this.plugins = plugins;
|
|
17
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns the plugins managed by this runtime.
|
|
32
|
+
*/
|
|
18
33
|
getPlugins() {
|
|
19
34
|
return this.plugins;
|
|
20
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Checks if there are no plugins registered in this runtime.
|
|
38
|
+
*/
|
|
21
39
|
isEmpty() {
|
|
22
40
|
return !this.plugins.length;
|
|
23
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Registers a template handler for a given name.
|
|
44
|
+
* This method must be called inside the activate() method of a plugin.
|
|
45
|
+
* @param name - The name of the template to register.
|
|
46
|
+
* @param handler - The handler function for the template.
|
|
47
|
+
*/
|
|
24
48
|
registerTemplate(name, handler) {
|
|
25
49
|
const ctx = this.#pluginContext.getStore();
|
|
26
50
|
if (!ctx || ctx.mode !== PluginExecutionMode.Activate) throw new Error("registerTemplate() must be called inside activate() method");
|
|
@@ -30,6 +54,11 @@ var CompilerPluginRuntime = class {
|
|
|
30
54
|
plugin: ctx.plugin
|
|
31
55
|
});
|
|
32
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Unregisters a template handler for a given name.
|
|
59
|
+
* This method must be called inside the deactivate() method of a plugin.
|
|
60
|
+
* @param name - The name of the template to unregister.
|
|
61
|
+
*/
|
|
33
62
|
unregisterTemplate(name) {
|
|
34
63
|
const ctx = this.#pluginContext.getStore();
|
|
35
64
|
if (!ctx || ctx.mode !== PluginExecutionMode.Deactivate) throw new Error("unregisterTemplate() must be called inside deactivate() method");
|
|
@@ -38,13 +67,29 @@ var CompilerPluginRuntime = class {
|
|
|
38
67
|
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}"`);
|
|
39
68
|
this.templates.delete(name);
|
|
40
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Retrieves a template handler by its name.
|
|
72
|
+
* @param name - The name of the template to retrieve.
|
|
73
|
+
* @returns The template handler if found, otherwise undefined.
|
|
74
|
+
*/
|
|
41
75
|
getTemplate(name) {
|
|
42
76
|
var _this$templates$get;
|
|
43
77
|
return (_this$templates$get = this.templates.get(name)) === null || _this$templates$get === void 0 ? void 0 : _this$templates$get.handler;
|
|
44
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns a map of all registered templates with their handlers.
|
|
81
|
+
* The keys are the template names and the values are the template handlers.
|
|
82
|
+
*/
|
|
45
83
|
getTemplates() {
|
|
46
84
|
return new Map(Array.from(this.templates.entries()).map(([name, entry]) => [name, entry.handler]));
|
|
47
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Transforms the given code using all registered plugins.
|
|
88
|
+
* Each plugin's transform method is called in sequence, allowing them to modify the code.
|
|
89
|
+
* @param code - The code to be transformed.
|
|
90
|
+
* @param id - The identifier for the code being transformed (e.g., filename).
|
|
91
|
+
* @returns An object containing the transformed code and an optional source map.
|
|
92
|
+
*/
|
|
48
93
|
async transform(code, id) {
|
|
49
94
|
let map = null;
|
|
50
95
|
for (const plugin of this.plugins) try {
|
|
@@ -65,6 +110,10 @@ var CompilerPluginRuntime = class {
|
|
|
65
110
|
map
|
|
66
111
|
};
|
|
67
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Initializes the plugin runtime by activating all registered plugins.
|
|
115
|
+
* This method should be called once to set up the plugins.
|
|
116
|
+
*/
|
|
68
117
|
async init() {
|
|
69
118
|
if (this.initialized) return;
|
|
70
119
|
for (const plugin of this.plugins) try {
|
|
@@ -80,6 +129,10 @@ var CompilerPluginRuntime = class {
|
|
|
80
129
|
}
|
|
81
130
|
this.initialized = true;
|
|
82
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Destroys the plugin runtime by deactivating all registered plugins.
|
|
134
|
+
* This method should be called when the runtime is no longer needed.
|
|
135
|
+
*/
|
|
83
136
|
async destroy() {
|
|
84
137
|
if (!this.initialized) return;
|
|
85
138
|
for (const plugin of this.plugins) try {
|
|
@@ -95,6 +148,11 @@ var CompilerPluginRuntime = class {
|
|
|
95
148
|
}
|
|
96
149
|
this.initialized = false;
|
|
97
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Converts the plugin runtime to a JSON representation.
|
|
153
|
+
* This is useful for serialization or debugging purposes.
|
|
154
|
+
* @returns An object containing the name of the runtime and the transform method.
|
|
155
|
+
*/
|
|
98
156
|
toJSON() {
|
|
99
157
|
return {
|
|
100
158
|
name: this.name,
|
|
@@ -110,4 +168,4 @@ Object.defineProperty(exports, 'CompilerPluginRuntime', {
|
|
|
110
168
|
return CompilerPluginRuntime;
|
|
111
169
|
}
|
|
112
170
|
});
|
|
113
|
-
//# sourceMappingURL=CompilerPluginRuntime-
|
|
171
|
+
//# sourceMappingURL=CompilerPluginRuntime-CgVU_gU0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompilerPluginRuntime-CgVU_gU0.js","names":[],"sources":["../src/plugins/plugin-runtime/CompilerPluginRuntime.ts"],"sourcesContent":["import {\n CompilerPlugin,\n MaybeFalsey,\n TransformedResult,\n TemplateHandler,\n} from '..';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\n/**\n * Interface representing a template entry in the plugin runtime.\n * It contains a handler function for the template and the plugin that owns it.\n * @private\n */\ninterface TemplateEntry {\n handler: TemplateHandler;\n plugin: CompilerPlugin;\n}\n\n/**\n * Enum representing the execution mode of a plugin.\n * It can be either 'activate' or 'deactivate'.\n * @private\n */\nenum PluginExecutionMode {\n Activate = 'activate',\n Deactivate = 'deactivate',\n}\n\n/**\n * Context for the plugin execution, containing the plugin and its execution mode.\n * This is used to manage the state of the plugin during activation and deactivation.\n * @private\n */\ntype PluginContext = {\n plugin: CompilerPlugin;\n mode: PluginExecutionMode;\n};\n\n/**\n * CompilerPluginRuntime is a runtime for managing compiler plugins in CommandKit.\n */\nexport class CompilerPluginRuntime {\n public readonly name = 'CompilerPluginRuntime';\n private initialized = false;\n private templates = new Map<string, TemplateEntry>();\n #pluginContext = new AsyncLocalStorage<PluginContext>();\n\n /**\n * Creates a new instance of CompilerPluginRuntime.\n * @param plugins An array of compiler plugins to be managed by this runtime.\n */\n public constructor(private readonly plugins: CompilerPlugin[]) {}\n\n /**\n * Returns the plugins managed by this runtime.\n */\n public getPlugins() {\n return this.plugins;\n }\n\n /**\n * Checks if there are no plugins registered in this runtime.\n */\n public isEmpty() {\n return !this.plugins.length;\n }\n\n /**\n * Registers a template handler for a given name.\n * This method must be called inside the activate() method of a plugin.\n * @param name - The name of the template to register.\n * @param handler - The handler function for the template.\n */\n public registerTemplate(name: string, handler: TemplateHandler) {\n const ctx = this.#pluginContext.getStore();\n\n if (!ctx || ctx.mode !== PluginExecutionMode.Activate) {\n throw new Error(\n 'registerTemplate() must be called inside activate() method',\n );\n }\n\n if (this.templates.has(name)) {\n throw new Error(`Template \"${name}\" already exists`);\n }\n\n this.templates.set(name, { handler, plugin: ctx.plugin });\n }\n\n /**\n * Unregisters a template handler for a given name.\n * This method must be called inside the deactivate() method of a plugin.\n * @param name - The name of the template to unregister.\n */\n public unregisterTemplate(name: string) {\n const ctx = this.#pluginContext.getStore();\n\n if (!ctx || ctx.mode !== PluginExecutionMode.Deactivate) {\n throw new Error(\n 'unregisterTemplate() must be called inside deactivate() method',\n );\n }\n\n const template = this.templates.get(name);\n if (!template) {\n throw new Error(`Template \"${name}\" does not exist`);\n }\n\n if (template.plugin !== ctx.plugin) {\n throw new Error(\n `Template \"${name}\" is owned by plugin \"${template.plugin.name}\" and cannot be unregistered by \"${ctx.plugin.name}\"`,\n );\n }\n\n this.templates.delete(name);\n }\n\n /**\n * Retrieves a template handler by its name.\n * @param name - The name of the template to retrieve.\n * @returns The template handler if found, otherwise undefined.\n */\n public getTemplate(name: string): TemplateHandler | undefined {\n return this.templates.get(name)?.handler;\n }\n\n /**\n * Returns a map of all registered templates with their handlers.\n * The keys are the template names and the values are the template handlers.\n */\n public getTemplates(): Map<string, TemplateHandler> {\n return new Map(\n Array.from(this.templates.entries()).map(([name, entry]) => [\n name,\n entry.handler,\n ]),\n );\n }\n\n /**\n * Transforms the given code using all registered plugins.\n * Each plugin's transform method is called in sequence, allowing them to modify the code.\n * @param code - The code to be transformed.\n * @param id - The identifier for the code being transformed (e.g., filename).\n * @returns An object containing the transformed code and an optional source map.\n */\n public async transform(\n code: string,\n id: string,\n ): Promise<{ code: string; map: string | null }> {\n let map: string | null = null;\n for (const plugin of this.plugins) {\n try {\n const res: MaybeFalsey<TransformedResult> = await plugin.transform?.({\n code,\n id,\n });\n\n if (!res) continue;\n\n if (res.code) {\n code = res.code;\n }\n\n if (res.map) {\n map = res.map;\n }\n } catch (e: any) {\n const err = e instanceof Error ? e : new Error(e);\n throw new Error(\n `Plugin ${plugin.name} failed to transform: ${err.message}`,\n );\n }\n }\n\n return {\n code,\n map,\n };\n }\n\n /**\n * Initializes the plugin runtime by activating all registered plugins.\n * This method should be called once to set up the plugins.\n */\n public async init() {\n if (this.initialized) return;\n\n for (const plugin of this.plugins) {\n try {\n await this.#pluginContext.run(\n {\n plugin,\n mode: PluginExecutionMode.Activate,\n },\n async () => {\n await plugin.activate?.(this);\n },\n );\n } catch (e: any) {\n console.error(\n `Plugin ${plugin.name} failed to activate with ${e?.stack || e}`,\n );\n }\n }\n\n this.initialized = true;\n }\n\n /**\n * Destroys the plugin runtime by deactivating all registered plugins.\n * This method should be called when the runtime is no longer needed.\n */\n public async destroy() {\n if (!this.initialized) return;\n\n for (const plugin of this.plugins) {\n try {\n await this.#pluginContext.run(\n {\n plugin,\n mode: PluginExecutionMode.Deactivate,\n },\n async () => {\n await plugin.deactivate?.(this);\n },\n );\n } catch (e: any) {\n console.error(\n `Plugin ${plugin.name} failed to deactivate with ${e?.stack || e}`,\n );\n }\n }\n\n this.initialized = false;\n }\n\n /**\n * Converts the plugin runtime to a JSON representation.\n * This is useful for serialization or debugging purposes.\n * @returns An object containing the name of the runtime and the transform method.\n */\n public toJSON() {\n return {\n name: this.name,\n transform: this.transform.bind(this),\n };\n }\n}\n"],"mappings":";;;;;;;;;AAuBA,IAAK,sEAAL;AACE;AACA;;AACF,EAHK;;;;AAkBL,IAAa,wBAAb,MAAmC;CACjC,AAAgB,OAAO;CACvB,AAAQ,cAAc;CACtB,AAAQ,4BAAY,IAAI;CACxB,iBAAiB,IAAI;;;;;CAMrB,AAAO,YAA6B,SAA2B;EAA3B;CAA4B;;;;CAKhE,AAAO,aAAa;AAClB,SAAO,KAAK;CACd;;;;CAKA,AAAO,UAAU;AACf,UAAQ,KAAK,QAAQ;CACvB;;;;;;;CAQA,AAAO,iBAAiB,MAAc,SAA0B;EAC9D,MAAM,MAAM,KAAK,eAAe,UAAU;AAE1C,OAAK,OAAO,IAAI,SAAS,oBAAoB,SAC3C,OAAM,IAAI,MACR;AAIJ,MAAI,KAAK,UAAU,IAAI,KAAK,CAC1B,OAAM,IAAI,OAAO,YAAY,KAAK;AAGpC,OAAK,UAAU,IAAI,MAAM;GAAE;GAAS,QAAQ,IAAI;EAAQ,EAAC;CAC3D;;;;;;CAOA,AAAO,mBAAmB,MAAc;EACtC,MAAM,MAAM,KAAK,eAAe,UAAU;AAE1C,OAAK,OAAO,IAAI,SAAS,oBAAoB,WAC3C,OAAM,IAAI,MACR;EAIJ,MAAM,WAAW,KAAK,UAAU,IAAI,KAAK;AACzC,OAAK,SACH,OAAM,IAAI,OAAO,YAAY,KAAK;AAGpC,MAAI,SAAS,WAAW,IAAI,OAC1B,OAAM,IAAI,OACP,YAAY,KAAK,wBAAwB,SAAS,OAAO,KAAK,mCAAmC,IAAI,OAAO,KAAK;AAItH,OAAK,UAAU,OAAO,KAAK;CAC7B;;;;;;CAOA,AAAO,YAAY,MAA2C;;AAC5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oEAA6B,EAAG,UAAS,EAAE,EAClE;EACH;AAGF,OAAK,cAAc;CACrB;;;;;;CAOA,AAAO,SAAS;AACd,SAAO;GACL,MAAM,KAAK;GACX,WAAW,KAAK,UAAU,KAAK,KAAK;EACrC;CACH;AACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ILogger } from "./ILogger-Cs5SFzqd.js";
|
|
2
|
+
|
|
3
|
+
//#region src/logger/DefaultLogger.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Default logger implementation that logs messages to the console.
|
|
7
|
+
* It formats the log messages with timestamps, log levels, and context information.
|
|
8
|
+
*/
|
|
9
|
+
declare class DefaultLogger implements ILogger {
|
|
10
|
+
stdout: NodeJS.WriteStream & {
|
|
11
|
+
fd: 1;
|
|
12
|
+
};
|
|
13
|
+
stderr: NodeJS.WriteStream & {
|
|
14
|
+
fd: 2;
|
|
15
|
+
};
|
|
16
|
+
private logger;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new instance of DefaultLogger.
|
|
19
|
+
* @param stdout The output stream for standard messages (default: process.stdout).
|
|
20
|
+
* @param stderr The output stream for error messages (default: process.stderr).
|
|
21
|
+
*/
|
|
22
|
+
constructor(stdout?: NodeJS.WriteStream & {
|
|
23
|
+
fd: 1;
|
|
24
|
+
}, stderr?: NodeJS.WriteStream & {
|
|
25
|
+
fd: 2;
|
|
26
|
+
});
|
|
27
|
+
private _formatTime;
|
|
28
|
+
private _getContext;
|
|
29
|
+
private _getLevelLabel;
|
|
30
|
+
private _getPrefix;
|
|
31
|
+
private _log;
|
|
32
|
+
/**
|
|
33
|
+
* Logs a debug message.
|
|
34
|
+
* @param args The message arguments to log.
|
|
35
|
+
*/
|
|
36
|
+
debug(...args: any[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* Logs an error message.
|
|
39
|
+
* @param args The message arguments to log.
|
|
40
|
+
*/
|
|
41
|
+
error(...args: any[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* Logs a default message.
|
|
44
|
+
* @param args The message arguments to log.
|
|
45
|
+
*/
|
|
46
|
+
log(...args: any[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* Logs an info message.
|
|
49
|
+
* @param args The message arguments to log.
|
|
50
|
+
*/
|
|
51
|
+
info(...args: any[]): void;
|
|
52
|
+
/**
|
|
53
|
+
* Logs a warning message.
|
|
54
|
+
* @param args The message arguments to log.
|
|
55
|
+
*/
|
|
56
|
+
warn(...args: any[]): void;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { DefaultLogger };
|
|
60
|
+
//# sourceMappingURL=DefaultLogger-pWzrSxMd.d.ts.map
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/components/common/EventInterceptor.ts
|
|
3
|
+
/**
|
|
4
|
+
* The event interceptor class that allows subscribing to events and handling them with custom logic.
|
|
5
|
+
* It also supports automatic cleanup of expired subscriptions.
|
|
6
|
+
*/
|
|
3
7
|
var EventInterceptor = class {
|
|
4
8
|
subscribers = /* @__PURE__ */ new Map();
|
|
5
9
|
globalHandlers = /* @__PURE__ */ new Map();
|
|
@@ -137,4 +141,4 @@ Object.defineProperty(exports, 'EventInterceptor', {
|
|
|
137
141
|
return EventInterceptor;
|
|
138
142
|
}
|
|
139
143
|
});
|
|
140
|
-
//# sourceMappingURL=EventInterceptor-
|
|
144
|
+
//# sourceMappingURL=EventInterceptor-DWCHCGRh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventInterceptor-DWCHCGRh.js","names":[],"sources":["../src/components/common/EventInterceptor.ts"],"sourcesContent":["import { Awaitable, Client, ClientEvents, Events } from 'discord.js';\n\nexport interface EventInterceptorContextData<E extends keyof ClientEvents> {\n /**\n * The filter to use for the collector.\n */\n filter?: (...args: ClientEvents[E]) => Awaitable<boolean>;\n /**\n * The duration (in ms) that the collector should run for.\n */\n time?: number;\n /**\n * If the collector should automatically reset the timer when a button is clicked.\n */\n autoReset?: boolean;\n /**\n * Whether the collector should run only once.\n */\n once?: boolean;\n /**\n * The handler to run when the collector ends.\n */\n onEnd?: (reason: string) => Awaitable<void>;\n /**\n * The handler to run upon an error.\n */\n onError?: EventInterceptorErrorHandler;\n}\n\n/**\n * The error handler for the event interceptor.\n */\nexport type EventInterceptorErrorHandler = (error: Error) => Awaitable<void>;\n\n/**\n * The event interceptor class that allows subscribing to events and handling them with custom logic.\n * It also supports automatic cleanup of expired subscriptions.\n */\nexport class EventInterceptor {\n private subscribers = new Map<\n keyof ClientEvents,\n Set<(...args: any[]) => void>\n >();\n private globalHandlers = new Map<\n keyof ClientEvents,\n (...args: any[]) => void\n >();\n private cleanupTimer: NodeJS.Timeout | null = null;\n\n /**\n * Creates the event interceptor.\n */\n public constructor(public readonly client: Client) {\n this.#cleanupLoop();\n }\n\n #cleanupLoop() {\n if (this.cleanupTimer) clearInterval(this.cleanupTimer);\n\n this.cleanupTimer = setInterval(() => {\n for (const [event, handlers] of this.subscribers) {\n for (const handler of handlers) {\n const options = Reflect.get(\n handler,\n 'options',\n ) as EventInterceptorContextData<keyof ClientEvents> & {\n registeredAt: number;\n };\n\n const isExpired =\n options.time && Date.now() - options.registeredAt > options.time;\n\n if (isExpired) {\n this.unsubscribe(event, handler, 'time');\n }\n }\n }\n }, 60_000).unref();\n }\n\n /**\n * Destroys the event interceptor.\n */\n public destroy(): void {\n if (this.cleanupTimer) {\n clearInterval(this.cleanupTimer);\n this.cleanupTimer = null;\n }\n\n for (const [event, handlers] of this.subscribers) {\n for (const handler of handlers) {\n this.unsubscribe(event, handler, 'destroy');\n }\n }\n\n this.subscribers.clear();\n this.globalHandlers.clear();\n }\n\n /**\n * Whether the event has subscribers.\n * @param event The event to check.\n */\n public hasSubscribers(event: keyof ClientEvents): boolean {\n return this.subscribers.has(event);\n }\n\n /**\n * Returns the number of subscribers for the event.\n * @param event The event to check.\n */\n public getSubscriberCount(event: keyof ClientEvents): number {\n const handlers = this.subscribers.get(event);\n return handlers?.size ?? 0;\n }\n\n /**\n * Whether the event has global handlers.\n */\n public hasGlobalHandlers(): boolean {\n return this.globalHandlers.size > 0;\n }\n\n /**\n * Returns the number of global handlers.\n */\n public getGlobalHandlersCount(): number {\n return this.subscribers.size;\n }\n\n /**\n * Subscribes to an event.\n * @param event The event to subscribe to.\n * @param listener The listener to call when the event is emitted.\n * @returns A function to unsubscribe from the event.\n */\n public subscribe<Event extends keyof ClientEvents>(\n event: Event,\n listener: (...args: ClientEvents[Event]) => void,\n options?: EventInterceptorContextData<Event>,\n ): () => void {\n if (!this.subscribers.has(event)) {\n this.subscribers.set(event, new Set());\n this.client.on(event, this.createGlobalHandler(event));\n this.client.setMaxListeners(this.client.getMaxListeners() + 1);\n }\n\n options ??= {};\n\n // @ts-ignore\n options.registeredAt = Date.now();\n\n Reflect.set(listener, 'options', options);\n\n this.subscribers.get(event)!.add(listener);\n\n return () => {\n this.unsubscribe(event, listener);\n };\n }\n\n /**\n * Unsubscribes from an event.\n * @param event The event to unsubscribe from.\n */\n public unsubscribe<Event extends keyof ClientEvents>(\n event: Event,\n listener: (...args: ClientEvents[Event]) => void,\n reason?: string,\n ): void {\n const handlers = this.subscribers.get(event);\n if (!handlers) return;\n\n handlers.delete(listener);\n\n if (handlers.size < 1) {\n this.subscribers.delete(event);\n this.client.removeListener(event, this.globalHandlers.get(event)!);\n this.globalHandlers.delete(event);\n this.client.setMaxListeners(\n Math.max(this.client.getMaxListeners() - 1, 0),\n );\n }\n\n Reflect.get(listener, 'options').onEnd?.(reason ?? 'unsubscribe');\n }\n\n /**\n * Creates a global handler for the event.\n * @param event The event to create a global handler for.\n * @returns The global handler.\n */\n private createGlobalHandler<Event extends keyof ClientEvents>(\n event: Event,\n ): (...args: ClientEvents[Event]) => void {\n if (this.globalHandlers.has(event)) {\n return this.globalHandlers.get(event)!;\n }\n\n const handler = async (...args: ClientEvents[Event]) => {\n const subscribers = this.subscribers.get(event);\n if (subscribers && subscribers.size > 0) {\n for (const subscriber of subscribers) {\n const options = Reflect.get(\n subscriber,\n 'options',\n ) as EventInterceptorContextData<Event> & { registeredAt: number };\n\n const isExpired =\n options.time && Date.now() - options.registeredAt > options.time;\n\n if (isExpired) {\n this.unsubscribe(event, subscriber, 'time');\n continue;\n }\n\n if (options.autoReset) {\n options.registeredAt = Date.now();\n }\n\n if (options.filter && !(await options.filter(...args))) {\n continue;\n }\n\n try {\n await subscriber(...args);\n } catch (e) {\n if (options.onError) {\n await options.onError(<Error>e);\n } else {\n throw e;\n }\n } finally {\n if (options.once) {\n this.unsubscribe(event, subscriber, 'once');\n }\n }\n }\n }\n };\n\n this.globalHandlers.set(event, handler);\n\n return handler;\n }\n}\n"],"mappings":";;;;;;AAsCA,IAAa,mBAAb,MAA8B;CAC5B,AAAQ,8BAAc,IAAI;CAI1B,AAAQ,iCAAiB,IAAI;CAI7B,AAAQ,eAAsC;;;;CAK9C,AAAO,YAA4B,QAAgB;EAAhB;AACjC,OAAK,cAAc;CACrB;CAEA,eAAe;AACb,MAAI,KAAK,aAAc,eAAc,KAAK,aAAa;AAEvD,OAAK,eAAe,YAAY,MAAM;AACpC,QAAK,MAAM,CAAC,OAAO,SAAS,IAAI,KAAK,YACnC,MAAK,MAAM,WAAW,UAAU;IAC9B,MAAM,UAAU,QAAQ,IACtB,SACA,UACD;IAID,MAAM,YACN,QAAQ,QAAQ,KAAK,KAAK,GAAG,QAAQ,eAAe,QAAQ;AAE5D,QAAI,UACF,MAAK,YAAY,OAAO,SAAS,OAAO;GAE5C;EAEH,GAAE,IAAO,CAAC,OAAO;CACpB;;;;CAKA,AAAO,UAAgB;AACrB,MAAI,KAAK,cAAc;AACrB,iBAAc,KAAK,aAAa;AAChC,QAAK,eAAe;EACtB;AAEA,OAAK,MAAM,CAAC,OAAO,SAAS,IAAI,KAAK,YACnC,MAAK,MAAM,WAAW,SACpB,MAAK,YAAY,OAAO,SAAS,UAAU;AAI/C,OAAK,YAAY,OAAO;AACxB,OAAK,eAAe,OAAO;CAC7B;;;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,MAAM,CAChC,QAAO,KAAK,eAAe,IAAI,MAAM;EAGvC,MAAM,UAAU,OAAO,GAAG,SAA8B;GACtD,MAAM,cAAc,KAAK,YAAY,IAAI,MAAM;AAC/C,OAAI,eAAe,YAAY,OAAO,EACpC,MAAK,MAAM,cAAc,aAAa;IACpC,MAAM,UAAU,QAAQ,IACtB,YACA,UACD;IAED,MAAM,YACN,QAAQ,QAAQ,KAAK,KAAK,GAAG,QAAQ,eAAe,QAAQ;AAE5D,QAAI,WAAW;AACb,UAAK,YAAY,OAAO,YAAY,OAAO;AAC3C;IACF;AAEA,QAAI,QAAQ,UACV,SAAQ,eAAe,KAAK,KAAK;AAGnC,QAAI,QAAQ,WAAY,MAAM,QAAQ,OAAO,GAAG,KAAK,CACnD;AAGF,QAAI;AACF,WAAM,WAAW,GAAG,KAAK;IAC1B,SAAQ,GAAG;AACV,SAAI,QAAQ,QACV,OAAM,QAAQ,QAAgB,EAAC;SAE/B,OAAM;IAET,UAAS;AACR,SAAI,QAAQ,KACV,MAAK,YAAY,OAAO,YAAY,OAAO;IAE/C;GACF;EAEH;AAED,OAAK,eAAe,IAAI,OAAO,QAAQ;AAEvC,SAAO;CACT;AACF"}
|
|
@@ -27,7 +27,14 @@ interface EventInterceptorContextData<E extends keyof ClientEvents> {
|
|
|
27
27
|
*/
|
|
28
28
|
onError?: EventInterceptorErrorHandler;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The error handler for the event interceptor.
|
|
32
|
+
*/
|
|
30
33
|
type EventInterceptorErrorHandler = (error: Error) => Awaitable<void>;
|
|
34
|
+
/**
|
|
35
|
+
* The event interceptor class that allows subscribing to events and handling them with custom logic.
|
|
36
|
+
* It also supports automatic cleanup of expired subscriptions.
|
|
37
|
+
*/
|
|
31
38
|
declare class EventInterceptor {
|
|
32
39
|
#private;
|
|
33
40
|
readonly client: Client;
|
|
@@ -81,4 +88,4 @@ declare class EventInterceptor {
|
|
|
81
88
|
}
|
|
82
89
|
//#endregion
|
|
83
90
|
export { EventInterceptor, EventInterceptorContextData, EventInterceptorErrorHandler };
|
|
84
|
-
//# sourceMappingURL=EventInterceptor-
|
|
91
|
+
//# sourceMappingURL=EventInterceptor-x-R2qshQ.d.ts.map
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { CommandKit } from "./CommandKit-
|
|
1
|
+
import { CommandKit } from "./CommandKit-BkMUDbou.js";
|
|
2
2
|
import { ParsedEvent } from "./EventsRouter-BacqK6z3.js";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
|
|
5
5
|
//#region src/app/events/EventWorkerContext.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context object containing information about the currently executing event.
|
|
9
|
+
*/
|
|
6
10
|
interface EventWorkerContext {
|
|
7
11
|
event: string;
|
|
8
12
|
namespace: string | null;
|
|
@@ -11,10 +15,29 @@ interface EventWorkerContext {
|
|
|
11
15
|
arguments: any[];
|
|
12
16
|
variables: Map<string, any>;
|
|
13
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Async local storage for event worker context.
|
|
20
|
+
*/
|
|
14
21
|
declare const eventWorkerContext: AsyncLocalStorage<EventWorkerContext>;
|
|
22
|
+
/**
|
|
23
|
+
* Runs a callback within an event worker context.
|
|
24
|
+
* @param context - The event worker context
|
|
25
|
+
* @param callback - The callback to execute
|
|
26
|
+
* @returns The result of the callback
|
|
27
|
+
*/
|
|
15
28
|
declare function runInEventWorkerContext<T>(context: EventWorkerContext, callback: () => T): T;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the current event worker context.
|
|
31
|
+
* @returns The current event worker context
|
|
32
|
+
* @throws Error if no context is found
|
|
33
|
+
*/
|
|
16
34
|
declare function getEventWorkerContext(): EventWorkerContext;
|
|
35
|
+
/**
|
|
36
|
+
* Type guard to check if an object is an event worker context.
|
|
37
|
+
* @param worker - The object to check
|
|
38
|
+
* @returns True if the object is an event worker context
|
|
39
|
+
*/
|
|
17
40
|
declare function isEventWorkerContext(worker: any): worker is EventWorkerContext;
|
|
18
41
|
//#endregion
|
|
19
42
|
export { EventWorkerContext, eventWorkerContext, getEventWorkerContext, isEventWorkerContext, runInEventWorkerContext };
|
|
20
|
-
//# sourceMappingURL=EventWorkerContext-
|
|
43
|
+
//# sourceMappingURL=EventWorkerContext-DoFZMT8u.d.ts.map
|
|
@@ -2,17 +2,40 @@ const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
|
2
2
|
const node_async_hooks = require_chunk.__toESM(require("node:async_hooks"));
|
|
3
3
|
|
|
4
4
|
//#region src/app/events/EventWorkerContext.ts
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
5
9
|
const kEventWorker = Symbol("commandkitEventWorker");
|
|
10
|
+
/**
|
|
11
|
+
* Async local storage for event worker context.
|
|
12
|
+
*/
|
|
6
13
|
const eventWorkerContext = new node_async_hooks.AsyncLocalStorage();
|
|
14
|
+
/**
|
|
15
|
+
* Runs a callback within an event worker context.
|
|
16
|
+
* @param context - The event worker context
|
|
17
|
+
* @param callback - The callback to execute
|
|
18
|
+
* @returns The result of the callback
|
|
19
|
+
*/
|
|
7
20
|
function runInEventWorkerContext(context, callback) {
|
|
8
21
|
Reflect.set(context, kEventWorker, true);
|
|
9
22
|
return eventWorkerContext.run(context, callback);
|
|
10
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets the current event worker context.
|
|
26
|
+
* @returns The current event worker context
|
|
27
|
+
* @throws Error if no context is found
|
|
28
|
+
*/
|
|
11
29
|
function getEventWorkerContext() {
|
|
12
30
|
const context = eventWorkerContext.getStore();
|
|
13
31
|
if (!context) throw new Error("Event worker context not found");
|
|
14
32
|
return context;
|
|
15
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Type guard to check if an object is an event worker context.
|
|
36
|
+
* @param worker - The object to check
|
|
37
|
+
* @returns True if the object is an event worker context
|
|
38
|
+
*/
|
|
16
39
|
function isEventWorkerContext(worker) {
|
|
17
40
|
return worker && Reflect.get(worker, kEventWorker) === true;
|
|
18
41
|
}
|
|
@@ -42,4 +65,4 @@ Object.defineProperty(exports, 'runInEventWorkerContext', {
|
|
|
42
65
|
return runInEventWorkerContext;
|
|
43
66
|
}
|
|
44
67
|
});
|
|
45
|
-
//# sourceMappingURL=EventWorkerContext-
|
|
68
|
+
//# sourceMappingURL=EventWorkerContext-DxfS_0fJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventWorkerContext-DxfS_0fJ.js","names":[],"sources":["../src/app/events/EventWorkerContext.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\nimport { ParsedEvent } from '../router';\nimport { CommandKit } from '../../CommandKit';\n\n/**\n * Context object containing information about the currently executing event.\n */\nexport interface EventWorkerContext {\n event: string;\n namespace: string | null;\n data: ParsedEvent;\n commandkit: CommandKit;\n arguments: any[];\n variables: Map<string, any>;\n}\n\n/**\n * @private\n * @internal\n */\nconst kEventWorker = Symbol('commandkitEventWorker');\n\n/**\n * Async local storage for event worker context.\n */\nexport const eventWorkerContext = new AsyncLocalStorage<EventWorkerContext>();\n\n/**\n * Runs a callback within an event worker context.\n * @param context - The event worker context\n * @param callback - The callback to execute\n * @returns The result of the callback\n */\nexport function runInEventWorkerContext<T>(\n context: EventWorkerContext,\n callback: () => T,\n): T {\n Reflect.set(context, kEventWorker, true);\n\n return eventWorkerContext.run(context, callback);\n}\n\n/**\n * Gets the current event worker context.\n * @returns The current event worker context\n * @throws Error if no context is found\n */\nexport function getEventWorkerContext(): EventWorkerContext {\n const context = eventWorkerContext.getStore();\n\n if (!context) {\n throw new Error('Event worker context not found');\n }\n\n return context;\n}\n\n/**\n * Type guard to check if an object is an event worker context.\n * @param worker - The object to check\n * @returns True if the object is an event worker context\n */\nexport function isEventWorkerContext(\n worker: any,\n): worker is EventWorkerContext {\n return worker && Reflect.get(worker, kEventWorker) === true;\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,eAAe,OAAO,wBAAwB;;;;AAKpD,MAAa,qBAAqB,IAAI;;;;;;;AAQtC,SAAgB,wBAChB,SACA,UACI;AACF,SAAQ,IAAI,SAAS,cAAc,KAAK;AAExC,QAAO,mBAAmB,IAAI,SAAS,SAAS;AAClD;;;;;;AAOA,SAAgB,wBAA4C;CAC1D,MAAM,UAAU,mBAAmB,UAAU;AAE7C,MAAK,QACH,OAAM,IAAI,MAAM;AAGlB,QAAO;AACT;;;;;;AAOA,SAAgB,qBAChB,QAC+B;AAC7B,QAAO,UAAU,QAAQ,IAAI,QAAQ,aAAa,KAAK;AACzD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/logger/ILogger.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* ILogger interface for logging functionality.
|
|
4
|
+
*/
|
|
5
|
+
interface ILogger {
|
|
6
|
+
/**
|
|
7
|
+
* Logs a message with the default log level.
|
|
8
|
+
* @param args The message to log.
|
|
9
|
+
*/
|
|
10
|
+
log(...args: any[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Logs an error message.
|
|
13
|
+
* @param args The error message to log.
|
|
14
|
+
*/
|
|
15
|
+
error(...args: any[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Logs a warning message.
|
|
18
|
+
* @param args The warning message to log.
|
|
19
|
+
*/
|
|
20
|
+
warn(...args: any[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Logs an informational message.
|
|
23
|
+
* @param args The informational message to log.
|
|
24
|
+
*/
|
|
25
|
+
info(...args: any[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Logs a debug message.
|
|
28
|
+
* @param args The debug message to log.
|
|
29
|
+
*/
|
|
30
|
+
debug(...args: any[]): void;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ILogger };
|
|
34
|
+
//# sourceMappingURL=ILogger-Cs5SFzqd.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ILogger } from "./ILogger-Cs5SFzqd.js";
|
|
2
|
+
|
|
3
|
+
//#region src/logger/Logger.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Options for configuring the CommandKit logger.
|
|
7
|
+
*/
|
|
8
|
+
interface CommandKitLoggerOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The logger provider to use.
|
|
11
|
+
*/
|
|
12
|
+
provider: ILogger;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Logger implementation for CommandKit.
|
|
16
|
+
*/
|
|
17
|
+
interface LoggerImpl extends ILogger {
|
|
18
|
+
/**
|
|
19
|
+
* Configures the logger with the specified options.
|
|
20
|
+
* @param options The logger options to apply.
|
|
21
|
+
*/
|
|
22
|
+
configure(options: CommandKitLoggerOptions): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new logger instance with the specified options.
|
|
26
|
+
* @param options The options for configuring the logger.
|
|
27
|
+
* @returns A new logger instance.
|
|
28
|
+
*/
|
|
29
|
+
declare function createLogger(options: CommandKitLoggerOptions): LoggerImpl;
|
|
30
|
+
/**
|
|
31
|
+
* Default logger instance for CommandKit. This logger uses the DefaultLogger as its provider.
|
|
32
|
+
* The provider can be replaced with a custom logger implementation using the `configure` method.
|
|
33
|
+
*/
|
|
34
|
+
declare const Logger: LoggerImpl;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { CommandKitLoggerOptions, Logger, LoggerImpl, createLogger };
|
|
37
|
+
//# sourceMappingURL=Logger-5ew_YS4P.d.ts.map
|
package/dist/{MentionableSelectMenuKit-BiUSKUtZ.d.ts → MentionableSelectMenuKit-CPTKqx-O.d.ts}
RENAMED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { EventInterceptorErrorHandler } from "./EventInterceptor-
|
|
2
|
-
import { CommandKitSelectMenuBuilderInteractionCollectorDispatch, CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, CommandKitSelectMenuBuilderOnEnd, OnSelectMenuKitSubmit, SelectMenuKitPredicate } from "./common-
|
|
1
|
+
import { EventInterceptorErrorHandler } from "./EventInterceptor-x-R2qshQ.js";
|
|
2
|
+
import { CommandKitSelectMenuBuilderInteractionCollectorDispatch, CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, CommandKitSelectMenuBuilderOnEnd, OnSelectMenuKitSubmit, SelectMenuKitPredicate } from "./common-DOCvOVC4.js";
|
|
3
3
|
import { MentionableSelectMenuBuilder, MentionableSelectMenuInteraction } from "discord.js";
|
|
4
4
|
|
|
5
5
|
//#region src/components/v1/select-menu/MentionableSelectMenuKit.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Type for the handler function that is called when the mentionable select menu is submitted.
|
|
9
|
+
*/
|
|
6
10
|
type OnMentionableSelectMenuKitSubmit = OnSelectMenuKitSubmit<MentionableSelectMenuInteraction, MentionableSelectMenuKit>;
|
|
11
|
+
/**
|
|
12
|
+
* Type for the predicate function that filters mentionable select menu interactions.
|
|
13
|
+
* It receives a MentionableSelectMenuInteraction and returns a boolean or a Promise that resolves to a boolean.
|
|
14
|
+
*/
|
|
7
15
|
type MentionableSelectMenuKitPredicate = SelectMenuKitPredicate<MentionableSelectMenuInteraction>;
|
|
8
16
|
declare class MentionableSelectMenuKit extends MentionableSelectMenuBuilder {
|
|
9
17
|
#private;
|
|
@@ -44,8 +52,11 @@ declare class MentionableSelectMenuKit extends MentionableSelectMenuBuilder {
|
|
|
44
52
|
*/
|
|
45
53
|
filter(predicate: SelectMenuKitPredicate<MentionableSelectMenuInteraction>): this;
|
|
46
54
|
private get customId();
|
|
55
|
+
/**
|
|
56
|
+
* Disposes of the mentionable select menu kit, cleaning up any resources used by the interaction collector.
|
|
57
|
+
*/
|
|
47
58
|
dispose(): this;
|
|
48
59
|
}
|
|
49
60
|
//#endregion
|
|
50
61
|
export { MentionableSelectMenuKit, MentionableSelectMenuKitPredicate, OnMentionableSelectMenuKitSubmit };
|
|
51
|
-
//# sourceMappingURL=MentionableSelectMenuKit-
|
|
62
|
+
//# sourceMappingURL=MentionableSelectMenuKit-CPTKqx-O.d.ts.map
|
|
@@ -1,41 +1,94 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
-
const require_error_codes = require('./error-codes-
|
|
2
|
+
const require_error_codes = require('./error-codes-CxlUBdF6.js');
|
|
3
3
|
const discord_js = require_chunk.__toESM(require("discord.js"));
|
|
4
4
|
|
|
5
5
|
//#region src/app/commands/MessageCommandParser.ts
|
|
6
|
+
/**
|
|
7
|
+
* Parses message content into structured command data with options and subcommands.
|
|
8
|
+
*/
|
|
6
9
|
var MessageCommandParser = class {
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
7
14
|
#parsed = null;
|
|
15
|
+
/**
|
|
16
|
+
* @private
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
8
19
|
#options = null;
|
|
20
|
+
/**
|
|
21
|
+
* @private
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
9
24
|
#args = [];
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new message command parser.
|
|
27
|
+
* @param message - The Discord message to parse
|
|
28
|
+
* @param prefix - Array of valid command prefixes
|
|
29
|
+
* @param schema - Function that returns the options schema for a command
|
|
30
|
+
*/
|
|
10
31
|
constructor(message, prefix, schema) {
|
|
11
32
|
this.message = message;
|
|
12
33
|
this.prefix = prefix;
|
|
13
34
|
this.schema = schema;
|
|
14
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the parsed command arguments.
|
|
38
|
+
* @returns Array of command arguments
|
|
39
|
+
*/
|
|
15
40
|
getArgs() {
|
|
16
41
|
this.parse();
|
|
17
42
|
return this.#args;
|
|
18
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Gets the message command options object for easy access to typed option values.
|
|
46
|
+
*/
|
|
19
47
|
get options() {
|
|
20
48
|
if (!this.#options) this.#options = new MessageCommandOptions(this);
|
|
21
49
|
return this.#options;
|
|
22
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Gets a specific option value by name.
|
|
53
|
+
* @param name - The option name
|
|
54
|
+
* @returns The option value or undefined if not found
|
|
55
|
+
*/
|
|
23
56
|
getOption(name) {
|
|
24
57
|
var _this$parse$options$f;
|
|
25
58
|
return (_this$parse$options$f = this.parse().options.find((o) => o.name === name)) === null || _this$parse$options$f === void 0 ? void 0 : _this$parse$options$f.value;
|
|
26
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets the main command name.
|
|
62
|
+
* @returns The command name
|
|
63
|
+
*/
|
|
27
64
|
getCommand() {
|
|
28
65
|
return this.parse().command;
|
|
29
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Gets the subcommand name if present.
|
|
69
|
+
* @returns The subcommand name or undefined
|
|
70
|
+
*/
|
|
30
71
|
getSubcommand() {
|
|
31
72
|
return this.parse().subcommand;
|
|
32
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Gets the subcommand group name if present.
|
|
76
|
+
* @returns The subcommand group name or undefined
|
|
77
|
+
*/
|
|
33
78
|
getSubcommandGroup() {
|
|
34
79
|
return this.parse().subcommandGroup;
|
|
35
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Gets the prefix used in the message.
|
|
83
|
+
* @returns The matched prefix or undefined
|
|
84
|
+
*/
|
|
36
85
|
getPrefix() {
|
|
37
86
|
for (const p of this.prefix) if (this.message.content.startsWith(p)) return p;
|
|
38
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Gets the full command including subcommand group and subcommand.
|
|
90
|
+
* @returns The complete command string
|
|
91
|
+
*/
|
|
39
92
|
getFullCommand() {
|
|
40
93
|
return [
|
|
41
94
|
this.getCommand(),
|
|
@@ -43,6 +96,10 @@ var MessageCommandParser = class {
|
|
|
43
96
|
this.getSubcommand()
|
|
44
97
|
].filter((v) => v).join(" ");
|
|
45
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Parses the message content into structured command data.
|
|
101
|
+
* @returns The parsed command data
|
|
102
|
+
*/
|
|
46
103
|
parse() {
|
|
47
104
|
if (this.#parsed) return this.#parsed;
|
|
48
105
|
const content = this.message.content;
|
|
@@ -126,10 +183,21 @@ var MessageCommandParser = class {
|
|
|
126
183
|
return this.#parsed;
|
|
127
184
|
}
|
|
128
185
|
};
|
|
186
|
+
/**
|
|
187
|
+
* Provides typed access to message command options with methods similar to Discord.js interaction options.
|
|
188
|
+
*/
|
|
129
189
|
var MessageCommandOptions = class {
|
|
190
|
+
/**
|
|
191
|
+
* Creates a new message command options instance.
|
|
192
|
+
* @param parser - The message command parser instance
|
|
193
|
+
*/
|
|
130
194
|
constructor(parser) {
|
|
131
195
|
this.parser = parser;
|
|
132
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* @private
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
133
201
|
assertOption(name, required = false) {
|
|
134
202
|
const option = this.parser.getOption(name);
|
|
135
203
|
if (required && option === void 0) throw new Error(`Option "${name}" is required.`);
|
|
@@ -197,4 +265,4 @@ Object.defineProperty(exports, 'MessageCommandParser', {
|
|
|
197
265
|
return MessageCommandParser;
|
|
198
266
|
}
|
|
199
267
|
});
|
|
200
|
-
//# sourceMappingURL=MessageCommandParser-
|
|
268
|
+
//# sourceMappingURL=MessageCommandParser-Cz-3I-wL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageCommandParser-Cz-3I-wL.js","names":[],"sources":["../src/app/commands/MessageCommandParser.ts"],"sourcesContent":["import { Channel } from 'diagnostics_channel';\nimport {\n Message,\n ApplicationCommandOptionType,\n GuildMember,\n Attachment,\n User,\n Role,\n CommandInteractionOption,\n} from 'discord.js';\nimport {\n CommandKitErrorCodes,\n createCommandKitError,\n} from '../../utils/error-codes';\n\n/**\n * Represents a parsed message command with its components.\n */\nexport interface ParsedMessageCommand {\n command: string;\n options: { name: string; value: unknown }[];\n subcommand?: string;\n subcommandGroup?: string;\n}\n\n/**\n * Schema defining the types of options for a message command.\n */\nexport type MessageCommandOptionsSchema = Record<\n string,\n ApplicationCommandOptionType\n>;\n\n/**\n * Parses message content into structured command data with options and subcommands.\n */\nexport class MessageCommandParser {\n /**\n * @private\n * @internal\n */\n #parsed: ParsedMessageCommand | null = null;\n\n /**\n * @private\n * @internal\n */\n #options: MessageCommandOptions | null = null;\n\n /**\n * @private\n * @internal\n */\n #args: string[] = [];\n\n /**\n * Creates a new message command parser.\n * @param message - The Discord message to parse\n * @param prefix - Array of valid command prefixes\n * @param schema - Function that returns the options schema for a command\n */\n public constructor(\n public message: Message,\n private prefix: string[],\n private schema: (command: string) => MessageCommandOptionsSchema,\n ) {}\n\n /**\n * Gets the parsed command arguments.\n * @returns Array of command arguments\n */\n public getArgs() {\n void this.parse();\n return this.#args;\n }\n\n /**\n * Gets the message command options object for easy access to typed option values.\n */\n public get options() {\n if (!this.#options) {\n this.#options = new MessageCommandOptions(this);\n }\n\n return this.#options;\n }\n\n /**\n * Gets a specific option value by name.\n * @param name - The option name\n * @returns The option value or undefined if not found\n */\n public getOption<T>(name: string): T | undefined {\n return this.parse().options.find((o) => o.name === name)?.value as T;\n }\n\n /**\n * Gets the main command name.\n * @returns The command name\n */\n public getCommand(): string {\n return this.parse().command;\n }\n\n /**\n * Gets the subcommand name if present.\n * @returns The subcommand name or undefined\n */\n public getSubcommand(): string | undefined {\n return this.parse().subcommand;\n }\n\n /**\n * Gets the subcommand group name if present.\n * @returns The subcommand group name or undefined\n */\n public getSubcommandGroup(): string | undefined {\n return this.parse().subcommandGroup;\n }\n\n /**\n * Gets the prefix used in the message.\n * @returns The matched prefix or undefined\n */\n public getPrefix() {\n for (const p of this.prefix) {\n if (this.message.content.startsWith(p)) {\n return p;\n }\n }\n }\n\n /**\n * Gets the full command including subcommand group and subcommand.\n * @returns The complete command string\n */\n public getFullCommand() {\n return [this.getCommand(), this.getSubcommandGroup(), this.getSubcommand()]\n .filter((v) => v)\n .join(' ');\n }\n\n /**\n * Parses the message content into structured command data.\n * @returns The parsed command data\n */\n public parse(): ParsedMessageCommand {\n if (this.#parsed) {\n return this.#parsed;\n }\n\n const content = this.message.content;\n\n const prefix = this.getPrefix();\n\n if (!prefix) {\n throw createCommandKitError(CommandKitErrorCodes.InvalidCommandPrefix);\n }\n\n const parts = content.slice(prefix.length).trim().split(' ');\n const command = parts.shift();\n\n this.#args = parts;\n\n let subcommandGroup: string | undefined;\n let subcommand: string | undefined;\n\n if (command?.includes(':')) {\n const [, group, cmd] = command.split(':');\n\n if (!cmd && group) {\n subcommand = group;\n } else if (cmd && group) {\n subcommandGroup = group;\n subcommand = cmd;\n }\n }\n\n const schema = this.schema(\n [command, subcommandGroup, subcommand].filter(Boolean).join(' ').trim(),\n );\n\n const options = parts\n .map((part) => {\n try {\n const [name, value] = part.split(':');\n\n if (!(name in schema)) return null;\n\n switch (schema[name]) {\n case ApplicationCommandOptionType.Boolean:\n return { name, value: value === 'true' };\n case ApplicationCommandOptionType.Integer:\n return { name, value: parseInt(value, 10) };\n case ApplicationCommandOptionType.Number:\n return { name, value: parseFloat(value) };\n case ApplicationCommandOptionType.String:\n return { name, value };\n case ApplicationCommandOptionType.User:\n return {\n name,\n value: this.message.mentions.users.find((u) => {\n return u.id === value.replace(/[<@!>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Channel:\n return {\n name,\n value: this.message.mentions.channels.find((c) => {\n return c.id === value.replace(/[<#>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Role:\n return {\n name,\n value: this.message.mentions.roles.find((r) => {\n return r.id === value.replace(/[<@&>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Attachment:\n return {\n name,\n value: this.message.attachments.find((a) => {\n return a.name === value;\n }),\n };\n default:\n return null;\n }\n } catch {\n // Invalid option\n return null;\n }\n })\n .filter((v) => v !== null);\n\n this.#parsed = {\n command: command!,\n options,\n subcommand,\n subcommandGroup,\n };\n\n return this.#parsed;\n }\n}\n\n/**\n * Provides typed access to message command options with methods similar to Discord.js interaction options.\n */\nexport class MessageCommandOptions {\n /**\n * Creates a new message command options instance.\n * @param parser - The message command parser instance\n */\n public constructor(private parser: MessageCommandParser) {}\n\n /**\n * @private\n * @internal\n */\n private assertOption<T>(name: string, required = false) {\n const option = this.parser.getOption<T>(name);\n\n if (required && option === undefined) {\n throw new Error(`Option \"${name}\" is required.`);\n }\n\n return option ?? null;\n }\n\n /**\n * Gets a guild member from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The guild member or null if not found\n */\n getMember(name: string): GuildMember | null;\n getMember(name: string, required: true): GuildMember;\n getMember(name: string, required = false) {\n const user = this.assertOption<User>(name, required);\n const member = this.parser.message.guild?.members.cache.get(user?.id!);\n\n if (required && !member) {\n throw new Error(`Member \"${name}\" is required.`);\n }\n\n return member ?? null;\n }\n\n /**\n * Gets an attachment from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The attachment or null if not found\n */\n getAttachment(name: string): Attachment | null;\n getAttachment(name: string, required: true): Attachment;\n getAttachment(name: string, required = false) {\n return this.assertOption<Attachment>(name, required);\n }\n\n /**\n * Gets a boolean value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The boolean value or null if not found\n */\n getBoolean(name: string): boolean | null;\n getBoolean(name: string, required: true): boolean;\n getBoolean(name: string, required = false) {\n return this.assertOption<boolean>(name, required);\n }\n\n /**\n * Gets a number value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The number value or null if not found\n */\n getNumber(name: string): number | null;\n getNumber(name: string, required: true): number;\n getNumber(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a string value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The string value or null if not found\n */\n getString(name: string): string | null;\n getString(name: string, required: true): string;\n getString(name: string, required = false) {\n return this.assertOption<string>(name, required);\n }\n\n /**\n * Gets an integer value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The integer value or null if not found\n */\n getInteger(name: string): number | null;\n getInteger(name: string, required: true): number;\n getInteger(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a user from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The user or null if not found\n */\n getUser(name: string): User | null;\n getUser(name: string, required: true): User;\n getUser(name: string, required = false) {\n return this.assertOption<User>(name, required);\n }\n\n /**\n * Gets a channel from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The channel or null if not found\n */\n getChannel(name: string): Channel | null;\n getChannel(name: string, required: true): Channel;\n getChannel(name: string, required = false) {\n return this.assertOption<Channel>(name, required);\n }\n\n /**\n * Gets a role from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The role or null if not found\n */\n getRole(name: string): Role | null;\n getRole(name: string, required: true): Role;\n getRole(name: string, required = false) {\n return this.assertOption<Role>(name, required);\n }\n\n /**\n * Gets a mentionable (user, member, or role) from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The mentionable or null if not found\n */\n getMentionable(\n name: string,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;\n getMentionable(\n name: string,\n required: true,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;\n getMentionable(\n name: string,\n required = false,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null {\n const target = this.assertOption(name, required);\n\n if (\n target instanceof GuildMember ||\n target instanceof User ||\n target instanceof Role\n ) {\n return target;\n }\n\n if (required) {\n throw new Error(`Mentionable \"${name}\" is required.`);\n }\n\n return null;\n }\n\n /**\n * Gets the subcommand name from the command.\n * @param required - Whether the subcommand is required\n * @returns The subcommand name or null if not found\n */\n getSubcommand(): string | null;\n getSubcommand(required: true): string;\n getSubcommand(required = false) {\n const sub = this.parser.getSubcommand();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand is required.');\n }\n\n return sub ?? null;\n }\n\n /**\n * Gets the subcommand group name from the command.\n * @param required - Whether the subcommand group is required\n * @returns The subcommand group name or null if not found\n */\n getSubcommandGroup(): string | null;\n getSubcommandGroup(required: true): string;\n getSubcommandGroup(required = false) {\n const sub = this.parser.getSubcommandGroup();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand group is required.');\n }\n\n return sub ?? null;\n }\n}\n"],"mappings":";;;;;;;;AAoCA,IAAa,uBAAb,MAAkC;;;;;CAKhC,UAAuC;;;;;CAMvC,WAAyC;;;;;CAMzC,QAAkB,CAAE;;;;;;;CAQpB,AAAO,YACA,SACC,QACA,QACR;EAHO;EACC;EACA;CACN;;;;;CAMF,AAAO,UAAU;AACf,EAAK,KAAK,OAAO;AACjB,SAAO,KAAK;CACd;;;;CAKA,IAAW,UAAU;AACnB,OAAK,KAAK,SACR,MAAK,WAAW,IAAI,sBAAsB;AAG5C,SAAO,KAAK;CACd;;;;;;CAOA,AAAO,UAAa,MAA6B;;AAC/C,kCAAO,KAAK,OAAO,CAAC,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,KAAK,gFAAE;CAC5D;;;;;CAMA,AAAO,aAAqB;AAC1B,SAAO,KAAK,OAAO,CAAC;CACtB;;;;;CAMA,AAAO,gBAAoC;AACzC,SAAO,KAAK,OAAO,CAAC;CACtB;;;;;CAMA,AAAO,qBAAyC;AAC9C,SAAO,KAAK,OAAO,CAAC;CACtB;;;;;CAMA,AAAO,YAAY;AACjB,OAAK,MAAM,KAAK,KAAK,OACnB,KAAI,KAAK,QAAQ,QAAQ,WAAW,EAAE,CACpC,QAAO;CAGb;;;;;CAMA,AAAO,iBAAiB;AACtB,SAAO;GAAC,KAAK,YAAY;GAAE,KAAK,oBAAoB;GAAE,KAAK,eAAe;EAAA,EAC1E,OAAO,CAAC,MAAM,EAAE,CAChB,KAAK,IAAI;CACX;;;;;CAMA,AAAO,QAA8B;AACnC,MAAI,KAAK,QACP,QAAO,KAAK;EAGd,MAAM,UAAU,KAAK,QAAQ;EAE7B,MAAM,SAAS,KAAK,WAAW;AAE/B,OAAK,OACH,OAAM,0CAAsB,yCAAqB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