commandkit 1.2.0-rc.13 → 1.2.0-rc.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -23
- package/dist/{ActionRow-B-CGmjDp.d.ts → ActionRow-Bt9qi0Mb.d.ts} +2 -2
- package/dist/{Button-C-GPeFA3.d.ts → Button-DxJLcZIU.d.ts} +5 -5
- package/dist/{ButtonKit-DKu0VAe4.d.ts → ButtonKit-BfcyvWfj.d.ts} +35 -35
- package/dist/{ChannelSelectMenuKit-HQZ4hH5s.d.ts → ChannelSelectMenuKit-DYkudikb.d.ts} +33 -33
- package/dist/{CommandsRouter-C7dZEepB.d.ts → CommandsRouter-DiNoF0dq.d.ts} +48 -48
- package/dist/{EventInterceptor-CZmWpS08.d.ts → EventInterceptor-D9JKMcfi.d.ts} +39 -39
- package/dist/{EventsRouter-DZ37r54v.d.ts → EventsRouter-EuuSu6NH.d.ts} +34 -34
- package/dist/{MentionableSelectMenuKit-7URDUM3-.d.ts → MentionableSelectMenuKit-Mu4xqP6B.d.ts} +33 -33
- package/dist/MessageCommandParser-DPCbHXCS.d.ts +194 -0
- package/dist/{Modal-CZT9MZsy.d.ts → Modal-v9rrcMl-.d.ts} +7 -7
- package/dist/{ModalKit-BWXI3Z26.d.ts → ModalKit-XJSM65SV.d.ts} +32 -32
- package/dist/{RoleSelectMenuKit-BY-JJ18w.d.ts → RoleSelectMenuKit-CCjcp3HY.d.ts} +33 -33
- package/dist/{SelectMenu-q_b3Mjv9.d.ts → SelectMenu-CY0vvoSu.d.ts} +15 -11
- package/dist/{StringSelectMenuKit-lVhUMc3g.d.ts → StringSelectMenuKit-G5nBTicX.d.ts} +33 -33
- package/dist/{UserSelectMenuKit-CCj4Fpkr.d.ts → UserSelectMenuKit-D3SO_fXA.d.ts} +33 -33
- package/dist/analytics/analytics-engine.d.ts +1 -1
- package/dist/analytics/analytics-engine.js +2 -24
- package/dist/analytics/analytics-provider.d.ts +1 -1
- package/dist/analytics/analytics-provider.js +1 -0
- package/dist/analytics/constants.js +26 -3
- package/dist/analytics/constants.js.map +1 -0
- package/dist/analytics/utils.js +2 -24
- package/dist/{analytics-engine-WQhXmx3H.d.ts → analytics-engine-DnRsHBId.d.ts} +846 -841
- package/dist/app/commands/AppCommandRunner.d.ts +1 -1
- package/dist/app/commands/AppCommandRunner.js +2 -24
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +2 -24
- package/dist/app/commands/MessageCommandParser.d.ts +1 -1
- package/dist/app/commands/MessageCommandParser.js +261 -3
- package/dist/app/commands/MessageCommandParser.js.map +1 -0
- package/dist/app/commands/helpers.d.ts +1 -1
- package/dist/app/commands/helpers.js +25 -3
- package/dist/app/commands/helpers.js.map +1 -0
- package/dist/app/events/EventWorkerContext.d.ts +2 -2
- package/dist/app/events/EventWorkerContext.js +48 -5
- package/dist/app/events/EventWorkerContext.js.map +1 -0
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
- package/dist/app/handlers/AppCommandHandler.js +2 -24
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +2 -24
- package/dist/app/index.d.ts +4 -4
- package/dist/app/index.js +13 -32
- package/dist/app/interrupt/signals.d.ts +1 -1
- package/dist/app/interrupt/signals.js +54 -6
- package/dist/app/interrupt/signals.js.map +1 -0
- package/dist/app/middlewares/permissions.d.ts +1 -1
- package/dist/app/middlewares/permissions.js +2 -24
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +2 -24
- package/dist/app/router/CommandsRouter.d.ts +1 -1
- package/dist/app/router/CommandsRouter.js +210 -2
- package/dist/app/router/CommandsRouter.js.map +1 -0
- package/dist/app/router/EventsRouter.d.ts +1 -1
- package/dist/app/router/EventsRouter.js +128 -2
- package/dist/app/router/EventsRouter.js.map +1 -0
- package/dist/app/router/index.d.ts +2 -2
- package/dist/app/router/index.js +5 -5
- package/dist/{chunk-kSYXY2_d.js → chunk-BE-pF4vm.js} +1 -1
- package/dist/cli/app-process.d.ts +2 -2
- package/dist/cli/app-process.js +6 -8
- package/dist/cli/app-process.js.map +1 -1
- package/dist/cli/build.d.ts +2 -2
- package/dist/cli/build.js +15 -35
- package/dist/cli/build.js.map +1 -1
- package/dist/cli/common.d.ts +5 -5
- package/dist/cli/common.js +182 -12
- package/dist/cli/common.js.map +1 -0
- package/dist/cli/development.d.ts +3 -3
- package/dist/cli/development.js +38 -59
- package/dist/cli/development.js.map +1 -1
- package/dist/cli/env.js +73 -9
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/generators.js +10 -10
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.js +8 -7
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +2 -2
- package/dist/cli/init.js +14 -33
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/production.d.ts +2 -2
- package/dist/cli/production.js +11 -33
- package/dist/cli/production.js.map +1 -1
- package/dist/cli/type-checker.js +83 -6
- package/dist/cli/type-checker.js.map +1 -0
- package/dist/cli/utils.js +1 -0
- package/dist/cli/utils.js.map +1 -1
- package/dist/{commandkit-SIjTLD2R.js → commandkit--k6yDJEr.js} +3157 -2699
- package/dist/commandkit--k6yDJEr.js.map +1 -0
- package/dist/commandkit.d.ts +1 -1
- package/dist/commandkit.js +2 -24
- package/dist/{common-DnwCYit8.d.ts → common-CCvvgnxi.d.ts} +2 -2
- package/dist/components/common/EventInterceptor.d.ts +1 -1
- package/dist/components/common/EventInterceptor.js +137 -2
- package/dist/components/common/EventInterceptor.js.map +1 -0
- package/dist/components/common/element.d.ts +2 -2
- package/dist/components/common/element.js +10 -8
- package/dist/components/common/types.d.ts +1 -1
- package/dist/components/common/types.js +1 -0
- package/dist/components/display/common.js +3 -2
- package/dist/components/display/container.d.ts +1 -1
- package/dist/components/display/container.js +3 -2
- package/dist/components/display/file.d.ts +1 -1
- package/dist/components/display/file.js +23 -2
- package/dist/components/display/file.js.map +1 -0
- package/dist/components/display/index.d.ts +8 -8
- package/dist/components/display/index.js +18 -21
- package/dist/components/display/label.d.ts +1 -1
- package/dist/components/display/label.js +3 -2
- package/dist/components/display/media-gallery.d.ts +1 -1
- package/dist/components/display/media-gallery.js +4 -3
- package/dist/components/display/poll.d.ts +1 -1
- package/dist/components/display/poll.js +85 -4
- package/dist/{poll-CFe8yvoJ.js.map → components/display/poll.js.map} +1 -1
- package/dist/components/display/section.d.ts +1 -1
- package/dist/components/display/section.js +4 -3
- package/dist/components/display/separator.d.ts +1 -1
- package/dist/components/display/separator.js +21 -2
- package/dist/components/display/separator.js.map +1 -0
- package/dist/components/display/text-display.d.ts +1 -1
- package/dist/components/display/text-display.js +26 -2
- package/dist/components/display/text-display.js.map +1 -0
- package/dist/components/index.d.ts +23 -23
- package/dist/components/index.js +28 -45
- package/dist/components/interactive/action-row/ActionRow.d.ts +1 -1
- package/dist/components/interactive/action-row/ActionRow.js +20 -2
- package/dist/{ActionRow-CSN_UKmM.js.map → components/interactive/action-row/ActionRow.js.map} +1 -1
- package/dist/components/interactive/button/Button.d.ts +1 -1
- package/dist/components/interactive/button/Button.js +2 -24
- package/dist/components/interactive/button/ButtonKit.d.ts +1 -1
- package/dist/components/interactive/button/ButtonKit.js +2 -24
- package/dist/components/interactive/modal/Modal.d.ts +1 -1
- package/dist/components/interactive/modal/Modal.js +2 -24
- package/dist/components/interactive/modal/ModalKit.d.ts +1 -1
- package/dist/components/interactive/modal/ModalKit.js +2 -24
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +2 -24
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +2 -24
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +2 -24
- package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -1
- package/dist/components/interactive/select-menu/SelectMenu.js +2 -24
- package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/StringSelectMenuKit.js +2 -24
- package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/UserSelectMenuKit.js +2 -24
- package/dist/components/interactive/select-menu/common.d.ts +1 -1
- package/dist/components/interactive/select-menu/common.js +1 -0
- package/dist/config/config.d.ts +1 -1
- package/dist/config/config.js +2 -24
- package/dist/config/default.d.ts +1 -1
- package/dist/config/default.js +2 -24
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.js +2 -24
- package/dist/config/types.d.ts +1 -1
- package/dist/config/types.js +1 -0
- package/dist/config/utils.d.ts +1 -1
- package/dist/config/utils.js +29 -2
- package/dist/config/utils.js.map +1 -0
- package/dist/{constants-EpKcj0dH.d.ts → constants-DqtJY0t-.d.ts} +2 -2
- package/dist/{constants-CuYW0K10.d.ts → constants-DwxpkIeH.d.ts} +7 -7
- package/dist/{container-DYcb7zGw.d.ts → container-CYojOA9d.d.ts} +1 -1
- package/dist/context/async-context.d.ts +1 -1
- package/dist/context/async-context.js +2 -24
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +2 -24
- package/dist/{element-wQo0heGj.d.ts → element-DeLvTMfZ.d.ts} +5 -4
- package/dist/events/CommandKitEventsChannel.d.ts +1 -1
- package/dist/events/CommandKitEventsChannel.js +83 -2
- package/dist/events/CommandKitEventsChannel.js.map +1 -0
- package/dist/{file-CrV4lSnl.d.ts → file-DLO1zEcH.d.ts} +1 -1
- package/dist/flags/FlagProvider.d.ts +1 -1
- package/dist/flags/FlagProvider.js +1 -0
- package/dist/flags/FlagProvider.js.map +1 -1
- package/dist/flags/feature-flags.d.ts +1 -1
- package/dist/flags/feature-flags.js +5 -165
- package/dist/flags/store.d.ts +1 -1
- package/dist/flags/store.js +13 -2
- package/dist/flags/store.js.map +1 -0
- package/dist/{helpers-AQPLVY35.d.ts → helpers-zmC44Mcu.d.ts} +1 -1
- package/dist/index.d.ts +31 -31
- package/dist/index.js +78 -97
- package/dist/kv/constants.d.ts +1 -1
- package/dist/kv/constants.js +22 -2
- package/dist/kv/constants.js.map +1 -0
- package/dist/kv/dotprops.js +1 -0
- package/dist/kv/dotprops.js.map +1 -1
- package/dist/kv/kv.d.ts +288 -288
- package/dist/kv/kv.js +2 -1
- package/dist/kv/kv.js.map +1 -1
- package/dist/kv/serde.d.ts +1 -1
- package/dist/kv/serde.js +29 -28
- package/dist/kv/serde.js.map +1 -1
- package/dist/{label-37kaNWMH.d.ts → label-DqGRqodo.d.ts} +3 -3
- package/dist/logger/DefaultLogger.d.ts +19 -19
- package/dist/logger/DefaultLogger.js +2 -24
- package/dist/logger/ILogger.d.ts +35 -35
- package/dist/logger/ILogger.js +1 -0
- package/dist/logger/Logger.d.ts +5 -5
- package/dist/logger/Logger.js +2 -24
- package/dist/logger/NoopLogger.d.ts +35 -35
- package/dist/logger/NoopLogger.js +1 -0
- package/dist/logger/NoopLogger.js.map +1 -1
- package/dist/{media-gallery-Ci3I4ElH.d.ts → media-gallery-Ca8es-eB.d.ts} +1 -1
- package/dist/plugins/CompilerPlugin.d.ts +1 -1
- package/dist/plugins/CompilerPlugin.js +33 -3
- package/dist/plugins/CompilerPlugin.js.map +1 -0
- package/dist/plugins/PluginCommon.d.ts +1 -1
- package/dist/plugins/PluginCommon.js +55 -4
- package/dist/plugins/PluginCommon.js.map +1 -0
- package/dist/plugins/RuntimePlugin.d.ts +1 -1
- package/dist/plugins/RuntimePlugin.js +124 -3
- package/dist/plugins/RuntimePlugin.js.map +1 -0
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +8 -30
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +2 -24
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +2 -24
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +2 -24
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +2 -24
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/runtime.js +1 -0
- package/dist/plugins/types.d.ts +1 -1
- package/dist/plugins/types.js +1 -0
- package/dist/{poll-Ddtapd6n.d.ts → poll-DQ6DX_Tt.d.ts} +8 -8
- package/dist/{section-DkUKULnB.d.ts → section-Q8nwx_-q.d.ts} +1 -1
- package/dist/{separator-CbXsIFCa.d.ts → separator-B8P-kdIK.d.ts} +1 -1
- package/dist/{signals-BbTgTc0i.d.ts → signals-CBXwugBW.d.ts} +1 -1
- package/dist/{text-display-D7j39VC-.d.ts → text-display-CL9C2yMc.d.ts} +1 -1
- package/dist/{types-BywA9d2Z.d.ts → types-DZy7U-Ld.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -0
- package/dist/utils/colors.js +9 -3
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +50 -8
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/dev-hooks.d.ts +1 -1
- package/dist/utils/dev-hooks.js +2 -24
- package/dist/utils/error-codes.d.ts +10 -10
- package/dist/utils/error-codes.js +53 -5
- package/dist/utils/error-codes.js.map +1 -0
- package/dist/utils/resolve-file-url.js +18 -2
- package/dist/utils/resolve-file-url.js.map +1 -0
- package/dist/utils/types-package.js +61 -4
- package/dist/utils/types-package.js.map +1 -0
- package/dist/utils/useful-stuff/async-queue.d.ts +21 -21
- package/dist/utils/useful-stuff/async-queue.js +1 -0
- package/dist/utils/useful-stuff/async-queue.js.map +1 -1
- package/dist/utils/useful-stuff/mutex.d.ts +62 -62
- package/dist/utils/useful-stuff/mutex.js +1 -0
- package/dist/utils/useful-stuff/mutex.js.map +1 -1
- package/dist/utils/useful-stuff/ratelimiter.d.ts +56 -56
- package/dist/utils/useful-stuff/ratelimiter.js +1 -0
- package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
- package/dist/utils/useful-stuff/semaphore.d.ts +82 -82
- package/dist/utils/useful-stuff/semaphore.js +1 -0
- package/dist/utils/useful-stuff/semaphore.js.map +1 -1
- package/dist/utils/utilities.d.ts +5 -5
- package/dist/utils/utilities.js +2 -24
- package/dist/utils/warning.js +38 -4
- package/dist/utils/warning.js.map +1 -0
- package/dist/version.js +2 -1
- package/dist/version.js.map +1 -1
- package/package.json +12 -15
- package/dist/ActionRow-CSN_UKmM.js +0 -25
- package/dist/CommandKitEventsChannel-CnT5ymYe.js +0 -88
- package/dist/CommandKitEventsChannel-CnT5ymYe.js.map +0 -1
- package/dist/CommandsRouter-C_HLsrGX.js +0 -215
- package/dist/CommandsRouter-C_HLsrGX.js.map +0 -1
- package/dist/CompilerPlugin-CUsGAfgl.js +0 -43
- package/dist/CompilerPlugin-CUsGAfgl.js.map +0 -1
- package/dist/EventInterceptor-BWoEJMHZ.js +0 -142
- package/dist/EventInterceptor-BWoEJMHZ.js.map +0 -1
- package/dist/EventWorkerContext-Dfhgv329.js +0 -68
- package/dist/EventWorkerContext-Dfhgv329.js.map +0 -1
- package/dist/EventsRouter-DZYIha6m.js +0 -133
- package/dist/EventsRouter-DZYIha6m.js.map +0 -1
- package/dist/MessageCommandParser-Bs9fimmd.js +0 -271
- package/dist/MessageCommandParser-Bs9fimmd.js.map +0 -1
- package/dist/MessageCommandParser-q3dQcE5N.d.ts +0 -194
- package/dist/PluginCommon-BLxWww5u.js +0 -70
- package/dist/PluginCommon-BLxWww5u.js.map +0 -1
- package/dist/RuntimePlugin-CtobluSU.js +0 -134
- package/dist/RuntimePlugin-CtobluSU.js.map +0 -1
- package/dist/colors-Csc0X4QJ.js +0 -14
- package/dist/colors-Csc0X4QJ.js.map +0 -1
- package/dist/commandkit-SIjTLD2R.js.map +0 -1
- package/dist/common-C2jAjX4U.js +0 -0
- package/dist/common-CEordwf3.js +0 -17
- package/dist/common-CEordwf3.js.map +0 -1
- package/dist/common-DSRs_mfw.js +0 -222
- package/dist/common-DSRs_mfw.js.map +0 -1
- package/dist/constants-BFFK-hfP.js +0 -27
- package/dist/constants-BFFK-hfP.js.map +0 -1
- package/dist/constants-Cw8VjCVz.js +0 -36
- package/dist/constants-Cw8VjCVz.js.map +0 -1
- package/dist/constants-CxkFFZ7p.js +0 -85
- package/dist/constants-CxkFFZ7p.js.map +0 -1
- package/dist/container-DCPljKVH.js +0 -43
- package/dist/container-DCPljKVH.js.map +0 -1
- package/dist/display-WDb9wMCv.js +0 -0
- package/dist/element-DibzzA5L.js +0 -84
- package/dist/element-DibzzA5L.js.map +0 -1
- package/dist/env-CmspDhHy.js +0 -113
- package/dist/env-CmspDhHy.js.map +0 -1
- package/dist/error-codes-Ds0bnPvT.js +0 -73
- package/dist/error-codes-Ds0bnPvT.js.map +0 -1
- package/dist/file-Ca1kpEtE.js +0 -28
- package/dist/file-Ca1kpEtE.js.map +0 -1
- package/dist/flags/feature-flags.js.map +0 -1
- package/dist/helpers-Btx1FSZx.js +0 -35
- package/dist/helpers-Btx1FSZx.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/label-B6vXvwLM.js +0 -35
- package/dist/label-B6vXvwLM.js.map +0 -1
- package/dist/media-gallery-u3gjX7yD.js +0 -61
- package/dist/media-gallery-u3gjX7yD.js.map +0 -1
- package/dist/poll-CFe8yvoJ.js +0 -100
- package/dist/resolve-file-url-CdHqwWs3.js +0 -23
- package/dist/resolve-file-url-CdHqwWs3.js.map +0 -1
- package/dist/router-BvamdzoF.js +0 -0
- package/dist/runtime-Skt5NiOc.js +0 -0
- package/dist/section-BC8LF-B2.js +0 -59
- package/dist/section-BC8LF-B2.js.map +0 -1
- package/dist/separator-BUTiW7uz.js +0 -26
- package/dist/separator-BUTiW7uz.js.map +0 -1
- package/dist/signals-B8z1wJ6W.js +0 -74
- package/dist/signals-B8z1wJ6W.js.map +0 -1
- package/dist/store-D8r_hryO.js +0 -18
- package/dist/store-D8r_hryO.js.map +0 -1
- package/dist/text-display-DANahMN3.js +0 -31
- package/dist/text-display-DANahMN3.js.map +0 -1
- package/dist/type-checker-cVd3Hpnh.js +0 -88
- package/dist/type-checker-cVd3Hpnh.js.map +0 -1
- package/dist/types-Cdh4uaFR.js +0 -0
- package/dist/types-TC4g3w91.js +0 -0
- package/dist/types-package-CsTNfvv2.js +0 -71
- package/dist/types-package-CsTNfvv2.js.map +0 -1
- package/dist/utils-Br3eenD1.js +0 -34
- package/dist/utils-Br3eenD1.js.map +0 -1
- package/dist/warning-CszH8HeS.js +0 -53
- package/dist/warning-CszH8HeS.js.map +0 -1
- /package/dist/{index-BJfko-dP.d.ts → index-BIsCUWAs.d.ts} +0 -0
- /package/dist/{index-CCggO_hw.d.ts → index-CwHYpK-f.d.ts} +0 -0
- /package/dist/{index-CLjpoGi1.d.ts → index-DHrsNvX1.d.ts} +0 -0
|
@@ -1,7 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_utils_error_codes = require('../../utils/error-codes.js');
|
|
3
|
+
const require_app_events_EventWorkerContext = require('../events/EventWorkerContext.js');
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
//#region src/app/interrupt/signals.ts
|
|
6
|
+
/**
|
|
7
|
+
* Stop upcoming middlewares and command execution.
|
|
8
|
+
*/
|
|
9
|
+
function stopMiddlewares() {
|
|
10
|
+
throw require_utils_error_codes.createCommandKitError(require_utils_error_codes.CommandKitErrorCodes.StopMiddlewares);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Rethrow the error if it is a CommandKit error.
|
|
14
|
+
* @param error The error to rethrow.
|
|
15
|
+
* @example try {
|
|
16
|
+
* doSomething();
|
|
17
|
+
* } catch(e) {
|
|
18
|
+
* // do something
|
|
19
|
+
*
|
|
20
|
+
* // throw the error if it's a commandkit error
|
|
21
|
+
* rethrow(e)
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
function rethrow(error) {
|
|
25
|
+
if (require_utils_error_codes.isCommandKitError(error)) throw error;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Stops current command assuming it has been redirected to another command.
|
|
29
|
+
*/
|
|
30
|
+
function redirect() {
|
|
31
|
+
throw require_utils_error_codes.createCommandKitError(require_utils_error_codes.CommandKitErrorCodes.ForwardedCommand);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Stops event propagation. This function should be called inside an event handler
|
|
35
|
+
* to prevent further event handling.
|
|
36
|
+
* @example // src/app/events/messageCreate/handler.ts
|
|
37
|
+
* import { stopEvents } from 'commandkit';
|
|
38
|
+
*
|
|
39
|
+
* export default async function messageCreateHandler() {
|
|
40
|
+
* console.log('Message created');
|
|
41
|
+
* // Stop further event propagation
|
|
42
|
+
* stopEvents();
|
|
43
|
+
* }
|
|
44
|
+
*/
|
|
45
|
+
function stopEvents() {
|
|
46
|
+
if (!require_app_events_EventWorkerContext.eventWorkerContext.getStore()) throw new Error("stopEvents() may only be called inside an event handler");
|
|
47
|
+
throw require_utils_error_codes.createCommandKitError(require_utils_error_codes.CommandKitErrorCodes.StopEvents);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.redirect = redirect;
|
|
52
|
+
exports.rethrow = rethrow;
|
|
53
|
+
exports.stopEvents = stopEvents;
|
|
54
|
+
exports.stopMiddlewares = stopMiddlewares;
|
|
55
|
+
//# sourceMappingURL=signals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signals.js","names":[],"sources":["../../../src/app/interrupt/signals.ts"],"sourcesContent":["import {\n CommandKitErrorCodes,\n createCommandKitError,\n isCommandKitError,\n} from '../../utils/error-codes';\nimport { eventWorkerContext } from '../events/EventWorkerContext';\n\n/**\n * Stop upcoming middlewares and command execution.\n */\nexport function stopMiddlewares(): never {\n throw createCommandKitError(CommandKitErrorCodes.StopMiddlewares);\n}\n\n/**\n * Rethrow the error if it is a CommandKit error.\n * @param error The error to rethrow.\n * @example try {\n * doSomething();\n * } catch(e) {\n * // do something\n *\n * // throw the error if it's a commandkit error\n * rethrow(e)\n * }\n */\nexport function rethrow(error: unknown): void {\n if (isCommandKitError(error)) throw error;\n}\n\n/**\n * Stops current command assuming it has been redirected to another command.\n */\nexport function redirect(): never {\n throw createCommandKitError(CommandKitErrorCodes.ForwardedCommand);\n}\n\n/**\n * Stops event propagation. This function should be called inside an event handler\n * to prevent further event handling.\n * @example // src/app/events/messageCreate/handler.ts\n * import { stopEvents } from 'commandkit';\n *\n * export default async function messageCreateHandler() {\n * console.log('Message created');\n * // Stop further event propagation\n * stopEvents();\n * }\n */\nexport function stopEvents(): never {\n if (!eventWorkerContext.getStore()) {\n throw new Error('stopEvents() may only be called inside an event handler');\n }\n\n throw createCommandKitError(CommandKitErrorCodes.StopEvents);\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,kBAAyB;AACvC,OAAM,gDAAsB,+CAAqB,gBAAgB;;;;;;;;;;;;;;AAenE,SAAgB,QAAQ,OAAsB;AAC5C,KAAI,4CAAkB,MAAM,CAAE,OAAM;;;;;AAMtC,SAAgB,WAAkB;AAChC,OAAM,gDAAsB,+CAAqB,iBAAiB;;;;;;;;;;;;;;AAepE,SAAgB,aAAoB;AAClC,KAAI,CAAC,yDAAmB,UAAU,CAChC,OAAM,IAAI,MAAM,0DAA0D;AAG5E,OAAM,gDAAsB,+CAAqB,WAAW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { an as MiddlewareContext } from "../../analytics-engine-
|
|
1
|
+
import { an as MiddlewareContext } from "../../analytics-engine-DnRsHBId.js";
|
|
2
2
|
|
|
3
3
|
//#region src/app/middlewares/permissions.d.ts
|
|
4
4
|
declare const middlewareId: `${string}-${string}-${string}-${string}-${string}`;
|
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
require('../../
|
|
3
|
-
const require_commandkit = require('../../commandkit-SIjTLD2R.js');
|
|
4
|
-
require('../../container-DCPljKVH.js');
|
|
5
|
-
require('../../file-Ca1kpEtE.js');
|
|
6
|
-
require('../../media-gallery-u3gjX7yD.js');
|
|
7
|
-
require('../../section-BC8LF-B2.js');
|
|
8
|
-
require('../../separator-BUTiW7uz.js');
|
|
9
|
-
require('../../text-display-DANahMN3.js');
|
|
10
|
-
require('../../label-B6vXvwLM.js');
|
|
11
|
-
require('../../poll-CFe8yvoJ.js');
|
|
12
|
-
require('../../display-WDb9wMCv.js');
|
|
13
|
-
require('../../constants-CxkFFZ7p.js');
|
|
14
|
-
require('../../types-package-CsTNfvv2.js');
|
|
15
|
-
require('../../constants-Cw8VjCVz.js');
|
|
16
|
-
require('../../EventWorkerContext-Dfhgv329.js');
|
|
17
|
-
require('../../signals-B8z1wJ6W.js');
|
|
18
|
-
require('../../helpers-Btx1FSZx.js');
|
|
19
|
-
require('../../MessageCommandParser-Bs9fimmd.js');
|
|
20
|
-
require('../../CommandsRouter-C_HLsrGX.js');
|
|
21
|
-
require('../../EventsRouter-DZYIha6m.js');
|
|
22
|
-
require('../../router-BvamdzoF.js');
|
|
23
|
-
require('../../common-DSRs_mfw.js');
|
|
24
|
-
require('../../store-D8r_hryO.js');
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_commandkit = require('../../commandkit--k6yDJEr.js');
|
|
25
3
|
|
|
26
4
|
exports.beforeExecute = require_commandkit.beforeExecute;
|
|
27
5
|
exports.middlewareId = require_commandkit.middlewareId;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Bt as PreRegisterCommandsEvent, zt as CommandRegistrar } from "../../analytics-engine-
|
|
1
|
+
import { Bt as PreRegisterCommandsEvent, zt as CommandRegistrar } from "../../analytics-engine-DnRsHBId.js";
|
|
2
2
|
export { CommandRegistrar, PreRegisterCommandsEvent };
|
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
require('../../
|
|
3
|
-
const require_commandkit = require('../../commandkit-SIjTLD2R.js');
|
|
4
|
-
require('../../container-DCPljKVH.js');
|
|
5
|
-
require('../../file-Ca1kpEtE.js');
|
|
6
|
-
require('../../media-gallery-u3gjX7yD.js');
|
|
7
|
-
require('../../section-BC8LF-B2.js');
|
|
8
|
-
require('../../separator-BUTiW7uz.js');
|
|
9
|
-
require('../../text-display-DANahMN3.js');
|
|
10
|
-
require('../../label-B6vXvwLM.js');
|
|
11
|
-
require('../../poll-CFe8yvoJ.js');
|
|
12
|
-
require('../../display-WDb9wMCv.js');
|
|
13
|
-
require('../../constants-CxkFFZ7p.js');
|
|
14
|
-
require('../../types-package-CsTNfvv2.js');
|
|
15
|
-
require('../../constants-Cw8VjCVz.js');
|
|
16
|
-
require('../../EventWorkerContext-Dfhgv329.js');
|
|
17
|
-
require('../../signals-B8z1wJ6W.js');
|
|
18
|
-
require('../../helpers-Btx1FSZx.js');
|
|
19
|
-
require('../../MessageCommandParser-Bs9fimmd.js');
|
|
20
|
-
require('../../CommandsRouter-C_HLsrGX.js');
|
|
21
|
-
require('../../EventsRouter-DZYIha6m.js');
|
|
22
|
-
require('../../router-BvamdzoF.js');
|
|
23
|
-
require('../../common-DSRs_mfw.js');
|
|
24
|
-
require('../../store-D8r_hryO.js');
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_commandkit = require('../../commandkit--k6yDJEr.js');
|
|
25
3
|
|
|
26
4
|
exports.CommandRegistrar = require_commandkit.CommandRegistrar;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ParsedCommandData, i as Middleware, n as CommandsRouter, r as CommandsRouterOptions, t as Command } from "../../CommandsRouter-
|
|
1
|
+
import { a as ParsedCommandData, i as Middleware, n as CommandsRouter, r as CommandsRouterOptions, t as Command } from "../../CommandsRouter-DiNoF0dq.js";
|
|
2
2
|
export { Command, CommandsRouter, CommandsRouterOptions, Middleware, ParsedCommandData };
|
|
@@ -1,3 +1,211 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('../../chunk-BE-pF4vm.js');
|
|
3
|
+
let discord_js = require("discord.js");
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
let node_fs_promises = require("node:fs/promises");
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
//#region src/app/router/CommandsRouter.ts
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
const MIDDLEWARE_PATTERN = /^\+middleware\.(m|c)?(j|t)sx?$/;
|
|
14
|
+
/**
|
|
15
|
+
* @private
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
const COMMAND_MIDDLEWARE_PATTERN = /^\+([^+().][^().]*)\.middleware\.(m|c)?(j|t)sx?$/;
|
|
19
|
+
/**
|
|
20
|
+
* @private
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
const GLOBAL_MIDDLEWARE_PATTERN = /^\+global-middleware\.(m|c)?(j|t)sx?$/;
|
|
24
|
+
/**
|
|
25
|
+
* @private
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
const COMMAND_PATTERN = /^([^+().][^().]*)\.(m|c)?(j|t)sx?$/;
|
|
29
|
+
/**
|
|
30
|
+
* @private
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
const CATEGORY_PATTERN = /^\(.+\)$/;
|
|
34
|
+
/**
|
|
35
|
+
* Handles discovery and parsing of command and middleware files in the filesystem.
|
|
36
|
+
*/
|
|
37
|
+
var CommandsRouter = class {
|
|
38
|
+
/**
|
|
39
|
+
* @private
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
commands = new discord_js.Collection();
|
|
43
|
+
/**
|
|
44
|
+
* @private
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
middlewares = new discord_js.Collection();
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new CommandsRouter instance.
|
|
50
|
+
* @param options - Configuration options for the router
|
|
51
|
+
*/
|
|
52
|
+
constructor(options) {
|
|
53
|
+
this.options = options;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Populates the router with existing command and middleware data.
|
|
57
|
+
* @param data - Parsed command data to populate with
|
|
58
|
+
*/
|
|
59
|
+
populate(data) {
|
|
60
|
+
for (const [id, command] of Object.entries(data.commands)) this.commands.set(id, command);
|
|
61
|
+
for (const [id, middleware] of Object.entries(data.middlewares)) this.middlewares.set(id, middleware);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Checks if the configured entrypoint path exists.
|
|
65
|
+
* @returns True if the path exists
|
|
66
|
+
*/
|
|
67
|
+
isValidPath() {
|
|
68
|
+
return (0, node_fs.existsSync)(this.options.entrypoint);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @private
|
|
72
|
+
* @internal
|
|
73
|
+
*/
|
|
74
|
+
isCommand(name) {
|
|
75
|
+
return COMMAND_PATTERN.test(name);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @private
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
isMiddleware(name) {
|
|
82
|
+
return MIDDLEWARE_PATTERN.test(name) || GLOBAL_MIDDLEWARE_PATTERN.test(name) || COMMAND_MIDDLEWARE_PATTERN.test(name);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @private
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
isCategory(name) {
|
|
89
|
+
return CATEGORY_PATTERN.test(name);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Clears all loaded commands and middleware.
|
|
93
|
+
*/
|
|
94
|
+
clear() {
|
|
95
|
+
this.commands.clear();
|
|
96
|
+
this.middlewares.clear();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Scans the filesystem for commands and middleware files.
|
|
100
|
+
* @returns Parsed command data
|
|
101
|
+
*/
|
|
102
|
+
async scan() {
|
|
103
|
+
const entries = await (0, node_fs_promises.readdir)(this.options.entrypoint, { withFileTypes: true });
|
|
104
|
+
for (const entry of entries) {
|
|
105
|
+
if (entry.name.startsWith("_")) continue;
|
|
106
|
+
const fullPath = (0, node_path.join)(this.options.entrypoint, entry.name);
|
|
107
|
+
if (entry.isDirectory()) {
|
|
108
|
+
const category = this.isCategory(entry.name) ? entry.name.slice(1, -1) : null;
|
|
109
|
+
await this.traverse(fullPath, category);
|
|
110
|
+
} else await this.handle(entry);
|
|
111
|
+
}
|
|
112
|
+
await this.applyMiddlewares();
|
|
113
|
+
return this.toJSON();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Gets the raw command and middleware collections.
|
|
117
|
+
* @returns Object containing commands and middlewares collections
|
|
118
|
+
*/
|
|
119
|
+
getData() {
|
|
120
|
+
return {
|
|
121
|
+
commands: this.commands,
|
|
122
|
+
middlewares: this.middlewares
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Converts the loaded data to a JSON-serializable format.
|
|
127
|
+
* @returns Plain object with commands and middlewares
|
|
128
|
+
*/
|
|
129
|
+
toJSON() {
|
|
130
|
+
return {
|
|
131
|
+
commands: Object.fromEntries(this.commands.entries()),
|
|
132
|
+
middlewares: Object.fromEntries(this.middlewares.entries())
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* @private
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
async traverse(path, category) {
|
|
140
|
+
const entries = await (0, node_fs_promises.readdir)(path, { withFileTypes: true });
|
|
141
|
+
for (const entry of entries) {
|
|
142
|
+
if (entry.name.startsWith("_")) continue;
|
|
143
|
+
if (entry.isFile()) {
|
|
144
|
+
if (this.isCommand(entry.name) || this.isMiddleware(entry.name)) await this.handle(entry, category);
|
|
145
|
+
} else if (entry.isDirectory() && this.isCategory(entry.name) && category) {
|
|
146
|
+
const nestedCategory = this.isCategory(entry.name) ? `${category}:${entry.name.slice(1, -1)}` : null;
|
|
147
|
+
await this.traverse((0, node_path.join)(path, entry.name), nestedCategory);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* @private
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
async handle(entry, category = null) {
|
|
156
|
+
const name = entry.name;
|
|
157
|
+
const path = (0, node_path.join)(entry.parentPath, entry.name);
|
|
158
|
+
if (this.isCommand(name)) {
|
|
159
|
+
const command = {
|
|
160
|
+
id: crypto.randomUUID(),
|
|
161
|
+
name: (0, node_path.basename)(path, (0, node_path.extname)(path)),
|
|
162
|
+
path,
|
|
163
|
+
category,
|
|
164
|
+
parentPath: entry.parentPath,
|
|
165
|
+
relativePath: this.replaceEntrypoint(path),
|
|
166
|
+
middlewares: []
|
|
167
|
+
};
|
|
168
|
+
this.commands.set(command.id, command);
|
|
169
|
+
} else if (this.isMiddleware(name)) {
|
|
170
|
+
var _name$match;
|
|
171
|
+
const middleware = {
|
|
172
|
+
id: crypto.randomUUID(),
|
|
173
|
+
name: (0, node_path.basename)(path, (0, node_path.extname)(path)),
|
|
174
|
+
path,
|
|
175
|
+
relativePath: this.replaceEntrypoint(path),
|
|
176
|
+
parentPath: entry.parentPath,
|
|
177
|
+
global: GLOBAL_MIDDLEWARE_PATTERN.test(name),
|
|
178
|
+
command: COMMAND_MIDDLEWARE_PATTERN.test(name) ? ((_name$match = name.match(COMMAND_MIDDLEWARE_PATTERN)) === null || _name$match === void 0 ? void 0 : _name$match[1]) || null : null
|
|
179
|
+
};
|
|
180
|
+
this.middlewares.set(middleware.id, middleware);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* @private
|
|
185
|
+
* @internal
|
|
186
|
+
*/
|
|
187
|
+
applyMiddlewares() {
|
|
188
|
+
this.commands.forEach((command) => {
|
|
189
|
+
const commandPath = command.parentPath;
|
|
190
|
+
const allMiddlewares = Array.from(this.middlewares.values());
|
|
191
|
+
const commandSpecificMiddlewares = allMiddlewares.filter((middleware) => middleware.command === command.name).map((middleware) => middleware.id);
|
|
192
|
+
const directorySpecificMiddlewares = allMiddlewares.filter((middleware) => !middleware.global && !middleware.command && middleware.parentPath === commandPath).map((middleware) => middleware.id);
|
|
193
|
+
command.middlewares = [
|
|
194
|
+
...allMiddlewares.filter((middleware) => middleware.global).map((middleware) => middleware.id),
|
|
195
|
+
...directorySpecificMiddlewares,
|
|
196
|
+
...commandSpecificMiddlewares
|
|
197
|
+
];
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* @private
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
replaceEntrypoint(path) {
|
|
205
|
+
return (0, node_path.normalize)(path).replace(this.options.entrypoint, "");
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
//#endregion
|
|
210
|
+
exports.CommandsRouter = CommandsRouter;
|
|
211
|
+
//# sourceMappingURL=CommandsRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandsRouter.js","names":[],"sources":["../../../src/app/router/CommandsRouter.ts"],"sourcesContent":["import { Collection } from 'discord.js';\nimport { Dirent, existsSync } from 'node:fs';\nimport { readdir } from 'node:fs/promises';\nimport { basename, extname, join, normalize } from 'node:path';\n\n/**\n * Represents a command with its metadata and middleware associations.\n */\nexport interface Command {\n id: string;\n name: string;\n path: string;\n relativePath: string;\n parentPath: string;\n middlewares: Array<string>;\n category: string | null;\n}\n\n/**\n * Represents a middleware with its metadata and scope.\n */\nexport interface Middleware {\n id: string;\n name: string;\n path: string;\n relativePath: string;\n parentPath: string;\n global: boolean;\n command: string | null;\n}\n\n/**\n * Data structure containing parsed commands and middleware.\n */\nexport interface ParsedCommandData {\n commands: Record<string, Command>;\n middlewares: Record<string, Middleware>;\n}\n\n/**\n * Configuration options for the commands router.\n */\nexport interface CommandsRouterOptions {\n entrypoint: string;\n}\n\n/**\n * @private\n * @internal\n */\nconst MIDDLEWARE_PATTERN = /^\\+middleware\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst COMMAND_MIDDLEWARE_PATTERN =\n /^\\+([^+().][^().]*)\\.middleware\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst GLOBAL_MIDDLEWARE_PATTERN = /^\\+global-middleware\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst COMMAND_PATTERN = /^([^+().][^().]*)\\.(m|c)?(j|t)sx?$/;\n\n/**\n * @private\n * @internal\n */\nconst CATEGORY_PATTERN = /^\\(.+\\)$/;\n\n/**\n * Handles discovery and parsing of command and middleware files in the filesystem.\n */\nexport class CommandsRouter {\n /**\n * @private\n * @internal\n */\n private commands = new Collection<string, Command>();\n\n /**\n * @private\n * @internal\n */\n private middlewares = new Collection<string, Middleware>();\n\n /**\n * Creates a new CommandsRouter instance.\n * @param options - Configuration options for the router\n */\n public constructor(private readonly options: CommandsRouterOptions) {}\n\n /**\n * Populates the router with existing command and middleware data.\n * @param data - Parsed command data to populate with\n */\n public populate(data: ParsedCommandData) {\n for (const [id, command] of Object.entries(data.commands)) {\n this.commands.set(id, command);\n }\n\n for (const [id, middleware] of Object.entries(data.middlewares)) {\n this.middlewares.set(id, middleware);\n }\n }\n\n /**\n * Checks if the configured entrypoint path exists.\n * @returns True if the path exists\n */\n public isValidPath(): boolean {\n return existsSync(this.options.entrypoint);\n }\n\n /**\n * @private\n * @internal\n */\n private isCommand(name: string): boolean {\n return COMMAND_PATTERN.test(name);\n }\n\n /**\n * @private\n * @internal\n */\n private isMiddleware(name: string): boolean {\n return (\n MIDDLEWARE_PATTERN.test(name) ||\n GLOBAL_MIDDLEWARE_PATTERN.test(name) ||\n COMMAND_MIDDLEWARE_PATTERN.test(name)\n );\n }\n\n /**\n * @private\n * @internal\n */\n private isCategory(name: string): boolean {\n return CATEGORY_PATTERN.test(name);\n }\n\n /**\n * Clears all loaded commands and middleware.\n */\n public clear() {\n this.commands.clear();\n this.middlewares.clear();\n }\n\n /**\n * Scans the filesystem for commands and middleware files.\n * @returns Parsed command data\n */\n public async scan() {\n const entries = await readdir(this.options.entrypoint, {\n withFileTypes: true,\n });\n\n for (const entry of entries) {\n // ignore _ prefixed files\n if (entry.name.startsWith('_')) continue;\n\n const fullPath = join(this.options.entrypoint, entry.name);\n\n if (entry.isDirectory()) {\n const category = this.isCategory(entry.name)\n ? entry.name.slice(1, -1)\n : null;\n\n await this.traverse(fullPath, category);\n } else {\n await this.handle(entry);\n }\n }\n\n await this.applyMiddlewares();\n\n return this.toJSON();\n }\n\n /**\n * Gets the raw command and middleware collections.\n * @returns Object containing commands and middlewares collections\n */\n public getData() {\n return {\n commands: this.commands,\n middlewares: this.middlewares,\n };\n }\n\n /**\n * Converts the loaded data to a JSON-serializable format.\n * @returns Plain object with commands and middlewares\n */\n public toJSON() {\n return {\n commands: Object.fromEntries(this.commands.entries()),\n middlewares: Object.fromEntries(this.middlewares.entries()),\n };\n }\n\n /**\n * @private\n * @internal\n */\n private async traverse(path: string, category: string | null) {\n const entries = await readdir(path, {\n withFileTypes: true,\n });\n\n for (const entry of entries) {\n // ignore _ prefixed files\n if (entry.name.startsWith('_')) continue;\n\n if (entry.isFile()) {\n if (this.isCommand(entry.name) || this.isMiddleware(entry.name)) {\n await this.handle(entry, category);\n }\n } else if (\n entry.isDirectory() &&\n this.isCategory(entry.name) &&\n category\n ) {\n // nested category\n const nestedCategory = this.isCategory(entry.name)\n ? `${category}:${entry.name.slice(1, -1)}`\n : null;\n await this.traverse(join(path, entry.name), nestedCategory);\n }\n\n // TODO: handle subcommands\n }\n }\n\n /**\n * @private\n * @internal\n */\n private async handle(entry: Dirent, category: string | null = null) {\n const name = entry.name;\n const path = join(entry.parentPath, entry.name);\n\n if (this.isCommand(name)) {\n const command: Command = {\n id: crypto.randomUUID(),\n name: basename(path, extname(path)),\n path,\n category,\n parentPath: entry.parentPath,\n relativePath: this.replaceEntrypoint(path),\n middlewares: [],\n };\n\n this.commands.set(command.id, command);\n } else if (this.isMiddleware(name)) {\n const middleware: Middleware = {\n id: crypto.randomUUID(),\n name: basename(path, extname(path)),\n path,\n relativePath: this.replaceEntrypoint(path),\n parentPath: entry.parentPath,\n global: GLOBAL_MIDDLEWARE_PATTERN.test(name),\n command: COMMAND_MIDDLEWARE_PATTERN.test(name)\n ? name.match(COMMAND_MIDDLEWARE_PATTERN)?.[1] || null\n : null,\n };\n\n this.middlewares.set(middleware.id, middleware);\n }\n }\n\n /**\n * @private\n * @internal\n */\n private applyMiddlewares() {\n this.commands.forEach((command) => {\n const commandPath = command.parentPath;\n const allMiddlewares = Array.from(this.middlewares.values());\n\n const commandSpecificMiddlewares = allMiddlewares\n .filter((middleware) => middleware.command === command.name)\n .map((middleware) => middleware.id);\n\n const directorySpecificMiddlewares = allMiddlewares\n .filter(\n (middleware) =>\n !middleware.global &&\n !middleware.command &&\n middleware.parentPath === commandPath,\n )\n .map((middleware) => middleware.id);\n\n const globalMiddlewares = allMiddlewares\n .filter((middleware) => middleware.global)\n .map((middleware) => middleware.id);\n\n command.middlewares = [\n ...globalMiddlewares,\n ...directorySpecificMiddlewares,\n ...commandSpecificMiddlewares,\n ];\n });\n }\n\n /**\n * @private\n * @internal\n */\n private replaceEntrypoint(path: string) {\n const normalized = normalize(path);\n return normalized.replace(this.options.entrypoint, '');\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as ParsedEvent, n as EventsRouterOptions, r as EventsTree, t as EventsRouter } from "../../EventsRouter-
|
|
1
|
+
import { i as ParsedEvent, n as EventsRouterOptions, r as EventsTree, t as EventsRouter } from "../../EventsRouter-EuuSu6NH.js";
|
|
2
2
|
export { EventsRouter, EventsRouterOptions, EventsTree, ParsedEvent };
|
|
@@ -1,3 +1,129 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('../../chunk-BE-pF4vm.js');
|
|
3
|
+
let discord_js = require("discord.js");
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
let node_fs_promises = require("node:fs/promises");
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
//#region src/app/router/EventsRouter.ts
|
|
9
|
+
/**
|
|
10
|
+
* Router for discovering and managing event handler files in a directory structure.
|
|
11
|
+
* Events are represented by directories, and handlers are files within those directories.
|
|
12
|
+
*/
|
|
13
|
+
var EventsRouter = class {
|
|
14
|
+
/** Internal storage of parsed events */
|
|
15
|
+
events = new discord_js.Collection();
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new EventsRouter instance
|
|
18
|
+
* @param options - Configuration options for the router
|
|
19
|
+
* @throws Error if entrypoint is not provided
|
|
20
|
+
*/
|
|
21
|
+
constructor(options) {
|
|
22
|
+
var _options$entrypoints;
|
|
23
|
+
this.options = options;
|
|
24
|
+
if (options.entrypoints) options.entrypoints = Array.from(new Set(options.entrypoints));
|
|
25
|
+
if (!((_options$entrypoints = options.entrypoints) === null || _options$entrypoints === void 0 ? void 0 : _options$entrypoints.length)) throw new Error("Entrypoint directory must be provided");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Adds new entrypoints to the router
|
|
29
|
+
* @param entrypoints - Array of new entrypoint paths
|
|
30
|
+
*/
|
|
31
|
+
addEntrypoints(entrypoints) {
|
|
32
|
+
this.options.entrypoints = Array.from(new Set([...this.options.entrypoints, ...entrypoints]));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Find a parsed event by its name
|
|
36
|
+
* @param event - Name of the event to find
|
|
37
|
+
* @returns Parsed event metadata or null if not found
|
|
38
|
+
*/
|
|
39
|
+
match(event) {
|
|
40
|
+
return this.events.get(event) ?? null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get the entrypoint directory path
|
|
44
|
+
* @returns Entrypoint directory path
|
|
45
|
+
*/
|
|
46
|
+
get entrypoints() {
|
|
47
|
+
return this.options.entrypoints;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Checks if the entrypoint path is valid
|
|
51
|
+
*/
|
|
52
|
+
isValidPath() {
|
|
53
|
+
return this.entrypoints.every((entrypoint) => (0, node_fs.existsSync)(entrypoint));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Clear all parsed events
|
|
57
|
+
*/
|
|
58
|
+
clear() {
|
|
59
|
+
this.events.clear();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Reload and re-scan the entrypoint directory for events
|
|
63
|
+
* @returns Promise resolving to the updated events tree
|
|
64
|
+
*/
|
|
65
|
+
async reload() {
|
|
66
|
+
this.clear();
|
|
67
|
+
return this.scan();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Scan the entrypoint directory for events and their handlers
|
|
71
|
+
* @returns Promise resolving to the events tree
|
|
72
|
+
*/
|
|
73
|
+
async scan() {
|
|
74
|
+
for (const entrypoint of this.entrypoints) {
|
|
75
|
+
const dirs = await (0, node_fs_promises.readdir)(entrypoint, { withFileTypes: true });
|
|
76
|
+
for (const dir of dirs) if (dir.isDirectory()) {
|
|
77
|
+
const path = (0, node_path.join)(entrypoint, dir.name);
|
|
78
|
+
await this.scanEvent(dir.name, path, null, [], true);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return Object.fromEntries(this.events);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Convert the internal events Collection to a plain object
|
|
85
|
+
* @returns Events tree as a plain object
|
|
86
|
+
*/
|
|
87
|
+
toJSON() {
|
|
88
|
+
return Object.fromEntries(this.events);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Recursively scan a directory for event handlers
|
|
92
|
+
* @param event - Name of the event
|
|
93
|
+
* @param path - Path to the event directory
|
|
94
|
+
* @param listeners - Array to collect listener file paths
|
|
95
|
+
* @returns Promise resolving to the parsed event metadata
|
|
96
|
+
*/
|
|
97
|
+
async scanEvent(event, path, _namespace = null, listeners = [], isRoot = false) {
|
|
98
|
+
const files = await (0, node_fs_promises.readdir)(path, { withFileTypes: true });
|
|
99
|
+
const isNamespace = isRoot && /^\(.+\)$/.test(event);
|
|
100
|
+
const namespace = isNamespace ? event.slice(1, -1) : _namespace ?? null;
|
|
101
|
+
files.sort((a, b) => a.name.localeCompare(b.name));
|
|
102
|
+
for (const file of files) {
|
|
103
|
+
if (file.name.startsWith("_")) continue;
|
|
104
|
+
if (file.isDirectory()) {
|
|
105
|
+
const nextPath = (0, node_path.join)(path, file.name);
|
|
106
|
+
await this.scanEvent(file.name, nextPath, namespace, listeners);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (file.isFile() && /\.(m|c)?(j|t)sx?$/.test(file.name)) listeners.push((0, node_path.join)(file.parentPath, file.name));
|
|
110
|
+
}
|
|
111
|
+
if (!isNamespace) {
|
|
112
|
+
const existing = this.events.get(event);
|
|
113
|
+
if (existing) {
|
|
114
|
+
existing.listeners = Array.from(new Set([...existing.listeners, ...listeners]));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.events.set(event, {
|
|
118
|
+
event,
|
|
119
|
+
path,
|
|
120
|
+
listeners,
|
|
121
|
+
namespace
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
exports.EventsRouter = EventsRouter;
|
|
129
|
+
//# sourceMappingURL=EventsRouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventsRouter.js","names":[],"sources":["../../../src/app/router/EventsRouter.ts"],"sourcesContent":["import { Collection } from 'discord.js';\nimport { existsSync } from 'node:fs';\nimport { readdir } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Configuration options for the EventsRouter\n * @interface EventsRouterOptions\n */\nexport interface EventsRouterOptions {\n /** Root directory path where event handlers are located */\n entrypoints: string[];\n}\n\n/**\n * Represents a parsed event with its handlers\n * @interface ParsedEvent\n */\nexport interface ParsedEvent {\n /** Name of the event derived from directory name */\n event: string;\n /** Absolute path to the event directory */\n path: string;\n /** Array of file paths to event listener handlers */\n listeners: string[];\n /** Namespace of the event */\n namespace: string | null;\n}\n\n/** Collection of event names to their parsed metadata */\nexport type EventsTree = Record<string, ParsedEvent>;\n\n/**\n * Router for discovering and managing event handler files in a directory structure.\n * Events are represented by directories, and handlers are files within those directories.\n */\nexport class EventsRouter {\n /** Internal storage of parsed events */\n private events = new Collection<string, ParsedEvent>();\n\n /**\n * Creates a new EventsRouter instance\n * @param options - Configuration options for the router\n * @throws Error if entrypoint is not provided\n */\n public constructor(private options: EventsRouterOptions) {\n if (options.entrypoints) {\n options.entrypoints = Array.from(new Set(options.entrypoints));\n }\n\n if (!options.entrypoints?.length) {\n throw new Error('Entrypoint directory must be provided');\n }\n }\n\n /**\n * Adds new entrypoints to the router\n * @param entrypoints - Array of new entrypoint paths\n */\n public addEntrypoints(entrypoints: string[]) {\n this.options.entrypoints = Array.from(\n new Set([...this.options.entrypoints, ...entrypoints]),\n );\n }\n\n /**\n * Find a parsed event by its name\n * @param event - Name of the event to find\n * @returns Parsed event metadata or null if not found\n */\n public match(event: string): ParsedEvent | null {\n return this.events.get(event) ?? null;\n }\n\n /**\n * Get the entrypoint directory path\n * @returns Entrypoint directory path\n */\n public get entrypoints(): string[] {\n return this.options.entrypoints;\n }\n\n /**\n * Checks if the entrypoint path is valid\n */\n public isValidPath() {\n return this.entrypoints.every((entrypoint) => existsSync(entrypoint));\n }\n\n /**\n * Clear all parsed events\n */\n public clear() {\n this.events.clear();\n }\n\n /**\n * Reload and re-scan the entrypoint directory for events\n * @returns Promise resolving to the updated events tree\n */\n public async reload() {\n this.clear();\n return this.scan();\n }\n\n /**\n * Scan the entrypoint directory for events and their handlers\n * @returns Promise resolving to the events tree\n */\n public async scan(): Promise<EventsTree> {\n for (const entrypoint of this.entrypoints) {\n const dirs = await readdir(entrypoint, { withFileTypes: true });\n\n for (const dir of dirs) {\n if (dir.isDirectory()) {\n const path = join(entrypoint, dir.name);\n await this.scanEvent(dir.name, path, null, [], true);\n }\n }\n }\n\n return Object.fromEntries(this.events);\n }\n\n /**\n * Convert the internal events Collection to a plain object\n * @returns Events tree as a plain object\n */\n public toJSON(): EventsTree {\n return Object.fromEntries(this.events);\n }\n\n /**\n * Recursively scan a directory for event handlers\n * @param event - Name of the event\n * @param path - Path to the event directory\n * @param listeners - Array to collect listener file paths\n * @returns Promise resolving to the parsed event metadata\n */\n private async scanEvent(\n event: string,\n path: string,\n _namespace: string | null = null,\n listeners: string[] = [],\n isRoot = false,\n ): Promise<void> {\n const files = await readdir(path, { withFileTypes: true });\n const isNamespace = isRoot && /^\\(.+\\)$/.test(event);\n\n // if event = (something) pattern then namespace is something\n const namespace = isNamespace ? event.slice(1, -1) : (_namespace ?? null);\n\n files.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const file of files) {\n if (file.name.startsWith('_')) continue;\n\n if (file.isDirectory()) {\n const nextPath = join(path, file.name);\n await this.scanEvent(file.name, nextPath, namespace, listeners);\n continue;\n }\n\n if (file.isFile() && /\\.(m|c)?(j|t)sx?$/.test(file.name)) {\n listeners.push(join(file.parentPath, file.name));\n }\n }\n\n if (!isNamespace) {\n const existing = this.events.get(event);\n\n if (existing) {\n existing.listeners = Array.from(\n new Set([...existing.listeners, ...listeners]),\n );\n\n return;\n }\n\n this.events.set(event, { event, path, listeners, namespace });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAoCA,IAAa,eAAb,MAA0B;;CAExB,AAAQ,SAAS,IAAI,uBAAiC;;;;;;CAOtD,AAAO,YAAY,AAAQ,SAA8B;;EAA9B;AACzB,MAAI,QAAQ,YACV,SAAQ,cAAc,MAAM,KAAK,IAAI,IAAI,QAAQ,YAAY,CAAC;AAGhE,MAAI,0BAAC,QAAQ,yFAAa,QACxB,OAAM,IAAI,MAAM,wCAAwC;;;;;;CAQ5D,AAAO,eAAe,aAAuB;AAC3C,OAAK,QAAQ,cAAc,MAAM,KAC/B,IAAI,IAAI,CAAC,GAAG,KAAK,QAAQ,aAAa,GAAG,YAAY,CAAC,CACvD;;;;;;;CAQH,AAAO,MAAM,OAAmC;AAC9C,SAAO,KAAK,OAAO,IAAI,MAAM,IAAI;;;;;;CAOnC,IAAW,cAAwB;AACjC,SAAO,KAAK,QAAQ;;;;;CAMtB,AAAO,cAAc;AACnB,SAAO,KAAK,YAAY,OAAO,uCAA0B,WAAW,CAAC;;;;;CAMvE,AAAO,QAAQ;AACb,OAAK,OAAO,OAAO;;;;;;CAOrB,MAAa,SAAS;AACpB,OAAK,OAAO;AACZ,SAAO,KAAK,MAAM;;;;;;CAOpB,MAAa,OAA4B;AACvC,OAAK,MAAM,cAAc,KAAK,aAAa;GACzC,MAAM,OAAO,oCAAc,YAAY,EAAE,eAAe,MAAM,CAAC;AAE/D,QAAK,MAAM,OAAO,KAChB,KAAI,IAAI,aAAa,EAAE;IACrB,MAAM,2BAAY,YAAY,IAAI,KAAK;AACvC,UAAM,KAAK,UAAU,IAAI,MAAM,MAAM,MAAM,EAAE,EAAE,KAAK;;;AAK1D,SAAO,OAAO,YAAY,KAAK,OAAO;;;;;;CAOxC,AAAO,SAAqB;AAC1B,SAAO,OAAO,YAAY,KAAK,OAAO;;;;;;;;;CAUxC,MAAc,UACd,OACA,MACA,aAA4B,MAC5B,YAAsB,EAAE,EACxB,SAAS,OACO;EACd,MAAM,QAAQ,oCAAc,MAAM,EAAE,eAAe,MAAM,CAAC;EAC1D,MAAM,cAAc,UAAU,WAAW,KAAK,MAAM;EAGpD,MAAM,YAAY,cAAc,MAAM,MAAM,GAAG,GAAG,GAAG,cAAc;AAEnE,QAAM,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;AAElD,OAAK,MAAM,QAAQ,OAAO;AACxB,OAAI,KAAK,KAAK,WAAW,IAAI,CAAE;AAE/B,OAAI,KAAK,aAAa,EAAE;IACtB,MAAM,+BAAgB,MAAM,KAAK,KAAK;AACtC,UAAM,KAAK,UAAU,KAAK,MAAM,UAAU,WAAW,UAAU;AAC/D;;AAGF,OAAI,KAAK,QAAQ,IAAI,oBAAoB,KAAK,KAAK,KAAK,CACtD,WAAU,yBAAU,KAAK,YAAY,KAAK,KAAK,CAAC;;AAIpD,MAAI,CAAC,aAAa;GAChB,MAAM,WAAW,KAAK,OAAO,IAAI,MAAM;AAEvC,OAAI,UAAU;AACZ,aAAS,YAAY,MAAM,KACzB,IAAI,IAAI,CAAC,GAAG,SAAS,WAAW,GAAG,UAAU,CAAC,CAC/C;AAED;;AAGF,QAAK,OAAO,IAAI,OAAO;IAAE;IAAO;IAAM;IAAW;IAAW,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ParsedCommandData, i as Middleware, n as CommandsRouter, r as CommandsRouterOptions, t as Command } from "../../CommandsRouter-
|
|
2
|
-
import { i as ParsedEvent, n as EventsRouterOptions, r as EventsTree, t as EventsRouter } from "../../EventsRouter-
|
|
1
|
+
import { a as ParsedCommandData, i as Middleware, n as CommandsRouter, r as CommandsRouterOptions, t as Command } from "../../CommandsRouter-DiNoF0dq.js";
|
|
2
|
+
import { i as ParsedEvent, n as EventsRouterOptions, r as EventsTree, t as EventsRouter } from "../../EventsRouter-EuuSu6NH.js";
|
|
3
3
|
export { Command, CommandsRouter, CommandsRouterOptions, EventsRouter, EventsRouterOptions, EventsTree, Middleware, ParsedCommandData, ParsedEvent };
|
package/dist/app/router/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
require('
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_app_router_CommandsRouter = require('./CommandsRouter.js');
|
|
3
|
+
const require_app_router_EventsRouter = require('./EventsRouter.js');
|
|
4
4
|
|
|
5
|
-
exports.CommandsRouter =
|
|
6
|
-
exports.EventsRouter =
|
|
5
|
+
exports.CommandsRouter = require_app_router_CommandsRouter.CommandsRouter;
|
|
6
|
+
exports.EventsRouter = require_app_router_EventsRouter.EventsRouter;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as node_child_process0 from "node:child_process";
|
|
2
2
|
|
|
3
3
|
//#region src/cli/app-process.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* @private
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
declare function createAppProcess(fileName: string, cwd: string, isDev: boolean):
|
|
8
|
+
declare function createAppProcess(fileName: string, cwd: string, isDev: boolean): node_child_process0.ChildProcess;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { createAppProcess };
|
|
11
11
|
//# sourceMappingURL=app-process.d.ts.map
|
package/dist/cli/app-process.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
require('../
|
|
3
|
-
require('
|
|
4
|
-
require('
|
|
5
|
-
const require_common = require('../common-DSRs_mfw.js');
|
|
6
|
-
const require_env = require('../env-CmspDhHy.js');
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('../chunk-BE-pF4vm.js');
|
|
3
|
+
const require_cli_common = require('./common.js');
|
|
4
|
+
const require_cli_env = require('./env.js');
|
|
7
5
|
let node_fs = require("node:fs");
|
|
8
6
|
let node_path = require("node:path");
|
|
9
7
|
let node_child_process = require("node:child_process");
|
|
@@ -32,7 +30,7 @@ function getStdio(supportsCommands) {
|
|
|
32
30
|
*/
|
|
33
31
|
function createAppProcess(fileName, cwd, isDev) {
|
|
34
32
|
var _ps$stdout, _ps$stderr;
|
|
35
|
-
if (!(0, node_fs.existsSync)((0, node_path.join)(cwd, fileName)))
|
|
33
|
+
if (!(0, node_fs.existsSync)((0, node_path.join)(cwd, fileName))) require_cli_common.panic(`Could not locate the entrypoint file: ${fileName}`);
|
|
36
34
|
const stdio = getStdio(isDev);
|
|
37
35
|
const baseArgs = [`--title="CommandKit ${isDev ? "Development" : "Production"}"`, "--enable-source-maps"];
|
|
38
36
|
const nodeOptions = process.env.CK_NODE_OPTIONS || process.env.NODE_OPTIONS;
|
|
@@ -50,7 +48,7 @@ function createAppProcess(fileName, cwd, isDev) {
|
|
|
50
48
|
const ps = (0, node_child_process.spawn)("node", nodeArgs, {
|
|
51
49
|
cwd,
|
|
52
50
|
windowsHide: true,
|
|
53
|
-
env: isDev ?
|
|
51
|
+
env: isDev ? require_cli_env.DevEnv() : require_cli_env.ProdEnv(),
|
|
54
52
|
stdio
|
|
55
53
|
});
|
|
56
54
|
(_ps$stdout = ps.stdout) === null || _ps$stdout === void 0 || _ps$stdout.pipe(process.stdout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-process.js","names":[],"sources":["../../src/cli/app-process.ts"],"sourcesContent":["import { IOType, spawn } from 'node:child_process';\nimport { DevEnv, ProdEnv } from './env';\nimport { join } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport { panic } from './common';\n\n/**\n * @private\n * @internal\n */\nfunction getStdio(supportsCommands: boolean) {\n if (supportsCommands) {\n return ['pipe', 'pipe', 'pipe', 'ipc'];\n }\n\n return ['pipe', 'pipe', 'pipe'];\n}\n\n/**\n * @private\n * @internal\n */\nexport function createAppProcess(\n fileName: string,\n cwd: string,\n isDev: boolean,\n) {\n if (!existsSync(join(cwd, fileName))) {\n panic(`Could not locate the entrypoint file: ${fileName}`);\n }\n\n const stdio = getStdio(isDev) as IOType[];\n\n const baseArgs = [\n `--title=\"CommandKit ${isDev ? 'Development' : 'Production'}\"`,\n '--enable-source-maps',\n ];\n\n const nodeOptions = process.env.CK_NODE_OPTIONS || process.env.NODE_OPTIONS;\n let nodeArgs = [...baseArgs];\n\n if (nodeOptions) {\n const options = nodeOptions.trim().split(/\\s+/);\n\n for (const option of options) {\n const optionName = option.split('=')[0];\n const existingIndex = nodeArgs.findIndex((arg) =>\n arg.startsWith(optionName),\n );\n\n if (existingIndex !== -1) {\n nodeArgs[existingIndex] = option;\n } else {\n nodeArgs.push(option);\n }\n }\n }\n\n nodeArgs.push(fileName);\n\n const ps = spawn('node', nodeArgs, {\n cwd,\n windowsHide: true,\n env: isDev ? DevEnv() : ProdEnv(),\n stdio,\n });\n\n ps.stdout?.pipe(process.stdout);\n ps.stderr?.pipe(process.stderr);\n\n return ps;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-process.js","names":[],"sources":["../../src/cli/app-process.ts"],"sourcesContent":["import { IOType, spawn } from 'node:child_process';\nimport { DevEnv, ProdEnv } from './env';\nimport { join } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport { panic } from './common';\n\n/**\n * @private\n * @internal\n */\nfunction getStdio(supportsCommands: boolean) {\n if (supportsCommands) {\n return ['pipe', 'pipe', 'pipe', 'ipc'];\n }\n\n return ['pipe', 'pipe', 'pipe'];\n}\n\n/**\n * @private\n * @internal\n */\nexport function createAppProcess(\n fileName: string,\n cwd: string,\n isDev: boolean,\n) {\n if (!existsSync(join(cwd, fileName))) {\n panic(`Could not locate the entrypoint file: ${fileName}`);\n }\n\n const stdio = getStdio(isDev) as IOType[];\n\n const baseArgs = [\n `--title=\"CommandKit ${isDev ? 'Development' : 'Production'}\"`,\n '--enable-source-maps',\n ];\n\n const nodeOptions = process.env.CK_NODE_OPTIONS || process.env.NODE_OPTIONS;\n let nodeArgs = [...baseArgs];\n\n if (nodeOptions) {\n const options = nodeOptions.trim().split(/\\s+/);\n\n for (const option of options) {\n const optionName = option.split('=')[0];\n const existingIndex = nodeArgs.findIndex((arg) =>\n arg.startsWith(optionName),\n );\n\n if (existingIndex !== -1) {\n nodeArgs[existingIndex] = option;\n } else {\n nodeArgs.push(option);\n }\n }\n }\n\n nodeArgs.push(fileName);\n\n const ps = spawn('node', nodeArgs, {\n cwd,\n windowsHide: true,\n env: isDev ? DevEnv() : ProdEnv(),\n stdio,\n });\n\n ps.stdout?.pipe(process.stdout);\n ps.stderr?.pipe(process.stderr);\n\n return ps;\n}\n"],"mappings":";;;;;;;;;;;;;AAUA,SAAS,SAAS,kBAA2B;AAC3C,KAAI,iBACF,QAAO;EAAC;EAAQ;EAAQ;EAAQ;EAAM;AAGxC,QAAO;EAAC;EAAQ;EAAQ;EAAO;;;;;;AAOjC,SAAgB,iBAChB,UACA,KACA,OACA;;AACE,KAAI,6CAAiB,KAAK,SAAS,CAAC,CAClC,0BAAM,yCAAyC,WAAW;CAG5D,MAAM,QAAQ,SAAS,MAAM;CAE7B,MAAM,WAAW,CACjB,uBAAuB,QAAQ,gBAAgB,aAAa,IAC5D,uBAAuB;CAGvB,MAAM,cAAc,QAAQ,IAAI,mBAAmB,QAAQ,IAAI;CAC/D,IAAI,WAAW,CAAC,GAAG,SAAS;AAE5B,KAAI,aAAa;EACf,MAAM,UAAU,YAAY,MAAM,CAAC,MAAM,MAAM;AAE/C,OAAK,MAAM,UAAU,SAAS;GAC5B,MAAM,aAAa,OAAO,MAAM,IAAI,CAAC;GACrC,MAAM,gBAAgB,SAAS,WAAW,QAC1C,IAAE,WAAI,WAAW,CAChB;AAED,OAAI,kBAAkB,GACpB,UAAS,iBAAiB;OAE1B,UAAS,KAAK,OAAO;;;AAK3B,UAAS,KAAK,SAAS;CAEvB,MAAM,mCAAW,QAAQ,UAAU;EACjC;EACA,aAAa;EACb,KAAK,QAAQ,wBAAQ,GAAG,yBAAS;EACjC;EACD,CAAC;AAEF,kBAAG,wDAAQ,KAAK,QAAQ,OAAO;AAC/B,kBAAG,wDAAQ,KAAK,QAAQ,OAAO;AAE/B,QAAO"}
|
package/dist/cli/build.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as CompilerPlugin } from "../analytics-engine-
|
|
2
|
-
import { t as MaybeArray } from "../types-
|
|
1
|
+
import { W as CompilerPlugin } from "../analytics-engine-DnRsHBId.js";
|
|
2
|
+
import { t as MaybeArray } from "../types-DZy7U-Ld.js";
|
|
3
3
|
|
|
4
4
|
//#region src/cli/build.d.ts
|
|
5
5
|
/**
|