commandkit 1.0.0-dev.20250511052916 → 1.0.0-dev.20250511124349

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/index.d.ts CHANGED
@@ -1461,10 +1461,18 @@ declare class CommandKitEventsChannel {
1461
1461
  removeAllListeners(namespace: string, event: string): void;
1462
1462
  }
1463
1463
 
1464
+ interface AppEventsHandlerLoadedData {
1465
+ name: string;
1466
+ namespace: string | null;
1467
+ onceListeners: number;
1468
+ regularListeners: number;
1469
+ metadata: ParsedEvent;
1470
+ }
1464
1471
  declare class AppEventsHandler {
1465
1472
  readonly commandkit: CommandKit;
1466
1473
  private loadedEvents;
1467
1474
  constructor(commandkit: CommandKit);
1475
+ getEvents(): AppEventsHandlerLoadedData[];
1468
1476
  reloadEvents(): Promise<void>;
1469
1477
  loadEvents(): Promise<void>;
1470
1478
  unregisterAll(): void;
@@ -1543,84 +1551,6 @@ interface Setup {
1543
1551
  onResolve(options: OnResolveOptions, cb: (args: OnResolveArgs) => Promise<OnResolveResult>): Promise<any>;
1544
1552
  }
1545
1553
 
1546
- type CommandKitPlugin = RuntimePlugin | CompilerPlugin;
1547
- type MaybeFalsey<T> = T | false | null | undefined;
1548
-
1549
- interface PluginTransformParameters {
1550
- args: OnLoadArgs;
1551
- path: string;
1552
- contents: string | Uint8Array;
1553
- loader?: Loader;
1554
- }
1555
- interface TransformedResult {
1556
- contents?: string | Uint8Array;
1557
- loader?: Loader;
1558
- }
1559
- interface ResolveResult {
1560
- path?: string;
1561
- external?: boolean;
1562
- }
1563
- declare abstract class CompilerPlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CompilerPluginRuntime> {
1564
- /**
1565
- * Called when transformation is requested to this plugin
1566
- * @param params The parameters for the transformation
1567
- * @returns The transformed result
1568
- */
1569
- transform(params: PluginTransformParameters): Promise<MaybeFalsey<TransformedResult>>;
1570
- /**
1571
- * Called when a resolve is requested to this plugin
1572
- * @param args The arguments for the resolve
1573
- * @returns The resolved result
1574
- */
1575
- resolve(args: OnResolveArgs): Promise<MaybeFalsey<ResolveResult>>;
1576
- /**
1577
- * Called when a build is started
1578
- */
1579
- onBuildStart(): Promise<void>;
1580
- /**
1581
- * Called when a build is ended
1582
- */
1583
- onBuildEnd(): Promise<void>;
1584
- }
1585
- declare function isCompilerPlugin(plugin: unknown): plugin is CompilerPlugin;
1586
-
1587
- declare class CompilerPluginRuntime {
1588
- private readonly plugins;
1589
- readonly name = "CompilerPluginRuntime";
1590
- constructor(plugins: CompilerPlugin[]);
1591
- isEmpty(): boolean;
1592
- private onLoad;
1593
- private onResolve;
1594
- private onStart;
1595
- private onEnd;
1596
- private onDispose;
1597
- private onInit;
1598
- cleanup(): Promise<void>;
1599
- setup(build: Setup): Promise<void>;
1600
- toEsbuildPlugin(): {
1601
- name: string;
1602
- setup: (build: Setup) => Promise<void>;
1603
- };
1604
- }
1605
- declare function fromEsbuildPlugin(plugin: any): typeof CompilerPlugin;
1606
-
1607
- type CommonPluginRuntime = CommandKitPluginRuntime | CompilerPluginRuntime;
1608
-
1609
- type PluginOptions = Record<string, any>;
1610
- declare abstract class PluginCommon<T extends PluginOptions = PluginOptions, C extends CommonPluginRuntime = CommonPluginRuntime> {
1611
- protected readonly options: T;
1612
- abstract readonly name: string;
1613
- constructor(options: T);
1614
- /**
1615
- * Called when this plugin is activated
1616
- */
1617
- activate(ctx: C): Promise<void>;
1618
- /**
1619
- * Called when this plugin is deactivated
1620
- */
1621
- deactivate(ctx: C): Promise<void>;
1622
- }
1623
-
1624
1554
  declare const COMMANDKIT_CACHE_TAG: unique symbol;
1625
1555
  declare const COMMANDKIT_IS_DEV: boolean;
1626
1556
  declare const COMMANDKIT_IS_TEST: boolean;
@@ -1742,10 +1672,92 @@ declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> ex
1742
1672
  }
