commandkit 1.2.0-dev.20260228121941 → 1.2.0-dev.20260301122036
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ActionRow-CT-uyxW0.d.ts → ActionRow-Bt9qi0Mb.d.ts} +2 -2
- package/dist/{Button-oMnlpF6W.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--iMEUqSm.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-DQbmOp1Y.d.ts → SelectMenu-CY0vvoSu.d.ts} +8 -8
- 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 -19
- 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 -19
- package/dist/{analytics-engine-_urJ5QTH.d.ts → analytics-engine-DnRsHBId.d.ts} +843 -843
- package/dist/app/commands/AppCommandRunner.d.ts +1 -1
- package/dist/app/commands/AppCommandRunner.js +2 -19
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +2 -19
- 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 -19
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +2 -19
- package/dist/app/index.d.ts +4 -4
- package/dist/app/index.js +13 -27
- 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 -19
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +2 -19
- 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 +14 -29
- 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 -54
- 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 +9 -8
- package/dist/cli/information.js.map +1 -1
- package/dist/cli/init.d.ts +2 -2
- package/dist/cli/init.js +14 -28
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/production.d.ts +2 -2
- package/dist/cli/production.js +11 -28
- 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-B1_NP74k.js → commandkit--k6yDJEr.js} +192 -192
- package/dist/{commandkit-B1_NP74k.js.map → commandkit--k6yDJEr.js.map} +1 -1
- package/dist/commandkit.d.ts +1 -1
- package/dist/commandkit.js +2 -19
- 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 +1 -1
- package/dist/components/common/element.js +2 -19
- package/dist/components/common/types.d.ts +1 -1
- package/dist/components/common/types.js +1 -0
- package/dist/components/display/common.js +2 -19
- package/dist/components/display/container.d.ts +1 -1
- package/dist/components/display/container.js +2 -19
- 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 +12 -25
- package/dist/components/display/label.d.ts +1 -1
- package/dist/components/display/label.js +2 -19
- package/dist/components/display/media-gallery.d.ts +1 -1
- package/dist/components/display/media-gallery.js +2 -19
- package/dist/components/display/poll.d.ts +1 -1
- package/dist/components/display/poll.js +85 -4
- package/dist/{poll-ziQQQbMU.js.map → components/display/poll.js.map} +1 -1
- package/dist/components/display/section.d.ts +1 -1
- package/dist/components/display/section.js +2 -19
- 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 +22 -22
- package/dist/components/index.js +14 -26
- 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 -19
- package/dist/components/interactive/button/ButtonKit.d.ts +1 -1
- package/dist/components/interactive/button/ButtonKit.js +2 -19
- package/dist/components/interactive/modal/Modal.d.ts +1 -1
- package/dist/components/interactive/modal/Modal.js +2 -19
- package/dist/components/interactive/modal/ModalKit.d.ts +1 -1
- package/dist/components/interactive/modal/ModalKit.js +2 -19
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +2 -19
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +2 -19
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +2 -19
- package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -1
- package/dist/components/interactive/select-menu/SelectMenu.js +2 -19
- package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/StringSelectMenuKit.js +2 -19
- package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -1
- package/dist/components/interactive/select-menu/UserSelectMenuKit.js +2 -19
- 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 -19
- package/dist/config/default.d.ts +1 -1
- package/dist/config/default.js +2 -19
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.js +2 -19
- 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 -19
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +2 -19
- package/dist/{element-DZeqbSTk.d.ts → element-DeLvTMfZ.d.ts} +3 -3
- 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 +2 -19
- 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 +30 -30
- package/dist/index.js +61 -67
- 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 -19
- 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 -19
- 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 -25
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +2 -19
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +2 -19
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +2 -19
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +2 -19
- 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 -19
- 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 -19
- package/dist/utils/warning.js +38 -4
- package/dist/utils/warning.js.map +1 -0
- package/dist/version.js +13 -2
- package/dist/version.js.map +1 -0
- package/package.json +11 -14
- package/dist/ActionRow-CSN_UKmM.js +0 -25
- package/dist/CommandKitEventsChannel-DDI0UVh9.js +0 -88
- package/dist/CommandKitEventsChannel-DDI0UVh9.js.map +0 -1
- package/dist/CommandsRouter-D5mGRFEr.js +0 -215
- package/dist/CommandsRouter-D5mGRFEr.js.map +0 -1
- package/dist/CompilerPlugin-DZidFuHJ.js +0 -43
- package/dist/CompilerPlugin-DZidFuHJ.js.map +0 -1
- package/dist/EventInterceptor-CxA95XYA.js +0 -142
- package/dist/EventInterceptor-CxA95XYA.js.map +0 -1
- package/dist/EventWorkerContext-CfqamFWu.js +0 -68
- package/dist/EventWorkerContext-CfqamFWu.js.map +0 -1
- package/dist/EventsRouter-Be5NDOX4.js +0 -133
- package/dist/EventsRouter-Be5NDOX4.js.map +0 -1
- package/dist/ILogger-JI8VGyJf.js +0 -0
- package/dist/MessageCommandParser-VMFFGs0R.js +0 -271
- package/dist/MessageCommandParser-VMFFGs0R.js.map +0 -1
- package/dist/MessageCommandParser-q3dQcE5N.d.ts +0 -194
- package/dist/PluginCommon-Bfs8d9s7.js +0 -70
- package/dist/PluginCommon-Bfs8d9s7.js.map +0 -1
- package/dist/RuntimePlugin-BYQXQO8w.js +0 -134
- package/dist/RuntimePlugin-BYQXQO8w.js.map +0 -1
- package/dist/colors-Csc0X4QJ.js +0 -14
- package/dist/colors-Csc0X4QJ.js.map +0 -1
- package/dist/common-vGj3fpz3.js +0 -0
- package/dist/common-zQwj90Nz.js +0 -222
- package/dist/common-zQwj90Nz.js.map +0 -1
- package/dist/constants-BA0TJU6e.js +0 -36
- package/dist/constants-BA0TJU6e.js.map +0 -1
- package/dist/constants-BS9N2avz.js +0 -27
- package/dist/constants-BS9N2avz.js.map +0 -1
- package/dist/constants-CeIMhMD0.js +0 -85
- package/dist/constants-CeIMhMD0.js.map +0 -1
- package/dist/env-FxaiNasU.js +0 -113
- package/dist/env-FxaiNasU.js.map +0 -1
- package/dist/error-codes-Ds0bnPvT.js +0 -73
- package/dist/error-codes-Ds0bnPvT.js.map +0 -1
- package/dist/file-DqI3v90P.js +0 -28
- package/dist/file-DqI3v90P.js.map +0 -1
- package/dist/helpers-DSy7EjzP.js +0 -35
- package/dist/helpers-DSy7EjzP.js.map +0 -1
- package/dist/poll-ziQQQbMU.js +0 -100
- package/dist/resolve-file-url-BmjHzIKe.js +0 -23
- package/dist/resolve-file-url-BmjHzIKe.js.map +0 -1
- package/dist/router-CtcApqrw.js +0 -0
- package/dist/runtime-UJIpkNww.js +0 -0
- package/dist/separator-DGwA_b1J.js +0 -26
- package/dist/separator-DGwA_b1J.js.map +0 -1
- package/dist/signals-ewEPW2cO.js +0 -74
- package/dist/signals-ewEPW2cO.js.map +0 -1
- package/dist/store-DK4JA-fQ.js +0 -18
- package/dist/store-DK4JA-fQ.js.map +0 -1
- package/dist/text-display-BVuG7dT-.js +0 -31
- package/dist/text-display-BVuG7dT-.js.map +0 -1
- package/dist/type-checker-CFpKDDs8.js +0 -88
- package/dist/type-checker-CFpKDDs8.js.map +0 -1
- package/dist/types-Bx1EKe0v.js +0 -0
- package/dist/types-CAwOz52q.js +0 -0
- package/dist/types-package-Bjh_ap0V.js +0 -71
- package/dist/types-package-Bjh_ap0V.js.map +0 -1
- package/dist/utils-CVaVycsK.js +0 -34
- package/dist/utils-CVaVycsK.js.map +0 -1
- package/dist/version-rRfNG5vY.js +0 -18
- package/dist/version-rRfNG5vY.js.map +0 -1
- package/dist/warning-BWiQltHE.js +0 -53
- package/dist/warning-BWiQltHE.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
package/dist/common-zQwj90Nz.js
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-kSYXY2_d.js');
|
|
2
|
-
const require_colors = require('./colors-Csc0X4QJ.js');
|
|
3
|
-
const require_constants = require('./constants-CeIMhMD0.js');
|
|
4
|
-
const require_types_package = require('./types-package-Bjh_ap0V.js');
|
|
5
|
-
let node_fs = require("node:fs");
|
|
6
|
-
node_fs = require_chunk.__toESM(node_fs);
|
|
7
|
-
let node_path = require("node:path");
|
|
8
|
-
let rimraf = require("rimraf");
|
|
9
|
-
let node_child_process = require("node:child_process");
|
|
10
|
-
|
|
11
|
-
//#region src/cli/common.ts
|
|
12
|
-
let ts;
|
|
13
|
-
let tsdown;
|
|
14
|
-
/**
|
|
15
|
-
* @private
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
function write(message) {
|
|
19
|
-
process.stdout.write(message);
|
|
20
|
-
process.stdout.write("\n");
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @private
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
function findEntrypoint(dir) {
|
|
27
|
-
const target = (0, node_path.join)(dir, "sharding-manager.js");
|
|
28
|
-
if (node_fs.default.existsSync(target)) return target;
|
|
29
|
-
return (0, node_path.join)(dir, "index.js");
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @returns {never}
|
|
33
|
-
* @internal
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
|
-
function panic(message) {
|
|
37
|
-
write(require_colors.colors_default.red(`Error: ${message}`));
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @private
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
async function ensureTypeScript(target) {
|
|
45
|
-
if (!/\.(c|m)?tsx?$/.test(target)) return false;
|
|
46
|
-
if (process.features.typescript) return true;
|
|
47
|
-
await loadTypeScript();
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
let packageManager;
|
|
51
|
-
/**
|
|
52
|
-
* @private
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
function detectPackageManager() {
|
|
56
|
-
if (packageManager) return packageManager;
|
|
57
|
-
for (const [lockfile, manager] of Object.entries({
|
|
58
|
-
"yarn.lock": "yarn",
|
|
59
|
-
"pnpm-lock.yaml": "pnpm",
|
|
60
|
-
"package-lock.json": "npm",
|
|
61
|
-
"bun.lock": "bun",
|
|
62
|
-
"bun.lockb": "bun",
|
|
63
|
-
"deno.lock": "deno"
|
|
64
|
-
})) if (node_fs.default.existsSync((0, node_path.join)(require_constants.COMMANDKIT_CWD, lockfile))) {
|
|
65
|
-
packageManager = manager;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
if (!packageManager) packageManager = "npm";
|
|
69
|
-
return packageManager;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @private
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
async function loadTypeScript(e) {
|
|
76
|
-
if (ts) return ts;
|
|
77
|
-
try {
|
|
78
|
-
ts = await import("typescript");
|
|
79
|
-
} catch (e$1) {
|
|
80
|
-
if (e$1 instanceof Error && "code" in e$1 && e$1.code === "MODULE_NOT_FOUND") try {
|
|
81
|
-
const packageManager = detectPackageManager();
|
|
82
|
-
(0, node_child_process.execSync)(`${packageManager} add -D ${packageManager === "deno" ? "npm:" : ""}typescript`, {
|
|
83
|
-
stdio: "inherit",
|
|
84
|
-
cwd: require_constants.COMMANDKIT_CWD
|
|
85
|
-
});
|
|
86
|
-
console.log(require_colors.colors_default.cyan(`TypeScript has been installed automatically, restarting...`));
|
|
87
|
-
ts = await import("typescript");
|
|
88
|
-
return ts;
|
|
89
|
-
} catch {
|
|
90
|
-
panic("TypeScript is not installed and could not be installed automatically. Please install it manually.");
|
|
91
|
-
}
|
|
92
|
-
panic(e$1 || "TypeScript must be installed to use TypeScript config files.");
|
|
93
|
-
}
|
|
94
|
-
return ts;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @private
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
async function loadConfigFileFromPath(target) {
|
|
101
|
-
await ensureExists(target);
|
|
102
|
-
const isTs = await ensureTypeScript(target);
|
|
103
|
-
let generatedFilePath;
|
|
104
|
-
if (isTs && ts) {
|
|
105
|
-
const { transpileModule } = ts;
|
|
106
|
-
const { outputText } = transpileModule(node_fs.default.readFileSync(target, "utf8"), {
|
|
107
|
-
compilerOptions: {
|
|
108
|
-
module: ts.ModuleKind.ESNext,
|
|
109
|
-
target: ts.ScriptTarget.ESNext,
|
|
110
|
-
moduleResolution: ts.ModuleResolutionKind.NodeNext
|
|
111
|
-
},
|
|
112
|
-
fileName: target
|
|
113
|
-
});
|
|
114
|
-
await require_types_package.generateTypesPackage();
|
|
115
|
-
const tmpFile = (0, node_path.join)(require_constants.COMMANDKIT_CWD, "compiled-commandkit.config.mjs");
|
|
116
|
-
node_fs.default.writeFileSync(tmpFile, outputText);
|
|
117
|
-
generatedFilePath = tmpFile;
|
|
118
|
-
target = tmpFile;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @type {import('..').CommandKitConfig}
|
|
122
|
-
*/
|
|
123
|
-
const config = await import(`file://${target}`).then((conf) => conf.default || conf);
|
|
124
|
-
if (generatedFilePath) try {
|
|
125
|
-
node_fs.default.unlinkSync(generatedFilePath);
|
|
126
|
-
} catch {}
|
|
127
|
-
return config;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* @private
|
|
131
|
-
* @internal
|
|
132
|
-
*/
|
|
133
|
-
async function ensureExists(loc) {
|
|
134
|
-
if (!node_fs.default.existsSync(loc)) throw new Error(`File not found: ${loc}`);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* @private
|
|
138
|
-
* @internal
|
|
139
|
-
*/
|
|
140
|
-
function erase(dir) {
|
|
141
|
-
(0, rimraf.rimrafSync)(dir);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @private
|
|
145
|
-
* @internal
|
|
146
|
-
*/
|
|
147
|
-
async function copyLocaleFiles(_from, _to) {
|
|
148
|
-
const resolvedFrom = (0, node_path.join)(require_constants.COMMANDKIT_CWD, _from);
|
|
149
|
-
const resolvedTo = (0, node_path.join)(require_constants.COMMANDKIT_CWD, _to);
|
|
150
|
-
const localePaths = ["app/locales"];
|
|
151
|
-
const srcLocalePaths = localePaths.map((path) => (0, node_path.join)(resolvedFrom, path));
|
|
152
|
-
const destLocalePaths = localePaths.map((path) => (0, node_path.join)(resolvedTo, path));
|
|
153
|
-
for (const localePath of srcLocalePaths) {
|
|
154
|
-
if (!node_fs.default.existsSync(localePath)) continue;
|
|
155
|
-
const destLocalePath = destLocalePaths[srcLocalePaths.indexOf(localePath)];
|
|
156
|
-
if (!node_fs.default.existsSync(destLocalePath)) node_fs.default.promises.mkdir(destLocalePath, { recursive: true }).catch(() => {});
|
|
157
|
-
await node_fs.default.promises.cp(localePath, destLocalePath, {
|
|
158
|
-
recursive: true,
|
|
159
|
-
force: true
|
|
160
|
-
}).catch(() => {});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* @private
|
|
165
|
-
* @internal
|
|
166
|
-
*/
|
|
167
|
-
async function loadTsdown() {
|
|
168
|
-
if (tsdown) return tsdown;
|
|
169
|
-
tsdown = await import("tsdown");
|
|
170
|
-
return tsdown;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
//#endregion
|
|
174
|
-
Object.defineProperty(exports, 'copyLocaleFiles', {
|
|
175
|
-
enumerable: true,
|
|
176
|
-
get: function () {
|
|
177
|
-
return copyLocaleFiles;
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
Object.defineProperty(exports, 'erase', {
|
|
181
|
-
enumerable: true,
|
|
182
|
-
get: function () {
|
|
183
|
-
return erase;
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
Object.defineProperty(exports, 'findEntrypoint', {
|
|
187
|
-
enumerable: true,
|
|
188
|
-
get: function () {
|
|
189
|
-
return findEntrypoint;
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
Object.defineProperty(exports, 'loadConfigFileFromPath', {
|
|
193
|
-
enumerable: true,
|
|
194
|
-
get: function () {
|
|
195
|
-
return loadConfigFileFromPath;
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
Object.defineProperty(exports, 'loadTsdown', {
|
|
199
|
-
enumerable: true,
|
|
200
|
-
get: function () {
|
|
201
|
-
return loadTsdown;
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
Object.defineProperty(exports, 'loadTypeScript', {
|
|
205
|
-
enumerable: true,
|
|
206
|
-
get: function () {
|
|
207
|
-
return loadTypeScript;
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
Object.defineProperty(exports, 'panic', {
|
|
211
|
-
enumerable: true,
|
|
212
|
-
get: function () {
|
|
213
|
-
return panic;
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
Object.defineProperty(exports, 'write', {
|
|
217
|
-
enumerable: true,
|
|
218
|
-
get: function () {
|
|
219
|
-
return write;
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
//# sourceMappingURL=common-zQwj90Nz.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common-zQwj90Nz.js","names":[],"sources":["../src/cli/common.ts"],"sourcesContent":["import { rimrafSync } from 'rimraf';\nimport { join } from 'node:path';\nimport fs from 'node:fs';\nimport colors from '../utils/colors';\nimport { ResolvedCommandKitConfig } from '../config/utils';\nimport { generateTypesPackage } from '../utils/types-package';\nimport { execSync } from 'node:child_process';\nimport { COMMANDKIT_CWD } from '../utils/constants';\n\nlet ts: typeof import('typescript') | undefined;\nlet tsdown: typeof import('tsdown') | undefined;\n\n/**\n * @private\n * @internal\n */\nexport function write(message: any) {\n process.stdout.write(message);\n process.stdout.write('\\n');\n}\n\n/**\n * @private\n * @internal\n */\nexport function findEntrypoint(dir: string) {\n const target = join(dir, 'sharding-manager.js');\n\n // if sharding manager exists, return that file instead\n if (fs.existsSync(target)) return target;\n\n return join(dir, 'index.js');\n}\n\n/**\n * @returns {never}\n * @internal\n * @private\n */\nexport function panic(message: any): never {\n write(colors.red(`Error: ${message}`));\n process.exit(1);\n}\n\n/**\n * @private\n * @internal\n */\nasync function ensureTypeScript(target: string) {\n const isTypeScript = /\\.(c|m)?tsx?$/.test(target);\n\n if (!isTypeScript) return false;\n if (process.features.typescript) return true;\n\n await loadTypeScript();\n\n return true;\n}\n\nlet packageManager: string;\n\n/**\n * @private\n * @internal\n */\nfunction detectPackageManager() {\n if (packageManager) return packageManager;\n\n const lockfiles = {\n 'yarn.lock': 'yarn',\n 'pnpm-lock.yaml': 'pnpm',\n 'package-lock.json': 'npm',\n 'bun.lock': 'bun',\n 'bun.lockb': 'bun',\n 'deno.lock': 'deno',\n };\n\n for (const [lockfile, manager] of Object.entries(lockfiles)) {\n if (fs.existsSync(join(COMMANDKIT_CWD, lockfile))) {\n packageManager = manager;\n break;\n }\n }\n\n if (!packageManager) {\n packageManager = 'npm';\n }\n\n return packageManager;\n}\n\n/**\n * @private\n * @internal\n */\nexport async function loadTypeScript(e?: string) {\n if (ts) return ts;\n\n try {\n ts = await import('typescript');\n } catch (e) {\n if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') {\n try {\n const packageManager = detectPackageManager();\n const prefix = packageManager === 'deno' ? 'npm:' : '';\n execSync(`${packageManager} add -D ${prefix}typescript`, {\n stdio: 'inherit',\n cwd: COMMANDKIT_CWD,\n });\n\n console.log(\n colors.cyan(\n `TypeScript has been installed automatically, restarting...`,\n ),\n );\n\n ts = await import('typescript');\n\n return ts;\n } catch {\n panic(\n 'TypeScript is not installed and could not be installed automatically. Please install it manually.',\n );\n }\n }\n panic(e || 'TypeScript must be installed to use TypeScript config files.');\n }\n\n return ts;\n}\n\n/**\n * @private\n * @internal\n */\nexport async function loadConfigFileFromPath(\n target: string,\n): Promise<ResolvedCommandKitConfig> {\n await ensureExists(target);\n\n const isTs = await ensureTypeScript(target);\n\n let generatedFilePath: string | undefined;\n\n if (isTs && ts) {\n const { transpileModule } = ts;\n const src = fs.readFileSync(target, 'utf8');\n const { outputText } = transpileModule(src, {\n compilerOptions: {\n module: ts.ModuleKind.ESNext,\n target: ts.ScriptTarget.ESNext,\n moduleResolution: ts.ModuleResolutionKind.NodeNext,\n },\n fileName: target,\n });\n\n await generateTypesPackage();\n\n const nodeModulesPath = COMMANDKIT_CWD;\n\n const tmpFile = join(nodeModulesPath, 'compiled-commandkit.config.mjs');\n\n fs.writeFileSync(tmpFile, outputText);\n\n generatedFilePath = tmpFile;\n\n target = tmpFile;\n }\n\n /**\n * @type {import('..').CommandKitConfig}\n */\n const config = await import(`file://${target}`).then(\n (conf) => conf.default || conf,\n );\n\n if (generatedFilePath) {\n try {\n fs.unlinkSync(generatedFilePath);\n } catch {\n //\n }\n }\n\n return config;\n}\n\n/**\n * @private\n * @internal\n */\nasync function ensureExists(loc: string) {\n const exists = fs.existsSync(loc);\n\n if (!exists) {\n throw new Error(`File not found: ${loc}`);\n }\n}\n\n/**\n * @private\n * @internal\n */\nexport function erase(dir: string) {\n rimrafSync(dir);\n}\n\n/**\n * @private\n * @internal\n */\nexport async function copyLocaleFiles(_from: string, _to: string) {\n const resolvedFrom = join(COMMANDKIT_CWD, _from);\n const resolvedTo = join(COMMANDKIT_CWD, _to);\n\n const localePaths = ['app/locales'];\n const srcLocalePaths = localePaths.map((path) => join(resolvedFrom, path));\n const destLocalePaths = localePaths.map((path) => join(resolvedTo, path));\n\n for (const localePath of srcLocalePaths) {\n if (!fs.existsSync(localePath)) {\n continue;\n }\n\n // copy localePath to destLocalePath\n const destLocalePath = destLocalePaths[srcLocalePaths.indexOf(localePath)];\n\n if (!fs.existsSync(destLocalePath)) {\n fs.promises.mkdir(destLocalePath, { recursive: true }).catch(() => {});\n }\n\n await fs.promises\n .cp(localePath, destLocalePath, {\n recursive: true,\n force: true,\n })\n .catch(() => {});\n }\n}\n\n/**\n * @private\n * @internal\n */\nexport async function loadTsdown(): Promise<typeof import('tsdown')> {\n if (tsdown) return tsdown;\n\n tsdown = await import('tsdown');\n\n return tsdown;\n}\n"],"mappings":";;;;;;;;;;;AASA,IAAI;AACJ,IAAI;;;;;AAMJ,SAAgB,MAAM,SAAc;AAClC,SAAQ,OAAO,MAAM,QAAQ;AAC7B,SAAQ,OAAO,MAAM,KAAK;;;;;;AAO5B,SAAgB,eAAe,KAAa;CAC1C,MAAM,6BAAc,KAAK,sBAAsB;AAG/C,KAAI,gBAAG,WAAW,OAAO,CAAE,QAAO;AAElC,4BAAY,KAAK,WAAW;;;;;;;AAQ9B,SAAgB,MAAM,SAAqB;AACzC,OAAM,8BAAO,IAAI,UAAU,UAAU,CAAC;AACtC,SAAQ,KAAK,EAAE;;;;;;AAOjB,eAAe,iBAAiB,QAAgB;AAG9C,KAAI,CAFiB,gBAAgB,KAAK,OAAO,CAE9B,QAAO;AAC1B,KAAI,QAAQ,SAAS,WAAY,QAAO;AAExC,OAAM,gBAAgB;AAEtB,QAAO;;AAGT,IAAI;;;;;AAMJ,SAAS,uBAAuB;AAC9B,KAAI,eAAgB,QAAO;AAW3B,MAAK,MAAM,CAAC,UAAU,YAAY,OAAO,QATvB;EAChB,aAAa;EACb,kBAAkB;EAClB,qBAAqB;EACrB,YAAY;EACZ,aAAa;EACb,aAAa;EACd,CAE0D,CACzD,KAAI,gBAAG,+BAAgB,kCAAgB,SAAS,CAAC,EAAE;AACjD,mBAAiB;AACjB;;AAIJ,KAAI,CAAC,eACH,kBAAiB;AAGnB,QAAO;;;;;;AAOT,eAAsB,eAAe,GAAY;AAC/C,KAAI,GAAI,QAAO;AAEf,KAAI;AACF,OAAK,MAAM,OAAO;UACX,KAAG;AACV,MAAI,eAAa,SAAS,UAAU,OAAK,IAAE,SAAS,mBAClD,KAAI;GACF,MAAM,iBAAiB,sBAAsB;AAE7C,oCAAS,GAAG,eAAe,UADZ,mBAAmB,SAAS,SAAS,GACR,aAAa;IACvD,OAAO;IACP,KAAK;IACN,CAAC;AAEF,WAAQ,IACN,8BAAO,KACL,6DACD,CACF;AAED,QAAK,MAAM,OAAO;AAElB,UAAO;UACD;AACN,SACE,oGACD;;AAGL,QAAM,OAAK,+DAA+D;;AAG5E,QAAO;;;;;;AAOT,eAAsB,uBACtB,QACoC;AAClC,OAAM,aAAa,OAAO;CAE1B,MAAM,OAAO,MAAM,iBAAiB,OAAO;CAE3C,IAAI;AAEJ,KAAI,QAAQ,IAAI;EACd,MAAM,EAAE,oBAAoB;EAE5B,MAAM,EAAE,eAAe,gBADX,gBAAG,aAAa,QAAQ,OAAO,EACC;GAC1C,iBAAiB;IACf,QAAQ,GAAG,WAAW;IACtB,QAAQ,GAAG,aAAa;IACxB,kBAAkB,GAAG,qBAAqB;IAC3C;GACD,UAAU;GACX,CAAC;AAEF,QAAM,4CAAsB;EAI5B,MAAM,8BAFkB,kCAEc,iCAAiC;AAEvE,kBAAG,cAAc,SAAS,WAAW;AAErC,sBAAoB;AAEpB,WAAS;;;;;CAMX,MAAM,SAAS,MAAM,OAAO,UAAU,UAAU,MAC7C,SAAS,KAAK,WAAW,KAC3B;AAED,KAAI,kBACF,KAAI;AACF,kBAAG,WAAW,kBAAkB;SAC1B;AAKV,QAAO;;;;;;AAOT,eAAe,aAAa,KAAa;AAGvC,KAAI,CAFW,gBAAG,WAAW,IAAI,CAG/B,OAAM,IAAI,MAAM,mBAAmB,MAAM;;;;;;AAQ7C,SAAgB,MAAM,KAAa;AACjC,wBAAW,IAAI;;;;;;AAOjB,eAAsB,gBAAgB,OAAe,KAAa;CAChE,MAAM,mCAAoB,kCAAgB,MAAM;CAChD,MAAM,iCAAkB,kCAAgB,IAAI;CAE5C,MAAM,cAAc,CAAC,cAAc;CACnC,MAAM,iBAAiB,YAAY,KAAK,6BAAc,cAAc,KAAK,CAAC;CAC1E,MAAM,kBAAkB,YAAY,KAAK,6BAAc,YAAY,KAAK,CAAC;AAEzE,MAAK,MAAM,cAAc,gBAAgB;AACvC,MAAI,CAAC,gBAAG,WAAW,WAAW,CAC5B;EAIF,MAAM,iBAAiB,gBAAgB,eAAe,QAAQ,WAAW;AAEzE,MAAI,CAAC,gBAAG,WAAW,eAAe,CAChC,iBAAG,SAAS,MAAM,gBAAgB,EAAE,WAAW,MAAM,CAAC,CAAC,YAAY,GAAG;AAGxE,QAAM,gBAAG,SACT,GAAG,YAAG,gBAAY;GAChB,WAAW;GACX,OAAO;GACR,CAAC,CACF,YAAY,GAAG;;;;;;;AAQnB,eAAsB,aAA+C;AACnE,KAAI,OAAQ,QAAO;AAEnB,UAAS,MAAM,OAAO;AAEtB,QAAO"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-kSYXY2_d.js');
|
|
2
|
-
let node_crypto = require("node:crypto");
|
|
3
|
-
|
|
4
|
-
//#region src/analytics/constants.ts
|
|
5
|
-
/**
|
|
6
|
-
* @private
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
const DO_NOT_TRACK_KEY = `COMMANDKIT_ANALYTICS__DO_NOT_TRACK::${(0, node_crypto.randomUUID)()}`;
|
|
10
|
-
/**
|
|
11
|
-
* The analytics events that are used in CommandKit.
|
|
12
|
-
* These events are used to track various actions and metrics within the CommandKit framework.
|
|
13
|
-
*/
|
|
14
|
-
const AnalyticsEvents = {
|
|
15
|
-
COMMAND_EXECUTION: "command_execution",
|
|
16
|
-
FEATURE_FLAG_METRICS: "feature_flag_metrics",
|
|
17
|
-
FEATURE_FLAG_DECISION: "feature_flag_decision",
|
|
18
|
-
CACHE_HIT: "cache_hit",
|
|
19
|
-
CACHE_MISS: "cache_miss",
|
|
20
|
-
CACHE_REVALIDATED: "cache_revalidated"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
Object.defineProperty(exports, 'AnalyticsEvents', {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return AnalyticsEvents;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, 'DO_NOT_TRACK_KEY', {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return DO_NOT_TRACK_KEY;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=constants-BA0TJU6e.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-BA0TJU6e.js","names":[],"sources":["../src/analytics/constants.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\n/**\n * @private\n * @internal\n */\nexport const DO_NOT_TRACK_KEY = `COMMANDKIT_ANALYTICS__DO_NOT_TRACK::${randomUUID()}`;\n\n/**\n * The analytics events that are used in CommandKit.\n * These events are used to track various actions and metrics within the CommandKit framework.\n */\nexport const AnalyticsEvents = {\n // commands\n COMMAND_EXECUTION: 'command_execution',\n // feature flags\n FEATURE_FLAG_METRICS: 'feature_flag_metrics',\n FEATURE_FLAG_DECISION: 'feature_flag_decision',\n // @commandkit/cache\n CACHE_HIT: 'cache_hit',\n CACHE_MISS: 'cache_miss',\n CACHE_REVALIDATED: 'cache_revalidated',\n} as const;\n\n/**\n * The type of analytics events that can be tracked in CommandKit.\n * This type is derived from the keys of the `AnalyticsEvents` object.\n * It ensures that only valid analytics events can be used in the tracking functions.\n */\nexport type AnalyticsEvent =\n (typeof AnalyticsEvents)[keyof typeof AnalyticsEvents];\n"],"mappings":";;;;;;;;AAMA,MAAa,mBAAmB,oEAAmD;;;;;AAMnF,MAAa,kBAAkB;CAE7B,mBAAmB;CAEnB,sBAAsB;CACtB,uBAAuB;CAEvB,WAAW;CACX,YAAY;CACZ,mBAAmB;CACpB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/kv/constants.ts
|
|
3
|
-
let SerializerType = /* @__PURE__ */ function(SerializerType) {
|
|
4
|
-
SerializerType[SerializerType["String"] = 0] = "String";
|
|
5
|
-
SerializerType[SerializerType["Number"] = 1] = "Number";
|
|
6
|
-
SerializerType[SerializerType["Boolean"] = 2] = "Boolean";
|
|
7
|
-
SerializerType[SerializerType["Object"] = 3] = "Object";
|
|
8
|
-
SerializerType[SerializerType["Date"] = 4] = "Date";
|
|
9
|
-
SerializerType[SerializerType["BigInt"] = 5] = "BigInt";
|
|
10
|
-
SerializerType[SerializerType["Null"] = 6] = "Null";
|
|
11
|
-
SerializerType[SerializerType["Undefined"] = 7] = "Undefined";
|
|
12
|
-
SerializerType[SerializerType["Array"] = 8] = "Array";
|
|
13
|
-
SerializerType[SerializerType["Map"] = 9] = "Map";
|
|
14
|
-
SerializerType[SerializerType["Set"] = 10] = "Set";
|
|
15
|
-
SerializerType[SerializerType["Buffer"] = 11] = "Buffer";
|
|
16
|
-
SerializerType[SerializerType["RegExp"] = 12] = "RegExp";
|
|
17
|
-
return SerializerType;
|
|
18
|
-
}({});
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
Object.defineProperty(exports, 'SerializerType', {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return SerializerType;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=constants-BS9N2avz.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-BS9N2avz.js","names":[],"sources":["../src/kv/constants.ts"],"sourcesContent":["export enum SerializerType {\n String,\n Number,\n Boolean,\n Object,\n Date,\n BigInt,\n Null,\n Undefined,\n Array,\n Map,\n Set,\n Buffer,\n RegExp,\n}\n"],"mappings":";;AAAA,IAAY,0DAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/utils/constants.ts
|
|
3
|
-
/**
|
|
4
|
-
* The current working directory of the CommandKit instance.
|
|
5
|
-
*/
|
|
6
|
-
const COMMANDKIT_CWD = process.env.COMMANDKIT_CWD || process.cwd();
|
|
7
|
-
/**
|
|
8
|
-
* Indicates whether CommandKit is running in development mode.
|
|
9
|
-
*/
|
|
10
|
-
const COMMANDKIT_IS_DEV = process.env.COMMANDKIT_IS_DEV === "true";
|
|
11
|
-
/**
|
|
12
|
-
* Indicates whether CommandKit is running in CLI thread.
|
|
13
|
-
*/
|
|
14
|
-
const COMMANDKIT_IS_CLI = process.env.COMMANDKIT_IS_CLI === "true";
|
|
15
|
-
/**
|
|
16
|
-
* Indicates whether CommandKit is running in test mode.
|
|
17
|
-
*/
|
|
18
|
-
const COMMANDKIT_IS_TEST = process.env.COMMANDKIT_IS_TEST === "true";
|
|
19
|
-
/**
|
|
20
|
-
* Indicates that CommandKit is running in a build-like environment.
|
|
21
|
-
* @private
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
function isBuildLikeEnvironment() {
|
|
25
|
-
if (process.env.COMMANDKIT_INTERNAL_IS_CLI_PROCESS === "true") return true;
|
|
26
|
-
return process.env.COMMANDKIT_IS_BUILD === "true";
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* The current bootstrap mode of CommandKit.
|
|
30
|
-
* This can be 'development' or 'production'.
|
|
31
|
-
*/
|
|
32
|
-
const COMMANDKIT_BOOTSTRAP_MODE = process.env.COMMANDKIT_BOOTSTRAP_MODE || "development";
|
|
33
|
-
/**
|
|
34
|
-
* Types of Hot Module Replacement events
|
|
35
|
-
*/
|
|
36
|
-
const HMREventType = {
|
|
37
|
-
ReloadCommands: "reload-commands",
|
|
38
|
-
ReloadEvents: "reload-events",
|
|
39
|
-
Unknown: "unknown"
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
Object.defineProperty(exports, 'COMMANDKIT_BOOTSTRAP_MODE', {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return COMMANDKIT_BOOTSTRAP_MODE;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(exports, 'COMMANDKIT_CWD', {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: function () {
|
|
52
|
-
return COMMANDKIT_CWD;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(exports, 'COMMANDKIT_IS_CLI', {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
get: function () {
|
|
58
|
-
return COMMANDKIT_IS_CLI;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(exports, 'COMMANDKIT_IS_DEV', {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get: function () {
|
|
64
|
-
return COMMANDKIT_IS_DEV;
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(exports, 'COMMANDKIT_IS_TEST', {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
get: function () {
|
|
70
|
-
return COMMANDKIT_IS_TEST;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(exports, 'HMREventType', {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
get: function () {
|
|
76
|
-
return HMREventType;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(exports, 'isBuildLikeEnvironment', {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
get: function () {
|
|
82
|
-
return isBuildLikeEnvironment;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
//# sourceMappingURL=constants-CeIMhMD0.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-CeIMhMD0.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 * Indicates that CommandKit is running in a build-like environment.\n * @private\n * @internal\n */\nexport function isBuildLikeEnvironment() {\n const isCLI = process.env.COMMANDKIT_INTERNAL_IS_CLI_PROCESS === 'true';\n if (isCLI) return true;\n\n return process.env.COMMANDKIT_IS_BUILD === 'true';\n}\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;;;;;;AAOrE,SAAgB,yBAAyB;AAEvC,KADc,QAAQ,IAAI,uCAAuC,OACtD,QAAO;AAElB,QAAO,QAAQ,IAAI,wBAAwB;;;;;;AAO7C,MAAa,4BAA6B,QAAQ,IAClD,6BAA6B;;;;AAK7B,MAAa,eAAe;CAI1B,gBAAgB;CAIhB,cAAc;CAId,SAAS;CACV"}
|
package/dist/env-FxaiNasU.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/cli/env.ts
|
|
3
|
-
/**
|
|
4
|
-
* @private
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
function DevEnv(_static = false) {
|
|
8
|
-
const common = {
|
|
9
|
-
NODE_ENV: "development",
|
|
10
|
-
COMMANDKIT_IS_DEV: "true",
|
|
11
|
-
COMMANDKIT_INTERNAL_IS_CLI_PROCESS: "false",
|
|
12
|
-
COMMANDKIT_IS_BUILD: "false"
|
|
13
|
-
};
|
|
14
|
-
if (_static) return Object.assign({}, common);
|
|
15
|
-
return Object.assign({}, process.env, common);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @private
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
function ProdEnv(_static = false) {
|
|
22
|
-
const common = {
|
|
23
|
-
NODE_ENV: "production",
|
|
24
|
-
COMMANDKIT_IS_DEV: "false",
|
|
25
|
-
COMMANDKIT_INTERNAL_IS_CLI_PROCESS: "false",
|
|
26
|
-
COMMANDKIT_IS_BUILD: "false"
|
|
27
|
-
};
|
|
28
|
-
if (_static) return Object.assign({}, common);
|
|
29
|
-
return Object.assign({}, process.env, common);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @private
|
|
33
|
-
* @internal
|
|
34
|
-
*/
|
|
35
|
-
const CommonEnvFiles = [".env", ".env.local"];
|
|
36
|
-
/**
|
|
37
|
-
* @private
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
const DevEnvFiles = [".env.development", ".env.development.local"];
|
|
41
|
-
/**
|
|
42
|
-
* @private
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
45
|
-
const ProdEnvFiles = [".env.production", ".env.production.local"];
|
|
46
|
-
/**
|
|
47
|
-
* @private
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
const devEnvFileArgs = [...CommonEnvFiles, ...DevEnvFiles];
|
|
51
|
-
/**
|
|
52
|
-
* @private
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
const prodEnvFileArgs = [...CommonEnvFiles, ...ProdEnvFiles];
|
|
56
|
-
/**
|
|
57
|
-
* @private
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
function setCLIEnv() {
|
|
61
|
-
process.env.COMMANDKIT_IS_CLI = "true";
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
//#endregion
|
|
65
|
-
Object.defineProperty(exports, 'CommonEnvFiles', {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function () {
|
|
68
|
-
return CommonEnvFiles;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
Object.defineProperty(exports, 'DevEnv', {
|
|
72
|
-
enumerable: true,
|
|
73
|
-
get: function () {
|
|
74
|
-
return DevEnv;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
Object.defineProperty(exports, 'DevEnvFiles', {
|
|
78
|
-
enumerable: true,
|
|
79
|
-
get: function () {
|
|
80
|
-
return DevEnvFiles;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
Object.defineProperty(exports, 'ProdEnv', {
|
|
84
|
-
enumerable: true,
|
|
85
|
-
get: function () {
|
|
86
|
-
return ProdEnv;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(exports, 'ProdEnvFiles', {
|
|
90
|
-
enumerable: true,
|
|
91
|
-
get: function () {
|
|
92
|
-
return ProdEnvFiles;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
Object.defineProperty(exports, 'devEnvFileArgs', {
|
|
96
|
-
enumerable: true,
|
|
97
|
-
get: function () {
|
|
98
|
-
return devEnvFileArgs;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
Object.defineProperty(exports, 'prodEnvFileArgs', {
|
|
102
|
-
enumerable: true,
|
|
103
|
-
get: function () {
|
|
104
|
-
return prodEnvFileArgs;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
Object.defineProperty(exports, 'setCLIEnv', {
|
|
108
|
-
enumerable: true,
|
|
109
|
-
get: function () {
|
|
110
|
-
return setCLIEnv;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
//# sourceMappingURL=env-FxaiNasU.js.map
|
package/dist/env-FxaiNasU.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env-FxaiNasU.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 COMMANDKIT_INTERNAL_IS_CLI_PROCESS: 'false',\n COMMANDKIT_IS_BUILD: '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 function ProdEnv(_static = false) {\n const common = {\n NODE_ENV: 'production',\n COMMANDKIT_IS_DEV: 'false',\n COMMANDKIT_INTERNAL_IS_CLI_PROCESS: 'false',\n COMMANDKIT_IS_BUILD: '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;EACnB,oCAAoC;EACpC,qBAAqB;EACtB;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;EACnB,oCAAoC;EACpC,qBAAqB;EACtB;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,73 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/utils/error-codes.ts
|
|
3
|
-
/**
|
|
4
|
-
* The error codes used by CommandKit.
|
|
5
|
-
*/
|
|
6
|
-
const CommandKitErrorCodes = {
|
|
7
|
-
StopMiddlewares: Symbol("kStopMiddlewares"),
|
|
8
|
-
ForwardedCommand: Symbol("kForwardedCommand"),
|
|
9
|
-
InvalidCommandPrefix: Symbol("kInvalidCommandPrefix"),
|
|
10
|
-
PluginCaptureHandle: Symbol("kPluginCaptureHandle"),
|
|
11
|
-
StopEvents: Symbol("kStopEvents")
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Creates a new CommandKit error with the specified code.
|
|
15
|
-
* @param code The error code to assign to the error.
|
|
16
|
-
* @returns A new CommandKit error instance.
|
|
17
|
-
*/
|
|
18
|
-
function createCommandKitError(code) {
|
|
19
|
-
const error = /* @__PURE__ */ new Error();
|
|
20
|
-
Reflect.set(error, "code", code);
|
|
21
|
-
return error;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Checks if the given error is a CommandKit error.
|
|
25
|
-
* @param error The error to check.
|
|
26
|
-
* @returns True if the error is a CommandKit error, false otherwise.
|
|
27
|
-
*/
|
|
28
|
-
function isCommandKitError(error) {
|
|
29
|
-
if (!(error instanceof Error)) return false;
|
|
30
|
-
const code = Reflect.get(error, "code");
|
|
31
|
-
for (const key in CommandKitErrorCodes) if (CommandKitErrorCodes[key] === code) return true;
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Checks if the given error is of a specific CommandKit error type.
|
|
36
|
-
* @param error The error to check.
|
|
37
|
-
* @param code The error code or an array of error codes to check against.
|
|
38
|
-
* @returns True if the error matches the specified code(s), false otherwise.
|
|
39
|
-
*/
|
|
40
|
-
function isErrorType(error, code) {
|
|
41
|
-
if (!isCommandKitError(error)) return false;
|
|
42
|
-
const errorCode = Reflect.get(error, "code");
|
|
43
|
-
if (!errorCode) return false;
|
|
44
|
-
if (Array.isArray(code)) return code.includes(errorCode);
|
|
45
|
-
return errorCode === code;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
Object.defineProperty(exports, 'CommandKitErrorCodes', {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: function () {
|
|
52
|
-
return CommandKitErrorCodes;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(exports, 'createCommandKitError', {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
get: function () {
|
|
58
|
-
return createCommandKitError;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(exports, 'isCommandKitError', {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get: function () {
|
|
64
|
-
return isCommandKitError;
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(exports, 'isErrorType', {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
get: function () {
|
|
70
|
-
return isErrorType;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
//# sourceMappingURL=error-codes-Ds0bnPvT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes-Ds0bnPvT.js","names":[],"sources":["../src/utils/error-codes.ts"],"sourcesContent":["/**\n * The error codes used by CommandKit.\n */\nexport const CommandKitErrorCodes = {\n /**\n * Error code for exiting middleware.\n */\n StopMiddlewares: Symbol('kStopMiddlewares'),\n /**\n * Error code for forwarded commands.\n */\n ForwardedCommand: Symbol('kForwardedCommand'),\n /**\n * Error code for invalid command prefix.\n */\n InvalidCommandPrefix: Symbol('kInvalidCommandPrefix'),\n /**\n * Error code for plugin capture handle.\n */\n PluginCaptureHandle: Symbol('kPluginCaptureHandle'),\n /**\n * Error code for event interruption signal\n */\n StopEvents: Symbol('kStopEvents'),\n} as const;\n\n/**\n * The type for CommandKit errors.\n */\nexport type CommandKitError = Error & { code: symbol };\n\n/**\n * Creates a new CommandKit error with the specified code.\n * @param code The error code to assign to the error.\n * @returns A new CommandKit error instance.\n */\nexport function createCommandKitError(code: symbol): CommandKitError {\n const error = new Error() as CommandKitError;\n\n Reflect.set(error, 'code', code);\n\n return error;\n}\n\n/**\n * Checks if the given error is a CommandKit error.\n * @param error The error to check.\n * @returns True if the error is a CommandKit error, false otherwise.\n */\nexport function isCommandKitError(error: unknown): error is CommandKitError {\n if (!(error instanceof Error)) return false;\n const code = Reflect.get(error, 'code');\n\n for (const key in CommandKitErrorCodes) {\n if (CommandKitErrorCodes[key as keyof typeof CommandKitErrorCodes] === code)\n return true;\n }\n\n return false;\n}\n\n/**\n * Checks if the given error is of a specific CommandKit error type.\n * @param error The error to check.\n * @param code The error code or an array of error codes to check against.\n * @returns True if the error matches the specified code(s), false otherwise.\n */\nexport function isErrorType(error: unknown, code: symbol | symbol[]): boolean {\n if (!isCommandKitError(error)) return false;\n const errorCode = Reflect.get(error, 'code');\n\n if (!errorCode) return false;\n\n if (Array.isArray(code)) return code.includes(errorCode);\n\n return errorCode === code;\n}\n"],"mappings":";;;;;AAGA,MAAa,uBAAuB;CAIlC,iBAAiB,OAAO,mBAAmB;CAI3C,kBAAkB,OAAO,oBAAoB;CAI7C,sBAAsB,OAAO,wBAAwB;CAIrD,qBAAqB,OAAO,uBAAuB;CAInD,YAAY,OAAO,cAAc;CAClC;;;;;;AAYD,SAAgB,sBAAsB,MAA+B;CACnE,MAAM,wBAAQ,IAAI,OAAO;AAEzB,SAAQ,IAAI,OAAO,QAAQ,KAAK;AAEhC,QAAO;;;;;;;AAQT,SAAgB,kBAAkB,OAA0C;AAC1E,KAAI,EAAE,iBAAiB,OAAQ,QAAO;CACtC,MAAM,OAAO,QAAQ,IAAI,OAAO,OAAO;AAEvC,MAAK,MAAM,OAAO,qBAChB,KAAI,qBAAqB,SAA8C,KACvE,QAAE;AAGJ,QAAO;;;;;;;;AAST,SAAgB,YAAY,OAAgB,MAAkC;AAC5E,KAAI,CAAC,kBAAkB,MAAM,CAAE,QAAO;CACtC,MAAM,YAAY,QAAQ,IAAI,OAAO,OAAO;AAE5C,KAAI,CAAC,UAAW,QAAO;AAEvB,KAAI,MAAM,QAAQ,KAAK,CAAE,QAAO,KAAK,SAAS,UAAU;AAExD,QAAO,cAAc"}
|
package/dist/file-DqI3v90P.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-kSYXY2_d.js');
|
|
2
|
-
let discord_js = require("discord.js");
|
|
3
|
-
|
|
4
|
-
//#region src/components/display/file.ts
|
|
5
|
-
/**
|
|
6
|
-
* The file component
|
|
7
|
-
* @param props - The properties for the file component.
|
|
8
|
-
* @returns The file builder instance.
|
|
9
|
-
* @example ```tsx
|
|
10
|
-
* import { File } from 'commandkit';
|
|
11
|
-
*
|
|
12
|
-
* const file = <File url="https://example.com/file.png" />;
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
function File(props) {
|
|
16
|
-
const file = new discord_js.FileBuilder(props);
|
|
17
|
-
if (props.url != null) file.setURL(props.url);
|
|
18
|
-
return file;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
Object.defineProperty(exports, 'File', {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () {
|
|
25
|
-
return File;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=file-DqI3v90P.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-DqI3v90P.js","names":[],"sources":["../src/components/display/file.ts"],"sourcesContent":["import { FileBuilder, FileComponentData } from 'discord.js';\n\n/**\n * Represents the properties for a file component.\n */\nexport interface FileProps extends Omit<FileComponentData, 'type' | 'file'> {\n url: string;\n}\n\n/**\n * The file component\n * @param props - The properties for the file component.\n * @returns The file builder instance.\n * @example ```tsx\n * import { File } from 'commandkit';\n *\n * const file = <File url=\"https://example.com/file.png\" />;\n * ```\n */\nexport function File(props: FileProps) {\n const file = new FileBuilder(props);\n\n if (props.url != null) {\n file.setURL(props.url);\n }\n\n return file;\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,SAAgB,KAAK,OAAkB;CACrC,MAAM,OAAO,IAAI,uBAAY,MAAM;AAEnC,KAAI,MAAM,OAAO,KACf,MAAK,OAAO,MAAM,IAAI;AAGxB,QAAO"}
|
package/dist/helpers-DSy7EjzP.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-kSYXY2_d.js');
|
|
2
|
-
let discord_js = require("discord.js");
|
|
3
|
-
|
|
4
|
-
//#region src/app/commands/helpers.ts
|
|
5
|
-
/**
|
|
6
|
-
* Type guard to check if a command source is a Discord message.
|
|
7
|
-
* @param source - The command source to check
|
|
8
|
-
* @returns True if the source is a Message
|
|
9
|
-
*/
|
|
10
|
-
function isMessageSource(source) {
|
|
11
|
-
return source instanceof discord_js.Message;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Type guard to check if a command source is a Discord interaction.
|
|
15
|
-
* @param source - The command source to check
|
|
16
|
-
* @returns True if the source is an Interaction
|
|
17
|
-
*/
|
|
18
|
-
function isInteractionSource(source) {
|
|
19
|
-
return !isMessageSource(source);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
Object.defineProperty(exports, 'isInteractionSource', {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () {
|
|
26
|
-
return isInteractionSource;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(exports, 'isMessageSource', {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return isMessageSource;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=helpers-DSy7EjzP.js.map
|