commandkit 1.0.0-dev.20250529020123 → 1.0.0-dev.20250530015910

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.
Files changed (391) hide show
  1. package/dist/ActionRow-CmTHbo2t.js +25 -0
  2. package/dist/ActionRow-CmTHbo2t.js.map +1 -0
  3. package/dist/ActionRow-D0wafJhZ.d.ts +16 -0
  4. package/dist/Button-Bl5nbwTS.d.ts +32 -0
  5. package/dist/ButtonKit-BSI7lCI0.d.ts +68 -0
  6. package/dist/ChannelSelectMenuKit-L15A2jpT.d.ts +51 -0
  7. package/dist/CommandKit-CDlCsGCx.d.ts +926 -0
  8. package/dist/CommandKit-DDrQtQns.js +3281 -0
  9. package/dist/CommandKit-DDrQtQns.js.map +1 -0
  10. package/dist/CommandKit.d.ts +33 -13
  11. package/dist/CommandKit.js +46 -16
  12. package/dist/CommandKitEventsChannel-B6LKgxmv.js +44 -0
  13. package/dist/CommandKitEventsChannel-B6LKgxmv.js.map +1 -0
  14. package/dist/CommandsRouter-BHaPno8o.js +127 -0
  15. package/dist/CommandsRouter-BHaPno8o.js.map +1 -0
  16. package/dist/CommandsRouter-C7X-eXE2.d.ts +67 -0
  17. package/dist/CompilerPlugin-XzuGixkC.js +32 -0
  18. package/dist/CompilerPlugin-XzuGixkC.js.map +1 -0
  19. package/dist/CompilerPluginRuntime-zFCCw1kM.js +70 -0
  20. package/dist/CompilerPluginRuntime-zFCCw1kM.js.map +1 -0
  21. package/dist/DefaultLogger-D3G0rGnV.d.ts +30 -0
  22. package/dist/EventInterceptor-D_oEWSnF.d.ts +84 -0
  23. package/dist/EventInterceptor-DtRINyTP.js +140 -0
  24. package/dist/EventInterceptor-DtRINyTP.js.map +1 -0
  25. package/dist/EventWorkerContext-C0e23GNY.d.ts +19 -0
  26. package/dist/EventWorkerContext-XZGSHn5F.js +45 -0
  27. package/dist/EventWorkerContext-XZGSHn5F.js.map +1 -0
  28. package/dist/EventsRouter-BacqK6z3.d.ts +90 -0
  29. package/dist/EventsRouter-CqnrlbjN.js +133 -0
  30. package/dist/EventsRouter-CqnrlbjN.js.map +1 -0
  31. package/dist/ILogger-BTMQuall.d.ts +11 -0
  32. package/dist/ILogger-DucYb0bG.js +0 -0
  33. package/dist/Logger-A3wjB7L1.d.ts +17 -0
  34. package/dist/MentionableSelectMenuKit-BiUSKUtZ.d.ts +51 -0
  35. package/dist/MessageCommandParser-B13Pkwo9.js +200 -0
  36. package/dist/MessageCommandParser-B13Pkwo9.js.map +1 -0
  37. package/dist/MessageCommandParser-tzroBwij.d.ts +62 -0
  38. package/dist/Modal-Cxm6cs5c.d.ts +58 -0
  39. package/dist/ModalKit-CKtQ8eXW.d.ts +66 -0
  40. package/dist/PluginCommon-DPqnQngK.js +48 -0
  41. package/dist/PluginCommon-DPqnQngK.js.map +1 -0
  42. package/dist/RoleSelectMenuKit-BSMKkru2.d.ts +51 -0
  43. package/dist/RuntimePlugin-CKsd83M3.js +130 -0
  44. package/dist/RuntimePlugin-CKsd83M3.js.map +1 -0
  45. package/dist/SelectMenu-b7jgrkjO.d.ts +36 -0
  46. package/dist/StringSelectMenuKit-B9FHTe48.d.ts +51 -0
  47. package/dist/UserSelectMenuKit-DiP0imyo.d.ts +51 -0
  48. package/dist/app/commands/AppCommandRunner.d.ts +33 -13
  49. package/dist/app/commands/AppCommandRunner.js +38 -3
  50. package/dist/app/commands/Context.d.ts +33 -13
  51. package/dist/app/commands/Context.js +40 -3
  52. package/dist/app/commands/MessageCommandParser.d.ts +2 -60
  53. package/dist/app/commands/MessageCommandParser.js +5 -2
  54. package/dist/app/commands/helpers.d.ts +2 -7
  55. package/dist/app/commands/helpers.js +4 -2
  56. package/dist/app/events/EventWorkerContext.d.ts +34 -28
  57. package/dist/app/events/EventWorkerContext.js +6 -2
  58. package/dist/app/handlers/AppCommandHandler.d.ts +33 -13
  59. package/dist/app/handlers/AppCommandHandler.js +38 -8
  60. package/dist/app/handlers/AppEventsHandler.d.ts +33 -13
  61. package/dist/app/handlers/AppEventsHandler.js +38 -3
  62. package/dist/app/index.d.ts +33 -15
  63. package/dist/app/index.js +51 -8
  64. package/dist/app/middleware/signals.d.ts +2 -18
  65. package/dist/app/middleware/signals.js +6 -2
  66. package/dist/app/register/CommandRegistrar.d.ts +33 -13
  67. package/dist/app/register/CommandRegistrar.js +38 -3
  68. package/dist/app/router/CommandsRouter.d.ts +2 -65
  69. package/dist/app/router/CommandsRouter.js +3 -2
  70. package/dist/app/router/EventsRouter.d.ts +2 -88
  71. package/dist/app/router/EventsRouter.js +3 -2
  72. package/dist/app/router/index.d.ts +4 -3
  73. package/dist/app/router/index.js +6 -2
  74. package/dist/app-CXCbKsPz.js +0 -0
  75. package/dist/app-process-uCX52YaE.js +48 -0
  76. package/dist/app-process-uCX52YaE.js.map +1 -0
  77. package/dist/build-Bkb5t3XA.js +122 -0
  78. package/dist/build-Bkb5t3XA.js.map +1 -0
  79. package/dist/chunk-nOFOJqeH.js +30 -0
  80. package/dist/cli/app-process.d.ts +5 -3
  81. package/dist/cli/app-process.js +8 -3
  82. package/dist/cli/build.d.ts +46 -21
  83. package/dist/cli/build.js +40 -48
  84. package/dist/cli/common.d.ts +39 -19
  85. package/dist/cli/common.js +13 -10
  86. package/dist/cli/development.d.ts +3 -1
  87. package/dist/cli/development.js +185 -50
  88. package/dist/cli/development.js.map +1 -1
  89. package/dist/cli/env.d.ts +7 -5
  90. package/dist/cli/env.js +9 -2
  91. package/dist/cli/generators.d.ts +3 -1
  92. package/dist/cli/generators.js +64 -15
  93. package/dist/cli/generators.js.map +1 -1
  94. package/dist/cli/information.d.ts +3 -1
  95. package/dist/cli/information.js +110 -5
  96. package/dist/cli/information.js.map +1 -1
  97. package/dist/cli/init.d.ts +2 -10
  98. package/dist/cli/init.js +4 -99
  99. package/dist/cli/parse-env.d.ts +3 -1
  100. package/dist/cli/parse-env.js +53 -1
  101. package/dist/cli/parse-env.js.map +1 -1
  102. package/dist/cli/production.d.ts +5 -3
  103. package/dist/cli/production.js +68 -46
  104. package/dist/cli/production.js.map +1 -1
  105. package/dist/cli/type-checker.d.ts +3 -1
  106. package/dist/cli/type-checker.js +7 -5
  107. package/dist/cli/utils.d.ts +4 -2
  108. package/dist/cli/utils.js +3 -2
  109. package/dist/colors-Cd4Oz-r-.js +14 -0
  110. package/dist/colors-Cd4Oz-r-.js.map +1 -0
  111. package/dist/common-CcfjYnPG.js +0 -0
  112. package/dist/common-CeO-vn8Y.js +14 -0
  113. package/dist/common-CeO-vn8Y.js.map +1 -0
  114. package/dist/common-DirpDCa6.js +182 -0
  115. package/dist/common-DirpDCa6.js.map +1 -0
  116. package/dist/common-pvPJVTfe.d.ts +25 -0
  117. package/dist/components/common/EventInterceptor.d.ts +2 -82
  118. package/dist/components/common/EventInterceptor.js +3 -2
  119. package/dist/components/common/element.d.ts +5 -29
  120. package/dist/components/common/element.js +10 -2
  121. package/dist/components/common/types.d.ts +2 -3
  122. package/dist/components/common/types.js +1 -2
  123. package/dist/components/index.d.ts +24 -22
  124. package/dist/components/index.js +72 -16
  125. package/dist/components/v1/action-row/ActionRow.d.ts +6 -18
  126. package/dist/components/v1/action-row/ActionRow.js +3 -2
  127. package/dist/components/v1/button/Button.d.ts +7 -31
  128. package/dist/components/v1/button/Button.js +38 -16
  129. package/dist/components/v1/button/ButtonKit.d.ts +3 -66
  130. package/dist/components/v1/button/ButtonKit.js +38 -16
  131. package/dist/components/v1/modal/Modal.d.ts +7 -57
  132. package/dist/components/v1/modal/Modal.js +41 -16
  133. package/dist/components/v1/modal/ModalKit.d.ts +3 -64
  134. package/dist/components/v1/modal/ModalKit.js +38 -16
  135. package/dist/components/v1/select-menu/ChannelSelectMenuKit.d.ts +4 -49
  136. package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +38 -16
  137. package/dist/components/v1/select-menu/MentionableSelectMenuKit.d.ts +4 -49
  138. package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +38 -16
  139. package/dist/components/v1/select-menu/RoleSelectMenuKit.d.ts +4 -49
  140. package/dist/components/v1/select-menu/RoleSelectMenuKit.js +38 -16
  141. package/dist/components/v1/select-menu/SelectMenu.d.ts +10 -40
  142. package/dist/components/v1/select-menu/SelectMenu.js +43 -16
  143. package/dist/components/v1/select-menu/StringSelectMenuKit.d.ts +4 -49
  144. package/dist/components/v1/select-menu/StringSelectMenuKit.js +38 -16
  145. package/dist/components/v1/select-menu/UserSelectMenuKit.d.ts +4 -49
  146. package/dist/components/v1/select-menu/UserSelectMenuKit.js +38 -16
  147. package/dist/components/v1/select-menu/common.d.ts +3 -23
  148. package/dist/components/v1/select-menu/common.js +1 -2
  149. package/dist/components/v2/common.d.ts +5 -3
  150. package/dist/components/v2/common.js +3 -2
  151. package/dist/components/v2/container.d.ts +2 -8
  152. package/dist/components/v2/container.js +4 -2
  153. package/dist/components/v2/file.d.ts +2 -8
  154. package/dist/components/v2/file.js +3 -2
  155. package/dist/components/v2/index.d.ts +8 -7
  156. package/dist/components/v2/index.js +17 -2
  157. package/dist/components/v2/media-gallery.d.ts +2 -15
  158. package/dist/components/v2/media-gallery.js +5 -2
  159. package/dist/components/v2/section.d.ts +2 -16
  160. package/dist/components/v2/section.js +5 -2
  161. package/dist/components/v2/separator.d.ts +2 -7
  162. package/dist/components/v2/separator.js +3 -2
  163. package/dist/components/v2/text-display.d.ts +2 -10
  164. package/dist/components/v2/text-display.js +3 -2
  165. package/dist/config/config.d.ts +36 -28
  166. package/dist/config/config.js +39 -3
  167. package/dist/config/default.d.ts +37 -17
  168. package/dist/config/default.js +38 -3
  169. package/dist/config/loader.d.ts +37 -17
  170. package/dist/config/loader.js +39 -11
  171. package/dist/config/types.d.ts +34 -83
  172. package/dist/config/types.js +0 -2
  173. package/dist/config/utils.d.ts +35 -26
  174. package/dist/config/utils.js +15 -1
  175. package/dist/config/utils.js.map +1 -1
  176. package/dist/config-Dyb-zl9w.d.ts +17 -0
  177. package/dist/constants-Ce6w4OFe.d.ts +17 -0
  178. package/dist/constants-DOPSzXI0.js +47 -0
  179. package/dist/constants-DOPSzXI0.js.map +1 -0
  180. package/dist/container-CpuiLsZM.js +33 -0
  181. package/dist/container-CpuiLsZM.js.map +1 -0
  182. package/dist/container-CwEATQy2.d.ts +10 -0
  183. package/dist/context/async-context.d.ts +33 -13
  184. package/dist/context/async-context.js +44 -16
  185. package/dist/context/environment.d.ts +33 -13
  186. package/dist/context/environment.js +41 -3
  187. package/dist/element-D_nyVwgB.d.ts +30 -0
  188. package/dist/element-hdSqnIpC.js +62 -0
  189. package/dist/element-hdSqnIpC.js.map +1 -0
  190. package/dist/env-DKFSgEcR.js +68 -0
  191. package/dist/env-DKFSgEcR.js.map +1 -0
  192. package/dist/error-codes-C_UO39jz.js +53 -0
  193. package/dist/error-codes-C_UO39jz.js.map +1 -0
  194. package/dist/events/CommandKitEventsChannel.d.ts +33 -13
  195. package/dist/events/CommandKitEventsChannel.js +3 -2
  196. package/dist/feature-flags-BJp6kYmi.js +85 -0
  197. package/dist/feature-flags-BJp6kYmi.js.map +1 -0
  198. package/dist/file-BdyYwkaI.d.ts +10 -0
  199. package/dist/file-DE69SSOP.js +18 -0
  200. package/dist/file-DE69SSOP.js.map +1 -0
  201. package/dist/flags/feature-flags.d.ts +33 -13
  202. package/dist/flags/feature-flags.js +40 -16
  203. package/dist/flags/store.d.ts +33 -13
  204. package/dist/flags/store.js +3 -2
  205. package/dist/helpers-CswC9gKF.js +25 -0
  206. package/dist/helpers-CswC9gKF.js.map +1 -0
  207. package/dist/helpers-DAmE106r.d.ts +9 -0
  208. package/dist/index-CUPkUUOR.d.ts +1 -0
  209. package/dist/index-Dw5cCt-A.d.ts +1 -0
  210. package/dist/index-E7Wvm5uX.d.ts +1 -0
  211. package/dist/index.d.ts +43 -51
  212. package/dist/index.js +147 -102
  213. package/dist/index.js.map +1 -1
  214. package/dist/init--p1nl1NO.d.ts +13 -0
  215. package/dist/init-D2me-V0n.js +67 -0
  216. package/dist/init-D2me-V0n.js.map +1 -0
  217. package/dist/logger/DefaultLogger.d.ts +3 -28
  218. package/dist/logger/DefaultLogger.js +38 -3
  219. package/dist/logger/ILogger.d.ts +2 -9
  220. package/dist/logger/ILogger.js +1 -2
  221. package/dist/logger/Logger.d.ts +3 -15
  222. package/dist/logger/Logger.js +39 -3
  223. package/dist/media-gallery-DCu02VXc.d.ts +17 -0
  224. package/dist/media-gallery-nUEHqKVF.js +36 -0
  225. package/dist/media-gallery-nUEHqKVF.js.map +1 -0
  226. package/dist/plugins/CompilerPlugin.d.ts +33 -13
  227. package/dist/plugins/CompilerPlugin.js +5 -2
  228. package/dist/plugins/PluginCommon.d.ts +33 -13
  229. package/dist/plugins/PluginCommon.js +5 -2
  230. package/dist/plugins/RuntimePlugin.d.ts +33 -13
  231. package/dist/plugins/RuntimePlugin.js +5 -2
  232. package/dist/plugins/index.d.ts +33 -15
  233. package/dist/plugins/index.js +44 -3
  234. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +33 -13
  235. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +38 -3
  236. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +33 -13
  237. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +3 -3
  238. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +33 -26
  239. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +38 -3
  240. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +40 -19
  241. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +38 -3
  242. package/dist/plugins/plugin-runtime/runtime.d.ts +33 -13
  243. package/dist/plugins/plugin-runtime/runtime.js +1 -2
  244. package/dist/plugins/plugin-runtime/types.d.ts +2 -72
  245. package/dist/plugins/plugin-runtime/types.js +1 -2
  246. package/dist/plugins/types.d.ts +33 -13
  247. package/dist/plugins/types.js +1 -2
  248. package/dist/resolve-file-url-pO9_rLft.js +23 -0
  249. package/dist/resolve-file-url-pO9_rLft.js.map +1 -0
  250. package/dist/router-Dn35v30f.js +0 -0
  251. package/dist/runtime-ByJtSXs_.js +0 -0
  252. package/dist/section-D6t7tyEZ.js +40 -0
  253. package/dist/section-D6t7tyEZ.js.map +1 -0
  254. package/dist/section-fktaECHL.d.ts +18 -0
  255. package/dist/separator-CuesaLrC.d.ts +8 -0
  256. package/dist/separator-DYAFK-Jj.js +17 -0
  257. package/dist/separator-DYAFK-Jj.js.map +1 -0
  258. package/dist/signals-Bp0bzjE6.js +46 -0
  259. package/dist/signals-Bp0bzjE6.js.map +1 -0
  260. package/dist/signals-DUoWkeZ7.d.ts +20 -0
  261. package/dist/store-Ci6ib2C9.js +14 -0
  262. package/dist/store-Ci6ib2C9.js.map +1 -0
  263. package/dist/text-display-DNMwmGHJ.d.ts +12 -0
  264. package/dist/text-display-Dy6JHB5X.js +19 -0
  265. package/dist/text-display-Dy6JHB5X.js.map +1 -0
  266. package/dist/type-checker-FOYNSGX0.js +84 -0
  267. package/dist/type-checker-FOYNSGX0.js.map +1 -0
  268. package/dist/types-0ADL_reY.d.ts +73 -0
  269. package/dist/types-B5VPP9ig.js +0 -0
  270. package/dist/types-BDwNROY2.d.ts +74 -0
  271. package/dist/types-Bq0EWaM3.js +0 -0
  272. package/dist/types-CJ-XvOFN.d.ts +5 -0
  273. package/dist/types-Cdh4uaFR.js +0 -0
  274. package/dist/types-package-DRhFn59I.js +66 -0
  275. package/dist/types-package-DRhFn59I.js.map +1 -0
  276. package/dist/types.d.ts +33 -13
  277. package/dist/types.js +0 -2
  278. package/dist/utilities-5Jw5BdE1.d.ts +42 -0
  279. package/dist/utils/clone.d.ts +3 -1
  280. package/dist/utils/clone.js +8 -1
  281. package/dist/utils/clone.js.map +1 -1
  282. package/dist/utils/colors.d.ts +5 -3
  283. package/dist/utils/colors.js +4 -2
  284. package/dist/utils/constants.d.ts +2 -15
  285. package/dist/utils/constants.js +7 -2
  286. package/dist/utils/dev-hooks.d.ts +33 -13
  287. package/dist/utils/dev-hooks.js +38 -3
  288. package/dist/utils/error-codes.d.ts +9 -7
  289. package/dist/utils/error-codes.js +6 -2
  290. package/dist/utils/get-paths.d.ts +3 -1
  291. package/dist/utils/get-paths.js +33 -1
  292. package/dist/utils/get-paths.js.map +1 -1
  293. package/dist/utils/resolve-file-url.d.ts +3 -1
  294. package/dist/utils/resolve-file-url.js +3 -2
  295. package/dist/utils/types-package.d.ts +3 -1
  296. package/dist/utils/types-package.js +5 -14
  297. package/dist/utils/utilities.d.ts +2 -40
  298. package/dist/utils/utilities.js +44 -3
  299. package/dist/utils/warn-unstable.d.ts +3 -1
  300. package/dist/utils/warn-unstable.js +4 -2
  301. package/dist/utils-C0V7zD7R.d.ts +10 -0
  302. package/dist/utils-IYtoeTur.js +19 -0
  303. package/dist/utils-IYtoeTur.js.map +1 -0
  304. package/dist/v2-DofkPKHs.js +0 -0
  305. package/dist/version-DnRxh8U8.js +15 -0
  306. package/dist/version-DnRxh8U8.js.map +1 -0
  307. package/dist/version-SMsmj3M1.d.ts +8 -0
  308. package/dist/version.d.ts +2 -6
  309. package/dist/version.js +3 -2
  310. package/dist/warn-unstable-V20WCBDd.js +26 -0
  311. package/dist/warn-unstable-V20WCBDd.js.map +1 -0
  312. package/package.json +5 -4
  313. package/dist/CommandKit-jZCy9fZX.d.ts +0 -914
  314. package/dist/CommandKit.js.map +0 -1
  315. package/dist/app/commands/AppCommandRunner.js.map +0 -1
  316. package/dist/app/commands/Context.js.map +0 -1
  317. package/dist/app/commands/MessageCommandParser.js.map +0 -1
  318. package/dist/app/commands/helpers.js.map +0 -1
  319. package/dist/app/events/EventWorkerContext.js.map +0 -1
  320. package/dist/app/handlers/AppCommandHandler.js.map +0 -1
  321. package/dist/app/handlers/AppEventsHandler.js.map +0 -1
  322. package/dist/app/index.js.map +0 -1
  323. package/dist/app/middleware/signals.js.map +0 -1
  324. package/dist/app/register/CommandRegistrar.js.map +0 -1
  325. package/dist/app/router/CommandsRouter.js.map +0 -1
  326. package/dist/app/router/EventsRouter.js.map +0 -1
  327. package/dist/app/router/index.js.map +0 -1
  328. package/dist/cli/app-process.js.map +0 -1
  329. package/dist/cli/build.js.map +0 -1
  330. package/dist/cli/common.js.map +0 -1
  331. package/dist/cli/env.js.map +0 -1
  332. package/dist/cli/init.js.map +0 -1
  333. package/dist/cli/type-checker.js.map +0 -1
  334. package/dist/cli/utils.js.map +0 -1
  335. package/dist/components/common/EventInterceptor.js.map +0 -1
  336. package/dist/components/common/element.js.map +0 -1
  337. package/dist/components/common/types.js.map +0 -1
  338. package/dist/components/index.js.map +0 -1
  339. package/dist/components/v1/action-row/ActionRow.js.map +0 -1
  340. package/dist/components/v1/button/Button.js.map +0 -1
  341. package/dist/components/v1/button/ButtonKit.js.map +0 -1
  342. package/dist/components/v1/modal/Modal.js.map +0 -1
  343. package/dist/components/v1/modal/ModalKit.js.map +0 -1
  344. package/dist/components/v1/select-menu/ChannelSelectMenuKit.js.map +0 -1
  345. package/dist/components/v1/select-menu/MentionableSelectMenuKit.js.map +0 -1
  346. package/dist/components/v1/select-menu/RoleSelectMenuKit.js.map +0 -1
  347. package/dist/components/v1/select-menu/SelectMenu.js.map +0 -1
  348. package/dist/components/v1/select-menu/StringSelectMenuKit.js.map +0 -1
  349. package/dist/components/v1/select-menu/UserSelectMenuKit.js.map +0 -1
  350. package/dist/components/v1/select-menu/common.js.map +0 -1
  351. package/dist/components/v2/common.js.map +0 -1
  352. package/dist/components/v2/container.js.map +0 -1
  353. package/dist/components/v2/file.js.map +0 -1
  354. package/dist/components/v2/index.js.map +0 -1
  355. package/dist/components/v2/media-gallery.js.map +0 -1
  356. package/dist/components/v2/section.js.map +0 -1
  357. package/dist/components/v2/separator.js.map +0 -1
  358. package/dist/components/v2/text-display.js.map +0 -1
  359. package/dist/config/config.js.map +0 -1
  360. package/dist/config/default.js.map +0 -1
  361. package/dist/config/loader.js.map +0 -1
  362. package/dist/config/types.js.map +0 -1
  363. package/dist/context/async-context.js.map +0 -1
  364. package/dist/context/environment.js.map +0 -1
  365. package/dist/events/CommandKitEventsChannel.js.map +0 -1
  366. package/dist/flags/feature-flags.js.map +0 -1
  367. package/dist/flags/store.js.map +0 -1
  368. package/dist/logger/DefaultLogger.js.map +0 -1
  369. package/dist/logger/ILogger.js.map +0 -1
  370. package/dist/logger/Logger.js.map +0 -1
  371. package/dist/plugins/CompilerPlugin.js.map +0 -1
  372. package/dist/plugins/PluginCommon.js.map +0 -1
  373. package/dist/plugins/RuntimePlugin.js.map +0 -1
  374. package/dist/plugins/index.js.map +0 -1
  375. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js.map +0 -1
  376. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js.map +0 -1
  377. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js.map +0 -1
  378. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js.map +0 -1
  379. package/dist/plugins/plugin-runtime/runtime.js.map +0 -1
  380. package/dist/plugins/plugin-runtime/types.js.map +0 -1
  381. package/dist/plugins/types.js.map +0 -1
  382. package/dist/types.js.map +0 -1
  383. package/dist/utils/colors.js.map +0 -1
  384. package/dist/utils/constants.js.map +0 -1
  385. package/dist/utils/dev-hooks.js.map +0 -1
  386. package/dist/utils/error-codes.js.map +0 -1
  387. package/dist/utils/resolve-file-url.js.map +0 -1
  388. package/dist/utils/types-package.js.map +0 -1
  389. package/dist/utils/utilities.js.map +0 -1
  390. package/dist/utils/warn-unstable.js.map +0 -1
  391. package/dist/version.js.map +0 -1