1743
1673
  declare function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin;
1744
1674
 
1675
+ type CommandKitPlugin = RuntimePlugin | CompilerPlugin;
1676
+ type MaybeFalsey<T> = T | false | null | undefined;
1677
+
1678
+ interface PluginTransformParameters {
1679
+ args: OnLoadArgs;
1680
+ path: string;
1681
+ contents: string | Uint8Array;
1682
+ loader?: Loader;
1683
+ }
1684
+ interface TransformedResult {
1685
+ contents?: string | Uint8Array;
1686
+ loader?: Loader;
1687
+ }
1688
+ interface ResolveResult {
1689
+ path?: string;
1690
+ external?: boolean;
1691
+ }
1692
+ declare abstract class CompilerPlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CompilerPluginRuntime> {
1693
+ /**
1694
+ * Called when transformation is requested to this plugin
1695
+ * @param params The parameters for the transformation
1696
+ * @returns The transformed result
1697
+ */
1698
+ transform(params: PluginTransformParameters): Promise<MaybeFalsey<TransformedResult>>;
1699
+ /**
1700
+ * Called when a resolve is requested to this plugin
1701
+ * @param args The arguments for the resolve
1702
+ * @returns The resolved result
1703
+ */
1704
+ resolve(args: OnResolveArgs): Promise<MaybeFalsey<ResolveResult>>;
1705
+ /**
1706
+ * Called when a build is started
1707
+ */
1708
+ onBuildStart(): Promise<void>;
1709
+ /**
1710
+ * Called when a build is ended
1711
+ */
1712
+ onBuildEnd(): Promise<void>;
1713
+ }
1714
+ declare function isCompilerPlugin(plugin: unknown): plugin is CompilerPlugin;
1715
+
1716
+ declare class CompilerPluginRuntime {
1717
+ private readonly plugins;
1718
+ readonly name = "CompilerPluginRuntime";
1719
+ constructor(plugins: CompilerPlugin[]);
1720
+ getPlugins(): CompilerPlugin<PluginOptions>[];
1721
+ isEmpty(): boolean;
1722
+ private onLoad;
1723
+ private onResolve;
1724
+ private onStart;
1725
+ private onEnd;
1726
+ private onDispose;
1727
+ private onInit;
1728
+ cleanup(): Promise<void>;
1729
+ setup(build: Setup): Promise<void>;
1730
+ toEsbuildPlugin(): {
1731
+ name: string;
1732
+ setup: (build: Setup) => Promise<void>;
1733
+ };
1734
+ }
1735
+ declare function fromEsbuildPlugin(plugin: any): typeof CompilerPlugin;
1736
+
1737
+ type CommonPluginRuntime = CommandKitPluginRuntime | CompilerPluginRuntime;
1738
+
1739
+ type PluginOptions = Record<string, any>;
1740
+ declare abstract class PluginCommon<T extends PluginOptions = PluginOptions, C extends CommonPluginRuntime = CommonPluginRuntime> {
1741
+ protected readonly options: T;
1742
+ readonly id: `${string}-${string}-${string}-${string}-${string}`;
1743
+ readonly loadedAt: number;
1744
+ abstract readonly name: string;
1745
+ constructor(options: T);
1746
+ /**
1747
+ * Called when this plugin is activated
1748
+ */
1749
+ activate(ctx: C): Promise<void>;
1750
+ /**
1751
+ * Called when this plugin is deactivated
1752
+ */
1753
+ deactivate(ctx: C): Promise<void>;
1754
+ }
1755
+
1745
1756
  declare class CommandKitPluginRuntime {
1746
1757
  readonly commandkit: CommandKit;
1747
1758
  private plugins;
1748
1759
  constructor(commandkit: CommandKit);
1760
+ getPlugins(): Collection<string, RuntimePlugin<PluginOptions>>;
1749
1761
  getPlugin(pluginName: string): RuntimePlugin | null;
1750
1762
  softRegisterPlugin(plugin: RuntimePlugin): Promise<void>;
1751
1763
  registerPlugin(plugin: RuntimePlugin): Promise<void>;
package/dist/index.js CHANGED
@@ -2087,15 +2087,18 @@ var init_constants = __esm({
2087
2087
  });
2088
2088
 
2089
2089
  // src/plugins/PluginCommon.ts
2090
- var _PluginCommon, PluginCommon;
2090
+ var import_node_crypto, _PluginCommon, PluginCommon;
2091
2091
  var init_PluginCommon = __esm({
2092
2092
  "src/plugins/PluginCommon.ts"() {
2093
2093
  "use strict";
2094
2094
  init_cjs_shims();
2095
+ import_node_crypto = require("crypto");
2095
2096
  _PluginCommon = class _PluginCommon {
2096
2097
  constructor(options) {
2097
2098
  this.options = options;
2098
2099
  }
2100
+ id = (0, import_node_crypto.randomUUID)();
2101
+ loadedAt = Date.now();
2099
2102
  /**
2100
2103
  * Called when this plugin is activated
2101
2104
  */
@@ -2477,6 +2480,9 @@ var init_CommandKitPluginRuntime = __esm({
2477
2480
  this.commandkit = commandkit2;
2478
2481
  }
2479
2482
  plugins = new import_discord18.Collection();
2483
+ getPlugins() {
2484
+ return this.plugins;
2485
+ }
2480
2486
  getPlugin(pluginName) {
2481
2487
  return this.plugins.get(pluginName) ?? null;
2482
2488
  }
@@ -2586,6 +2592,9 @@ var init_CompilerPluginRuntime = __esm({
2586
2592
  this.plugins = plugins;
2587
2593
  }
2588
2594
  name = "CompilerPluginRuntime";
2595
+ getPlugins() {
2596
+ return this.plugins;
2597
+ }
2589
2598
  isEmpty() {
2590
2599
  return !this.plugins.length;
2591
2600
  }
@@ -3512,12 +3521,12 @@ function cancelAfter(id) {
3512
3521
  }
3513
3522
  env.clearDeferredFunction(id);
3514
3523
  }
3515
- var import_node_crypto, _data, _CommandKitEnvironment, CommandKitEnvironment, CommandKitEnvironmentType;
3524
+ var import_node_crypto2, _data, _CommandKitEnvironment, CommandKitEnvironment, CommandKitEnvironmentType;
3516
3525
  var init_environment = __esm({
3517
3526
  "src/context/environment.ts"() {
3518
3527
  "use strict";
3519
3528
  init_cjs_shims();
3520
- import_node_crypto = require("crypto");
3529
+ import_node_crypto2 = require("crypto");
3521
3530
  init_async_context();
3522
3531
  _CommandKitEnvironment = class _CommandKitEnvironment {
3523
3532
  /**
@@ -3600,7 +3609,7 @@ var init_environment = __esm({
3600
3609
  * @internal
3601
3610
  */
3602
3611
  registerDeferredFunction(fn) {
3603
- const id = (0, import_node_crypto.randomUUID)();
3612
+ const id = (0, import_node_crypto2.randomUUID)();
3604
3613
  __privateGet(this, _data).deferredFunctions.set(id, fn);
3605
3614
  return id;
3606
3615
  }
@@ -4906,11 +4915,12 @@ var init_router = __esm({
4906
4915
  });
4907
4916
 
4908
4917
  // src/app/handlers/AppEventsHandler.ts
4909
- var _AppEventsHandler, AppEventsHandler;
4918
+ var import_discord25, _AppEventsHandler, AppEventsHandler;
4910
4919
  var init_AppEventsHandler = __esm({
4911
4920
  "src/app/handlers/AppEventsHandler.ts"() {
4912
4921
  "use strict";
4913
4922
  init_cjs_shims();
4923
+ import_discord25 = require("discord.js");
4914
4924
  init_Logger();
4915
4925
  init_resolve_file_url();
4916
4926
  init_utilities();
@@ -4919,7 +4929,20 @@ var init_AppEventsHandler = __esm({
4919
4929
  constructor(commandkit2) {
4920
4930
  this.commandkit = commandkit2;
4921
4931
  }
4922
- loadedEvents = /* @__PURE__ */ new Map();
4932
+ loadedEvents = new import_discord25.Collection();
4933
+ getEvents() {
4934
+ if (this.loadedEvents.size === 0) return [];
4935
+ const events = this.loadedEvents.toJSON();
4936
+ return events.map(
4937
+ (event) => ({
4938
+ name: event.name,
4939
+ namespace: event.namespace,
4940
+ onceListeners: event.listeners.filter((listener) => listener.once).length,
4941
+ regularListeners: event.listeners.filter((listener) => !listener.once).length,
4942
+ metadata: event.event
4943
+ })
4944
+ );
4945
+ }
4923
4946
  async reloadEvents() {
4924
4947
  this.unregisterAll();
4925
4948
  await this.loadEvents();
@@ -5399,7 +5422,7 @@ function onBootstrap(fn) {
5399
5422
  function onApplicationBootstrap(fn) {
5400
5423
  onApplicationBootstrapHooks.add(fn);
5401
5424
  }
5402
- var import_node_events2, import_discord25, import_node_path7, import_node_fs7, commandkit, bootstrapHooks, onApplicationBootstrapHooks, _started, _CommandKit_instances, bootstrapHooks_fn, applicationBootstrapHooks_fn, init_fn, initCommands_fn, initEvents_fn, _CommandKit, CommandKit;
5425
+ var import_node_events2, import_discord26, import_node_path7, import_node_fs7, commandkit, bootstrapHooks, onApplicationBootstrapHooks, _started, _CommandKit_instances, bootstrapHooks_fn, applicationBootstrapHooks_fn, init_fn, initCommands_fn, initEvents_fn, _CommandKit, CommandKit;
5403
5426
  var init_CommandKit = __esm({
5404
5427
  "src/CommandKit.ts"() {
5405
5428
  "use strict";
@@ -5410,7 +5433,7 @@ var init_CommandKit = __esm({
5410
5433
  init_MemoryCache();
5411
5434
  init_components();
5412
5435
  init_EventInterceptor();
5413
- import_discord25 = require("discord.js");
5436
+ import_discord26 = require("discord.js");
5414
5437
  init_utilities();
5415
5438
  import_node_path7 = require("path");
5416
5439
  init_AppCommandHandler();
@@ -5456,7 +5479,7 @@ var init_CommandKit = __esm({
5456
5479
  __privateAdd(this, _started, false);
5457
5480
  __publicField(this, "eventInterceptor");
5458
5481
  __publicField(this, "config", {
5459
- defaultLocale: import_discord25.Locale.EnglishUS,
5482
+ defaultLocale: import_discord26.Locale.EnglishUS,
5460
5483
  getMessageCommandPrefix: /* @__PURE__ */ __name(() => "!", "getMessageCommandPrefix")
5461
5484
  });
5462
5485
  __publicField(this, "store", /* @__PURE__ */ new Map());
@@ -5503,7 +5526,7 @@ var init_CommandKit = __esm({
5503
5526
  this.commandHandler.registerCommandHandler();
5504
5527
  this.incrementClientListenersCount();
5505
5528
  if (token !== false && !this.options.client.isReady()) {
5506
- this.client.once(import_discord25.Events.ClientReady, async () => {
5529
+ this.client.once(import_discord26.Events.ClientReady, async () => {
5507
5530
  await this.commandHandler.registrar.register();
5508
5531
  });
5509
5532
  await this.plugins.execute((ctx, plugin) => {
@@ -5715,7 +5738,7 @@ var init_version = __esm({
5715
5738
  "use strict";
5716
5739
  init_cjs_shims();
5717
5740
  version = /* @__MACRO__ $version */
5718
- "1.0.0-dev.20250511052916";
5741
+ "1.0.0-dev.20250511124349";
5719
5742
  }
5720
5743
  });
5721
5744
 
@@ -6112,7 +6135,7 @@ async function bootstrapDevelopmentServer(configPath) {
6112
6135
  }, "waitForAcknowledgment");
6113
6136
  const sendHmrEvent = /* @__PURE__ */ __name(async (event, path3) => {
6114
6137
  if (!ps || !ps.send) return false;
6115
- const messageId = (0, import_node_crypto4.randomUUID)();
6138
+ const messageId = (0, import_node_crypto5.randomUUID)();
6116
6139
  const messagePromise = waitForAcknowledgment(messageId);
6117
6140
  ps.send({ event, path: path3, id: messageId });
6118
6141
  try {
@@ -6229,7 +6252,7 @@ ${colors_default.yellowBright("rc")} - Reload all commands
6229
6252
  ${colors_default.yellowBright("re")} - Reload all events`
6230
6253
  );
6231
6254
  }
6232
- var import_path2, import_chokidar, import_promises6, import_node_crypto4, isCommandSource, isEventSource;
6255
+ var import_path2, import_chokidar, import_promises6, import_node_crypto5, isCommandSource, isEventSource;
6233
6256
  var init_development = __esm({
6234
6257
  "src/cli/development.ts"() {
6235
6258
  "use strict";
@@ -6243,7 +6266,7 @@ var init_development = __esm({
6243
6266
  init_utilities();
6244
6267
  init_colors();
6245
6268
  import_promises6 = require("timers/promises");
6246
- import_node_crypto4 = require("crypto");
6269
+ import_node_crypto5 = require("crypto");
6247
6270
  init_constants();
6248
6271
  __name(buildAndStart, "buildAndStart");
6249
6272
  isCommandSource = /* @__PURE__ */ __name((p) => p.replaceAll("\\", "/").includes("src/app/commands"), "isCommandSource");
@@ -6576,7 +6599,7 @@ var init_information = __esm({
6576
6599
  import_node_fs10 = __toESM(require("fs"));
6577
6600
  import_node_path11 = __toESM(require("path"));
6578
6601
  knownPlugins = /* @__MACRO__ $getKnownPlugins */
6579
- ["@commandkit/i18n", "@commandkit/legacy", "@commandkit/redis"];
6602
+ ["@commandkit/devtools", "@commandkit/i18n", "@commandkit/legacy", "@commandkit/redis"];
6580
6603
  __name(findPackageVersion, "findPackageVersion");
6581
6604
  __name(getBinaryVersion, "getBinaryVersion");
6582
6605
  __name(showInformation, "showInformation");
@@ -6704,12 +6727,12 @@ init_MemoryCache();
6704
6727
  init_cjs_shims();
6705
6728
  var import_node_async_hooks3 = require("async_hooks");
6706
6729
  init_async_context();
6707
- var import_node_crypto3 = require("crypto");
6730
+ var import_node_crypto4 = require("crypto");
6708
6731
  var import_ms = __toESM(require("ms"));
6709
6732
 
6710
6733
  // src/cache/utils.ts
6711
6734
  init_cjs_shims();
6712
- var import_node_crypto2 = require("crypto");
6735
+ var import_node_crypto3 = require("crypto");
6713
6736
  var tracker = 0n;
6714
6737
  var references = /* @__PURE__ */ new WeakMap();
6715
6738
  var PRIMITIVE_TYPES = /* @__PURE__ */ new Set(
@@ -6744,7 +6767,7 @@ __name(getObjectId, "getObjectId");
6744
6767
  async function createObjectHash(...args) {
6745
6768
  const serializedKey = args.map(getObjectId).join(":");
6746
6769
  try {
6747
- const hash = (0, import_node_crypto2.createHash)("sha256");
6770
+ const hash = (0, import_node_crypto3.createHash)("sha256");
6748
6771
  hash.update(serializedKey);
6749
6772
  return hash.digest("hex");
6750
6773
  } catch {
@@ -6775,7 +6798,7 @@ function useCache(fn, id, params) {
6775
6798
  if (id && !isLocal) {
6776
6799
  throw new Error("Illegal use of cache function.");
6777
6800
  }
6778
- const fnId = (0, import_node_crypto3.randomUUID)();
6801
+ const fnId = (0, import_node_crypto4.randomUUID)();
6779
6802
  const memo = /* @__PURE__ */ __name(async (...args) => {
6780
6803
  const forcedName = isLocal ? params == null ? void 0 : params.name : null;
6781
6804
  const keyHash = forcedName ?? await createObjectHash(fnId, ...args);
@@ -6887,9 +6910,9 @@ init_CommandRegistrar();
6887
6910
 
6888
6911
  // src/app/commands/helpers.ts
6889
6912
  init_cjs_shims();
6890
- var import_discord26 = require("discord.js");
6913
+ var import_discord27 = require("discord.js");
6891
6914
  function isMessageSource(source) {
6892
- return source instanceof import_discord26.Message;
6915
+ return source instanceof import_discord27.Message;
6893
6916
  }
6894
6917
  __name(isMessageSource, "isMessageSource");
6895
6918
  function isInteractionSource(source) {