commandkit 1.2.0-rc.12 → 1.2.0-rc.13
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/{COPYING.md → LICENSE.md} +3 -3
- package/README.md +3 -3
- package/bin/index.mjs +1 -1
- package/cli.d.ts +19 -0
- package/config.cjs +3 -0
- package/config.d.ts +1 -0
- package/dist/{ActionRow-B-7n9MMr.d.ts → ActionRow-B-CGmjDp.d.ts} +3 -4
- package/dist/{ActionRow-uJxU4UGo.js → ActionRow-CSN_UKmM.js} +2 -3
- package/dist/{ActionRow-uJxU4UGo.js.map → ActionRow-CSN_UKmM.js.map} +1 -1
- package/dist/{Button-RMp-w8HV.d.ts → Button-C-GPeFA3.d.ts} +6 -7
- package/dist/{ButtonKit-9k4yfhYD.d.ts → ButtonKit-DKu0VAe4.d.ts} +36 -37
- package/dist/ChannelSelectMenuKit-HQZ4hH5s.d.ts +66 -0
- package/dist/{CommandKitEventsChannel-2l9Za-le.js → CommandKitEventsChannel-CnT5ymYe.js} +2 -2
- package/dist/{CommandKitEventsChannel-2l9Za-le.js.map → CommandKitEventsChannel-CnT5ymYe.js.map} +1 -1
- package/dist/{CommandsRouter-CBdsqaWK.d.ts → CommandsRouter-C7dZEepB.d.ts} +49 -50
- package/dist/{CommandsRouter-CWMipIis.js → CommandsRouter-C_HLsrGX.js} +2 -6
- package/dist/{CommandsRouter-CWMipIis.js.map → CommandsRouter-C_HLsrGX.js.map} +1 -1
- package/dist/{CompilerPlugin-CZ4412Zm.js → CompilerPlugin-CUsGAfgl.js} +2 -2
- package/dist/{CompilerPlugin-CZ4412Zm.js.map → CompilerPlugin-CUsGAfgl.js.map} +1 -1
- package/dist/EventInterceptor-BWoEJMHZ.js.map +1 -1
- package/dist/{EventInterceptor-x-R2qshQ.d.ts → EventInterceptor-CZmWpS08.d.ts} +40 -40
- package/dist/{EventWorkerContext-D_9q1Bm2.js → EventWorkerContext-Dfhgv329.js} +2 -3
- package/dist/{EventWorkerContext-D_9q1Bm2.js.map → EventWorkerContext-Dfhgv329.js.map} +1 -1
- package/dist/EventsRouter-DZ37r54v.d.ts +90 -0
- package/dist/{EventsRouter-C04XqRKf.js → EventsRouter-DZYIha6m.js} +2 -6
- package/dist/{EventsRouter-C04XqRKf.js.map → EventsRouter-DZYIha6m.js.map} +1 -1
- package/dist/MentionableSelectMenuKit-7URDUM3-.d.ts +61 -0
- package/dist/{MessageCommandParser-CKh-tM97.js → MessageCommandParser-Bs9fimmd.js} +2 -3
- package/dist/{MessageCommandParser-CKh-tM97.js.map → MessageCommandParser-Bs9fimmd.js.map} +1 -1
- package/dist/MessageCommandParser-q3dQcE5N.d.ts +194 -0
- package/dist/{Modal-Calb46SJ.d.ts → Modal-CZT9MZsy.d.ts} +20 -10
- package/dist/{ModalKit-Cq2ns6jv.d.ts → ModalKit-BWXI3Z26.d.ts} +33 -34
- package/dist/{PluginCommon-CPWV5xuX.js → PluginCommon-BLxWww5u.js} +6 -7
- package/dist/{PluginCommon-CPWV5xuX.js.map → PluginCommon-BLxWww5u.js.map} +1 -1
- package/dist/RoleSelectMenuKit-BY-JJ18w.d.ts +66 -0
- package/dist/{RuntimePlugin-COeXe8rP.js → RuntimePlugin-CtobluSU.js} +2 -2
- package/dist/{RuntimePlugin-COeXe8rP.js.map → RuntimePlugin-CtobluSU.js.map} +1 -1
- package/dist/{SelectMenu-VcDhOGoJ.d.ts → SelectMenu-q_b3Mjv9.d.ts} +9 -10
- package/dist/StringSelectMenuKit-lVhUMc3g.d.ts +66 -0
- package/dist/UserSelectMenuKit-CCj4Fpkr.d.ts +66 -0
- package/dist/analytics/analytics-engine.d.ts +1 -33
- package/dist/analytics/analytics-engine.js +22 -37
- package/dist/analytics/analytics-provider.d.ts +1 -33
- package/dist/analytics/constants.js +1 -1
- package/dist/analytics/utils.js +22 -37
- package/dist/{analytics-engine-NOInIjv8.d.ts → analytics-engine-WQhXmx3H.d.ts} +844 -841
- package/dist/app/commands/AppCommandRunner.d.ts +1 -33
- package/dist/app/commands/AppCommandRunner.js +22 -37
- package/dist/app/commands/Context.d.ts +1 -33
- package/dist/app/commands/Context.js +22 -37
- package/dist/app/commands/MessageCommandParser.d.ts +1 -1
- package/dist/app/commands/MessageCommandParser.js +1 -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 +42 -35
- package/dist/app/events/EventWorkerContext.js +1 -1
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -33
- package/dist/app/handlers/AppCommandHandler.js +22 -37
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -33
- package/dist/app/handlers/AppEventsHandler.js +22 -37
- package/dist/app/index.d.ts +4 -33
- package/dist/app/index.js +22 -38
- package/dist/app/interrupt/signals.d.ts +1 -1
- package/dist/app/interrupt/signals.js +2 -3
- package/dist/app/middlewares/permissions.d.ts +1 -33
- package/dist/app/middlewares/permissions.js +22 -37
- package/dist/app/register/CommandRegistrar.d.ts +1 -33
- package/dist/app/register/CommandRegistrar.js +22 -37
- package/dist/app/router/CommandsRouter.d.ts +1 -1
- package/dist/app/router/CommandsRouter.js +1 -1
- package/dist/app/router/EventsRouter.d.ts +1 -1
- package/dist/app/router/EventsRouter.js +1 -1
- package/dist/app/router/index.d.ts +2 -3
- package/dist/app/router/index.js +2 -2
- package/dist/{chunk-nOFOJqeH.js → chunk-kSYXY2_d.js} +10 -6
- package/dist/cli/app-process.d.ts +0 -1
- package/dist/cli/app-process.js +62 -7
- package/dist/cli/app-process.js.map +1 -0
- package/dist/cli/build.d.ts +2 -33
- package/dist/cli/build.js +189 -42
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/common.d.ts +1 -33
- package/dist/cli/common.js +4 -4
- package/dist/cli/development.d.ts +18 -1
- package/dist/cli/development.js +41 -49
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.d.ts +4 -0
- package/dist/cli/env.js +1 -1
- package/dist/cli/generators.js +5 -8
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.js +5 -5
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +12 -2
- package/dist/cli/init.js +100 -39
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/production.d.ts +0 -1
- package/dist/cli/production.js +36 -49
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.js +5 -5
- package/dist/cli/utils.d.ts +0 -1
- package/dist/cli/utils.js +17 -2
- package/dist/cli/utils.js.map +1 -0
- package/dist/{colors-DL3ucTiT.js → colors-Csc0X4QJ.js} +2 -3
- package/dist/{colors-DL3ucTiT.js.map → colors-Csc0X4QJ.js.map} +1 -1
- package/dist/{commandkit-DabqpQ6v.js → commandkit-SIjTLD2R.js} +145 -46
- package/dist/commandkit-SIjTLD2R.js.map +1 -0
- package/dist/commandkit.d.ts +1 -33
- package/dist/commandkit.js +22 -37
- package/dist/{common-CCx-FJI4.js → common-CEordwf3.js} +1 -1
- package/dist/{common-CCx-FJI4.js.map → common-CEordwf3.js.map} +1 -1
- package/dist/{common-fIO6fqGZ.js → common-DSRs_mfw.js} +9 -12
- package/dist/{common-fIO6fqGZ.js.map → common-DSRs_mfw.js.map} +1 -1
- package/dist/{common-DHTTnX82.d.ts → common-DnwCYit8.d.ts} +3 -4
- package/dist/components/common/EventInterceptor.d.ts +1 -1
- package/dist/components/common/element.d.ts +1 -4
- package/dist/components/common/types.d.ts +1 -1
- package/dist/components/common/types.js +0 -1
- package/dist/components/display/common.d.ts +0 -1
- package/dist/components/display/common.js +1 -1
- package/dist/components/display/container.d.ts +1 -1
- package/dist/components/display/container.js +1 -2
- package/dist/components/display/file.d.ts +1 -1
- package/dist/components/display/file.js +1 -1
- package/dist/components/display/index.d.ts +8 -9
- package/dist/components/display/index.js +8 -9
- package/dist/components/display/label.d.ts +1 -1
- package/dist/components/display/label.js +1 -2
- package/dist/components/display/media-gallery.d.ts +1 -1
- package/dist/components/display/media-gallery.js +1 -2
- package/dist/components/display/poll.d.ts +1 -1
- package/dist/components/display/poll.js +1 -1
- package/dist/components/display/section.d.ts +1 -1
- package/dist/components/display/section.js +1 -2
- package/dist/components/display/separator.d.ts +1 -1
- package/dist/components/display/separator.js +1 -1
- package/dist/components/display/text-display.d.ts +1 -1
- package/dist/components/display/text-display.js +1 -1
- package/dist/components/index.d.ts +23 -26
- package/dist/components/index.js +23 -36
- package/dist/components/interactive/action-row/ActionRow.d.ts +1 -5
- package/dist/components/interactive/action-row/ActionRow.js +1 -1
- package/dist/components/interactive/button/Button.d.ts +1 -6
- package/dist/components/interactive/button/Button.js +22 -37
- package/dist/components/interactive/button/ButtonKit.d.ts +1 -2
- package/dist/components/interactive/button/ButtonKit.js +22 -37
- package/dist/components/interactive/modal/Modal.d.ts +2 -7
- package/dist/components/interactive/modal/Modal.js +23 -37
- package/dist/components/interactive/modal/ModalKit.d.ts +1 -2
- package/dist/components/interactive/modal/ModalKit.js +22 -37
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +22 -37
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +22 -37
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +22 -37
- package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -9
- package/dist/components/interactive/select-menu/SelectMenu.js +22 -37
- package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/StringSelectMenuKit.js +22 -37
- package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -3
- package/dist/components/interactive/select-menu/UserSelectMenuKit.js +22 -37
- package/dist/components/interactive/select-menu/common.d.ts +1 -2
- package/dist/components/interactive/select-menu/common.js +0 -1
- package/dist/config/config.d.ts +15 -35
- package/dist/config/config.js +22 -37
- package/dist/config/default.d.ts +1 -33
- package/dist/config/default.js +22 -37
- package/dist/config/loader.d.ts +1 -33
- package/dist/config/loader.js +22 -37
- package/dist/config/types.d.ts +1 -33
- package/dist/config/utils.d.ts +1 -33
- package/dist/constants-BFFK-hfP.js +27 -0
- package/dist/{constants-AH-9qJ89.js.map → constants-BFFK-hfP.js.map} +1 -1
- package/dist/{constants-DqnSDZ6l.d.ts → constants-CuYW0K10.d.ts} +14 -8
- package/dist/{constants-D0dawKxO.js → constants-Cw8VjCVz.js} +2 -3
- package/dist/{constants-D0dawKxO.js.map → constants-Cw8VjCVz.js.map} +1 -1
- package/dist/{constants-BMWH2YUr.js → constants-CxkFFZ7p.js} +16 -1
- package/dist/constants-CxkFFZ7p.js.map +1 -0
- package/dist/{constants-CCFSX2NG.d.ts → constants-EpKcj0dH.d.ts} +2 -2
- package/dist/{container-DC0eQigs.js → container-DCPljKVH.js} +3 -4
- package/dist/{container-DC0eQigs.js.map → container-DCPljKVH.js.map} +1 -1
- package/dist/{container-1ltvkavy.d.ts → container-DYcb7zGw.d.ts} +2 -3
- package/dist/context/async-context.d.ts +1 -33
- package/dist/context/async-context.js +22 -37
- package/dist/context/environment.d.ts +1 -33
- package/dist/context/environment.js +22 -37
- package/dist/element-DibzzA5L.js.map +1 -1
- package/dist/{element-CvNhvLZ8.d.ts → element-wQo0heGj.d.ts} +4 -5
- package/dist/{env-8yY-6pbC.js → env-CmspDhHy.js} +7 -3
- package/dist/env-CmspDhHy.js.map +1 -0
- package/dist/error-codes-Ds0bnPvT.js.map +1 -1
- package/dist/events/CommandKitEventsChannel.d.ts +1 -33
- package/dist/events/CommandKitEventsChannel.js +1 -1
- package/dist/{file-DAUOZYhC.js → file-Ca1kpEtE.js} +2 -3
- package/dist/{file-DAUOZYhC.js.map → file-Ca1kpEtE.js.map} +1 -1
- package/dist/{file-n2yl_-vl.d.ts → file-CrV4lSnl.d.ts} +2 -3
- package/dist/flags/FlagProvider.d.ts +1 -33
- package/dist/flags/feature-flags.d.ts +1 -33
- package/dist/flags/feature-flags.js +163 -41
- package/dist/flags/feature-flags.js.map +1 -0
- package/dist/flags/store.d.ts +1 -33
- package/dist/flags/store.js +1 -1
- package/dist/{helpers-hDh_tMb6.d.ts → helpers-AQPLVY35.d.ts} +2 -3
- package/dist/{helpers-D2_1jih6.js → helpers-Btx1FSZx.js} +2 -3
- package/dist/{helpers-D2_1jih6.js.map → helpers-Btx1FSZx.js.map} +1 -1
- package/dist/index.d.ts +41 -44
- package/dist/index.js +39 -45
- package/dist/index.js.map +1 -1
- package/dist/kv/constants.d.ts +1 -1
- package/dist/kv/constants.js +1 -1
- package/dist/kv/dotprops.js +25 -3
- package/dist/kv/dotprops.js.map +1 -0
- package/dist/kv/kv.d.ts +289 -290
- package/dist/kv/kv.js +14 -16
- package/dist/kv/kv.js.map +1 -1
- package/dist/kv/serde.d.ts +12 -3
- package/dist/kv/serde.js +86 -4
- package/dist/kv/serde.js.map +1 -0
- package/dist/{label-D0KXeBhk.d.ts → label-37kaNWMH.d.ts} +4 -5
- package/dist/{label-D-uJWRZ0.js → label-B6vXvwLM.js} +4 -5
- package/dist/{label-D-uJWRZ0.js.map → label-B6vXvwLM.js.map} +1 -1
- package/dist/logger/DefaultLogger.d.ts +66 -3
- package/dist/logger/DefaultLogger.js +22 -37
- package/dist/logger/ILogger.d.ts +64 -2
- package/dist/logger/ILogger.js +0 -1
- package/dist/logger/Logger.d.ts +36 -3
- package/dist/logger/Logger.js +22 -37
- package/dist/logger/NoopLogger.d.ts +36 -37
- package/dist/{media-gallery-BzG70ued.d.ts → media-gallery-Ci3I4ElH.d.ts} +2 -3
- package/dist/{media-gallery-BLhwe5lO.js → media-gallery-u3gjX7yD.js} +3 -4
- package/dist/{media-gallery-BLhwe5lO.js.map → media-gallery-u3gjX7yD.js.map} +1 -1
- package/dist/plugins/CompilerPlugin.d.ts +1 -33
- package/dist/plugins/CompilerPlugin.js +1 -2
- package/dist/plugins/PluginCommon.d.ts +1 -33
- package/dist/plugins/PluginCommon.js +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +1 -33
- package/dist/plugins/RuntimePlugin.js +1 -2
- package/dist/plugins/index.d.ts +1 -33
- package/dist/plugins/index.js +24 -37
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -33
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +22 -37
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -33
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +22 -37
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -33
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +22 -37
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -33
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +22 -37
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -33
- package/dist/plugins/plugin-runtime/runtime.js +0 -1
- package/dist/plugins/types.d.ts +1 -33
- package/dist/plugins/types.js +0 -1
- package/dist/{poll-Bc6rjeUS.js → poll-CFe8yvoJ.js} +12 -13
- package/dist/{poll-Bc6rjeUS.js.map → poll-CFe8yvoJ.js.map} +1 -1
- package/dist/{poll-HnaJcB0o.d.ts → poll-Ddtapd6n.d.ts} +8 -9
- package/dist/{resolve-file-url-CJoD0FAn.js → resolve-file-url-CdHqwWs3.js} +2 -2
- package/dist/{resolve-file-url-CJoD0FAn.js.map → resolve-file-url-CdHqwWs3.js.map} +1 -1
- package/dist/{section-BMcHN97i.js → section-BC8LF-B2.js} +3 -4
- package/dist/{section-BMcHN97i.js.map → section-BC8LF-B2.js.map} +1 -1
- package/dist/{section-BOaJKXiy.d.ts → section-DkUKULnB.d.ts} +2 -3
- package/dist/{separator-C___2K-f.js → separator-BUTiW7uz.js} +2 -3
- package/dist/{separator-C___2K-f.js.map → separator-BUTiW7uz.js.map} +1 -1
- package/dist/{separator-Cb7-6T6N.d.ts → separator-CbXsIFCa.d.ts} +2 -3
- package/dist/{signals-Cnqe9dFV.js → signals-B8z1wJ6W.js} +2 -2
- package/dist/{signals-Cnqe9dFV.js.map → signals-B8z1wJ6W.js.map} +1 -1
- package/dist/{signals-DBS60vTo.d.ts → signals-BbTgTc0i.d.ts} +2 -2
- package/dist/{store-ZwL2gN6a.js → store-D8r_hryO.js} +2 -3
- package/dist/{store-ZwL2gN6a.js.map → store-D8r_hryO.js.map} +1 -1
- package/dist/{text-display-B_hpz50P.d.ts → text-display-D7j39VC-.d.ts} +2 -3
- package/dist/{text-display-BtQR88kY.js → text-display-DANahMN3.js} +2 -3
- package/dist/{text-display-BtQR88kY.js.map → text-display-DANahMN3.js.map} +1 -1
- package/dist/{type-checker-CEFHoQoV.js → type-checker-cVd3Hpnh.js} +4 -6
- package/dist/{type-checker-CEFHoQoV.js.map → type-checker-cVd3Hpnh.js.map} +1 -1
- package/dist/{types-CJ-XvOFN.d.ts → types-BywA9d2Z.d.ts} +2 -2
- package/dist/{types-package-D11rQXLs.js → types-package-CsTNfvv2.js} +3 -6
- package/dist/{types-package-D11rQXLs.js.map → types-package-CsTNfvv2.js.map} +1 -1
- package/dist/types.d.ts +1 -33
- package/dist/utils/colors.js +1 -1
- package/dist/utils/constants.d.ts +2 -2
- package/dist/utils/constants.js +3 -2
- package/dist/utils/dev-hooks.d.ts +1 -33
- package/dist/utils/dev-hooks.js +22 -37
- package/dist/utils/error-codes.d.ts +54 -2
- package/dist/utils/resolve-file-url.d.ts +11 -2
- package/dist/utils/resolve-file-url.js +1 -1
- package/dist/utils/types-package.js +2 -2
- package/dist/utils/useful-stuff/async-queue.d.ts +21 -21
- package/dist/utils/useful-stuff/mutex.d.ts +62 -62
- package/dist/utils/useful-stuff/ratelimiter.d.ts +56 -56
- package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
- package/dist/utils/useful-stuff/semaphore.d.ts +82 -82
- package/dist/utils/utilities.d.ts +113 -2
- package/dist/utils/utilities.js +25 -38
- package/dist/utils-Br3eenD1.js.map +1 -1
- package/dist/version.d.ts +8 -2
- package/dist/version.js +12 -2
- package/dist/version.js.map +1 -0
- package/dist/warning-CszH8HeS.js.map +1 -1
- package/hooks.cjs +11 -4
- package/package.json +14 -7
- package/dist/ChannelSelectMenuKit-CsYgIyKe.d.ts +0 -67
- package/dist/DefaultLogger-CHMVsizQ.d.ts +0 -67
- package/dist/EventWorkerContext-CLhZRHhH.d.ts +0 -43
- package/dist/EventsRouter-4pT6vj-U.d.ts +0 -90
- package/dist/ILogger-BQ2ew4zR.d.ts +0 -64
- package/dist/Logger-DyV7oli4.d.ts +0 -37
- package/dist/MentionableSelectMenuKit-CO9phWMf.d.ts +0 -62
- package/dist/MessageCommandParser-DEOl_ifb.d.ts +0 -195
- package/dist/RoleSelectMenuKit-DvBxzpWh.d.ts +0 -67
- package/dist/StringSelectMenuKit-CJ0MzUZJ.d.ts +0 -67
- package/dist/UserSelectMenuKit-C_J-9RJs.d.ts +0 -67
- package/dist/app-CrjK9yWX.js +0 -0
- package/dist/app-process-AQ3Cbf6j.js +0 -68
- package/dist/app-process-AQ3Cbf6j.js.map +0 -1
- package/dist/build-BYMHMOl_.js +0 -173
- package/dist/build-BYMHMOl_.js.map +0 -1
- package/dist/commandkit-DabqpQ6v.js.map +0 -1
- package/dist/common-0Iw8ZeM6.js +0 -0
- package/dist/config-DbgXt6mf.d.ts +0 -16
- package/dist/constants-AH-9qJ89.js +0 -27
- package/dist/constants-BMWH2YUr.js.map +0 -1
- package/dist/dotprops-DvJUE8fw.js +0 -36
- package/dist/dotprops-DvJUE8fw.js.map +0 -1
- package/dist/env-8yY-6pbC.js.map +0 -1
- package/dist/error-codes-BiNRVMiV.d.ts +0 -54
- package/dist/feature-flags-BoBV4Dsj.js +0 -160
- package/dist/feature-flags-BoBV4Dsj.js.map +0 -1
- package/dist/init-CBb0StSB.js +0 -91
- package/dist/init-CBb0StSB.js.map +0 -1
- package/dist/init-DSYckXwx.d.ts +0 -13
- package/dist/resolve-file-url-DFtR8jRR.d.ts +0 -11
- package/dist/serde-D4H23l2F.d.ts +0 -12
- package/dist/serde-DHHwhltz.js +0 -97
- package/dist/serde-DHHwhltz.js.map +0 -1
- package/dist/utilities-CQUaua43.d.ts +0 -87
- package/dist/utils-Bf-3Eevb.js +0 -23
- package/dist/utils-Bf-3Eevb.js.map +0 -1
- package/dist/version-DC4j2ZwU.js +0 -18
- package/dist/version-DC4j2ZwU.js.map +0 -1
- package/dist/version-DggMfP_1.d.ts +0 -8
- /package/dist/{ILogger-B0q7p7L1.js → common-C2jAjX4U.js} +0 -0
- /package/dist/{index-B5F3AfVc.d.ts → index-BJfko-dP.d.ts} +0 -0
- /package/dist/{index-BLwMeReG.d.ts → index-CCggO_hw.d.ts} +0 -0
- /package/dist/{index-h64gcVNJ.d.ts → index-CLjpoGi1.d.ts} +0 -0
package/dist/common-0Iw8ZeM6.js
DELETED
|
File without changes
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CommandKitConfig, ResolvedCommandKitConfig } from "./analytics-engine-NOInIjv8.js";
|
|
2
|
-
|
|
3
|
-
//#region src/config/config.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get the defined configuration for CommandKit.
|
|
7
|
-
*/
|
|
8
|
-
declare function getConfig(): ResolvedCommandKitConfig;
|
|
9
|
-
/**
|
|
10
|
-
* Define the configuration for CommandKit.
|
|
11
|
-
* @param config The configuration to use.
|
|
12
|
-
*/
|
|
13
|
-
declare function defineConfig(config?: Partial<CommandKitConfig>): ResolvedCommandKitConfig;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { defineConfig, getConfig };
|
|
16
|
-
//# sourceMappingURL=config-DbgXt6mf.d.ts.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/kv/constants.ts
|
|
3
|
-
let SerializerType = /* @__PURE__ */ function(SerializerType$1) {
|
|
4
|
-
SerializerType$1[SerializerType$1["String"] = 0] = "String";
|
|
5
|
-
SerializerType$1[SerializerType$1["Number"] = 1] = "Number";
|
|
6
|
-
SerializerType$1[SerializerType$1["Boolean"] = 2] = "Boolean";
|
|
7
|
-
SerializerType$1[SerializerType$1["Object"] = 3] = "Object";
|
|
8
|
-
SerializerType$1[SerializerType$1["Date"] = 4] = "Date";
|
|
9
|
-
SerializerType$1[SerializerType$1["BigInt"] = 5] = "BigInt";
|
|
10
|
-
SerializerType$1[SerializerType$1["Null"] = 6] = "Null";
|
|
11
|
-
SerializerType$1[SerializerType$1["Undefined"] = 7] = "Undefined";
|
|
12
|
-
SerializerType$1[SerializerType$1["Array"] = 8] = "Array";
|
|
13
|
-
SerializerType$1[SerializerType$1["Map"] = 9] = "Map";
|
|
14
|
-
SerializerType$1[SerializerType$1["Set"] = 10] = "Set";
|
|
15
|
-
SerializerType$1[SerializerType$1["Buffer"] = 11] = "Buffer";
|
|
16
|
-
SerializerType$1[SerializerType$1["RegExp"] = 12] = "RegExp";
|
|
17
|
-
return SerializerType$1;
|
|
18
|
-
}({});
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
Object.defineProperty(exports, 'SerializerType', {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return SerializerType;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=constants-AH-9qJ89.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-BMWH2YUr.js","names":[],"sources":["../src/utils/constants.ts"],"sourcesContent":["/**\n * The current working directory of the CommandKit instance.\n */\nexport const COMMANDKIT_CWD = process.env.COMMANDKIT_CWD || process.cwd();\n\n/**\n * Indicates whether CommandKit is running in development mode.\n */\nexport const COMMANDKIT_IS_DEV = process.env.COMMANDKIT_IS_DEV === 'true';\n\n/**\n * Indicates whether CommandKit is running in CLI thread.\n */\nexport const COMMANDKIT_IS_CLI = process.env.COMMANDKIT_IS_CLI === 'true';\n\n/**\n * Indicates whether CommandKit is running in test mode.\n */\nexport const COMMANDKIT_IS_TEST = process.env.COMMANDKIT_IS_TEST === 'true';\n\n/**\n * The current bootstrap mode of CommandKit.\n * This can be 'development' or 'production'.\n */\nexport const COMMANDKIT_BOOTSTRAP_MODE = (process.env\n .COMMANDKIT_BOOTSTRAP_MODE || 'development') as 'development' | 'production';\n\n/**\n * Types of Hot Module Replacement events\n */\nexport const HMREventType = {\n /**\n * HMR event for reloading commands.\n */\n ReloadCommands: 'reload-commands',\n /**\n * HMR event for reloading events.\n */\n ReloadEvents: 'reload-events',\n /**\n * HMR event for reloading unknown path, typically used by the plugins.\n */\n Unknown: 'unknown',\n} as const;\n\n/**\n * The type for HMR events.\n */\nexport type HMREventType = (typeof HMREventType)[keyof typeof HMREventType];\n"],"mappings":";;;;;AAGA,MAAa,iBAAiB,QAAQ,IAAI,kBAAkB,QAAQ,KAAK;;;;AAKzE,MAAa,oBAAoB,QAAQ,IAAI,sBAAsB;;;;AAKnE,MAAa,oBAAoB,QAAQ,IAAI,sBAAsB;;;;AAKnE,MAAa,qBAAqB,QAAQ,IAAI,uBAAuB;;;;;AAMrE,MAAa,4BAA6B,QAAQ,IAClD,6BAA6B;;;;AAK7B,MAAa,eAAe;CAI1B,gBAAgB;CAIhB,cAAc;CAId,SAAS;CACV"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/kv/dotprops.ts
|
|
3
|
-
function getNestedValue(obj, path) {
|
|
4
|
-
const keys = path.split(".");
|
|
5
|
-
let current = obj;
|
|
6
|
-
for (const key of keys) {
|
|
7
|
-
if (current === null || current === void 0) return;
|
|
8
|
-
current = current[key];
|
|
9
|
-
}
|
|
10
|
-
return current;
|
|
11
|
-
}
|
|
12
|
-
function setNestedValue(obj, path, value) {
|
|
13
|
-
const keys = path.split(".");
|
|
14
|
-
const lastKey = keys.pop();
|
|
15
|
-
let current = obj;
|
|
16
|
-
for (const key of keys) {
|
|
17
|
-
if (current[key] === null || current[key] === void 0) current[key] = {};
|
|
18
|
-
current = current[key];
|
|
19
|
-
}
|
|
20
|
-
current[lastKey] = value;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
Object.defineProperty(exports, 'getNestedValue', {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return getNestedValue;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, 'setNestedValue', {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return setNestedValue;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=dotprops-DvJUE8fw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dotprops-DvJUE8fw.js","names":[],"sources":["../src/kv/dotprops.ts"],"sourcesContent":["export function getNestedValue(obj: any, path: string): any {\n const keys = path.split('.');\n let current = obj;\n\n for (const key of keys) {\n if (current === null || current === undefined) {\n return undefined;\n }\n current = current[key];\n }\n\n return current;\n}\n\nexport function setNestedValue(obj: any, path: string, value: any): void {\n const keys = path.split('.');\n const lastKey = keys.pop()!;\n let current = obj;\n\n for (const key of keys) {\n if (current[key] === null || current[key] === undefined) {\n current[key] = {};\n }\n current = current[key];\n }\n\n current[lastKey] = value;\n}\n"],"mappings":";;AAAA,SAAgB,eAAe,KAAU,MAAmB;CAC1D,MAAM,OAAO,KAAK,MAAM,IAAI;CAC5B,IAAI,UAAU;AAEd,MAAK,MAAM,OAAO,MAAM;AACtB,MAAI,YAAY,QAAQ,YAAY,OAClC;AAEF,YAAU,QAAQ;;AAGpB,QAAO;;AAGT,SAAgB,eAAe,KAAU,MAAc,OAAkB;CACvE,MAAM,OAAO,KAAK,MAAM,IAAI;CAC5B,MAAM,UAAU,KAAK,KAAK;CAC1B,IAAI,UAAU;AAEd,MAAK,MAAM,OAAO,MAAM;AACtB,MAAI,QAAQ,SAAS,QAAQ,QAAQ,SAAS,OAC5C,SAAQ,OAAO,EAAE;AAEnB,YAAU,QAAQ;;AAGpB,SAAQ,WAAW"}
|
package/dist/env-8yY-6pbC.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env-8yY-6pbC.js","names":[],"sources":["../src/cli/env.ts"],"sourcesContent":["/**\n * @private\n * @internal\n */\nexport function DevEnv(_static = false) {\n const common = {\n NODE_ENV: 'development',\n COMMANDKIT_IS_DEV: 'true',\n };\n\n if (_static) return Object.assign({}, common);\n\n return Object.assign({}, process.env, common);\n}\n\n/**\n * @private\n * @internal\n */\nexport function ProdEnv(_static = false) {\n const common = {\n NODE_ENV: 'production',\n COMMANDKIT_IS_DEV: 'false',\n };\n\n if (_static) return Object.assign({}, common);\n\n return Object.assign({}, process.env, common);\n}\n\n/**\n * @private\n * @internal\n */\nexport const CommonEnvFiles = ['.env', '.env.local'];\n/**\n * @private\n * @internal\n */\nexport const DevEnvFiles = ['.env.development', '.env.development.local'];\n/**\n * @private\n * @internal\n */\nexport const ProdEnvFiles = ['.env.production', '.env.production.local'];\n/**\n * @private\n * @internal\n */\nexport const devEnvFileArgs = [...CommonEnvFiles, ...DevEnvFiles];\n/**\n * @private\n * @internal\n */\nexport const prodEnvFileArgs = [...CommonEnvFiles, ...ProdEnvFiles];\n/**\n * @private\n * @internal\n */\nexport function setCLIEnv() {\n process.env.COMMANDKIT_IS_CLI = 'true';\n}\n"],"mappings":";;;;;;AAIA,SAAgB,OAAO,UAAU,OAAO;CACtC,MAAM,SAAS;EACb,UAAU;EACV,mBAAmB;EACpB;AAED,KAAI,QAAS,QAAO,OAAO,OAAO,EAAE,EAAE,OAAO;AAE7C,QAAO,OAAO,OAAO,EAAE,EAAE,QAAQ,KAAK,OAAO;;;;;;AAO/C,SAAgB,QAAQ,UAAU,OAAO;CACvC,MAAM,SAAS;EACb,UAAU;EACV,mBAAmB;EACpB;AAED,KAAI,QAAS,QAAO,OAAO,OAAO,EAAE,EAAE,OAAO;AAE7C,QAAO,OAAO,OAAO,EAAE,EAAE,QAAQ,KAAK,OAAO;;;;;;AAO/C,MAAa,iBAAiB,CAAC,QAAQ,aAAa;;;;;AAKpD,MAAa,cAAc,CAAC,oBAAoB,yBAAyB;;;;;AAKzE,MAAa,eAAe,CAAC,mBAAmB,wBAAwB;;;;;AAKxE,MAAa,iBAAiB,CAAC,GAAG,gBAAgB,GAAG,YAAY;;;;;AAKjE,MAAa,kBAAkB,CAAC,GAAG,gBAAgB,GAAG,aAAa;;;;;AAKnE,SAAgB,YAAY;AAC1B,SAAQ,IAAI,oBAAoB"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
//#region src/utils/error-codes.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* The error codes used by CommandKit.
|
|
4
|
-
*/
|
|
5
|
-
declare const CommandKitErrorCodes: {
|
|
6
|
-
/**
|
|
7
|
-
* Error code for exiting middleware.
|
|
8
|
-
*/
|
|
9
|
-
readonly StopMiddlewares: symbol;
|
|
10
|
-
/**
|
|
11
|
-
* Error code for forwarded commands.
|
|
12
|
-
*/
|
|
13
|
-
readonly ForwardedCommand: symbol;
|
|
14
|
-
/**
|
|
15
|
-
* Error code for invalid command prefix.
|
|
16
|
-
*/
|
|
17
|
-
readonly InvalidCommandPrefix: symbol;
|
|
18
|
-
/**
|
|
19
|
-
* Error code for plugin capture handle.
|
|
20
|
-
*/
|
|
21
|
-
readonly PluginCaptureHandle: symbol;
|
|
22
|
-
/**
|
|
23
|
-
* Error code for event interruption signal
|
|
24
|
-
*/
|
|
25
|
-
readonly StopEvents: symbol;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* The type for CommandKit errors.
|
|
29
|
-
*/
|
|
30
|
-
type CommandKitError = Error & {
|
|
31
|
-
code: symbol;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Creates a new CommandKit error with the specified code.
|
|
35
|
-
* @param code The error code to assign to the error.
|
|
36
|
-
* @returns A new CommandKit error instance.
|
|
37
|
-
*/
|
|
38
|
-
declare function createCommandKitError(code: symbol): CommandKitError;
|
|
39
|
-
/**
|
|
40
|
-
* Checks if the given error is a CommandKit error.
|
|
41
|
-
* @param error The error to check.
|
|
42
|
-
* @returns True if the error is a CommandKit error, false otherwise.
|
|
43
|
-
*/
|
|
44
|
-
declare function isCommandKitError(error: unknown): error is CommandKitError;
|
|
45
|
-
/**
|
|
46
|
-
* Checks if the given error is of a specific CommandKit error type.
|
|
47
|
-
* @param error The error to check.
|
|
48
|
-
* @param code The error code or an array of error codes to check against.
|
|
49
|
-
* @returns True if the error matches the specified code(s), false otherwise.
|
|
50
|
-
*/
|
|
51
|
-
declare function isErrorType(error: unknown, code: symbol | symbol[]): boolean;
|
|
52
|
-
//#endregion
|
|
53
|
-
export { CommandKitError, CommandKitErrorCodes, createCommandKitError, isCommandKitError, isErrorType };
|
|
54
|
-
//# sourceMappingURL=error-codes-BiNRVMiV.d.ts.map
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
const require_commandkit = require('./commandkit-DabqpQ6v.js');
|
|
2
|
-
const require_constants = require('./constants-D0dawKxO.js');
|
|
3
|
-
const require_EventWorkerContext = require('./EventWorkerContext-D_9q1Bm2.js');
|
|
4
|
-
|
|
5
|
-
//#region src/flags/feature-flags.ts
|
|
6
|
-
let flagProvider = null;
|
|
7
|
-
/**
|
|
8
|
-
* Set the global flag provider for all feature flags
|
|
9
|
-
*/
|
|
10
|
-
function setFlagProvider(provider) {
|
|
11
|
-
flagProvider = provider;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Class representing a feature flag in CommandKit.
|
|
15
|
-
*/
|
|
16
|
-
var FeatureFlag = class {
|
|
17
|
-
commandkit;
|
|
18
|
-
/**
|
|
19
|
-
* Create a new feature flag.
|
|
20
|
-
* @param options - The options for the feature flag.
|
|
21
|
-
*/
|
|
22
|
-
constructor(options) {
|
|
23
|
-
this.options = options;
|
|
24
|
-
this.commandkit = require_commandkit.getCommandKit(true);
|
|
25
|
-
const FlagStore = this.commandkit.flags;
|
|
26
|
-
if (FlagStore.has(options.key)) throw new Error(`Feature flag with key "${options.key}" already exists.`);
|
|
27
|
-
FlagStore.set(options.key, this);
|
|
28
|
-
}
|
|
29
|
-
getContext() {
|
|
30
|
-
const env = require_commandkit.getContext();
|
|
31
|
-
if (env === null || env === void 0 ? void 0 : env.context) {
|
|
32
|
-
const { client, commandkit, interaction, message, guild, channel, command } = env.context;
|
|
33
|
-
return {
|
|
34
|
-
client,
|
|
35
|
-
commandkit,
|
|
36
|
-
command: {
|
|
37
|
-
interaction,
|
|
38
|
-
message,
|
|
39
|
-
guild,
|
|
40
|
-
channel,
|
|
41
|
-
command
|
|
42
|
-
},
|
|
43
|
-
event: null
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const eventCtx = require_EventWorkerContext.eventWorkerContext.getStore();
|
|
47
|
-
if (eventCtx) {
|
|
48
|
-
const { commandkit, data, event, namespace } = eventCtx;
|
|
49
|
-
return {
|
|
50
|
-
client: commandkit.client,
|
|
51
|
-
commandkit,
|
|
52
|
-
event: {
|
|
53
|
-
data,
|
|
54
|
-
event,
|
|
55
|
-
namespace,
|
|
56
|
-
arguments: eventCtx.arguments,
|
|
57
|
-
argumentsAs: (eventName) => {
|
|
58
|
-
return eventCtx.arguments;
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
command: null
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
throw new Error("Could not determine the execution context. Feature flags may only be used inside a command or event.");
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Execute the feature flag evaluation.
|
|
68
|
-
* @param res - Optional entities to use for evaluation. If not provided, it will call the identify function.
|
|
69
|
-
* @returns A promise that resolves to the result of the feature flag evaluation.
|
|
70
|
-
*/
|
|
71
|
-
async execute(res) {
|
|
72
|
-
const { decide, identify, disableAnalytics } = this.options;
|
|
73
|
-
const identificationStart = performance.now();
|
|
74
|
-
const entities = res ?? await (async () => {
|
|
75
|
-
const ctx = this.getContext();
|
|
76
|
-
return await (identify === null || identify === void 0 ? void 0 : identify(ctx)) ?? {};
|
|
77
|
-
})();
|
|
78
|
-
const identificationTime = performance.now() - identificationStart;
|
|
79
|
-
let providerConfig = null;
|
|
80
|
-
if (flagProvider) try {
|
|
81
|
-
providerConfig = await flagProvider.getFlag(this.options.key, entities);
|
|
82
|
-
if (providerConfig && !providerConfig.enabled) {
|
|
83
|
-
if (typeof decide === "function") return await decide({
|
|
84
|
-
entities,
|
|
85
|
-
provider: providerConfig
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
} catch (error) {
|
|
89
|
-
require_commandkit.Logger.error`Error fetching flag provider configuration for "${this.options.key}": ${error}`;
|
|
90
|
-
}
|
|
91
|
-
const decisionStart = performance.now();
|
|
92
|
-
const decisionResult = await decide({
|
|
93
|
-
entities,
|
|
94
|
-
provider: providerConfig
|
|
95
|
-
});
|
|
96
|
-
const decisionTime = performance.now() - decisionStart;
|
|
97
|
-
if (!disableAnalytics) {
|
|
98
|
-
require_commandkit.defer(async () => {
|
|
99
|
-
await this.commandkit.analytics.track({
|
|
100
|
-
name: require_constants.AnalyticsEvents.FEATURE_FLAG_METRICS,
|
|
101
|
-
data: {
|
|
102
|
-
flag: this.options.key,
|
|
103
|
-
identificationTime: identificationTime.toFixed(2),
|
|
104
|
-
decisionTime: decisionTime.toFixed(2),
|
|
105
|
-
usedProvider: flagProvider !== null,
|
|
106
|
-
providerEnabled: (providerConfig === null || providerConfig === void 0 ? void 0 : providerConfig.enabled) ?? null
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
require_commandkit.defer(async () => {
|
|
111
|
-
await this.commandkit.analytics.track({
|
|
112
|
-
name: require_constants.AnalyticsEvents.FEATURE_FLAG_DECISION,
|
|
113
|
-
id: entities && typeof entities === "object" && "id" in entities && typeof entities.id === "string" ? entities.id : void 0,
|
|
114
|
-
data: {
|
|
115
|
-
flag: this.options.key,
|
|
116
|
-
decision: require_commandkit.JsonSerialize(decisionResult, "unknown"),
|
|
117
|
-
providerUsed: flagProvider !== null
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
return decisionResult;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Create a new feature flag.
|
|
127
|
-
* @param options - The options for the feature flag.
|
|
128
|
-
* @returns A new instance of the FeatureFlag class.
|
|
129
|
-
*/
|
|
130
|
-
function flag(options) {
|
|
131
|
-
const flag$1 = new FeatureFlag(options);
|
|
132
|
-
const runner = flag$1.execute.bind(flag$1, void 0);
|
|
133
|
-
runner.run = async function(ctx) {
|
|
134
|
-
if (!(ctx === null || ctx === void 0 ? void 0 : ctx.identify)) throw new Error("Custom evaluation context must have an identify function or object.");
|
|
135
|
-
const context = typeof ctx === "function" ? await ctx() : ctx;
|
|
136
|
-
return await flag$1.execute(context);
|
|
137
|
-
};
|
|
138
|
-
return runner;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
//#endregion
|
|
142
|
-
Object.defineProperty(exports, 'FeatureFlag', {
|
|
143
|
-
enumerable: true,
|
|
144
|
-
get: function () {
|
|
145
|
-
return FeatureFlag;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
Object.defineProperty(exports, 'flag', {
|
|
149
|
-
enumerable: true,
|
|
150
|
-
get: function () {
|
|
151
|
-
return flag;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
Object.defineProperty(exports, 'setFlagProvider', {
|
|
155
|
-
enumerable: true,
|
|
156
|
-
get: function () {
|
|
157
|
-
return setFlagProvider;
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
//# sourceMappingURL=feature-flags-BoBV4Dsj.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"feature-flags-BoBV4Dsj.js","names":[],"sources":["../src/flags/feature-flags.ts"],"sourcesContent":["import { getCommandKit, getContext } from '../context/async-context';\nimport { eventWorkerContext } from '../app/events/EventWorkerContext';\nimport { ParsedEvent } from '../app/router';\nimport type { CommandKit } from '../commandkit';\nimport {\n AutocompleteInteraction,\n ChatInputCommandInteraction,\n Client,\n ClientEvents,\n ContextMenuCommandInteraction,\n Guild,\n Message,\n TextBasedChannel,\n} from 'discord.js';\nimport { LoadedCommand } from '../app';\nimport { defer, JsonSerialize } from '../utils/utilities';\nimport { AnalyticsEvents } from '../analytics/constants';\nimport { FlagProvider, FlagConfiguration } from './FlagProvider';\nimport { Logger } from '../logger/Logger';\n\n// Global flag provider\nlet flagProvider: FlagProvider | null = null;\n\n/**\n * Set the global flag provider for all feature flags\n */\nexport function setFlagProvider(provider: FlagProvider): void {\n flagProvider = provider;\n}\n\n/**\n * @private\n */\nexport type MaybePromise<T> = T | Promise<T>;\n\n/**\n * Function type for identifying entities in the context of feature flags.\n * This function should return an object representing the entity that will be used\n * to evaluate the feature flag.\n * It can be synchronous or asynchronous.\n */\nexport type IdentifyFunction<R> = (\n context: EvaluationContext,\n) => MaybePromise<R>;\n\n/**\n * Function type for deciding the outcome of a feature flag based on the provided entities.\n * This function receives an object containing the entities and optionally the provider configuration,\n * and should return the result of the decision.\n * It can be synchronous or asynchronous.\n */\nexport type DecideFunction<E, R> = (data: {\n entities: E;\n provider?: FlagConfiguration | null;\n}) => MaybePromise<R>;\n\n/**\n * Definition for a feature flag, including its key, description, identify function,\n * and decide function.\n * The identify function is used to determine the entities that will be evaluated\n * against the feature flag, while the decide function contains the logic for\n * determining the outcome of the flag based on those entities.\n */\nexport interface FeatureFlagDefinition<R, Entity> {\n /**\n * Unique key for the feature flag.\n * Should be a string that identifies the flag.\n */\n key: string;\n /**\n * Optional description of the feature flag.\n * This can be used for documentation or debugging purposes.\n */\n description?: string;\n /**\n * Optional flag to enable integration with an external flag provider.\n * If true, the flag will use the global flag provider to determine its state.\n * Default: false\n */\n identify?: IdentifyFunction<Entity>;\n /**\n * Function to decide the outcome of the feature flag.\n * This function receives the identified entities and should return the result of the decision.\n */\n decide: DecideFunction<Entity, R>;\n /**\n * Whether to disable analytics tracking for this flag.\n * Default: false\n */\n disableAnalytics?: boolean;\n}\n\n/**\n * Context for evaluating command flags in CommandKit.\n */\nexport interface CommandFlagContext {\n /**\n * The Discord client instance.\n * This is the main entry point for interacting with the Discord API.\n */\n client: Client<true>;\n /**\n * The CommandKit instance, which provides access to the command framework.\n * This includes commands, events, and other features of CommandKit.\n */\n commandkit: CommandKit;\n /**\n * The command context, which includes information about the command being executed.\n * This can include the interaction, message, guild, channel, and the loaded command.\n */\n command: {\n /**\n * The interaction object if the command was invoked via an interaction.\n * This can be a ChatInputCommandInteraction, AutocompleteInteraction, or ContextMenuCommandInteraction.\n */\n interaction?:\n | ChatInputCommandInteraction\n | AutocompleteInteraction\n | ContextMenuCommandInteraction;\n /**\n * The message object if the command was invoked via a message.\n */\n message?: Message;\n /**\n * The guild where the command was invoked, if applicable.\n * This will be null for commands invoked in DMs.\n */\n guild: Guild | null;\n /**\n * The channel where the command was invoked.\n * This can be a text channel, DM channel, or any other type of text-based channel.\n */\n channel: TextBasedChannel | null;\n /**\n * The loaded command instance that is being executed.\n * This contains the command's metadata and logic.\n */\n command: LoadedCommand;\n };\n /**\n * The event context is null for command flags, as they are not tied to a specific event.\n * This is used to differentiate between command and event flags.\n */\n event: null;\n}\n\n/**\n * Context for evaluating event flags in CommandKit.\n */\nexport interface EventFlagContext {\n /**\n * The Discord client instance.\n * This is the main entry point for interacting with the Discord API.\n */\n client: Client<true>;\n /**\n * The CommandKit instance, which provides access to the command framework.\n * This includes commands, events, and other features of CommandKit.\n */\n commandkit: CommandKit;\n /**\n * The event context, which includes information about the event being processed.\n * This can include the parsed event data, the event name, and the namespace if applicable.\n */\n event: {\n /**\n * The parsed event data, which contains the raw data from the event.\n * This can include information like user IDs, channel IDs, and other relevant data.\n */\n data: ParsedEvent;\n /**\n * The name of the event being processed.\n * This is the string identifier for the event, such as 'messageCreate' or 'guildMemberAdd'.\n */\n event: string;\n /**\n * The namespace of the event, if applicable.\n * This can be used to group related events or commands together.\n * It is null if the event does not belong to a specific namespace.\n */\n namespace: string | null;\n /**\n * The arguments passed to the event handler.\n * This is an array of arguments that were passed when the event was triggered.\n * It can be used to access specific data related to the event.\n */\n arguments: any[];\n /**\n * A function to retrieve the arguments for a specific event type.\n * This allows for type-safe access to the arguments based on the event name.\n * @param event - The name of the event to retrieve arguments for.\n */\n argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];\n };\n /**\n * The command context is null for event flags, as they are not tied to a specific command.\n * This is used to differentiate between command and event flags.\n */\n command: null;\n}\n\n/**\n * Combined context type for feature flag evaluation.\n */\nexport type EvaluationContext = CommandFlagContext | EventFlagContext;\n\n/**\n * Function type for custom evaluation of feature flags.\n * This function can be used to provide a custom evaluation context for the flag.\n * It should return an object representing the entities to be evaluated.\n */\nexport type CustomEvaluationFunction<E> = () => MaybePromise<E>;\n\n/**\n * Context for custom evaluation of feature flags.\n * This allows for more flexible evaluation based on custom logic or external data.\n * The identify function can be a direct object or a function that returns the entities.\n */\nexport type CustomEvaluationContext<E> = {\n /**\n * Optional function to identify the entities for evaluation.\n * This can be a function that returns the entities based on the current context.\n */\n identify: E | CustomEvaluationFunction<E>;\n};\n\nexport interface FlagRunner<E, R> {\n /**\n * Execute the feature flag evaluation with the provided entities.\n * This method will run the identify and decide functions to determine the flag's outcome.\n * @param res - Optional entities to use for evaluation. If not provided, it will call the identify function.\n * @returns A promise that resolves to the result of the feature flag evaluation.\n */\n (): Promise<R>;\n /**\n * Run the feature flag evaluation with a custom context.\n * This allows for more flexible evaluation based on custom logic or external data.\n * @param context - The custom evaluation context containing the identify function or object.\n * @returns A promise that resolves to the result of the feature flag evaluation.\n */\n run(context: CustomEvaluationContext<E>): Promise<R>;\n}\n\n/**\n * Class representing a feature flag in CommandKit.\n */\nexport class FeatureFlag<R, T> {\n private commandkit: CommandKit;\n\n /**\n * Create a new feature flag.\n * @param options - The options for the feature flag.\n */\n public constructor(public readonly options: FeatureFlagDefinition<R, T>) {\n this.commandkit = getCommandKit(true);\n const FlagStore = this.commandkit.flags;\n\n if (FlagStore.has(options.key)) {\n throw new Error(`Feature flag with key \"${options.key}\" already exists.`);\n }\n\n FlagStore.set(options.key, this);\n }\n\n private getContext(): EvaluationContext {\n const env = getContext();\n\n if (env?.context) {\n const {\n client,\n commandkit,\n interaction,\n message,\n guild,\n channel,\n command,\n } = env.context;\n\n return {\n client: client as Client<true>,\n commandkit,\n command: {\n interaction,\n message,\n guild,\n channel,\n command,\n },\n event: null,\n };\n }\n\n const eventCtx = eventWorkerContext.getStore();\n\n if (eventCtx) {\n const { commandkit, data, event, namespace } = eventCtx;\n\n return {\n client: commandkit.client as Client<true>,\n commandkit,\n event: {\n data,\n event,\n namespace,\n arguments: eventCtx.arguments,\n argumentsAs: (eventName) => {\n const args = eventCtx.arguments as ClientEvents[typeof eventName];\n return args;\n },\n },\n command: null,\n };\n }\n\n throw new Error(\n 'Could not determine the execution context. Feature flags may only be used inside a command or event.',\n );\n }\n\n /**\n * Execute the feature flag evaluation.\n * @param res - Optional entities to use for evaluation. If not provided, it will call the identify function.\n * @returns A promise that resolves to the result of the feature flag evaluation.\n */\n public async execute(res?: T): Promise<R> {\n const { decide, identify, disableAnalytics } = this.options;\n\n const identificationStart = performance.now();\n const entities =\n res ??\n (await (async () => {\n const ctx = this.getContext();\n return (await identify?.(ctx)) ?? ({} as T);\n })());\n const identificationTime = performance.now() - identificationStart;\n\n // Get provider configuration if global provider is available\n let providerConfig: FlagConfiguration | null = null;\n if (flagProvider) {\n try {\n providerConfig = await flagProvider.getFlag(this.options.key, entities);\n\n // If provider says flag is disabled, return early with default behavior\n if (providerConfig && !providerConfig.enabled) {\n // For boolean flags, return false; for others, let decide function handle it\n if (typeof decide === 'function') {\n const decisionResult = await decide({\n entities,\n provider: providerConfig,\n });\n return decisionResult as R;\n }\n }\n } catch (error) {\n Logger.error`Error fetching flag provider configuration for \"${this.options.key}\": ${error}`;\n // continue with local decision if provider fails\n }\n }\n\n const decisionStart = performance.now();\n const decisionResult = await decide({\n entities,\n provider: providerConfig,\n });\n const decisionTime = performance.now() - decisionStart;\n\n // Skip analytics if disabled\n if (!disableAnalytics) {\n defer(async () => {\n await this.commandkit.analytics.track({\n name: AnalyticsEvents.FEATURE_FLAG_METRICS,\n data: {\n flag: this.options.key,\n identificationTime: identificationTime.toFixed(2),\n decisionTime: decisionTime.toFixed(2),\n usedProvider: flagProvider !== null,\n providerEnabled: providerConfig?.enabled ?? null,\n },\n });\n });\n\n defer(async () => {\n await this.commandkit.analytics.track({\n name: AnalyticsEvents.FEATURE_FLAG_DECISION,\n id:\n entities &&\n typeof entities === 'object' &&\n 'id' in entities &&\n typeof entities.id === 'string'\n ? entities.id\n : undefined,\n data: {\n flag: this.options.key,\n decision: JsonSerialize(decisionResult, 'unknown'),\n providerUsed: flagProvider !== null,\n },\n });\n });\n }\n\n return decisionResult as R;\n }\n}\n\n/**\n * Create a new feature flag.\n * @param options - The options for the feature flag.\n * @returns A new instance of the FeatureFlag class.\n */\nexport function flag<Returns = boolean, Entity = Record<any, any>>(\n options: FeatureFlagDefinition<Returns, Entity>,\n): FlagRunner<Entity, Returns> {\n const flag = new FeatureFlag<Returns, Entity>(options);\n const runner = flag.execute.bind(flag, undefined) as FlagRunner<\n Entity,\n Returns\n >;\n\n runner.run = async function (ctx) {\n if (!ctx?.identify) {\n throw new Error(\n 'Custom evaluation context must have an identify function or object.',\n );\n }\n\n const context = (\n typeof ctx === 'function'\n ? await (ctx as CustomEvaluationFunction<Entity>)()\n : ctx\n ) as Entity;\n\n const decisionResult = await flag.execute(context);\n\n return decisionResult;\n };\n\n return runner;\n}\n"],"mappings":";;;;;AAqBA,IAAI,eAAoC;;;;AAKxC,SAAgB,gBAAgB,UAA8B;AAC5D,gBAAe;;;;;AA2NjB,IAAa,cAAb,MAA+B;CAC7B,AAAQ;;;;;CAMR,AAAO,YAAY,AAAgB,SAAsC;EAAtC;AACjC,OAAK,aAAa,iCAAc,KAAK;EACrC,MAAM,YAAY,KAAK,WAAW;AAElC,MAAI,UAAU,IAAI,QAAQ,IAAI,CAC5B,OAAM,IAAI,MAAM,0BAA0B,QAAQ,IAAI,mBAAmB;AAG3E,YAAU,IAAI,QAAQ,KAAK,KAAK;;CAGlC,AAAQ,aAAgC;EACtC,MAAM,MAAM,+BAAY;AAExB,gDAAI,IAAK,SAAS;GAChB,MAAM,EACJ,QACA,YACA,aACA,SACA,OACA,SACA,YACE,IAAI;AAER,UAAO;IACG;IACR;IACA,SAAS;KACP;KACA;KACA;KACA;KACA;KACD;IACD,OAAO;IACR;;EAGH,MAAM,WAAW,8CAAmB,UAAU;AAE9C,MAAI,UAAU;GACZ,MAAM,EAAE,YAAY,MAAM,OAAO,cAAc;AAE/C,UAAO;IACL,QAAQ,WAAW;IACnB;IACA,OAAO;KACL;KACA;KACA;KACA,WAAW,SAAS;KACpB,cAAc,cAAc;AAE1B,aADa,SAAS;;KAGzB;IACD,SAAS;IACV;;AAGH,QAAM,IAAI,MACR,uGACD;;;;;;;CAQH,MAAa,QAAQ,KAAqB;EACxC,MAAM,EAAE,QAAQ,UAAU,qBAAqB,KAAK;EAEpD,MAAM,sBAAsB,YAAY,KAAK;EAC7C,MAAM,WACN,OACA,OAAO,YAAY;GACjB,MAAM,MAAM,KAAK,YAAY;AAC7B,UAAQ,2DAAM,SAAW,IAAI,KAAK,EAAE;MAClC;EACJ,MAAM,qBAAqB,YAAY,KAAK,GAAG;EAG/C,IAAI,iBAA2C;AAC/C,MAAI,aACF,KAAI;AACF,oBAAiB,MAAM,aAAa,QAAQ,KAAK,QAAQ,KAAK,SAAS;AAGvE,OAAI,kBAAkB,CAAC,eAAe,SAEpC;QAAI,OAAO,WAAW,WAKpB,QAJuB,MAAM,OAAO;KAClC;KACA,UAAU;KACX,CAAC;;WAIC,OAAO;AACd,6BAAO,KAAK,mDAAmD,KAAK,QAAQ,IAAI,KAAK;;EAKzF,MAAM,gBAAgB,YAAY,KAAK;EACvC,MAAM,iBAAiB,MAAM,OAAO;GAClC;GACA,UAAU;GACX,CAAC;EACF,MAAM,eAAe,YAAY,KAAK,GAAG;AAGzC,MAAI,CAAC,kBAAkB;AACrB,4BAAM,YAAY;AAChB,UAAM,KAAK,WAAW,UAAU,MAAM;KACpC,MAAM,kCAAgB;KACtB,MAAM;MACJ,MAAM,KAAK,QAAQ;MACnB,oBAAoB,mBAAmB,QAAQ,EAAE;MACjD,cAAc,aAAa,QAAQ,EAAE;MACrC,cAAc,iBAAiB;MAC/B,kFAAiB,eAAgB,YAAW;MAC7C;KACF,CAAC;KACF;AAEF,4BAAM,YAAY;AAChB,UAAM,KAAK,WAAW,UAAU,MAAM;KACpC,MAAM,kCAAgB;KACtB,IACA,YACA,OAAO,aAAa,YACpB,QAAQ,YACR,OAAO,SAAS,OAAO,WACvB,SAAS,KACT;KACA,MAAM;MACJ,MAAM,KAAK,QAAQ;MACnB,UAAU,iCAAc,gBAAgB,UAAU;MAClD,cAAc,iBAAiB;MAChC;KACF,CAAC;KACF;;AAGJ,SAAO;;;;;;;;AASX,SAAgB,KAChB,SAC8B;CAC5B,MAAM,SAAO,IAAI,YAA6B,QAAQ;CACtD,MAAM,SAAS,OAAK,QAAQ,KAAK,QAAM,OAAU;AAKjD,QAAO,MAAM,eAAgB,KAAK;AAChC,MAAI,4CAAC,IAAK,UACR,OAAM,IAAI,MACR,sEACD;EAGH,MAAM,UACN,OAAO,QAAQ,aACf,MAAO,KAA0C,GACjD;AAKA,SAFuB,MAAM,OAAK,QAAQ,QAAQ;;AAKpD,QAAO"}
|
package/dist/init-CBb0StSB.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
-
const require_commandkit = require('./commandkit-DabqpQ6v.js');
|
|
3
|
-
const require_constants = require('./constants-BMWH2YUr.js');
|
|
4
|
-
const require_CompilerPlugin = require('./CompilerPlugin-CZ4412Zm.js');
|
|
5
|
-
const require_types_package = require('./types-package-D11rQXLs.js');
|
|
6
|
-
const require_common = require('./common-fIO6fqGZ.js');
|
|
7
|
-
let node_fs = require("node:fs");
|
|
8
|
-
node_fs = require_chunk.__toESM(node_fs);
|
|
9
|
-
let node_path = require("node:path");
|
|
10
|
-
node_path = require_chunk.__toESM(node_path);
|
|
11
|
-
let node_fs_promises = require("node:fs/promises");
|
|
12
|
-
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
13
|
-
|
|
14
|
-
//#region src/cli/init.ts
|
|
15
|
-
/**
|
|
16
|
-
* Creates a command line interface for CommandKit.
|
|
17
|
-
* @param argv The arguments passed to the CLI.
|
|
18
|
-
* @param options The options passed to the CLI.
|
|
19
|
-
*/
|
|
20
|
-
async function bootstrapCommandkitCLI(argv, options) {
|
|
21
|
-
process.title = "CommandKit CLI";
|
|
22
|
-
const { Command } = await import("commander");
|
|
23
|
-
const { bootstrapDevelopmentServer } = await Promise.resolve().then(() => require("./cli/development.js"));
|
|
24
|
-
const { bootstrapProductionServer, createProductionBuild } = await Promise.resolve().then(() => require("./cli/production.js"));
|
|
25
|
-
const { generateCommand, generateEvent } = await Promise.resolve().then(() => require("./cli/generators.js"));
|
|
26
|
-
const { version } = await Promise.resolve().then(() => require("./version.js"));
|
|
27
|
-
const { showInformation } = await Promise.resolve().then(() => require("./cli/information.js"));
|
|
28
|
-
const { setCLIEnv } = await Promise.resolve().then(() => require("./cli/env.js"));
|
|
29
|
-
const program = new Command("commandkit");
|
|
30
|
-
program.command("dev").version(version).description("Start your bot in development mode.").option("-c, --config [path]", "Path to your commandkit config file.", "./commandkit.js").action(() => {
|
|
31
|
-
bootstrapDevelopmentServer(program.opts().config);
|
|
32
|
-
});
|
|
33
|
-
program.command("info").description("Show information about the system which can be used to report bugs.").action(async () => {
|
|
34
|
-
await showInformation();
|
|
35
|
-
});
|
|
36
|
-
program.command("start").description("Start your bot in production mode after running the build command.").option("-c, --config [path]", "Path to your commandkit config file.").action(() => {
|
|
37
|
-
bootstrapProductionServer(program.opts().config);
|
|
38
|
-
});
|
|
39
|
-
program.command("build").description("Build your project for production usage.").option("-c, --config [path]", "Path to your commandkit config file.").action(() => {
|
|
40
|
-
setCLIEnv();
|
|
41
|
-
return createProductionBuild(program.opts().config);
|
|
42
|
-
});
|
|
43
|
-
program.command("create").description("Create new files using built-in templates or custom plugin templates").argument("<template>", "The template to use (e.g. command, event, or custom plugin template)").argument("[args...]", "Additional arguments for the template").action(async (template, args) => {
|
|
44
|
-
setCLIEnv();
|
|
45
|
-
const { plugins } = await require_commandkit.loadConfigFile();
|
|
46
|
-
const runtime = new require_commandkit.CompilerPluginRuntime(plugins.filter((p) => require_CompilerPlugin.isCompilerPlugin(p)));
|
|
47
|
-
try {
|
|
48
|
-
await runtime.init();
|
|
49
|
-
const templateHandler = runtime.getTemplate(template);
|
|
50
|
-
if (!templateHandler) {
|
|
51
|
-
if (template === "command") {
|
|
52
|
-
const [name] = args;
|
|
53
|
-
if (!name) require_common.panic("Command name is required");
|
|
54
|
-
await generateCommand(name);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (template === "event") {
|
|
58
|
-
const [name] = args;
|
|
59
|
-
if (!name) require_common.panic("Event name is required");
|
|
60
|
-
await generateEvent(name);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
require_common.panic(`Template "${template}" not found. Available templates: ${Array.from(new Set([
|
|
64
|
-
"command",
|
|
65
|
-
"event",
|
|
66
|
-
...Array.from(runtime.getTemplates().keys())
|
|
67
|
-
])).map((t) => `"${t}"`).join(", ")}`);
|
|
68
|
-
}
|
|
69
|
-
await templateHandler(args);
|
|
70
|
-
} catch (e) {
|
|
71
|
-
require_common.panic(`Failed to execute template "${template}": ${(e === null || e === void 0 ? void 0 : e.message) || e}`);
|
|
72
|
-
} finally {
|
|
73
|
-
await runtime.destroy();
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
const types = (0, node_path.join)(require_constants.COMMANDKIT_CWD, "node_modules", "commandkit-types");
|
|
77
|
-
if (!(0, node_fs.existsSync)(types)) {
|
|
78
|
-
await (0, node_fs_promises.mkdir)(types, { recursive: true }).catch(() => {});
|
|
79
|
-
await require_types_package.generateTypesPackage(true).catch(() => {});
|
|
80
|
-
}
|
|
81
|
-
await program.parseAsync(argv, options);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
//#endregion
|
|
85
|
-
Object.defineProperty(exports, 'bootstrapCommandkitCLI', {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
get: function () {
|
|
88
|
-
return bootstrapCommandkitCLI;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
//# sourceMappingURL=init-CBb0StSB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-CBb0StSB.js","names":[],"sources":["../src/cli/init.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { generateTypesPackage } from '../utils/types-package';\nimport { loadConfigFile } from '../config/loader';\nimport {\n CompilerPlugin,\n CompilerPluginRuntime,\n isCompilerPlugin,\n} from '../plugins';\nimport { panic } from './common';\nimport { COMMANDKIT_CWD } from '../utils/constants';\n\n/**\n * Creates a command line interface for CommandKit.\n * @param argv The arguments passed to the CLI.\n * @param options The options passed to the CLI.\n */\nexport async function bootstrapCommandkitCLI(\n argv: string[],\n options?: import('commander').ParseOptions | undefined,\n) {\n process.title = 'CommandKit CLI';\n\n // imports are lazily loaded when the cli is used, instead of loading it with the lib itself\n const { Command } = await import('commander');\n const { bootstrapDevelopmentServer } = await import('./development');\n const { bootstrapProductionServer, createProductionBuild } = await import(\n './production'\n );\n const { generateCommand, generateEvent } = await import('./generators');\n const { version } = await import('../version');\n const { showInformation } = await import('./information');\n const { setCLIEnv } = await import('./env');\n\n const program = new Command('commandkit');\n\n program\n .command('dev')\n .version(version)\n .description('Start your bot in development mode.')\n .option(\n '-c, --config [path]',\n 'Path to your commandkit config file.',\n './commandkit.js',\n )\n .action(() => {\n const options = program.opts();\n bootstrapDevelopmentServer(options.config);\n });\n\n program\n .command('info')\n .description(\n 'Show information about the system which can be used to report bugs.',\n )\n .action(async () => {\n await showInformation();\n });\n\n program\n .command('start')\n .description(\n 'Start your bot in production mode after running the build command.',\n )\n .option('-c, --config [path]', 'Path to your commandkit config file.')\n .action(() => {\n const options = program.opts();\n bootstrapProductionServer(options.config);\n });\n\n program\n .command('build')\n .description('Build your project for production usage.')\n .option('-c, --config [path]', 'Path to your commandkit config file.')\n .action(() => {\n setCLIEnv();\n const options = program.opts();\n return createProductionBuild(options.config);\n });\n\n program\n .command('create')\n .description(\n 'Create new files using built-in templates or custom plugin templates',\n )\n .argument(\n '<template>',\n 'The template to use (e.g. command, event, or custom plugin template)',\n )\n .argument('[args...]', 'Additional arguments for the template')\n .action(async (template, args) => {\n setCLIEnv();\n\n // Handle custom plugin templates\n const { plugins } = await loadConfigFile();\n const runtime = new CompilerPluginRuntime(\n plugins.filter((p) => isCompilerPlugin(p)) as CompilerPlugin[],\n );\n\n try {\n await runtime.init();\n const templateHandler = runtime.getTemplate(template);\n\n if (!templateHandler) {\n // Handle built-in templates\n if (template === 'command') {\n const [name] = args;\n if (!name) {\n panic('Command name is required');\n }\n await generateCommand(name);\n return;\n }\n\n if (template === 'event') {\n const [name] = args;\n if (!name) {\n panic('Event name is required');\n }\n await generateEvent(name);\n return;\n }\n\n const valid = Array.from(\n new Set([\n 'command',\n 'event',\n ...Array.from(runtime.getTemplates().keys()),\n ]),\n ).map((t) => `\"${t}\"`);\n\n panic(\n `Template \"${template}\" not found. Available templates: ${valid.join(', ')}`,\n );\n }\n\n await templateHandler(args);\n } catch (e: any) {\n panic(`Failed to execute template \"${template}\": ${e?.message || e}`);\n } finally {\n await runtime.destroy();\n }\n });\n\n const types = join(COMMANDKIT_CWD, 'node_modules', 'commandkit-types');\n\n if (!existsSync(types)) {\n await mkdir(types, { recursive: true }).catch(() => {});\n await generateTypesPackage(true).catch(() => {});\n }\n\n await program.parseAsync(argv, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,eAAsB,uBACtB,MACA,SACA;AACE,SAAQ,QAAQ;CAGhB,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,EAAE,+BAA+B,2CAAM;CAC7C,MAAM,EAAE,2BAA2B,0BAA0B,2CAAM;CAGnE,MAAM,EAAE,iBAAiB,kBAAkB,2CAAM;CACjD,MAAM,EAAE,YAAY,2CAAM;CAC1B,MAAM,EAAE,oBAAoB,2CAAM;CAClC,MAAM,EAAE,cAAc,2CAAM;CAE5B,MAAM,UAAU,IAAI,QAAQ,aAAa;AAEzC,SACA,QAAQ,MAAM,CACd,QAAQ,QAAQ,CAChB,YAAY,sCAAsC,CAClD,OACE,uBACA,wCACA,kBACD,CACD,aAAa;AAEX,6BADgB,QAAQ,MAAM,CACK,OAAO;GAC1C;AAEF,SACA,QAAQ,OAAO,CACf,YACE,sEACD,CACD,OAAO,YAAY;AACjB,QAAM,iBAAiB;GACvB;AAEF,SACA,QAAQ,QAAQ,CAChB,YACE,qEACD,CACD,OAAO,uBAAuB,uCAAuC,CACrE,aAAa;AAEX,4BADgB,QAAQ,MAAM,CACI,OAAO;GACzC;AAEF,SACA,QAAQ,QAAQ,CAChB,YAAY,2CAA2C,CACvD,OAAO,uBAAuB,uCAAuC,CACrE,aAAa;AACX,aAAW;AAEX,SAAO,sBADS,QAAQ,MAAM,CACO,OAAO;GAC5C;AAEF,SACA,QAAQ,SAAS,CACjB,YACE,uEACD,CACD,SACE,cACA,uEACD,CACD,SAAS,aAAa,wCAAwC,CAC9D,OAAO,OAAO,UAAU,SAAS;AAC/B,aAAW;EAGX,MAAM,EAAE,YAAY,MAAM,mCAAgB;EAC1C,MAAM,UAAU,IAAI,yCAClB,QAAQ,QAAQ,MAAM,wCAAiB,EAAE,CAAC,CAC3C;AAED,MAAI;AACF,SAAM,QAAQ,MAAM;GACpB,MAAM,kBAAkB,QAAQ,YAAY,SAAS;AAErD,OAAI,CAAC,iBAAiB;AAEpB,QAAI,aAAa,WAAW;KAC1B,MAAM,CAAC,QAAQ;AACf,SAAI,CAAC,KACH,sBAAM,2BAA2B;AAEnC,WAAM,gBAAgB,KAAK;AAC3B;;AAGF,QAAI,aAAa,SAAS;KACxB,MAAM,CAAC,QAAQ;AACf,SAAI,CAAC,KACH,sBAAM,yBAAyB;AAEjC,WAAM,cAAc,KAAK;AACzB;;AAWF,yBACE,aAAa,SAAS,oCATV,MAAM,KAClB,IAAI,IAAI;KACR;KACA;KACA,GAAG,MAAM,KAAK,QAAQ,cAAc,CAAC,MAAM,CAAC;KAAC,CAC5C,CACF,CAAC,KAAK,MAAM,IAAI,EAAE,GAAG,CAG4C,KAAK,KAAK,GAC3E;;AAGH,SAAM,gBAAgB,KAAK;WACpB,GAAQ;AACf,wBAAM,+BAA+B,SAAS,4CAAK,EAAG,YAAW,IAAI;YAC7D;AACR,SAAM,QAAQ,SAAS;;GAEzB;CAEF,MAAM,4BAAa,kCAAgB,gBAAgB,mBAAmB;AAEtE,KAAI,yBAAY,MAAM,EAAE;AACtB,oCAAY,OAAO,EAAE,WAAW,MAAM,CAAC,CAAC,YAAY,GAAG;AACvD,QAAM,2CAAqB,KAAK,CAAC,YAAY,GAAG;;AAGlD,OAAM,QAAQ,WAAW,MAAM,QAAQ"}
|
package/dist/init-DSYckXwx.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as commander0 from "commander";
|
|
2
|
-
|
|
3
|
-
//#region src/cli/init.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates a command line interface for CommandKit.
|
|
7
|
-
* @param argv The arguments passed to the CLI.
|
|
8
|
-
* @param options The options passed to the CLI.
|
|
9
|
-
*/
|
|
10
|
-
declare function bootstrapCommandkitCLI(argv: string[], options?: commander0.ParseOptions | undefined): Promise<void>;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { bootstrapCommandkitCLI };
|
|
13
|
-
//# sourceMappingURL=init-DSYckXwx.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/utils/resolve-file-url.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Convert a local file path to a file URL.
|
|
4
|
-
* @param filePath - The local file's path.
|
|
5
|
-
* @param withTs - Whether to append a timestamp to the URL.
|
|
6
|
-
* @returns - The converted file URL.
|
|
7
|
-
*/
|
|
8
|
-
declare function toFileURL(filePath: string, withTs?: boolean): string;
|
|
9
|
-
//#endregion
|
|
10
|
-
export { toFileURL };
|
|
11
|
-
//# sourceMappingURL=resolve-file-url-DFtR8jRR.d.ts.map
|
package/dist/serde-D4H23l2F.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SerializerType } from "./constants-CCFSX2NG.js";
|
|
2
|
-
|
|
3
|
-
//#region src/kv/serde.d.ts
|
|
4
|
-
interface SerializedValue {
|
|
5
|
-
t: SerializerType;
|
|
6
|
-
v: any;
|
|
7
|
-
}
|
|
8
|
-
declare function serializer(value: any): SerializedValue;
|
|
9
|
-
declare function deserializer(serialized: SerializedValue): any;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { SerializedValue, deserializer, serializer };
|
|
12
|
-
//# sourceMappingURL=serde-D4H23l2F.d.ts.map
|
package/dist/serde-DHHwhltz.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
const require_constants = require('./constants-AH-9qJ89.js');
|
|
2
|
-
|
|
3
|
-
//#region src/kv/serde.ts
|
|
4
|
-
function serializer(value) {
|
|
5
|
-
if (value === null) return {
|
|
6
|
-
t: require_constants.SerializerType.Null,
|
|
7
|
-
v: null
|
|
8
|
-
};
|
|
9
|
-
if (value === void 0) return {
|
|
10
|
-
t: require_constants.SerializerType.Undefined,
|
|
11
|
-
v: void 0
|
|
12
|
-
};
|
|
13
|
-
if (typeof value === "string") return {
|
|
14
|
-
t: require_constants.SerializerType.String,
|
|
15
|
-
v: value
|
|
16
|
-
};
|
|
17
|
-
if (typeof value === "number") return {
|
|
18
|
-
t: require_constants.SerializerType.Number,
|
|
19
|
-
v: value
|
|
20
|
-
};
|
|
21
|
-
if (typeof value === "boolean") return {
|
|
22
|
-
t: require_constants.SerializerType.Boolean,
|
|
23
|
-
v: value
|
|
24
|
-
};
|
|
25
|
-
if (typeof value === "bigint") return {
|
|
26
|
-
t: require_constants.SerializerType.BigInt,
|
|
27
|
-
v: value.toString()
|
|
28
|
-
};
|
|
29
|
-
if (value instanceof Date) return {
|
|
30
|
-
t: require_constants.SerializerType.Date,
|
|
31
|
-
v: value.toISOString()
|
|
32
|
-
};
|
|
33
|
-
if (Array.isArray(value)) return {
|
|
34
|
-
t: require_constants.SerializerType.Array,
|
|
35
|
-
v: value
|
|
36
|
-
};
|
|
37
|
-
if (value instanceof Map) return {
|
|
38
|
-
t: require_constants.SerializerType.Map,
|
|
39
|
-
v: Array.from(value.entries())
|
|
40
|
-
};
|
|
41
|
-
if (value instanceof Set) return {
|
|
42
|
-
t: require_constants.SerializerType.Set,
|
|
43
|
-
v: Array.from(value)
|
|
44
|
-
};
|
|
45
|
-
if (Buffer.isBuffer(value)) return {
|
|
46
|
-
t: require_constants.SerializerType.Buffer,
|
|
47
|
-
v: value.toString("base64")
|
|
48
|
-
};
|
|
49
|
-
if (value instanceof RegExp) return {
|
|
50
|
-
t: require_constants.SerializerType.RegExp,
|
|
51
|
-
v: {
|
|
52
|
-
source: value.source,
|
|
53
|
-
flags: value.flags
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
if (typeof value === "object") return {
|
|
57
|
-
t: require_constants.SerializerType.Object,
|
|
58
|
-
v: value
|
|
59
|
-
};
|
|
60
|
-
return {
|
|
61
|
-
t: require_constants.SerializerType.String,
|
|
62
|
-
v: String(value)
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function deserializer(serialized) {
|
|
66
|
-
switch (serialized.t) {
|
|
67
|
-
case require_constants.SerializerType.Null: return null;
|
|
68
|
-
case require_constants.SerializerType.Undefined: return;
|
|
69
|
-
case require_constants.SerializerType.String: return serialized.v;
|
|
70
|
-
case require_constants.SerializerType.Number: return serialized.v;
|
|
71
|
-
case require_constants.SerializerType.Boolean: return serialized.v;
|
|
72
|
-
case require_constants.SerializerType.BigInt: return BigInt(serialized.v);
|
|
73
|
-
case require_constants.SerializerType.Date: return new Date(serialized.v);
|
|
74
|
-
case require_constants.SerializerType.Array: return serialized.v;
|
|
75
|
-
case require_constants.SerializerType.Map: return new Map(serialized.v);
|
|
76
|
-
case require_constants.SerializerType.Set: return new Set(serialized.v);
|
|
77
|
-
case require_constants.SerializerType.Buffer: return Buffer.from(serialized.v, "base64");
|
|
78
|
-
case require_constants.SerializerType.RegExp: return new RegExp(serialized.v.source, serialized.v.flags);
|
|
79
|
-
case require_constants.SerializerType.Object: return serialized.v;
|
|
80
|
-
default: return serialized.v;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
//#endregion
|
|
85
|
-
Object.defineProperty(exports, 'deserializer', {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
get: function () {
|
|
88
|
-
return deserializer;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
Object.defineProperty(exports, 'serializer', {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
get: function () {
|
|
94
|
-
return serializer;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
//# sourceMappingURL=serde-DHHwhltz.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serde-DHHwhltz.js","names":[],"sources":["../src/kv/serde.ts"],"sourcesContent":["import { SerializerType } from './constants';\n\nexport interface SerializedValue {\n t: SerializerType;\n v: any;\n}\n\nexport function serializer(value: any): SerializedValue {\n if (value === null) {\n return { t: SerializerType.Null, v: null };\n }\n\n if (value === undefined) {\n return { t: SerializerType.Undefined, v: undefined };\n }\n\n if (typeof value === 'string') {\n return { t: SerializerType.String, v: value };\n }\n\n if (typeof value === 'number') {\n return { t: SerializerType.Number, v: value };\n }\n\n if (typeof value === 'boolean') {\n return { t: SerializerType.Boolean, v: value };\n }\n\n if (typeof value === 'bigint') {\n return { t: SerializerType.BigInt, v: value.toString() };\n }\n\n if (value instanceof Date) {\n return { t: SerializerType.Date, v: value.toISOString() };\n }\n\n if (Array.isArray(value)) {\n return { t: SerializerType.Array, v: value };\n }\n\n if (value instanceof Map) {\n return { t: SerializerType.Map, v: Array.from(value.entries()) };\n }\n\n if (value instanceof Set) {\n return { t: SerializerType.Set, v: Array.from(value) };\n }\n\n if (Buffer.isBuffer(value)) {\n return { t: SerializerType.Buffer, v: value.toString('base64') };\n }\n\n if (value instanceof RegExp) {\n return {\n t: SerializerType.RegExp,\n v: { source: value.source, flags: value.flags },\n };\n }\n\n if (typeof value === 'object') {\n return { t: SerializerType.Object, v: value };\n }\n\n // Fallback to string\n return { t: SerializerType.String, v: String(value) };\n}\n\nexport function deserializer(serialized: SerializedValue): any {\n switch (serialized.t) {\n case SerializerType.Null:\n return null;\n case SerializerType.Undefined:\n return undefined;\n case SerializerType.String:\n return serialized.v;\n case SerializerType.Number:\n return serialized.v;\n case SerializerType.Boolean:\n return serialized.v;\n case SerializerType.BigInt:\n return BigInt(serialized.v);\n case SerializerType.Date:\n return new Date(serialized.v);\n case SerializerType.Array:\n return serialized.v;\n case SerializerType.Map:\n return new Map(serialized.v);\n case SerializerType.Set:\n return new Set(serialized.v);\n case SerializerType.Buffer:\n return Buffer.from(serialized.v, 'base64');\n case SerializerType.RegExp:\n return new RegExp(serialized.v.source, serialized.v.flags);\n case SerializerType.Object:\n return serialized.v;\n default:\n return serialized.v;\n }\n}\n"],"mappings":";;;AAOA,SAAgB,WAAW,OAA6B;AACtD,KAAI,UAAU,KACZ,QAAO;EAAE,GAAG,iCAAe;EAAM,GAAG;EAAM;AAG5C,KAAI,UAAU,OACZ,QAAO;EAAE,GAAG,iCAAe;EAAW,GAAG;EAAW;AAGtD,KAAI,OAAO,UAAU,SACnB,QAAO;EAAE,GAAG,iCAAe;EAAQ,GAAG;EAAO;AAG/C,KAAI,OAAO,UAAU,SACnB,QAAO;EAAE,GAAG,iCAAe;EAAQ,GAAG;EAAO;AAG/C,KAAI,OAAO,UAAU,UACnB,QAAO;EAAE,GAAG,iCAAe;EAAS,GAAG;EAAO;AAGhD,KAAI,OAAO,UAAU,SACnB,QAAO;EAAE,GAAG,iCAAe;EAAQ,GAAG,MAAM,UAAU;EAAE;AAG1D,KAAI,iBAAiB,KACnB,QAAO;EAAE,GAAG,iCAAe;EAAM,GAAG,MAAM,aAAa;EAAE;AAG3D,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO;EAAE,GAAG,iCAAe;EAAO,GAAG;EAAO;AAG9C,KAAI,iBAAiB,IACnB,QAAO;EAAE,GAAG,iCAAe;EAAK,GAAG,MAAM,KAAK,MAAM,SAAS,CAAC;EAAE;AAGlE,KAAI,iBAAiB,IACnB,QAAO;EAAE,GAAG,iCAAe;EAAK,GAAG,MAAM,KAAK,MAAM;EAAE;AAGxD,KAAI,OAAO,SAAS,MAAM,CACxB,QAAO;EAAE,GAAG,iCAAe;EAAQ,GAAG,MAAM,SAAS,SAAS;EAAE;AAGlE,KAAI,iBAAiB,OACnB,QAAO;EACL,GAAG,iCAAe;EAClB,GAAG;GAAE,QAAQ,MAAM;GAAQ,OAAO,MAAM;GAAO;EAChD;AAGH,KAAI,OAAO,UAAU,SACnB,QAAO;EAAE,GAAG,iCAAe;EAAQ,GAAG;EAAO;AAI/C,QAAO;EAAE,GAAG,iCAAe;EAAQ,GAAG,OAAO,MAAM;EAAE;;AAGvD,SAAgB,aAAa,YAAkC;AAC7D,SAAQ,WAAW,GAAnB;EACE,KAAK,iCAAe,KAClB,QAAO;EACT,KAAK,iCAAe,UAClB;EACF,KAAK,iCAAe,OAClB,QAAO,WAAW;EACpB,KAAK,iCAAe,OAClB,QAAO,WAAW;EACpB,KAAK,iCAAe,QAClB,QAAO,WAAW;EACpB,KAAK,iCAAe,OAClB,QAAO,OAAO,WAAW,EAAE;EAC7B,KAAK,iCAAe,KAClB,QAAO,IAAI,KAAK,WAAW,EAAE;EAC/B,KAAK,iCAAe,MAClB,QAAO,WAAW;EACpB,KAAK,iCAAe,IAClB,QAAO,IAAI,IAAI,WAAW,EAAE;EAC9B,KAAK,iCAAe,IAClB,QAAO,IAAI,IAAI,WAAW,EAAE;EAC9B,KAAK,iCAAe,OAClB,QAAO,OAAO,KAAK,WAAW,GAAG,SAAS;EAC5C,KAAK,iCAAe,OAClB,QAAO,IAAI,OAAO,WAAW,EAAE,QAAQ,WAAW,EAAE,MAAM;EAC5D,KAAK,iCAAe,OAClB,QAAO,WAAW;EACpB,QACE,QAAO,WAAW"}
|