@@ -0,0 +1,926 @@
1
+ import { EventInterceptor } from "./EventInterceptor-D_oEWSnF.js";
2
+ import { Fragment, createElement } from "./element-D_nyVwgB.js";
3
+ import { MessageCommandOptions, MessageCommandParser } from "./MessageCommandParser-tzroBwij.js";
4
+ import { Command, CommandsRouter, Middleware } from "./CommandsRouter-C7X-eXE2.js";
5
+ import { EventsRouter, ParsedEvent } from "./EventsRouter-BacqK6z3.js";
6
+ import { HMREventType } from "./constants-Ce6w4OFe.js";
7
+ import * as discord_js0 from "discord.js";
8
+ import { AutocompleteInteraction, Awaitable, CacheType, ChatInputCommandInteraction, Client, ClientEvents, Collection, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Guild, Interaction, Locale, Message, MessageContextMenuCommandInteraction, RESTPostAPIApplicationCommandsJSONBody, SlashCommandBuilder, TextBasedChannel, UserContextMenuCommandInteraction } from "discord.js";
9
+ import EventEmitter from "node:events";
10
+ import { DirectiveTransformerOptions } from "directive-to-hof";
11
+
12
+ //#region src/types.d.ts
13
+ /**
14
+ * Options for instantiating a CommandKit handler.
15
+ */
16
+ interface CommandKitOptions {
17
+ /**
18
+ * The Discord.js client object to use with CommandKit.
19
+ */
20
+ client: Client;
21
+ }
22
+ /**
23
+ * Represents a command context.
24
+ */
25
+ interface CommandContext<T extends Interaction, Cached extends CacheType> {
26
+ /**
27
+ * The interaction that triggered this command.
28
+ */
29
+ interaction: Interaction<CacheType>;
30
+ /**
31
+ * The client that instantiated this command.
32
+ */
33
+ client: Client;
34
+ /**
35
+ * The command data.
36
+ */
37
+ handler: CommandKit;
38
+ }
39
+ type CommandData = RESTPostAPIApplicationCommandsJSONBody & {
40
+ guilds?: string[];
41
+ };
42
+ //#endregion
43
+ //#region src/context/async-context.d.ts
44
+ type GenericFunction<A extends any[] = any[]> = (...args: A) => any;
45
+ declare function isCommandWorkerContext(worker: any): worker is CommandKitEnvironment;
46
+ /**
47
+ * Represents an async function that can be cached
48
+ * @template R - Array of argument types
49
+ * @template T - Return type
50
+ */
51
+ type AsyncFunction<R extends any[] = any[], T = any> = (...args: R) => Promise<T>;
52
+ declare function exitContext<T>(fn: () => T): T;
53
+ declare function provideContext<R>(value: CommandKitEnvironment, receiver: () => R): R;
54
+ /**
55
+ * Returns a context-aware version of the given function.
56
+ * @param env - The commandkit environment data.
57
+ * @param fn - The target function.
58
+ * @param finalizer - An optional finalizer function to run after the target function. This function will be context-aware.
59
+ * @internal
60
+ */
61
+ declare function makeContextAwareFunction<R extends GenericFunction, F extends GenericFunction>(env: CommandKitEnvironment, fn: R, finalizer?: F): R;
62
+ /**
63
+ * Retrieves commandkit
64
+ * @private
65
+ * @internal
66
+ */
67
+ declare function getCommandKit(): CommandKit | undefined;
68
+ declare function getCommandKit(strict: true): CommandKit;
69
+ declare function getCommandKit(strict: false): CommandKit | undefined;
70
+ /**
71
+ * Get the current commandkit context.
72
+ * @internal
73
+ */
74
+ declare function getContext(): CommandKitEnvironment | undefined;
75
+ /**
76
+ * Use current commandkit context. Throws an error if no context is found.
77
+ */
78
+ declare function useEnvironment(): CommandKitEnvironment;
79
+ //#endregion
80
+ //#region src/app/register/CommandRegistrar.d.ts
81
+ interface PreRegisterCommandsEvent {
82
+ preventDefault(): void;
83
+ commands: CommandData[];
84
+ }
85
+ declare class CommandRegistrar {
86
+ readonly commandkit: CommandKit;
87
+ private api;
88
+ /**
89
+ * Creates an instance of CommandRegistrar.
90
+ * @param commandkit The commandkit instance.
91
+ */
92
+ constructor(commandkit: CommandKit);
93
+ /**
94
+ * Gets the commands data.
95
+ */
96
+ getCommandsData(): CommandData[];
97
+ /**
98
+ * Registers loaded commands.
99
+ */
100
+ register(): Promise<void>;
101
+ /**
102
+ * Updates the global commands.
103
+ */
104
+ updateGlobalCommands(commands: CommandData[]): Promise<void>;
105
+ /**
106
+ * Updates the guild commands.
107
+ */
108
+ updateGuildCommands(commands: CommandData[]): Promise<void>;
109
+ }
110
+ //#endregion
111
+ //#region src/context/environment.d.ts
112
+ interface CommandKitEnvironmentInternalData {
113
+ executionError: Error | null;
114
+ type: CommandKitEnvironmentType | null;
115
+ variables: Map<string, any>;
116
+ deferredFunctions: Map<string, GenericFunction<[CommandKitEnvironment]>>;
117
+ marker: string;
118
+ markStart: number;
119
+ markEnd: number;
120
+ context: Context | null;
121
+ }
122
+ declare class CommandKitEnvironment {
123
+ #private;
124
+ readonly commandkit: CommandKit;
125
+ /**
126
+ * Creates the commandkit execution environment.
127
+ * @param commandkit - The commandkit instance.
128
+ */
129
+ constructor(commandkit: CommandKit);
130
+ /**
131
+ * Set the context.
132
+ * @param context - The context to set.
133
+ */
134
+ setContext(context: Context): void;
135
+ /**
136
+ * Get the context. `null` if not set.
137
+ * @internal
138
+ */
139
+ get context(): Context | null;
140
+ /**
141
+ * Get the execution error.
142
+ * @internal
143
+ */
144
+ getExecutionError(): Error | null;
145
+ /**
146
+ * Set the execution error.
147
+ * @param error - The error to set.
148
+ * @internal
149
+ */
150
+ setExecutionError(error: Error): void;
151
+ /**
152
+ * Get the environment type.
153
+ */
154
+ getType(): CommandKitEnvironmentType;
155
+ /**
156
+ * Set the environment type.
157
+ * @param type - The environment type to set.
158
+ * @internal
159
+ */
160
+ setType(type: CommandKitEnvironmentType): void;
161
+ /**
162
+ * The variables store for this environment.
163
+ */
164
+ get variables(): Map<string, any>;
165
+ /**
166
+ * Register a deferred function.
167
+ * @param fn - The deferred function to register.
168
+ * @returns The deferred function id.
169
+ * @internal
170
+ */
171
+ registerDeferredFunction(fn: GenericFunction<[CommandKitEnvironment]>): string;
172
+ /**
173
+ * Clear a deferred function by id.
174
+ * @param id - The deferred function id to clear.
175
+ * @internal
176
+ */
177
+ clearDeferredFunction(id: string): void;
178
+ /**
179
+ * Run all deferred functions sequentially.
180
+ * @internal
181
+ */
182
+ runDeferredFunctions(): Promise<void>;
183
+ /**
184
+ * Clear all deferred functions.
185
+ * @internal
186
+ */
187
+ clearAllDeferredFunctions(): void;
188
+ /**
189
+ * Mark the start of a command execution.
190
+ * @param marker - The marker to set.
191
+ * @internal
192
+ */
193
+ markStart(marker: string): void;
194
+ /**
195
+ * Mark the end of a command execution.
196
+ * @internal
197
+ */
198
+ markEnd(): void;
199
+ /**
200
+ * Get the marker.
201
+ * @internal
202
+ */
203
+ getMarker(): string;
204
+ /**
205
+ * Get the execution time in milliseconds.
206
+ * @internal
207
+ */
208
+ getExecutionTime(): number;
209
+ }
210
+ declare enum CommandKitEnvironmentType {
211
+ CommandHandler = "COMMAND_HANDLER",
212
+ }
213
+ /**
214
+ * Runs the given function after the current command has finished executing.
215
+ * @param fn The function to run after the current command.
216
+ * @returns The deferred function id. This can be used to cancel the deferred function.
217
+ */
218
+ declare function after(fn: GenericFunction<[CommandKitEnvironment]>): string;
219
+ /**
220
+ * Cancels a deferred function registered with `after`.
221
+ * @param id The deferred function id to cancel.
222
+ */
223
+ declare function cancelAfter(id: string): void;
224
+ //#endregion
225
+ //#region src/app/commands/Context.d.ts
226
+ declare const CommandExecutionMode: {
227
+ readonly ChatInputCommand: "chatInput";
228
+ readonly MessageContextMenu: "messageContextMenu";
229
+ readonly UserContextMenu: "userContextMenu";
230
+ readonly Autocomplete: "autocomplete";
231
+ readonly Message: "message";
232
+ };
233
+ type CommandExecutionMode = (typeof CommandExecutionMode)[keyof typeof CommandExecutionMode];
234
+ interface ContextParameters<T extends CommandExecutionMode, Args = Record<string, any>> {
235
+ command: LoadedCommand;
236
+ environment?: CommandKitEnvironment;
237
+ executionMode: T;
238
+ interaction: T extends 'chatInput' ? ChatInputCommandInteraction : T extends 'messageContextMenu' ? MessageContextMenuCommandInteraction : T extends 'userContextMenu' ? UserContextMenuCommandInteraction : T extends 'autocomplete' ? AutocompleteInteraction : never;
239
+ message: T extends 'message' ? Message : never;
240
+ forwarded?: boolean;
241
+ messageCommandParser?: T extends 'message' ? MessageCommandParser : never;
242
+ store?: Map<string, any>;
243
+ customArgs?: Args;
244
+ }
245
+ type MessageCommandContext = Context<'message'>;
246
+ type InteractionCommandContext = Context<'autocomplete' | 'chatInput' | 'messageContextMenu' | 'userContextMenu'>;
247
+ type MessageCommandMiddlewareContext = MiddlewareContext<'message'>;
248
+ type InteractionCommandMiddlewareContext = MiddlewareContext<'autocomplete' | 'chatInput' | 'messageContextMenu' | 'userContextMenu'>;
249
+ type ChatInputCommandContext = Context<'chatInput'>;
250
+ type SlashCommandMiddlewareContext = MiddlewareContext<'chatInput'>;
251
+ type AutocompleteCommandContext = Context<'autocomplete'>;
252
+ type AutocompleteCommandMiddlewareContext = MiddlewareContext<'autocomplete'>;
253
+ type MessageContextMenuCommandContext = Context<'messageContextMenu'>;
254
+ type MessageContextMenuCommandMiddlewareContext = MiddlewareContext<'messageContextMenu'>;
255
+ type UserContextMenuCommandContext = Context<'userContextMenu'>;
256
+ type UserContextMenuCommandMiddlewareContext = MiddlewareContext<'userContextMenu'>;
257
+ type CommandContextOptions<T extends CommandExecutionMode> = T extends 'message' ? MessageCommandOptions : T extends 'chatInput' ? ChatInputCommandInteraction['options'] : T extends 'autocomplete' ? AutocompleteInteraction['options'] : T extends 'messageContextMenu' ? MessageContextMenuCommandInteraction['options'] : T extends 'userContextMenu' ? UserContextMenuCommandInteraction['options'] : never;
258
+ type AnyCommandExecute<ContextType extends Context = Context> = (ctx: ContextType) => Awaitable<unknown>;
259
+ type ChatInputCommand = AnyCommandExecute<ChatInputCommandContext>;
260
+ type AutocompleteCommand = AnyCommandExecute<AutocompleteCommandContext>;
261
+ type MessageContextMenuCommand = AnyCommandExecute<MessageContextMenuCommandContext>;
262
+ type UserContextMenuCommand = AnyCommandExecute<UserContextMenuCommandContext>;
263
+ type MessageCommand = AnyCommandExecute<MessageCommandContext>;
264
+ interface MiddlewareContextArgs {
265
+ setCommandRunner?: GenericFunction<[RunCommand]>;
266
+ }
267
+ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecutionMode, Args extends Record<string, any> = Record<string, any>> {
268
+ #private;
269
+ readonly commandkit: CommandKit;
270
+ protected readonly config: ContextParameters<ExecutionMode, Args>;
271
+ /**
272
+ * The interaction that triggered the command.
273
+ */
274
+ readonly interaction: ContextParameters<ExecutionMode>['interaction'];
275
+ /**
276
+ * The message that triggered the command.
277
+ */
278
+ readonly message: ContextParameters<ExecutionMode>['message'];
279
+ /**
280
+ * The guild where the command was triggered.
281
+ */
282
+ readonly guild: Guild | null;
283
+ /**
284
+ * The guild ID where the command was triggered.
285
+ */
286
+ readonly guildId: string | null;
287
+ /**
288
+ * The channel where the command was triggered.
289
+ */
290
+ readonly channel: TextBasedChannel | null;
291
+ /**
292
+ * The channel id where the command was triggered.
293
+ */
294
+ readonly channelId: string | null;
295
+ /**
296
+ * The client instance.
297
+ */
298
+ readonly client: Client;
299
+ /**
300
+ * The command that this context belongs to.
301
+ */
302
+ readonly command: LoadedCommand;
303
+ private _locale;
304
+ /**
305
+ * Creates a new command context.
306
+ * @param commandkit The command kit instance.
307
+ * @param config The context parameters.
308
+ */
309
+ constructor(commandkit: CommandKit, config: ContextParameters<ExecutionMode, Args>);
310
+ /**
311
+ * The shared key-value store for this context. This can be used to store data that needs to be shared between middlewares or commands.
312
+ * This store is shared across all contexts in the same command execution, including the cloned contexts and middleware contexts.
313
+ */
314
+ get store(): Map<string, any>;
315
+ get commandName(): string;
316
+ get options(): CommandContextOptions<ExecutionMode>;
317
+ /**
318
+ * Whether this context was forwarded from another context. This happens when a command forwards its context to another command.
319
+ */
320
+ get forwarded(): boolean;
321
+ /**
322
+ * Forwards the context to another command. The target handler will be the same as current handler.
323
+ * @param command The command to forward to.
324
+ */
325
+ forwardCommand<C extends ResolvableCommand>(command: C): Promise<never>;
326
+ /**
327
+ * The execution mode of the command.
328
+ */
329
+ get executionMode(): ExecutionMode;
330
+ /**
331
+ * Whether the command was triggered by an interaction.
332
+ */
333
+ isInteraction(): this is InteractionCommandContext;
334
+ /**
335
+ * Whether the command was triggered by a slash command interaction.
336
+ */
337
+ isChatInputCommand(): this is ChatInputCommandContext;
338
+ /**
339
+ * Whether the command was triggered by an autocomplete interaction.
340
+ */
341
+ isAutocomplete(): this is AutocompleteCommandContext;
342
+ /**
343
+ * Whether the command was triggered by a message context menu interaction.
344
+ */
345
+ isMessageContextMenu(): this is MessageContextMenuCommandContext;
346
+ /**
347
+ * Whether the command was triggered by a user context menu interaction.
348
+ */
349
+ isUserContextMenu(): this is UserContextMenuCommandContext;
350
+ /**
351
+ * Whether the command was triggered by a message.
352
+ */
353
+ isMessage(): this is Context<'message'>;
354
+ /**
355
+ * Returns the command identifier.
356
+ */
357
+ getCommandIdentifier(): string;
358
+ /**
359
+ * Returns the locale of the guild where this command was triggered.
360
+ */
361
+ getGuildLocale(): Locale | null;
362
+ /**
363
+ * Returns the locale of the user who triggered this command.
364
+ */
365
+ getUserLocale(): Locale | null;
366
+ /**
367
+ * Returns the locale for this command.
368
+ * @param preferUser Whether to prefer the user's locale over the guild's locale.
369
+ * @returns The locale for this command. If no locale is found, the default locale is returned.
370
+ */
371
+ getLocale(preferUser?: boolean): Locale;
372
+ /**
373
+ * Sets the locale for this command.
374
+ * @param locale The locale to set.
375
+ */
376
+ setLocale(locale: Locale | null): void;
377
+ /**
378
+ * Creates a clone of this context
379
+ */
380
+ clone(config?: Partial<ContextParameters<ExecutionMode>>): Context<ExecutionMode>;
381
+ isMiddleware(): this is MiddlewareContext<ExecutionMode>;
382
+ args(): string[];
383
+ /**
384
+ * Stops upcoming middleware or current command execution.
385
+ * If this is called inside pre-stage middleware, the next run will be the actual command, skipping all other pre-stage middlewares.
386
+ * If this is called inside a command itself, it will skip all post-stage middlewares.
387
+ * If this is called inside post-stage middleware, it will skip all other post-stage middlewares.
388
+ */
389
+ exit(): never;
390
+ }
391
+ declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutionMode> extends Context<T, MiddlewareContextArgs> {
392
+ #private;
393
+ /**
394
+ * Whether the command execution was cancelled.
395
+ */
396
+ get cancelled(): boolean;
397
+ /**
398
+ * Cancels the command execution.
399
+ */
400
+ cancel(): void;
401
+ /**
402
+ * Sets command runner function to wrap the command execution.
403
+ * @param fn The function to set.
404
+ * @example ctx.setCommandRunner(async (execute) => {
405
+ * // do something before command execution
406
+ * await execute();
407
+ * // do something after command execution
408
+ * })
409
+ */
410
+ setCommandRunner(fn: RunCommand): void;
411
+ }
412
+ //#endregion
413
+ //#region src/app/commands/AppCommandRunner.d.ts
414
+ declare class AppCommandRunner {
415
+ #private;
416
+ private handler;
417
+ constructor(handler: AppCommandHandler);
418
+ runCommand(prepared: PreparedAppCommandExecution, source: Interaction | Message): Promise<void>;
419
+ getExecutionMode(source: Interaction | Message): CommandExecutionMode;
420
+ }
421
+ //#endregion
422
+ //#region src/app/handlers/AppCommandHandler.d.ts
423
+ type RunCommand = <T extends AsyncFunction>(fn: T) => T;
424
+ interface AppCommand {
425
+ command: SlashCommandBuilder | Record<string, any>;
426
+ chatInput?: (ctx: Context) => Awaitable<unknown>;
427
+ autocomplete?: (ctx: Context) => Awaitable<unknown>;
428
+ message?: (ctx: Context) => Awaitable<unknown>;
429
+ messageContextMenu?: (ctx: Context) => Awaitable<unknown>;
430
+ userContextMenu?: (ctx: Context) => Awaitable<unknown>;
431
+ }
432
+ interface AppCommandMiddleware {
433
+ beforeExecute: (ctx: Context) => Awaitable<unknown>;
434
+ afterExecute: (ctx: Context) => Awaitable<unknown>;
435
+ }
436
+ interface LoadedCommand {
437
+ command: Command;
438
+ data: AppCommand;
439
+ guilds?: string[];
440
+ }
441
+ type CommandTypeData = string;
442
+ type ResolvableCommand = CommandTypeData | (string & {});
443
+ interface LoadedMiddleware {
444
+ middleware: Middleware;
445
+ data: AppCommandMiddleware;
446
+ }
447
+ interface PreparedAppCommandExecution {
448
+ command: LoadedCommand;
449
+ middlewares: LoadedMiddleware[];
450
+ messageCommandParser?: MessageCommandParser;
451
+ }
452
+ type CommandBuilderLike = SlashCommandBuilder | ContextMenuCommandBuilder | Record<string, any>;
453
+ declare class AppCommandHandler {
454
+ readonly commandkit: CommandKit;
455
+ private loadedCommands;
456
+ private loadedMiddlewares;
457
+ private commandNameToId;
458
+ private subcommandPathToId;
459
+ readonly registrar: CommandRegistrar;
460
+ private onInteraction;
461
+ private onMessageCreate;
462
+ readonly commandRunner: AppCommandRunner;
463
+ readonly externalCommandData: Collection<string, Command>;
464
+ readonly externalMiddlewareData: Collection<string, Middleware>;
465
+ constructor(commandkit: CommandKit);
466
+ printBanner(): void;
467
+ getCommandsArray(): LoadedCommand[];
468
+ registerCommandHandler(): void;
469
+ prepareCommandRun(source: Interaction | Message, cmdName?: string): Promise<PreparedAppCommandExecution | null>;
470
+ reloadCommands(): Promise<void>;
471
+ addExternalMiddleware(data: Middleware[]): Promise<void>;
472
+ addExternalCommands(data: Command[]): Promise<void>;
473
+ registerExternalLoadedMiddleware(data: LoadedMiddleware[]): Promise<void>;
474
+ registerExternalLoadedCommands(data: LoadedCommand[]): Promise<void>;
475
+ loadCommands(): Promise<void>;
476
+ private loadMiddleware;
477
+ private loadCommand;
478
+ }
479
+ //#endregion
480
+ //#region src/events/CommandKitEventsChannel.d.ts
481
+ type ListenerFunction = GenericFunction | AsyncFunction;
482
+ declare class CommandKitEventsChannel {
483
+ readonly commandkit: CommandKit;
484
+ private emitter;
485
+ constructor(commandkit: CommandKit);
486
+ to(namespace: string): {
487
+ on: (event: string, listener: ListenerFunction) => void;
488
+ off: (event: string, listener: ListenerFunction) => void;
489
+ once: (event: string, listener: ListenerFunction) => void;
490
+ emit: (event: string, ...args: any[]) => boolean;
491
+ removeAllListeners: (event: string) => void;
492
+ };
493
+ on(namespace: string, event: string, listener: ListenerFunction): void;
494
+ off(namespace: string, event: string, listener: ListenerFunction): void;
495
+ once(namespace: string, event: string, listener: ListenerFunction): void;
496
+ emit(namespace: string, event: string, ...args: any[]): boolean;
497
+ removeAllListeners(namespace: string): void;
498
+ removeAllListeners(namespace: string, event: string): void;
499
+ }
500
+ //#endregion
501
+ //#region src/app/handlers/AppEventsHandler.d.ts
502
+ type EventListener = {
503
+ handler: ListenerFunction;
504
+ once: boolean;
505
+ };
506
+ interface LoadedEvent {
507
+ name: string;
508
+ namespace: string | null;
509
+ event: ParsedEvent;
510
+ listeners: EventListener[];
511
+ mainListener?: EventListener;
512
+ executedOnceListeners?: Set<ListenerFunction>;
513
+ }
514
+ interface AppEventsHandlerLoadedData {
515
+ name: string;
516
+ namespace: string | null;
517
+ onceListeners: number;
518
+ regularListeners: number;
519
+ metadata: ParsedEvent;
520
+ }
521
+ declare class AppEventsHandler {
522
+ readonly commandkit: CommandKit;
523
+ private loadedEvents;
524
+ constructor(commandkit: CommandKit);
525
+ getEvents(): AppEventsHandlerLoadedData[];
526
+ reloadEvents(): Promise<void>;
527
+ loadEvents(): Promise<void>;
528
+ unregisterAll(): void;
529
+ registerAllClientEvents(): void;
530
+ unregisterAllClientListeners(): void;
531
+ }
532
+ //#endregion
533
+ //#region src/utils/dev-hooks.d.ts
534
+ interface CommandKitHMREvent {
535
+ event: HMREventType;
536
+ path: string;
537
+ accept: () => void;
538
+ preventDefault: () => void;
539
+ }
540
+ declare function registerDevHooks(commandkit: CommandKit): void;
541
+ //#endregion
542
+ //#region src/plugins/RuntimePlugin.d.ts
543
+ declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CommandKitPluginRuntime> {
544
+ readonly type = PluginType.Runtime;
545
+ /**
546
+ * Called before commands are loaded
547
+ */
548
+ onBeforeCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
549
+ /**
550
+ * Called after commands are loaded
551
+ */
552
+ onAfterCommandsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
553
+ /**
554
+ * Called before events are loaded
555
+ */
556
+ onBeforeEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
557
+ /**
558
+ * Called after events are loaded
559
+ */
560
+ onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void>;
561
+ /**
562
+ * Called before the client logs in
563
+ */
564
+ onBeforeClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
565
+ /**
566
+ * Called after the client logs in
567
+ */
568
+ onAfterClientLogin(ctx: CommandKitPluginRuntime): Promise<void>;
569
+ /**
570
+ * Called before interaction is handled
571
+ * @param interaction The interaction
572
+ */
573
+ onBeforeInteraction(ctx: CommandKitPluginRuntime, interaction: Interaction): Promise<void>;
574
+ /**
575
+ * Called before message command is processed
576
+ * @param message The message
577
+ */
578
+ onBeforeMessageCommand(ctx: CommandKitPluginRuntime, message: Message): Promise<void>;
579
+ /**
580
+ * Called before command is executed. This method can execute the command itself.
581
+ * @param source The source that triggered the command
582
+ * @param command The command
583
+ * @param execute The function that executes the command
584
+ */
585
+ executeCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment, source: Interaction | Message, command: PreparedAppCommandExecution, execute: () => Promise<any>): Promise<boolean>;
586
+ /**
587
+ * Called after events router is initialized
588
+ * @param ctx The context
589
+ */
590
+ onEventsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
591
+ /**
592
+ * Called after commands router is initialized
593
+ * @param ctx The context
594
+ */
595
+ onCommandsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
596
+ /**
597
+ * Called when HMR event is received
598
+ * @param ctx The context
599
+ * @param event The event
600
+ */
601
+ performHMR(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent): Promise<void>;
602
+ /**
603
+ * Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.
604
+ * @param ctx The context
605
+ * @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command
606
+ */
607
+ prepareCommand(ctx: CommandKitPluginRuntime, commands: CommandBuilderLike): Promise<CommandBuilderLike | null>;
608
+ /**
609
+ * Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.
610
+ * @param ctx The context
611
+ * @param data The command registration data
612
+ */
613
+ onBeforeRegisterCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
614
+ /**
615
+ * Called before global commands registration. This method can cancel the registration of the command and handle it manually.
616
+ * This method is called after `onBeforeRegisterCommands` if that stage was not handled.
617
+ * @param ctx The context
618
+ * @param event The command registration data
619
+ */
620
+ onBeforeRegisterGlobalCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
621
+ /**
622
+ * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
623
+ * This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.
624
+ * @param ctx The context
625
+ * @param event The command registration data
626
+ */
627
+ onBeforePrepareGuildCommandsRegistration(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
628
+ /**
629
+ * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
630
+ * This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.
631
+ * @param ctx The context
632
+ * @param event The command registration data
633
+ */
634
+ onBeforeRegisterGuildCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent): Promise<void>;
635
+ /**
636
+ * Called after command and all of its deferred functions are executed.
637
+ * @param ctx The context
638
+ * @param env The environment of the command. This environment contains the command execution data such as command context and more.
639
+ */
640
+ onAfterCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment): Promise<void>;
641
+ /**
642
+ * Called before emitting an event
643
+ * @param ctx The context
644
+ * @param event The event that is being emitted
645
+ */
646
+ willEmitEvent(ctx: CommandKitPluginRuntime, event: CommandKitEventDispatch): Promise<void>;
647
+ }
648
+ declare function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin;
649
+ //#endregion
650
+ //#region src/plugins/types.d.ts
651
+ type CommandKitPlugin = RuntimePlugin | CompilerPlugin;
652
+ type MaybeFalsey<T> = T | false | null | undefined;
653
+ interface CommandKitEventDispatch {
654
+ name: string;
655
+ args: unknown[];
656
+ namespace: string | null;
657
+ once: boolean;
658
+ metadata: ParsedEvent;
659
+ accept(): void;
660
+ }
661
+ //#endregion
662
+ //#region src/plugins/CompilerPlugin.d.ts
663
+ interface PluginTransformParameters {
664
+ code: string;
665
+ id: string;
666
+ }
667
+ interface TransformedResult {
668
+ code?: string;
669
+ map?: string | null;
670
+ }
671
+ declare abstract class CompilerPlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CompilerPluginRuntime> {
672
+ readonly type = PluginType.Compiler;
673
+ /**
674
+ * Called when transformation is requested to this plugin
675
+ * @param params The parameters for the transformation
676
+ * @returns The transformed result
677
+ */
678
+ transform(params: PluginTransformParameters): Promise<MaybeFalsey<TransformedResult>>;
679
+ }
680
+ declare function isCompilerPlugin(plugin: unknown): plugin is CompilerPlugin;
681
+ //#endregion
682
+ //#region src/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts
683
+ type CommonDirectiveTransformerOptions = DirectiveTransformerOptions & {
684
+ enabled?: boolean;
685
+ };
686
+ declare abstract class CommonDirectiveTransformer extends CompilerPlugin<CommonDirectiveTransformerOptions> {
687
+ private transformer;
688
+ activate(ctx: CompilerPluginRuntime): Promise<void>;
689
+ deactivate(ctx: CompilerPluginRuntime): Promise<void>;
690
+ transform(params: PluginTransformParameters): Promise<MaybeFalsey<TransformedResult>>;
691
+ }
692
+ //#endregion
693
+ //#region src/plugins/plugin-runtime/CompilerPluginRuntime.d.ts
694
+ declare class CompilerPluginRuntime {
695
+ private readonly plugins;
696
+ readonly name = "CompilerPluginRuntime";
697
+ private initialized;
698
+ constructor(plugins: CompilerPlugin[]);
699
+ getPlugins(): CompilerPlugin<PluginOptions>[];
700
+ isEmpty(): boolean;
701
+ transform(code: string, id: string): Promise<{
702
+ code: string;
703
+ map: string | null;
704
+ }>;
705
+ init(): Promise<void>;
706
+ destroy(): Promise<void>;
707
+ toJSON(): {
708
+ name: string;
709
+ transform: (code: string, id: string) => Promise<{
710
+ code: string;
711
+ map: string | null;
712
+ }>;
713
+ };
714
+ }
715
+ //#endregion
716
+ //#region src/plugins/plugin-runtime/runtime.d.ts
717
+ type CommonPluginRuntime = CommandKitPluginRuntime | CompilerPluginRuntime;
718
+ //#endregion
719
+ //#region src/plugins/PluginCommon.d.ts
720
+ type PluginOptions = Record<string, any>;
721
+ declare enum PluginType {
722
+ Compiler = "compiler",
723
+ Runtime = "runtime",
724
+ }
725
+ declare abstract class PluginCommon<T extends PluginOptions = PluginOptions, C extends CommonPluginRuntime = CommonPluginRuntime> {
726
+ protected readonly options: T;
727
+ abstract readonly type: PluginType;
728
+ readonly id: `${string}-${string}-${string}-${string}-${string}`;
729
+ readonly loadedAt: number;
730
+ abstract readonly name: string;
731
+ constructor(options: T);
732
+ /**
733
+ * Called when this plugin is activated
734
+ */
735
+ activate(ctx: C): Promise<void>;
736
+ /**
737
+ * Called when this plugin is deactivated
738
+ */
739
+ deactivate(ctx: C): Promise<void>;
740
+ }
741
+ declare function isPlugin(plugin: unknown): plugin is PluginCommon<PluginOptions>;
742
+ //#endregion
743
+ //#region src/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts
744
+ declare class CommandKitPluginRuntime {
745
+ readonly commandkit: CommandKit;
746
+ private plugins;
747
+ constructor(commandkit: CommandKit);
748
+ getPlugins(): Collection<string, RuntimePlugin<PluginOptions>>;
749
+ getPlugin(pluginName: string): RuntimePlugin | null;
750
+ softRegisterPlugin(plugin: RuntimePlugin): Promise<void>;
751
+ registerPlugin(plugin: RuntimePlugin): Promise<void>;
752
+ unregisterPlugin(plugin: RuntimePlugin): Promise<void>;
753
+ unregisterAllPlugins(): Promise<void>;
754
+ capture(): void;
755
+ execute<R = any>(f: AsyncFunction<[CommandKitPluginRuntime, RuntimePlugin], R | undefined>): Promise<true | R | undefined>;
756
+ }
757
+ //#endregion
758
+ //#region src/flags/feature-flags.d.ts
759
+ type MaybePromise<T> = T | Promise<T>;
760
+ type IdentifyFunction<R> = (context: EvaluationContext) => MaybePromise<R>;
761
+ type DecideFunction<E, R> = (data: {
762
+ entities: E;
763
+ }) => MaybePromise<R>;
764
+ interface FeatureFlagDefinition<R, Entity> {
765
+ key: string;
766
+ description?: string;
767
+ identify?: IdentifyFunction<Entity>;
768
+ decide: DecideFunction<Entity, R>;
769
+ }
770
+ interface CommandFlagContext {
771
+ client: Client<true>;
772
+ commandkit: CommandKit;
773
+ command: {
774
+ interaction?: ChatInputCommandInteraction | AutocompleteInteraction | ContextMenuCommandInteraction;
775
+ message?: Message;
776
+ guild: Guild | null;
777
+ channel: TextBasedChannel | null;
778
+ command: LoadedCommand;
779
+ };
780
+ event: null;
781
+ }
782
+ interface EventFlagContext {
783
+ client: Client<true>;
784
+ commandkit: CommandKit;
785
+ event: {
786
+ data: ParsedEvent;
787
+ event: string;
788
+ namespace: string | null;
789
+ arguments: any[];
790
+ argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];
791
+ };
792
+ command: null;
793
+ }
794
+ type EvaluationContext = CommandFlagContext | EventFlagContext;
795
+ type CustomEvaluationFunction<E> = () => MaybePromise<E>;
796
+ type CustomEvaluationContext<E> = {
797
+ identify: E | CustomEvaluationFunction<E>;
798
+ };
799
+ interface FlagRunner<E, R> {
800
+ (): Promise<R>;
801
+ run(context: CustomEvaluationContext<E>): Promise<R>;
802
+ }
803
+ declare class FeatureFlag<R, T> {
804
+ readonly options: FeatureFlagDefinition<R, T>;
805
+ constructor(options: FeatureFlagDefinition<R, T>);
806
+ private getContext;
807
+ execute(res?: T): Promise<R>;
808
+ }
809
+ declare function flag<Returns = boolean, Entity = Record<any, any>>(options: FeatureFlagDefinition<Returns, Entity>): FlagRunner<Entity, Returns>;
810
+ //#endregion
811
+ //#region src/flags/store.d.ts
812
+ declare class FlagStore extends Collection<string, FeatureFlag<any, any>> {}
813
+ //#endregion
814
+ //#region src/CommandKit.d.ts
815
+ interface CommandKitConfiguration {
816
+ defaultLocale: Locale;
817
+ getMessageCommandPrefix: (message: Message) => Awaitable<string | string[]>;
818
+ }
819
+ declare let commandkit: CommandKit;
820
+ type BootstrapFunction = GenericFunction<[CommandKit]> | AsyncFunction<[CommandKit]>;
821
+ /**
822
+ * Registers a bootstrap hook that will be called when the CommandKit instance is created.
823
+ * This is useful for plugins that need to run some code after the CommandKit instance is fully initialized.
824
+ * Note that not all commandkit dependiencs are available at this point. It is recommended to use the `onApplicationBootstrap` hook instead,
825
+ * if you need access to the commandkit dependencies.
826
+ * @param fn The bootstrap function to register.
827
+ * @example ```ts
828
+ * import { onBootstrap } from 'commandkit';
829
+ *
830
+ * onBootstrap(async (commandkit) => {
831
+ * // Do something with the commandkit instance
832
+ * })
833
+ * ```
834
+ */
835
+ declare function onBootstrap<F extends BootstrapFunction>(fn: F): void;
836
+ /**
837
+ * Registers a bootstrap hook that will be called when the CommandKit instance is created.
838
+ * This is useful for plugins that need to run some code after the CommandKit instance is fully initialized.
839
+ * @param fn The bootstrap function to register.
840
+ * @example ```ts
841
+ * import { onApplicationBootstrap } from 'commandkit';
842
+ *
843
+ * onApplicationBootstrap(async (commandkit) => {
844
+ * // Do something with the commandkit instance
845
+ * })
846
+ * ```
847
+ */
848
+ declare function onApplicationBootstrap<F extends BootstrapFunction>(fn: F): void;
849
+ declare class CommandKit extends EventEmitter {
850
+ #private;
851
+ private options;
852
+ eventInterceptor: EventInterceptor;
853
+ static readonly createElement: typeof createElement;
854
+ static readonly Fragment: typeof Fragment;
855
+ readonly config: CommandKitConfiguration;
856
+ readonly store: Map<string, any>;
857
+ readonly flags: FlagStore;
858
+ commandsRouter: CommandsRouter;
859
+ eventsRouter: EventsRouter;
860
+ commandHandler: AppCommandHandler;
861
+ eventHandler: AppEventsHandler;
862
+ plugins: CommandKitPluginRuntime;
863
+ events: CommandKitEventsChannel;
864
+ static instance: CommandKit | undefined;
865
+ /**
866
+ * Create a new command and event handler with CommandKit.
867
+ *
868
+ * @param options - The default CommandKit configuration.
869
+ * @see {@link https://commandkit.js.org/docs/guide/commandkit-setup}
870
+ */
871
+ constructor(options: CommandKitOptions);
872
+ /**
873
+ * Starts the commandkit application.
874
+ * @param token The application token to connect to the discord gateway. If not provided, it will use the `TOKEN` or `DISCORD_TOKEN` environment variable. If set to `false`, it will not login.
875
+ */
876
+ start(token?: string | false): Promise<void>;
877
+ /**
878
+ * Loads all the plugins.
879
+ */
880
+ loadPlugins(): Promise<void>;
881
+ /**
882
+ * Whether or not the commandkit application has started.
883
+ */
884
+ get started(): boolean;
885
+ /**
886
+ * Sets the prefix resolver for the command handler.
887
+ * @param resolver The resolver function.
888
+ */
889
+ setPrefixResolver(resolver: (message: Message) => Awaitable<string | string[]>): this;
890
+ /**
891
+ * Sets the default locale for the command handler.
892
+ * @param locale The default locale.
893
+ */
894
+ setDefaultLocale(locale: Locale): this;
895
+ /**
896
+ * Get the client attached to this CommandKit instance.
897
+ */
898
+ get client(): discord_js0.Client<boolean>;
899
+ /**
900
+ * Updates application commands with the latest from "commandsPath".
901
+ */
902
+ reloadCommands(): Promise<void>;
903
+ /**
904
+ * Updates application events with the latest from "eventsPath".
905
+ */
906
+ reloadEvents(): Promise<void>;
907
+ /**
908
+ * Increment the client listeners count.
909
+ */
910
+ incrementClientListenersCount(): void;
911
+ /**
912
+ * Decrement the client listeners count.
913
+ */
914
+ decrementClientListenersCount(): void;
915
+ /**
916
+ * Path to the app directory. Returns `null` if not found.
917
+ * The lookup order is:
918
+ * - `./app`
919
+ * - `./src/app`
920
+ */
921
+ getAppDirectory(): string | null;
922
+ getPath(to: 'commands' | 'events'): string | null;
923
+ }
924
+ //#endregion
925
+ export { AnyCommandExecute, AppCommandHandler, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, EvaluationContext, EventFlagContext, EventListener, FeatureFlag, FeatureFlagDefinition, FlagRunner, FlagStore, GenericFunction, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, RunCommand, RuntimePlugin, SlashCommandMiddlewareContext, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, useEnvironment };
926
+ //# sourceMappingURL=CommandKit-CDlCsGCx.d.ts.map