commandkit 1.2.0-dev.20251108015252 → 1.2.0-dev.20251108074143

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 (96) hide show
  1. package/dist/{EventWorkerContext-Ce1mQLGB.d.ts → EventWorkerContext-CNPnDdUZ.d.ts} +2 -2
  2. package/dist/analytics/analytics-engine.d.ts +1 -1
  3. package/dist/analytics/analytics-engine.js +1 -1
  4. package/dist/analytics/analytics-provider.d.ts +1 -1
  5. package/dist/analytics/utils.js +1 -1
  6. package/dist/{analytics-engine-BnrjXwc1.d.ts → analytics-engine-DHmLGxFA.d.ts} +4 -2
  7. package/dist/app/commands/AppCommandRunner.d.ts +1 -1
  8. package/dist/app/commands/AppCommandRunner.js +1 -1
  9. package/dist/app/commands/Context.d.ts +1 -1
  10. package/dist/app/commands/Context.js +1 -1
  11. package/dist/app/events/EventWorkerContext.d.ts +2 -2
  12. package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
  13. package/dist/app/handlers/AppCommandHandler.js +1 -1
  14. package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
  15. package/dist/app/handlers/AppEventsHandler.js +1 -1
  16. package/dist/app/index.d.ts +1 -1
  17. package/dist/app/index.js +1 -1
  18. package/dist/app/middlewares/permissions.d.ts +1 -1
  19. package/dist/app/middlewares/permissions.js +1 -1
  20. package/dist/app/register/CommandRegistrar.d.ts +1 -1
  21. package/dist/app/register/CommandRegistrar.js +1 -1
  22. package/dist/{build-C9EvWSOT.js → build-BtdjPnMr.js} +3 -3
  23. package/dist/build-BtdjPnMr.js.map +1 -0
  24. package/dist/cli/build.d.ts +1 -1
  25. package/dist/cli/build.js +2 -2
  26. package/dist/cli/common.d.ts +1 -1
  27. package/dist/cli/development.js +2 -2
  28. package/dist/cli/information.js +3 -2
  29. package/dist/cli/information.js.map +1 -1
  30. package/dist/cli/init.js +2 -2
  31. package/dist/cli/init.js.map +1 -1
  32. package/dist/cli/production.js +2 -2
  33. package/dist/{commandkit-Dc56U1Ri.js → commandkit-DfAoP5wK.js} +6 -2
  34. package/dist/commandkit-DfAoP5wK.js.map +1 -0
  35. package/dist/commandkit.d.ts +1 -1
  36. package/dist/commandkit.js +1 -1
  37. package/dist/components/index.js +1 -1
  38. package/dist/components/interactive/button/Button.js +1 -1
  39. package/dist/components/interactive/button/ButtonKit.js +1 -1
  40. package/dist/components/interactive/modal/Modal.js +1 -1
  41. package/dist/components/interactive/modal/ModalKit.js +1 -1
  42. package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +1 -1
  43. package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +1 -1
  44. package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +1 -1
  45. package/dist/components/interactive/select-menu/SelectMenu.js +1 -1
  46. package/dist/components/interactive/select-menu/StringSelectMenuKit.js +1 -1
  47. package/dist/components/interactive/select-menu/UserSelectMenuKit.js +1 -1
  48. package/dist/config/config.d.ts +2 -2
  49. package/dist/config/config.js +1 -1
  50. package/dist/config/default.d.ts +1 -1
  51. package/dist/config/default.js +1 -1
  52. package/dist/config/loader.d.ts +1 -1
  53. package/dist/config/loader.js +1 -1
  54. package/dist/config/types.d.ts +1 -1
  55. package/dist/config/utils.d.ts +1 -1
  56. package/dist/{config-BMICX-W2.d.ts → config-2prRz7_7.d.ts} +2 -2
  57. package/dist/context/async-context.d.ts +1 -1
  58. package/dist/context/async-context.js +1 -1
  59. package/dist/context/environment.d.ts +1 -1
  60. package/dist/context/environment.js +1 -1
  61. package/dist/events/CommandKitEventsChannel.d.ts +1 -1
  62. package/dist/{feature-flags-BjZpBgLv.js → feature-flags-CYb0Feae.js} +2 -2
  63. package/dist/{feature-flags-BjZpBgLv.js.map → feature-flags-CYb0Feae.js.map} +1 -1
  64. package/dist/flags/FlagProvider.d.ts +1 -1
  65. package/dist/flags/feature-flags.d.ts +1 -1
  66. package/dist/flags/feature-flags.js +2 -2
  67. package/dist/flags/store.d.ts +1 -1
  68. package/dist/index.d.ts +3 -3
  69. package/dist/index.js +3 -3
  70. package/dist/logger/DefaultLogger.js +1 -1
  71. package/dist/logger/Logger.js +1 -1
  72. package/dist/plugins/CompilerPlugin.d.ts +1 -1
  73. package/dist/plugins/PluginCommon.d.ts +1 -1
  74. package/dist/plugins/RuntimePlugin.d.ts +1 -1
  75. package/dist/plugins/index.d.ts +1 -1
  76. package/dist/plugins/index.js +1 -1
  77. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
  78. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +1 -1
  79. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
  80. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +1 -1
  81. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
  82. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +1 -1
  83. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
  84. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +1 -1
  85. package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
  86. package/dist/plugins/types.d.ts +1 -1
  87. package/dist/types.d.ts +1 -1
  88. package/dist/utils/dev-hooks.d.ts +1 -1
  89. package/dist/utils/dev-hooks.js +1 -1
  90. package/dist/utils/utilities.js +1 -1
  91. package/dist/{version-De1NA7Vn.js → version-B9xiS1lg.js} +2 -2
  92. package/dist/{version-De1NA7Vn.js.map → version-B9xiS1lg.js.map} +1 -1
  93. package/dist/version.js +1 -1
  94. package/package.json +2 -2
  95. package/dist/build-C9EvWSOT.js.map +0 -1
  96. package/dist/commandkit-Dc56U1Ri.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { s as CommandKit } from "./analytics-engine-BnrjXwc1.js";
1
+ import { s as CommandKit } from "./analytics-engine-DHmLGxFA.js";
2
2
  import { i as ParsedEvent } from "./EventsRouter-bILsV3Lh.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
 
@@ -40,4 +40,4 @@ declare function getEventWorkerContext(): EventWorkerContext;
40
40
  declare function isEventWorkerContext(worker: any): worker is EventWorkerContext;
41
41
  //#endregion
42
42
  export { runInEventWorkerContext as a, isEventWorkerContext as i, eventWorkerContext as n, getEventWorkerContext as r, EventWorkerContext as t };
43
- //# sourceMappingURL=EventWorkerContext-Ce1mQLGB.d.ts.map
43
+ //# sourceMappingURL=EventWorkerContext-CNPnDdUZ.d.ts.map
@@ -1,4 +1,4 @@
1
- import { n as FilterFunction, t as AnalyticsEngine } from "../analytics-engine-BnrjXwc1.js";
1
+ import { n as FilterFunction, t as AnalyticsEngine } from "../analytics-engine-DHmLGxFA.js";
2
2
  import "../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../ButtonKit-B_HCmb3D.js";
4
4
  import "../ModalKit-C8WkeoDl.js";
@@ -1,7 +1,7 @@
1
1
  require('../colors-CLmBiP9I.js');
2
2
  require('../ActionRow-D6knpVd6.js');
3
3
  require('../error-codes-Ds0bnPvT.js');
4
- const require_commandkit = require('../commandkit-Dc56U1Ri.js');
4
+ const require_commandkit = require('../commandkit-DfAoP5wK.js');
5
5
  require('../warning-CszH8HeS.js');
6
6
  require('../common-CEordwf3.js');
7
7
  require('../common-C2jAjX4U.js');
@@ -1,4 +1,4 @@
1
- import { a as IdentifyEvent, i as AnalyticsProvider, r as AnalyticsEvent } from "../analytics-engine-BnrjXwc1.js";
1
+ import { a as IdentifyEvent, i as AnalyticsProvider, r as AnalyticsEvent } from "../analytics-engine-DHmLGxFA.js";
2
2
  import "../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../ButtonKit-B_HCmb3D.js";
4
4
  import "../ModalKit-C8WkeoDl.js";
@@ -1,7 +1,7 @@
1
1
  require('../colors-CLmBiP9I.js');
2
2
  require('../ActionRow-D6knpVd6.js');
3
3
  require('../error-codes-Ds0bnPvT.js');
4
- const require_commandkit = require('../commandkit-Dc56U1Ri.js');
4
+ const require_commandkit = require('../commandkit-DfAoP5wK.js');
5
5
  require('../warning-CszH8HeS.js');
6
6
  require('../common-CEordwf3.js');
7
7
  require('../common-C2jAjX4U.js');
@@ -1341,14 +1341,16 @@ declare abstract class CommonDirectiveTransformer extends CompilerPlugin<CommonD
1341
1341
  declare class CompilerPluginRuntime {
1342
1342
  #private;
1343
1343
  private readonly plugins;
1344
+ readonly isDevMode: boolean;
1344
1345
  readonly name = "CompilerPluginRuntime";
1345
1346
  private initialized;
1346
1347
  private templates;
1347
1348
  /**
1348
1349
  * Creates a new instance of CompilerPluginRuntime.
1349
1350
  * @param plugins An array of compiler plugins to be managed by this runtime.
1351
+ * @param isDevMode Whether the build is in development mode.
1350
1352
  */
1351
- constructor(plugins: CompilerPlugin[]);
1353
+ constructor(plugins: CompilerPlugin[], isDevMode: boolean);
1352
1354
  /**
1353
1355
  * Returns the plugins managed by this runtime.
1354
1356
  */
@@ -2268,4 +2270,4 @@ declare class AnalyticsEngine {
2268
2270
  }
2269
2271
  //#endregion
2270
2272
  export { isRuntimePlugin as $, MessageCommand as $t, flag as A, makeContextAwareFunction as At, CommonPluginRuntime as B, PreRegisterCommandsEvent as Bt, EvaluationContext as C, RunCommandOptions as Ct, FlagRunner as D, getCommandKit as Dt, FeatureFlagDefinition as E, exitContext as Et, CommandKitPluginRuntime as F, CommandKitEnvironmentInternalData as Ft, PluginTransformParameters as G, ChatInputCommand as Gt, CommonDirectiveTransformer as H, AutocompleteCommand as Ht, PluginCommon as I, CommandKitEnvironmentType as It, CommandKitEventDispatch as J, CommandExecutionMode as Jt, TransformedResult as K, ChatInputCommandContext as Kt, PluginOptions as L, after as Lt, FlagConfiguration as M, useEnvironment as Mt, FlagProvider as N, useStore as Nt, IdentifyFunction as O, getContext as Ot, JsonFlagProvider as P, CommandKitEnvironment as Pt, RuntimePlugin as Q, InteractionCommandMiddlewareContext as Qt, PluginType as R, cancelAfter as Rt, DecideFunction as S, AppCommandRunner as St, FeatureFlag as T, GenericFunction as Tt, CommonDirectiveTransformerOptions as U, AutocompleteCommandContext as Ut, CompilerPluginRuntime as V, AnyCommandExecute as Vt, CompilerPlugin as W, AutocompleteCommandMiddlewareContext as Wt, MaybeFalsey as X, ContextParameters as Xt, CommandKitPlugin as Y, Context as Yt, TemplateHandler as Z, InteractionCommandContext as Zt, CommandKitConfig as _, CustomAppCommandProps as _t, IdentifyEvent as a, MiddlewareContext as an, EventListener as at, CustomEvaluationContext as b, ResolvableCommand as bt, CommandKitConfiguration as c, UserContextMenuCommand as cn, ListenerFunction as ct, onBootstrap as d, CommandContext as dn, AppCommandNative as dt, MessageCommandContext as en, CommandKitHMREvent as et, DeepPartial as f, CommandData as fn, CommandBuilderLike as ft, CommandKitCompilerOptions as g, EventHandler as gn, CommandTypeData as gt, mergeDeep as h, CommandMetadataFunction as hn, CommandDataSchemaValue as ht, AnalyticsProvider as i, MessageContextMenuCommandMiddlewareContext as in, AppEventsHandlerLoadedData as it, setFlagProvider as j, provideContext as jt, MaybePromise as k, isCommandWorkerContext as kt, commandkit as l, UserContextMenuCommandContext as ln, AppCommand as lt, ResolvedCommandKitConfig as m, CommandMetadata as mn, CommandDataSchemaKey as mt, FilterFunction as n, MessageContextMenuCommand as nn, registerDevHooks as nt, BootstrapFunction as o, MiddlewareContextArgs as on, LoadedEvent as ot, DeepRequired as p, CommandKitOptions as pn, CommandDataSchema as pt, isCompilerPlugin as q, CommandContextOptions as qt, AnalyticsEvent as r, MessageContextMenuCommandContext as rn, AppEventsHandler as rt, CommandKit as s, SlashCommandMiddlewareContext as sn, CommandKitEventsChannel as st, AnalyticsEngine as t, MessageCommandMiddlewareContext as tn, IpcMessageCommand as tt, onApplicationBootstrap as u, UserContextMenuCommandMiddlewareContext as un, AppCommandHandler as ut, FlagStore as v, LoadedCommand as vt, EventFlagContext as w, AsyncFunction as wt, CustomEvaluationFunction as x, RunCommand as xt, CommandFlagContext as y, PreparedAppCommandExecution as yt, isPlugin as z, CommandRegistrar as zt };
2271
- //# sourceMappingURL=analytics-engine-BnrjXwc1.d.ts.map
2273
+ //# sourceMappingURL=analytics-engine-DHmLGxFA.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Ct as RunCommandOptions, St as AppCommandRunner } from "../../analytics-engine-BnrjXwc1.js";
1
+ import { Ct as RunCommandOptions, St as AppCommandRunner } from "../../analytics-engine-DHmLGxFA.js";
2
2
  import "../../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../../ButtonKit-B_HCmb3D.js";
4
4
  import "../../ModalKit-C8WkeoDl.js";
@@ -1,7 +1,7 @@
1
1
  require('../../colors-CLmBiP9I.js');
2
2
  require('../../ActionRow-D6knpVd6.js');
3
3
  require('../../error-codes-Ds0bnPvT.js');
4
- const require_commandkit = require('../../commandkit-Dc56U1Ri.js');
4
+ const require_commandkit = require('../../commandkit-DfAoP5wK.js');
5
5
  require('../../warning-CszH8HeS.js');
6
6
  require('../../common-CEordwf3.js');
7
7
  require('../../common-C2jAjX4U.js');
@@ -1,4 +1,4 @@
1
- import { $t as MessageCommand, Gt as ChatInputCommand, Ht as AutocompleteCommand, Jt as CommandExecutionMode, Kt as ChatInputCommandContext, Qt as InteractionCommandMiddlewareContext, Ut as AutocompleteCommandContext, Vt as AnyCommandExecute, Wt as AutocompleteCommandMiddlewareContext, Xt as ContextParameters, Yt as Context, Zt as InteractionCommandContext, an as MiddlewareContext, cn as UserContextMenuCommand, en as MessageCommandContext, in as MessageContextMenuCommandMiddlewareContext, ln as UserContextMenuCommandContext, nn as MessageContextMenuCommand, on as MiddlewareContextArgs, qt as CommandContextOptions, rn as MessageContextMenuCommandContext, sn as SlashCommandMiddlewareContext, tn as MessageCommandMiddlewareContext, un as UserContextMenuCommandMiddlewareContext } from "../../analytics-engine-BnrjXwc1.js";
1
+ import { $t as MessageCommand, Gt as ChatInputCommand, Ht as AutocompleteCommand, Jt as CommandExecutionMode, Kt as ChatInputCommandContext, Qt as InteractionCommandMiddlewareContext, Ut as AutocompleteCommandContext, Vt as AnyCommandExecute, Wt as AutocompleteCommandMiddlewareContext, Xt as ContextParameters, Yt as Context, Zt as InteractionCommandContext, an as MiddlewareContext, cn as UserContextMenuCommand, en as MessageCommandContext, in as MessageContextMenuCommandMiddlewareContext, ln as UserContextMenuCommandContext, nn as MessageContextMenuCommand, on as MiddlewareContextArgs, qt as CommandContextOptions, rn as MessageContextMenuCommandContext, sn as SlashCommandMiddlewareContext, tn as MessageCommandMiddlewareContext, un as UserContextMenuCommandMiddlewareContext } from "../../analytics-engine-DHmLGxFA.js";
2
2
  import "../../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../../ButtonKit-B_HCmb3D.js";
4
4
  import "../../ModalKit-C8WkeoDl.js";
@@ -1,7 +1,7 @@
1
1
  require('../../colors-CLmBiP9I.js');
2
2
  require('../../ActionRow-D6knpVd6.js');
3
3
  require('../../error-codes-Ds0bnPvT.js');
4
- const require_commandkit = require('../../commandkit-Dc56U1Ri.js');
4
+ const require_commandkit = require('../../commandkit-DfAoP5wK.js');
5
5
  require('../../warning-CszH8HeS.js');
6
6
  require('../../common-CEordwf3.js');
7
7
  require('../../common-C2jAjX4U.js');
@@ -1,4 +1,4 @@
1
- import "../../analytics-engine-BnrjXwc1.js";
1
+ import "../../analytics-engine-DHmLGxFA.js";
2
2
  import "../../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../../ButtonKit-B_HCmb3D.js";
4
4
  import "../../ModalKit-C8WkeoDl.js";
@@ -31,5 +31,5 @@ import "../../CommandsRouter-Bdkx7SZS.js";
31
31
  import "../../EventsRouter-bILsV3Lh.js";
32
32
  import "../../index-B5F3AfVc.js";
33
33
  import "../../constants-CAMgxUyw.js";
34
- import { a as runInEventWorkerContext, i as isEventWorkerContext, n as eventWorkerContext, r as getEventWorkerContext, t as EventWorkerContext } from "../../EventWorkerContext-Ce1mQLGB.js";
34
+ import { a as runInEventWorkerContext, i as isEventWorkerContext, n as eventWorkerContext, r as getEventWorkerContext, t as EventWorkerContext } from "../../EventWorkerContext-CNPnDdUZ.js";
35
35
  export { EventWorkerContext, eventWorkerContext, getEventWorkerContext, isEventWorkerContext, runInEventWorkerContext };
@@ -1,4 +1,4 @@
1
- import { _t as CustomAppCommandProps, bt as ResolvableCommand, dt as AppCommandNative, ft as CommandBuilderLike, gt as CommandTypeData, ht as CommandDataSchemaValue, lt as AppCommand, mt as CommandDataSchemaKey, pt as CommandDataSchema, ut as AppCommandHandler, vt as LoadedCommand, xt as RunCommand, yt as PreparedAppCommandExecution } from "../../analytics-engine-BnrjXwc1.js";
1
+ import { _t as CustomAppCommandProps, bt as ResolvableCommand, dt as AppCommandNative, ft as CommandBuilderLike, gt as CommandTypeData, ht as CommandDataSchemaValue, lt as AppCommand, mt as CommandDataSchemaKey, pt as CommandDataSchema, ut as AppCommandHandler, vt as LoadedCommand, xt as RunCommand, yt as PreparedAppCommandExecution } from "../../analytics-engine-DHmLGxFA.js";
2
2
  import "../../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../../ButtonKit-B_HCmb3D.js";
4
4
  import "../../ModalKit-C8WkeoDl.js";
@@ -1,7 +1,7 @@
1
1
  require('../../colors-CLmBiP9I.js');
2
2
  require('../../ActionRow-D6knpVd6.js');
3
3
  require('../../error-codes-Ds0bnPvT.js');
4
- const require_commandkit = require('../../commandkit-Dc56U1Ri.js');
4
+ const require_commandkit = require('../../commandkit-DfAoP5wK.js');
5
5
  require('../../warning-CszH8HeS.js');
6
6
  require('../../common-CEordwf3.js');
7
7
  require('../../common-C2jAjX4U.js');
@@ -1,4 +1,4 @@
1
- import { at as EventListener, it as AppEventsHandlerLoadedData, ot as LoadedEvent, rt as AppEventsHandler } from "../../analytics-engine-BnrjXwc1.js";
1
+ import { at as EventListener, it as AppEventsHandlerLoadedData, ot as LoadedEvent, rt as AppEventsHandler } from "../../analytics-engine-DHmLGxFA.js";
2
2
  import "../../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../../ButtonKit-B_HCmb3D.js";
4
4
  import "../../ModalKit-C8WkeoDl.js";
@@ -1,7 +1,7 @@
1
1
  require('../../colors-CLmBiP9I.js');
2
2
  require('../../ActionRow-D6knpVd6.js');
3
3
  require('../../error-codes-Ds0bnPvT.js');
4
- const require_commandkit = require('../../commandkit-Dc56U1Ri.js');
4
+ const require_commandkit = require('../../commandkit-DfAoP5wK.js');
5
5
  require('../../warning-CszH8HeS.js');
6
6
  require('../../common-CEordwf3.js');
7
7
  require('../../common-C2jAjX4U.js');
@@ -1,4 +1,4 @@
1
- import { $t as MessageCommand, Bt as PreRegisterCommandsEvent, Gt as ChatInputCommand, Ht as AutocompleteCommand, Jt as CommandExecutionMode, Kt as ChatInputCommandContext, Qt as InteractionCommandMiddlewareContext, Ut as AutocompleteCommandContext, Vt as AnyCommandExecute, Wt as AutocompleteCommandMiddlewareContext, Xt as ContextParameters, Yt as Context, Zt as InteractionCommandContext, _t as CustomAppCommandProps, an as MiddlewareContext, bt as ResolvableCommand, cn as UserContextMenuCommand, dt as AppCommandNative, en as MessageCommandContext, ft as CommandBuilderLike, gt as CommandTypeData, ht as CommandDataSchemaValue, in as MessageContextMenuCommandMiddlewareContext, ln as UserContextMenuCommandContext, lt as AppCommand, mt as CommandDataSchemaKey, nn as MessageContextMenuCommand, on as MiddlewareContextArgs, pt as CommandDataSchema, qt as CommandContextOptions, rn as MessageContextMenuCommandContext, sn as SlashCommandMiddlewareContext, tn as MessageCommandMiddlewareContext, un as UserContextMenuCommandMiddlewareContext, ut as AppCommandHandler, vt as LoadedCommand, xt as RunCommand, yt as PreparedAppCommandExecution, zt as CommandRegistrar } from "../analytics-engine-BnrjXwc1.js";
1
+ import { $t as MessageCommand, Bt as PreRegisterCommandsEvent, Gt as ChatInputCommand, Ht as AutocompleteCommand, Jt as CommandExecutionMode, Kt as ChatInputCommandContext, Qt as InteractionCommandMiddlewareContext, Ut as AutocompleteCommandContext, Vt as AnyCommandExecute, Wt as AutocompleteCommandMiddlewareContext, Xt as ContextParameters, Yt as Context, Zt as InteractionCommandContext, _t as CustomAppCommandProps, an as MiddlewareContext, bt as ResolvableCommand, cn as UserContextMenuCommand, dt as AppCommandNative, en as MessageCommandContext, ft as CommandBuilderLike, gt as CommandTypeData, ht as CommandDataSchemaValue, in as MessageContextMenuCommandMiddlewareContext, ln as UserContextMenuCommandContext, lt as AppCommand, mt as CommandDataSchemaKey, nn as MessageContextMenuCommand, on as MiddlewareContextArgs, pt as CommandDataSchema, qt as CommandContextOptions, rn as MessageContextMenuCommandContext, sn as SlashCommandMiddlewareContext, tn as MessageCommandMiddlewareContext, un as UserContextMenuCommandMiddlewareContext, ut as AppCommandHandler, vt as LoadedCommand, xt as RunCommand, yt as PreparedAppCommandExecution, zt as CommandRegistrar } from "../analytics-engine-DHmLGxFA.js";
2
2
  import "../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../ButtonKit-B_HCmb3D.js";
4
4
  import "../ModalKit-C8WkeoDl.js";
package/dist/app/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  require('../colors-CLmBiP9I.js');
2
2
  require('../ActionRow-D6knpVd6.js');
3
3
  require('../error-codes-Ds0bnPvT.js');
4
- const require_commandkit = require('../commandkit-Dc56U1Ri.js');
4
+ const require_commandkit = require('../commandkit-DfAoP5wK.js');
5
5
  require('../warning-CszH8HeS.js');
6
6
  require('../common-CEordwf3.js');
7
7
  require('../common-C2jAjX4U.js');
@@ -1,4 +1,4 @@
1
- import { an as MiddlewareContext } from "../../analytics-engine-BnrjXwc1.js";
1
+ import { an as MiddlewareContext } from "../../analytics-engine-DHmLGxFA.js";
2
2
  import "../../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../../ButtonKit-B_HCmb3D.js";
4
4
  import "../../ModalKit-C8WkeoDl.js";
@@ -1,7 +1,7 @@
1
1
  require('../../colors-CLmBiP9I.js');
2
2
  require('../../ActionRow-D6knpVd6.js');
3
3
  require('../../error-codes-Ds0bnPvT.js');
4
- const require_commandkit = require('../../commandkit-Dc56U1Ri.js');
4
+ const require_commandkit = require('../../commandkit-DfAoP5wK.js');
5
5
  require('../../warning-CszH8HeS.js');
6
6
  require('../../common-CEordwf3.js');
7
7
  require('../../common-C2jAjX4U.js');
@@ -1,4 +1,4 @@
1
- import { Bt as PreRegisterCommandsEvent, zt as CommandRegistrar } from "../../analytics-engine-BnrjXwc1.js";
1
+ import { Bt as PreRegisterCommandsEvent, zt as CommandRegistrar } from "../../analytics-engine-DHmLGxFA.js";
2
2
  import "../../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../../ButtonKit-B_HCmb3D.js";
4
4
  import "../../ModalKit-C8WkeoDl.js";
@@ -1,7 +1,7 @@
1
1
  require('../../colors-CLmBiP9I.js');
2
2
  require('../../ActionRow-D6knpVd6.js');
3
3
  require('../../error-codes-Ds0bnPvT.js');
4
- const require_commandkit = require('../../commandkit-Dc56U1Ri.js');
4
+ const require_commandkit = require('../../commandkit-DfAoP5wK.js');
5
5
  require('../../warning-CszH8HeS.js');
6
6
  require('../../common-CEordwf3.js');
7
7
  require('../../common-C2jAjX4U.js');
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-nOFOJqeH.js');
2
- const require_commandkit = require('./commandkit-Dc56U1Ri.js');
2
+ const require_commandkit = require('./commandkit-DfAoP5wK.js');
3
3
  const require_constants = require('./constants-CxkFFZ7p.js');
4
4
  const require_utils = require('./utils-Br3eenD1.js');
5
5
  const require_common = require('./common-B2-sF49Q.js');
@@ -42,7 +42,7 @@ async function buildApplication({ plugins, rolldownPlugins, isDev, configPath })
42
42
  const { build } = await require_common.loadTsdown();
43
43
  const config = await require_commandkit.loadConfigFile(configPath);
44
44
  if (!isDev && !(config === null || config === void 0 || (_config$typescript = config.typescript) === null || _config$typescript === void 0 ? void 0 : _config$typescript.ignoreBuildErrors)) await require_type_checker.performTypeCheck(configPath || require_constants.COMMANDKIT_CWD);
45
- const pluginRuntime = new require_commandkit.CompilerPluginRuntime(plugins || []);
45
+ const pluginRuntime = new require_commandkit.CompilerPluginRuntime(plugins || [], !!isDev);
46
46
  rolldownPlugins ??= [];
47
47
  rolldownPlugins.push(pluginRuntime.toJSON());
48
48
  try {
@@ -166,4 +166,4 @@ Object.defineProperty(exports, 'buildApplication', {
166
166
  return buildApplication;
167
167
  }
168
168
  });
169
- //# sourceMappingURL=build-C9EvWSOT.js.map
169
+ //# sourceMappingURL=build-BtdjPnMr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-BtdjPnMr.js","names":[],"sources":["../src/cli/build.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { rimraf } from 'rimraf';\nimport type { Options } from 'tsdown';\n\nimport { MaybeArray } from '../components';\nimport { loadConfigFile } from '../config/loader';\nimport { mergeDeep } from '../config/utils';\nimport { CompilerPlugin, CompilerPluginRuntime } from '../plugins';\nimport { COMMANDKIT_CWD } from '../utils/constants';\nimport { copyLocaleFiles, loadTsdown } from './common';\nimport { devEnvFileArgs, prodEnvFileArgs } from './env';\nimport { performTypeCheck } from './type-checker';\n\n/**\n * @private\n * @internal\n */\nexport interface ApplicationBuildOptions {\n plugins?: MaybeArray<CompilerPlugin>[] | Array<CompilerPlugin>;\n rolldownPlugins?: any[];\n isDev?: boolean;\n configPath?: string;\n}\n\n// emit public env variables and given env variables\n/**\n * @private\n * @internal\n */\nfunction mergeDefinitionsIfNeeded(env: Record<string, string>, isDev: boolean) {\n const values = Object.fromEntries(\n Object.entries(process.env).filter(\n ([k]) => !(k in env) && k.startsWith('COMMANDKIT_PUBLIC_'),\n ),\n );\n\n return {\n ...env,\n ...values,\n ...(isDev\n ? {\n NODE_ENV: 'development',\n COMMANDKIT_BOOTSTRAP_MODE: 'development',\n COMMANDKIT_IS_DEV: 'true',\n COMMANDKIT_IS_TEST: 'false',\n }\n : {\n NODE_ENV: 'production',\n COMMANDKIT_BOOTSTRAP_MODE: 'production',\n COMMANDKIT_IS_DEV: 'false',\n COMMANDKIT_IS_TEST: 'false',\n }),\n };\n}\n\n/**\n * @private\n * @internal\n */\nexport async function buildApplication({\n plugins,\n rolldownPlugins,\n isDev,\n configPath,\n}: ApplicationBuildOptions) {\n const { build } = await loadTsdown();\n const config = await loadConfigFile(configPath);\n\n if (!isDev && !config?.typescript?.ignoreBuildErrors) {\n await performTypeCheck(configPath || COMMANDKIT_CWD);\n }\n\n const pluginRuntime = new CompilerPluginRuntime(\n (plugins || []) as CompilerPlugin[],\n !!isDev,\n );\n\n rolldownPlugins ??= [];\n\n rolldownPlugins.push(pluginRuntime.toJSON());\n\n try {\n const dest = isDev ? '.commandkit' : config.distDir;\n\n // Clean the destination directory\n await rimraf(dest);\n\n await pluginRuntime.init();\n\n await build(\n mergeDeep(\n {\n watch: false,\n dts: false,\n clean: true,\n format: ['esm'],\n shims: true,\n minify: false,\n silent: !!isDev,\n inputOptions: {\n transform: {\n jsx: {\n runtime: 'automatic',\n importSource: 'commandkit',\n },\n },\n checks: {\n circularDependency: true,\n },\n onwarn: (warning, defaultWarn) => {\n if (warning?.message?.includes('compilerOptions.jsx')) return;\n\n return defaultWarn(warning);\n },\n onLog: (level, log, defaultLog) => {\n if (isDev) return;\n\n return defaultLog(level, log);\n },\n moduleTypes: {\n '.json': 'json',\n '.node': 'binary',\n },\n },\n plugins: rolldownPlugins,\n platform: 'node',\n skipNodeModulesBundle: true,\n sourcemap:\n config.sourceMap?.[isDev ? 'development' : 'production'] ?? true,\n target: 'node16',\n outDir: dest,\n env: mergeDefinitionsIfNeeded(config.env || {}, !!isDev),\n entry: Array.from(\n new Set([\n 'src/**/*.{js,cjs,mjs,ts,cts,mts,jsx,tsx}',\n `!${config.distDir}`,\n '!.commandkit',\n '!**/*.test.*',\n '!**/*.spec.*',\n ...(config.entrypoints ?? []),\n ]),\n ),\n outputOptions: {\n sanitizeFileName: (name) => name,\n },\n unbundle: isDev\n ? true\n : (config.compilerOptions?.disableChunking ?? false),\n } satisfies Options,\n config.compilerOptions?.tsdown,\n ),\n );\n\n await copyLocaleFiles('src', dest);\n await injectEntryFile(\n configPath || COMMANDKIT_CWD,\n !!isDev,\n !!(\n config.antiCrashScript?.[isDev ? 'development' : 'production'] ??\n (isDev ? true : false)\n ),\n config.distDir,\n );\n } catch (error) {\n console.error('Build failed:', error);\n if (error instanceof Error) {\n console.error('Error details:', error.stack);\n }\n process.exit(1); // Force exit on error\n } finally {\n // Ensure plugins are cleaned up\n await pluginRuntime.destroy();\n }\n}\n\nconst envScript = (dev: boolean) => `// --- Environment Variables Loader ---\nconst $env = [${(dev ? devEnvFileArgs : prodEnvFileArgs).map((p) => `\"${p}\"`).join(', ')}];\nfor (const file of $env) {\n try {\n process.loadEnvFile(file);\n console.log('\\\\x1b[36m✔ Loaded \\\\x1b[0m\\\\x1b[33m%s\\\\x1b[0m', file);\n } catch {}\n}\n`;\n\nconst antiCrashScript = [\n '// --- CommandKit Anti-Crash Monitor ---',\n \" // 'uncaughtException' event is supposed to be used to perform synchronous cleanup before shutting down the process\",\n ' // instead of using it as a means to resume operation.',\n ' // But it exists here due to compatibility reasons with discord bot ecosystem.',\n \" const p = (t) => `\\\\x1b[31m${t}\\\\x1b[0m`, b = '[CommandKit Anti-Crash Monitor]', l = console.log, e1 = 'uncaughtException', e2 = 'unhandledRejection';\",\n ' if (!process.eventNames().includes(e1)) // skip if it is already handled',\n ' process.on(e1, (e) => {',\n ' l(p(`${b} Uncaught Exception`)); l(p(b), p(e.stack || e));',\n ' })',\n ' if (!process.eventNames().includes(e2)) // skip if it is already handled',\n ' process.on(e2, (r) => {',\n ' l(p(`${b} Unhandled promise rejection`)); l(p(`${b} ${r.stack || r}`));',\n ' });',\n '// --- CommandKit Anti-Crash Monitor ---',\n].join('\\n');\n\nconst wrapInAsyncIIFE = (code: string[]) =>\n `;await (async () => {\\n${code.join('\\n\\n')}\\n})();`;\n\nasync function injectEntryFile(\n configPath: string,\n isDev: boolean,\n emitAntiCrashScript: boolean,\n distDir?: string,\n) {\n const dist = isDev ? '.commandkit' : distDir || 'dist';\n const entryFilePath = join(configPath, dist, 'index.js');\n\n // skip if the entry file already exists\n if (existsSync(entryFilePath)) return;\n\n const code = `/* Entrypoint File Generated By CommandKit */\n${isDev ? `\\n\\n// Injected for development\\n${wrapInAsyncIIFE([envScript(isDev), emitAntiCrashScript ? antiCrashScript : ''])}\\n\\n` : wrapInAsyncIIFE([envScript(isDev)])}\n\n\nasync function bootstrap() {\n const { Client } = await import('discord.js');\n const { commandkit } = await import('commandkit');\n const app = await import('./app.js').then((m) => m.default ?? m);\n\n if (!app || !(app instanceof Client)) {\n throw new Error('The app file must default export the discord.js client instance');\n }\n\n commandkit.setClient(app);\n\n await commandkit.start();\n}\n\nawait bootstrap().catch((e) => {\n console.error('Failed to bootstrap CommandKit application:\\\\n', e.stack);\n})\n`;\n\n await writeFile(entryFilePath, code);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA+BA,SAAS,yBAAyB,KAA6B,OAAgB;CAC7E,MAAM,SAAS,OAAO,YACpB,OAAO,QAAQ,QAAQ,IAAI,CAAC,QACzB,CAAC,OAAO,EAAE,KAAK,QAAQ,EAAE,WAAW,qBAAqB,CAC3D,CACF;AAED,QAAO;EACL,GAAG;EACH,GAAG;EACH,GAAI,QACJ;GACE,UAAU;GACV,2BAA2B;GAC3B,mBAAmB;GACnB,oBAAoB;GACrB,GACD;GACE,UAAU;GACV,2BAA2B;GAC3B,mBAAmB;GACnB,oBAAoB;GACrB;EACF;;;;;;AAOH,eAAsB,iBAAiB,EACrC,SACA,iBACA,OACA,cAC0B;;CAC1B,MAAM,EAAE,UAAU,MAAM,2BAAY;CACpC,MAAM,SAAS,MAAM,kCAAe,WAAW;AAE/C,KAAI,CAAC,SAAS,gEAAC,OAAQ,oFAAY,mBACjC,OAAM,sCAAiB,cAAc,iCAAe;CAGtD,MAAM,gBAAgB,IAAI,yCACvB,WAAW,EAAE,EACd,CAAC,CAAC,MACH;AAED,qBAAoB,EAAE;AAEtB,iBAAgB,KAAK,cAAc,QAAQ,CAAC;AAE5C,KAAI;;EACF,MAAM,OAAO,QAAQ,gBAAgB,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AAIjC,MAAM,aAAa,QAAiB;iBACnB,MAAM,6BAAiB,6BAAiB,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;;;;;;;;AASzF,MAAM,kBAAkB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAA2C,CAC3C,KAAK,KAAK;AAEV,MAAM,mBAAmB,SACzB,0BAA0B,KAAK,KAAK,OAAO,CAAC;AAE5C,eAAe,gBACf,YACA,OACA,qBACA,SACA;CAEE,MAAM,oCAAqB,YADd,QAAQ,gBAAgB,WAAW,QACH,WAAW;AAGxD,6BAAe,cAAc,CAAE;AAyB/B,uCAAgB,eAvBH;EACb,QAAQ,oCAAoC,gBAAgB,CAAC,UAAU,MAAM,EAAE,sBAAsB,kBAAkB,GAAG,CAAC,CAAC,QAAQ,gBAAgB,CAAC,UAAU,MAAM,CAAC,CAAC,CAAA;;;;;;;;;;;;;;;;;;;;EAsBnI"}
@@ -1,4 +1,4 @@
1
- import { W as CompilerPlugin } from "../analytics-engine-BnrjXwc1.js";
1
+ import { W as CompilerPlugin } from "../analytics-engine-DHmLGxFA.js";
2
2
  import "../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../ButtonKit-B_HCmb3D.js";
4
4
  import "../ModalKit-C8WkeoDl.js";
package/dist/cli/build.js CHANGED
@@ -1,7 +1,7 @@
1
1
  require('../colors-CLmBiP9I.js');
2
2
  require('../ActionRow-D6knpVd6.js');
3
3
  require('../error-codes-Ds0bnPvT.js');
4
- require('../commandkit-Dc56U1Ri.js');
4
+ require('../commandkit-DfAoP5wK.js');
5
5
  require('../warning-CszH8HeS.js');
6
6
  require('../common-CEordwf3.js');
7
7
  require('../common-C2jAjX4U.js');
@@ -39,6 +39,6 @@ require('../CommandKitEventsChannel-2l9Za-le.js');
39
39
  require('../store-GrsErvli.js');
40
40
  require('../env-CQJgOkQD.js');
41
41
  require('../type-checker-CEt5Inbw.js');
42
- const require_build = require('../build-C9EvWSOT.js');
42
+ const require_build = require('../build-BtdjPnMr.js');
43
43
 
44
44
  exports.buildApplication = require_build.buildApplication;
@@ -1,4 +1,4 @@
1
- import { m as ResolvedCommandKitConfig } from "../analytics-engine-BnrjXwc1.js";
1
+ import { m as ResolvedCommandKitConfig } from "../analytics-engine-DHmLGxFA.js";
2
2
  import "../EventInterceptor-Dk5Fwu-7.js";
3
3
  import "../ButtonKit-B_HCmb3D.js";
4
4
  import "../ModalKit-C8WkeoDl.js";
@@ -2,7 +2,7 @@ const require_chunk = require('../chunk-nOFOJqeH.js');
2
2
  const require_colors = require('../colors-CLmBiP9I.js');
3
3
  require('../ActionRow-D6knpVd6.js');
4
4
  require('../error-codes-Ds0bnPvT.js');
5
- const require_commandkit = require('../commandkit-Dc56U1Ri.js');
5
+ const require_commandkit = require('../commandkit-DfAoP5wK.js');
6
6
  require('../warning-CszH8HeS.js');
7
7
  require('../common-CEordwf3.js');
8
8
  require('../common-C2jAjX4U.js');
@@ -41,7 +41,7 @@ require('../store-GrsErvli.js');
41
41
  require('../env-CQJgOkQD.js');
42
42
  const require_app_process = require('../app-process-DCkz7RlU.js');
43
43
  require('../type-checker-CEt5Inbw.js');
44
- const require_build = require('../build-C9EvWSOT.js');
44
+ const require_build = require('../build-BtdjPnMr.js');
45
45
  let node_crypto = require("node:crypto");
46
46
  let path = require("path");
47
47
  let chokidar = require("chokidar");
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('../chunk-nOFOJqeH.js');
2
2
  const require_constants = require('../constants-CxkFFZ7p.js');
3
- const require_version = require('../version-De1NA7Vn.js');
3
+ const require_version = require('../version-B9xiS1lg.js');
4
4
  let node_fs = require("node:fs");
5
5
  node_fs = require_chunk.__toESM(node_fs);
6
6
  let node_path = require("node:path");
@@ -22,7 +22,8 @@ const knownPlugins = [
22
22
  "@commandkit/i18n",
23
23
  "@commandkit/legacy",
24
24
  "@commandkit/queue",
25
- "@commandkit/redis"
25
+ "@commandkit/redis",
26
+ "@commandkit/workflow"
26
27
  ];
27
28
  /**
28
29
  * @private
@@ -1 +1 @@
1
- {"version":3,"file":"information.js","names":[],"sources":["../../src/cli/information.ts"],"sourcesContent":["import os from 'node:os';\nimport { execSync } from 'node:child_process';\nimport { version as commandkitVersion } from '../version';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { COMMANDKIT_CWD } from '../utils/constants';\n\n/**\n * @private\n * @internal\n */\nfunction $getKnownPlugins() {\n 'use macro';\n\n // remove name from the list when that plugin is stable\n const BLACKLISTED = new Set([\n 'commandkit', // core package itself, not a plugin\n 'create-commandkit', // generator, not a plugin\n 'tsconfig', // repo config related, not a plugin\n 'devtools-ui', // the ui part of devtools, not a plugin\n // the plugins below are TBD\n 'tasks',\n ]);\n\n const { readdirSync, readFileSync } =\n require('node:fs') as typeof import('node:fs');\n const { join } = require('node:path') as typeof path;\n\n const pluginsPath = join(__dirname, '..', '..', '..');\n\n const entries = readdirSync(pluginsPath, { withFileTypes: true }).filter(\n (e) => !BLACKLISTED.has(e.name),\n );\n\n const packages = entries.map((p) =>\n join(p.parentPath, p.name, 'package.json'),\n );\n\n const knownPlugins: string[] = [];\n\n for (const pkg of packages) {\n try {\n const { name } = JSON.parse(readFileSync(pkg, 'utf8'));\n if (name && !BLACKLISTED.has(name.replace('@commandkit/', ''))) {\n knownPlugins.push(name);\n }\n } catch {\n // Ignore errors\n }\n }\n\n return knownPlugins;\n}\n\nconst knownPlugins: string[] = $getKnownPlugins();\n\n/**\n * @private\n * @internal\n */\nfunction findPackageVersion(packageName: string) {\n try {\n const packageJsonPath = require.resolve(`${packageName}/package.json`);\n const packageJson = require(packageJsonPath);\n return packageJson.version;\n } catch (e) {\n try {\n const basePaths = [\n path.join(COMMANDKIT_CWD, 'node_modules', packageName),\n path.join(COMMANDKIT_CWD, '..', '..', 'node_modules', packageName),\n path.join(COMMANDKIT_CWD, '..', '..', '.pnpm', packageName),\n path.join(\n COMMANDKIT_CWD,\n '..',\n '..',\n 'node_modules',\n '.pnpm',\n packageName,\n ),\n ];\n\n for (const basePath of basePaths) {\n const packageJsonPath = path.join(basePath, 'package.json');\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(\n fs.readFileSync(packageJsonPath, 'utf8'),\n );\n return packageJson.version;\n }\n }\n\n const nodeModulesPath = path.join(\n COMMANDKIT_CWD,\n '..',\n '..',\n 'node_modules',\n '.pnpm',\n );\n if (fs.existsSync(nodeModulesPath)) {\n const folders = fs.readdirSync(nodeModulesPath);\n const packageFolder = folders.find((folder) =>\n folder.startsWith(`${packageName.replace('/', '+')}@`),\n );\n\n if (packageFolder) {\n const packageJsonPath = path.join(\n nodeModulesPath,\n packageFolder,\n 'node_modules',\n packageName,\n 'package.json',\n );\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(\n fs.readFileSync(packageJsonPath, 'utf8'),\n );\n return packageJson.version;\n }\n }\n }\n\n return null;\n } catch {\n return null;\n }\n }\n}\n\n/**\n * @private\n * @internal\n */\nfunction getBinaryVersion(binary: string) {\n try {\n const version = execSync(`${binary} --version`).toString().trim();\n return version;\n } catch {\n return null;\n }\n}\n\n/**\n * @private\n * @internal\n */\nexport async function showInformation() {\n const runtimeName: string = (() => {\n // @ts-ignore\n if ('Deno' in globalThis && typeof Deno !== 'undefined') return 'Deno';\n // @ts-ignore\n if ('Bun' in globalThis && typeof Bun !== 'undefined') return 'Bun';\n\n return 'Node.js';\n })();\n\n const info = {\n 'Operating System': {\n Platform: process.platform,\n Arch: process.arch,\n Version: os.version(),\n 'Available Memory (MB)': Math.round(os.totalmem() / 1024 / 1024),\n 'Available CPU cores': os.cpus().length,\n },\n Runtime: runtimeName,\n Binaries: {\n Node: process.version,\n npm: getBinaryVersion('npm') || 'N/A',\n Yarn: getBinaryVersion('yarn') || 'N/A',\n pnpm: getBinaryVersion('pnpm') || 'N/A',\n Bun: getBinaryVersion('bun') || 'N/A',\n Deno: (getBinaryVersion('deno') || 'N/A').replace(/\\n|\\r/g, ' '),\n },\n 'Relevant Packages': {\n commandkit: commandkitVersion,\n 'discord.js': findPackageVersion('discord.js') || 'N/A',\n typescript: findPackageVersion('typescript') || 'N/A',\n rolldown: findPackageVersion('rolldown') || 'N/A',\n tsdown: findPackageVersion('tsdown') || 'N/A',\n },\n 'CommandKit Plugins': knownPlugins.reduce(\n (acc, plugin) => {\n acc[plugin] = findPackageVersion(plugin) || 'N/A';\n return acc;\n },\n {} as Record<string, string>,\n ),\n };\n\n let output = '';\n\n for (const [section, data] of Object.entries(info)) {\n output += `${section}:\\n`;\n\n if (typeof data === 'string') {\n output += ` ${data}\\n\\n`;\n continue;\n }\n\n for (const [key, value] of Object.entries(data)) {\n output += ` ${key}: ${value}\\n`;\n }\n output += '\\n';\n }\n\n console.log(output.trim());\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsDA,MAAM,eAA2C;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;AAMjD,SAAS,mBAAmB,aAAqB;AAC/C,KAAI;EACF,MAAM,kBAAkB,QAAQ,QAAQ,GAAG,YAAY,eAAe;AAEtE,SADoB,QAAQ,gBAAgB,CACzB;UACZ,GAAG;AACV,MAAI;GACF,MAAM,YAAY;IAClB,kBAAK,KAAK,kCAAgB,gBAAgB,YAAY;IACtD,kBAAK,KAAK,kCAAgB,MAAM,MAAM,gBAAgB,YAAY;IAClE,kBAAK,KAAK,kCAAgB,MAAM,MAAM,SAAS,YAAY;IAC3D,kBAAK,KACH,kCACA,MACA,MACA,gBACA,SACA,YACD;IAAC;AAGF,QAAK,MAAM,YAAY,WAAW;IAChC,MAAM,kBAAkB,kBAAK,KAAK,UAAU,eAAe;AAC3D,QAAI,gBAAG,WAAW,gBAAgB,CAIhC,QAHoB,KAAK,MACvB,gBAAG,aAAa,iBAAiB,OAAO,CACzC,CACkB;;GAIvB,MAAM,kBAAkB,kBAAK,KAC3B,kCACA,MACA,MACA,gBACA,QACD;AACD,OAAI,gBAAG,WAAW,gBAAgB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ChC,KAAK,WAAW;AACf,OAAI,UAAU,mBAAmB,OAAO,IAAI;AAC5C,UAAO;KAET,EAAE,CACH;EACF;CAED,IAAI,SAAS;AAEb,MAAK,MAAM,CAAC,SAAS,SAAS,OAAO,QAAQ,KAAK,EAAE;AAClD,YAAU,GAAG,QAAQ;AAErB,MAAI,OAAO,SAAS,UAAU;AAC5B,aAAU,KAAK,KAAK;AACpB;;AAGF,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,CAC7C,WAAU,KAAK,IAAI,IAAI,MAAM;AAE/B,YAAU;;AAGZ,SAAQ,IAAI,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"information.js","names":[],"sources":["../../src/cli/information.ts"],"sourcesContent":["import os from 'node:os';\nimport { execSync } from 'node:child_process';\nimport { version as commandkitVersion } from '../version';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { COMMANDKIT_CWD } from '../utils/constants';\n\n/**\n * @private\n * @internal\n */\nfunction $getKnownPlugins() {\n 'use macro';\n\n // remove name from the list when that plugin is stable\n const BLACKLISTED = new Set([\n 'commandkit', // core package itself, not a plugin\n 'create-commandkit', // generator, not a plugin\n 'tsconfig', // repo config related, not a plugin\n 'devtools-ui', // the ui part of devtools, not a plugin\n // the plugins below are TBD\n 'tasks',\n ]);\n\n const { readdirSync, readFileSync } =\n require('node:fs') as typeof import('node:fs');\n const { join } = require('node:path') as typeof path;\n\n const pluginsPath = join(__dirname, '..', '..', '..');\n\n const entries = readdirSync(pluginsPath, { withFileTypes: true }).filter(\n (e) => !BLACKLISTED.has(e.name),\n );\n\n const packages = entries.map((p) =>\n join(p.parentPath, p.name, 'package.json'),\n );\n\n const knownPlugins: string[] = [];\n\n for (const pkg of packages) {\n try {\n const { name } = JSON.parse(readFileSync(pkg, 'utf8'));\n if (name && !BLACKLISTED.has(name.replace('@commandkit/', ''))) {\n knownPlugins.push(name);\n }\n } catch {\n // Ignore errors\n }\n }\n\n return knownPlugins;\n}\n\nconst knownPlugins: string[] = $getKnownPlugins();\n\n/**\n * @private\n * @internal\n */\nfunction findPackageVersion(packageName: string) {\n try {\n const packageJsonPath = require.resolve(`${packageName}/package.json`);\n const packageJson = require(packageJsonPath);\n return packageJson.version;\n } catch (e) {\n try {\n const basePaths = [\n path.join(COMMANDKIT_CWD, 'node_modules', packageName),\n path.join(COMMANDKIT_CWD, '..', '..', 'node_modules', packageName),\n path.join(COMMANDKIT_CWD, '..', '..', '.pnpm', packageName),\n path.join(\n COMMANDKIT_CWD,\n '..',\n '..',\n 'node_modules',\n '.pnpm',\n packageName,\n ),\n ];\n\n for (const basePath of basePaths) {\n const packageJsonPath = path.join(basePath, 'package.json');\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(\n fs.readFileSync(packageJsonPath, 'utf8'),\n );\n return packageJson.version;\n }\n }\n\n const nodeModulesPath = path.join(\n COMMANDKIT_CWD,\n '..',\n '..',\n 'node_modules',\n '.pnpm',\n );\n if (fs.existsSync(nodeModulesPath)) {\n const folders = fs.readdirSync(nodeModulesPath);\n const packageFolder = folders.find((folder) =>\n folder.startsWith(`${packageName.replace('/', '+')}@`),\n );\n\n if (packageFolder) {\n const packageJsonPath = path.join(\n nodeModulesPath,\n packageFolder,\n 'node_modules',\n packageName,\n 'package.json',\n );\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(\n fs.readFileSync(packageJsonPath, 'utf8'),\n );\n return packageJson.version;\n }\n }\n }\n\n return null;\n } catch {\n return null;\n }\n }\n}\n\n/**\n * @private\n * @internal\n */\nfunction getBinaryVersion(binary: string) {\n try {\n const version = execSync(`${binary} --version`).toString().trim();\n return version;\n } catch {\n return null;\n }\n}\n\n/**\n * @private\n * @internal\n */\nexport async function showInformation() {\n const runtimeName: string = (() => {\n // @ts-ignore\n if ('Deno' in globalThis && typeof Deno !== 'undefined') return 'Deno';\n // @ts-ignore\n if ('Bun' in globalThis && typeof Bun !== 'undefined') return 'Bun';\n\n return 'Node.js';\n })();\n\n const info = {\n 'Operating System': {\n Platform: process.platform,\n Arch: process.arch,\n Version: os.version(),\n 'Available Memory (MB)': Math.round(os.totalmem() / 1024 / 1024),\n 'Available CPU cores': os.cpus().length,\n },\n Runtime: runtimeName,\n Binaries: {\n Node: process.version,\n npm: getBinaryVersion('npm') || 'N/A',\n Yarn: getBinaryVersion('yarn') || 'N/A',\n pnpm: getBinaryVersion('pnpm') || 'N/A',\n Bun: getBinaryVersion('bun') || 'N/A',\n Deno: (getBinaryVersion('deno') || 'N/A').replace(/\\n|\\r/g, ' '),\n },\n 'Relevant Packages': {\n commandkit: commandkitVersion,\n 'discord.js': findPackageVersion('discord.js') || 'N/A',\n typescript: findPackageVersion('typescript') || 'N/A',\n rolldown: findPackageVersion('rolldown') || 'N/A',\n tsdown: findPackageVersion('tsdown') || 'N/A',\n },\n 'CommandKit Plugins': knownPlugins.reduce(\n (acc, plugin) => {\n acc[plugin] = findPackageVersion(plugin) || 'N/A';\n return acc;\n },\n {} as Record<string, string>,\n ),\n };\n\n let output = '';\n\n for (const [section, data] of Object.entries(info)) {\n output += `${section}:\\n`;\n\n if (typeof data === 'string') {\n output += ` ${data}\\n\\n`;\n continue;\n }\n\n for (const [key, value] of Object.entries(data)) {\n output += ` ${key}: ${value}\\n`;\n }\n output += '\\n';\n }\n\n console.log(output.trim());\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsDA,MAAM,eAA2C;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;AAMjD,SAAS,mBAAmB,aAAqB;AAC/C,KAAI;EACF,MAAM,kBAAkB,QAAQ,QAAQ,GAAG,YAAY,eAAe;AAEtE,SADoB,QAAQ,gBAAgB,CACzB;UACZ,GAAG;AACV,MAAI;GACF,MAAM,YAAY;IAClB,kBAAK,KAAK,kCAAgB,gBAAgB,YAAY;IACtD,kBAAK,KAAK,kCAAgB,MAAM,MAAM,gBAAgB,YAAY;IAClE,kBAAK,KAAK,kCAAgB,M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AAI;GAChC,MAAM,iBAAiB,OAAO,IAAI;GAClC,MAAM,iBAAiB,OAAO,IAAI;GAClC,KAAK,iBAAiB,MAAM,IAAI;GAChC,OAAO,iBAAiB,OAAO,IAAI,OAAO,QAAQ,UAAU,IAAI;GACjE;EACD,qBAAqB;GACnB,YAAY;GACZ,cAAc,mBAAmB,aAAa,IAAI;GAClD,YAAY,mBAAmB,aAAa,IAAI;GAChD,UAAU,mBAAmB,WAAW,IAAI;GAC5C,QAAQ,mBAAmB,SAAS,IAAI;GACzC;EACD,sBAAsB,aAAa,QAChC,KAAK,WAAW;AACf,OAAI,UAAU,mBAAmB,OAAO,IAAI;AAC5C,UAAO;KAET,EAAE,CACH;EACF;CAED,IAAI,SAAS;AAEb,MAAK,MAAM,CAAC,SAAS,SAAS,OAAO,QAAQ,KAAK,EAAE;AAClD,YAAU,GAAG,QAAQ;AAErB,MAAI,OAAO,SAAS,UAAU;AAC5B,aAAU,KAAK,KAAK;AACpB;;AAGF,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,CAC7C,WAAU,KAAK,IAAI,IAAI,MAAM;AAE/B,YAAU;;AAGZ,SAAQ,IAAI,OAAO,MAAM,CAAC"}
package/dist/cli/init.js CHANGED
@@ -2,7 +2,7 @@ const require_chunk = require('../chunk-nOFOJqeH.js');
2
2
  require('../colors-CLmBiP9I.js');
3
3
  require('../ActionRow-D6knpVd6.js');
4
4
  require('../error-codes-Ds0bnPvT.js');
5
- const require_commandkit = require('../commandkit-Dc56U1Ri.js');
5
+ const require_commandkit = require('../commandkit-DfAoP5wK.js');
6
6
  require('../warning-CszH8HeS.js');
7
7
  require('../common-CEordwf3.js');
8
8
  require('../common-C2jAjX4U.js');
@@ -74,7 +74,7 @@ async function bootstrapCommandkitCLI(argv, options) {
74
74
  program.command("create").description("Create new files using built-in templates or custom plugin templates").argument("<template>", "The template to use (e.g. command, event, or custom plugin template)").argument("[args...]", "Additional arguments for the template").action(async (template, args) => {
75
75
  setCLIEnv();
76
76
  const { plugins } = await require_commandkit.loadConfigFile();
77
- const runtime = new require_commandkit.CompilerPluginRuntime(plugins.filter((p) => require_CompilerPlugin.isCompilerPlugin(p)));
77
+ const runtime = new require_commandkit.CompilerPluginRuntime(plugins.filter((p) => require_CompilerPlugin.isCompilerPlugin(p)), true);
78
78
  try {
79
79
  await runtime.init();
80
80
  const templateHandler = runtime.getTemplate(template);
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","names":[],"sources":["../../src/cli/init.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { generateTypesPackage } from '../utils/types-package';\nimport { loadConfigFile } from '../config/loader';\nimport {\n CompilerPlugin,\n CompilerPluginRuntime,\n isCompilerPlugin,\n} from '../plugins';\nimport { panic } from './common';\nimport { COMMANDKIT_CWD } from '../utils/constants';\n\n/**\n * Creates a command line interface for CommandKit.\n * @param argv The arguments passed to the CLI.\n * @param options The options passed to the CLI.\n */\nexport async function bootstrapCommandkitCLI(\n argv: string[],\n options?: import('commander').ParseOptions | undefined,\n) {\n process.title = 'CommandKit CLI';\n\n // imports are lazily loaded when the cli is used, instead of loading it with the lib itself\n const { Command } = await import('commander');\n const { bootstrapDevelopmentServer } = await import('./development');\n const { bootstrapProductionServer, createProductionBuild } = await import(\n './production'\n );\n const { generateCommand, generateEvent } = await import('./generators');\n const { version } = await import('../version');\n const { showInformation } = await import('./information');\n const { setCLIEnv } = await import('./env');\n\n const program = new Command('commandkit');\n\n program\n .command('dev')\n .version(version)\n .description('Start your bot in development mode.')\n .option(\n '-c, --config [path]',\n 'Path to your commandkit config file.',\n './commandkit.js',\n )\n .action(() => {\n const options = program.opts();\n bootstrapDevelopmentServer(options.config);\n });\n\n program\n .command('info')\n .description(\n 'Show information about the system which can be used to report bugs.',\n )\n .action(async () => {\n await showInformation();\n });\n\n program\n .command('start')\n .description(\n 'Start your bot in production mode after running the build command.',\n )\n .option('-c, --config [path]', 'Path to your commandkit config file.')\n .action(() => {\n const options = program.opts();\n bootstrapProductionServer(options.config);\n });\n\n program\n .command('build')\n .description('Build your project for production usage.')\n .option('-c, --config [path]', 'Path to your commandkit config file.')\n .action(() => {\n setCLIEnv();\n const options = program.opts();\n return createProductionBuild(options.config);\n });\n\n program\n .command('create')\n .description(\n 'Create new files using built-in templates or custom plugin templates',\n )\n .argument(\n '<template>',\n 'The template to use (e.g. command, event, or custom plugin template)',\n )\n .argument('[args...]', 'Additional arguments for the template')\n .action(async (template, args) => {\n setCLIEnv();\n\n // Handle custom plugin templates\n const { plugins } = await loadConfigFile();\n const runtime = new CompilerPluginRuntime(\n plugins.filter((p) => isCompilerPlugin(p)) as CompilerPlugin[],\n );\n\n try {\n await runtime.init();\n const templateHandler = runtime.getTemplate(template);\n\n if (!templateHandler) {\n // Handle built-in templates\n if (template === 'command') {\n const [name] = args;\n if (!name) {\n panic('Command name is required');\n }\n await generateCommand(name);\n return;\n }\n\n if (template === 'event') {\n const [name] = args;\n if (!name) {\n panic('Event name is required');\n }\n await generateEvent(name);\n return;\n }\n\n const valid = Array.from(\n new Set([\n 'command',\n 'event',\n ...Array.from(runtime.getTemplates().keys()),\n ]),\n ).map((t) => `\"${t}\"`);\n\n panic(\n `Template \"${template}\" not found. Available templates: ${valid.join(', ')}`,\n );\n }\n\n await templateHandler(args);\n } catch (e: any) {\n panic(`Failed to execute template \"${template}\": ${e?.message || e}`);\n } finally {\n await runtime.destroy();\n }\n });\n\n const types = join(COMMANDKIT_CWD, 'node_modules', 'commandkit-types');\n\n if (!existsSync(types)) {\n await mkdir(types, { recursive: true }).catch(() => {});\n await generateTypesPackage(true).catch(() => {});\n }\n\n await program.parseAsync(argv, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,eAAsB,uBACtB,MACA,SACA;AACE,SAAQ,QAAQ;CAGhB,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM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QAAI,aAAa,SAAS;KACxB,MAAM,CAAC,QAAQ;AACf,SAAI,CAAC,KACH,wBAAM,yBAAyB;AAEjC,WAAM,cAAc,KAAK;AACzB;;AAWF,2BACE,aAAa,SAAS,oCATV,MAAM,KAClB,IAAI,IAAI;KACR;KACA;KACA,GAAG,MAAM,KAAK,QAAQ,cAAc,CAAC,MAAM,CAAC;KAAC,CAC5C,CACF,CAAC,KAAK,MAAM,IAAI,EAAE,GAAG,CAG4C,KAAK,KAAK,GAC3E;;AAGH,SAAM,gBAAgB,KAAK;WACpB,GAAQ;AACf,0BAAM,+BAA+B,SAAS,4CAAK,EAAG,YAAW,IAAI;YAC7D;AACR,SAAM,QAAQ,SAAS;;GAEzB;CAEF,MAAM,4BAAa,kCAAgB,gBAAgB,mBAAmB;AAEtE,KAAI,yBAAY,MAAM,EAAE;AACtB,oCAAY,OAAO,EAAE,WAAW,MAAM,CAAC,CAAC,YAAY,GAAG;AACvD,QAAM,2CAAqB,KAAK,CAAC,YAAY,GAAG;;AAGlD,OAAM,QAAQ,WAAW,MAAM,QAAQ"}
1
+ {"version":3,"file":"init.js","names":[],"sources":["../../src/cli/init.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { generateTypesPackage } from '../utils/types-package';\nimport { loadConfigFile } from '../config/loader';\nimport {\n CompilerPlugin,\n CompilerPluginRuntime,\n isCompilerPlugin,\n} from '../plugins';\nimport { panic } from './common';\nimport { COMMANDKIT_CWD } from '../utils/constants';\n\n/**\n * Creates a command line interface for CommandKit.\n * @param argv The arguments passed to the CLI.\n * @param options The options passed to the CLI.\n */\nexport async function bootstrapCommandkitCLI(\n argv: string[],\n options?: import('commander').ParseOptions | undefined,\n) {\n process.title = 'CommandKit CLI';\n\n // imports are lazily loaded when the cli is used, instead of loading it with the lib itself\n const { Command } = await import('commander');\n const { bootstrapDevelopmentServer } = await import('./development');\n const { bootstrapProductionServer, createProductionBuild } = await import(\n './production'\n );\n const { generateCommand, generateEvent } = await import('./generators');\n const { version } = await import('../version');\n const { showInformation } = await import('./information');\n const { setCLIEnv } = await import('./env');\n\n const program = new Command('commandkit');\n\n program\n .command('dev')\n .version(version)\n .description('Start your bot in development mode.')\n .option(\n '-c, --config [path]',\n 'Path to your commandkit config file.',\n './commandkit.js',\n )\n .action(() => {\n const options = program.opts();\n bootstrapDevelopmentServer(options.config);\n });\n\n program\n .command('info')\n .description(\n 'Show information about the system which can be used to report bugs.',\n )\n .action(async () => {\n await showInformation();\n });\n\n program\n .command('start')\n .description(\n 'Start your bot in production mode after running the build command.',\n )\n .option('-c, --config [path]', 'Path to your commandkit config file.')\n .action(() => {\n const options = program.opts();\n bootstrapProductionServer(options.config);\n });\n\n program\n .command('build')\n .description('Build your project for production usage.')\n .option('-c, --config [path]', 'Path to your commandkit config file.')\n .action(() => {\n setCLIEnv();\n const options = program.opts();\n return createProductionBuild(options.config);\n });\n\n program\n .command('create')\n .description(\n 'Create new files using built-in templates or custom plugin templates',\n )\n .argument(\n '<template>',\n 'The template to use (e.g. command, event, or custom plugin template)',\n )\n .argument('[args...]', 'Additional arguments for the template')\n .action(async (template, args) => {\n setCLIEnv();\n\n // Handle custom plugin templates\n const { plugins } = await loadConfigFile();\n const runtime = new CompilerPluginRuntime(\n plugins.filter((p) => isCompilerPlugin(p)) as CompilerPlugin[],\n true,\n );\n\n try {\n await runtime.init();\n const templateHandler = runtime.getTemplate(template);\n\n if (!templateHandler) {\n // Handle built-in templates\n if (template === 'command') {\n const [name] = args;\n if (!name) {\n panic('Command name is required');\n }\n await generateCommand(name);\n return;\n }\n\n if (template === 'event') {\n const [name] = args;\n if (!name) {\n panic('Event name is required');\n }\n await generateEvent(name);\n return;\n }\n\n const valid = Array.from(\n new Set([\n 'command',\n 'event',\n ...Array.from(runtime.getTemplates().keys()),\n ]),\n ).map((t) => `\"${t}\"`);\n\n panic(\n `Template \"${template}\" not found. Available templates: ${valid.join(', ')}`,\n );\n }\n\n await templateHandler(args);\n } catch (e: any) {\n panic(`Failed to execute template \"${template}\": ${e?.message || e}`);\n } finally {\n await runtime.destroy();\n }\n });\n\n const types = join(COMMANDKIT_CWD, 'node_modules', 'commandkit-types');\n\n if (!existsSync(types)) {\n await mkdir(types, { recursive: true }).catch(() => {});\n await generateTypesPackage(true).catch(() => {});\n }\n\n await program.parseAsync(argv, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,eAAsB,uBACtB,MACA,SACA;AACE,SAAQ,QAAQ;CAGhB,MAAM,EAAE,YAAY,MAAM,OAAO;CACjC,MAAM,EAAE,+BAA+B,2CAAM;CAC7C,MAAM,EAAE,2BAA2B,0BAA0B,2CAAM;CAGnE,MAAM,EAAE,iBAAiB,kBAAkB,2CAAM;CACjD,MAAM,EAAE,YAAY,2CAAM;CAC1B,MAAM,EAAE,oBAAoB,2CAAM;CAClC,MAAM,EAAE,cAAc,2CAAM;CAE5B,MAAM,UAAU,IAAI,QAAQ,aAAa;AAEzC,SACA,QAAQ,MAAM,CACd,QAAQ,QAAQ,CAChB,YAAY,sCAAsC,CAClD,OACE,uBACA,wCACA,kBACD,CACD,aAAa;AAEX,6BADgB,QAAQ,MAAM,CACK,OAAO;GAC1C;AAEF,SACA,QAAQ,OAAO,CACf,YACE,sEACD,CACD,OAAO,YAAY;AACjB,QAAM,iBAAiB;GACvB;AAEF,SACA,QAAQ,QAAQ,CAChB,YACE,qEACD,CACD,OAAO,uBAAuB,uCAAuC,CACrE,aAAa;AAEX,4BADgB,QAAQ,MAAM,CACI,OAAO;GACzC;AAEF,SACA,QAAQ,QAAQ,CAChB,YAAY,2CAA2C,CACvD,OAAO,uBAAuB,uCAAuC,CACrE,aAAa;AACX,aAAW;AAEX,SAAO,sBADS,QAAQ,MAAM,CACO,OAAO;GAC5C;AAEF,SACA,QAAQ,SAAS,CACjB,YACE,uEACD,CACD,SACE,cACA,uEACD,CACD,SAAS,aAAa,wCAAwC,CAC9D,OAAO,OAAO,UAAU,SAAS;AAC/B,aAAW;EAGX,MAAM,EAAE,YAAY,MAAM,mCAAgB;EAC1C,MAAM,UAAU,IAAI,yCAClB,QAAQ,QAAQ,MAAM,wCAAiB,EAAE,CAAC,EAC1C,KACD;AAED,MAAI;AACF,SAAM,QAAQ,MAAM;GACpB,MAAM,kBAAkB,QAAQ,YAAY,SAAS;AAErD,OAAI,CAAC,iBAAiB;AAEpB,QAAI,aAAa,WAAW;KAC1B,MAAM,CAAC,QAAQ;AACf,SAAI,CAAC,KACH,wBAAM,2BAA2B;AAEnC,WAAM,gBAAgB,KAAK;AAC3B;;AAGF,QAAI,aAAa,SAAS;KACxB,MAAM,CAAC,QAAQ;AACf,SAAI,CAAC,KACH,wBAAM,yBAAyB;AAEjC,WAAM,cAAc,KAAK;AACzB;;AAWF,2BACE,aAAa,SAAS,oCATV,MAAM,KAClB,IAAI,IAAI;KACR;KACA;KACA,GAAG,MAAM,KAAK,QAAQ,cAAc,CAAC,MAAM,CAAC;KAAC,CAC5C,CACF,CAAC,KAAK,MAAM,IAAI,EAAE,GAAG,CAG4C,KAAK,KAAK,GAC3E;;AAGH,SAAM,gBAAgB,KAAK;WACpB,GAAQ;AACf,0BAAM,+BAA+B,SAAS,4CAAK,EAAG,YAAW,IAAI;YAC7D;AACR,SAAM,QAAQ,SAAS;;GAEzB;CAEF,MAAM,4BAAa,kCAAgB,gBAAgB,mBAAmB;AAEtE,KAAI,yBAAY,MAAM,EAAE;AACtB,oCAAY,OAAO,EAAE,WAAW,MAAM,CAAC,CAAC,YAAY,GAAG;AACvD,QAAM,2CAAqB,KAAK,CAAC,YAAY,GAAG;;AAGlD,OAAM,QAAQ,WAAW,MAAM,QAAQ"}
@@ -2,7 +2,7 @@ const require_chunk = require('../chunk-nOFOJqeH.js');
2
2
  require('../colors-CLmBiP9I.js');
3
3
  require('../ActionRow-D6knpVd6.js');
4
4
  require('../error-codes-Ds0bnPvT.js');
5
- const require_commandkit = require('../commandkit-Dc56U1Ri.js');
5
+ const require_commandkit = require('../commandkit-DfAoP5wK.js');
6
6
  require('../warning-CszH8HeS.js');
7
7
  require('../common-CEordwf3.js');
8
8
  require('../common-C2jAjX4U.js');
@@ -41,7 +41,7 @@ require('../store-GrsErvli.js');
41
41
  require('../env-CQJgOkQD.js');
42
42
  const require_app_process = require('../app-process-DCkz7RlU.js');
43
43
  require('../type-checker-CEt5Inbw.js');
44
- const require_build = require('../build-C9EvWSOT.js');
44
+ const require_build = require('../build-BtdjPnMr.js');
45
45
  const require_utils$1 = require('../utils-DGovVwyA.js');
46
46
  let fs = require("fs");
47
47
 
@@ -1535,9 +1535,11 @@ var CompilerPluginRuntime = class {
1535
1535
  /**
1536
1536
  * Creates a new instance of CompilerPluginRuntime.
1537
1537
  * @param plugins An array of compiler plugins to be managed by this runtime.
1538
+ * @param isDevMode Whether the build is in development mode.
1538
1539
  */
1539
- constructor(plugins) {
1540
+ constructor(plugins, isDevMode) {
1540
1541
  this.plugins = plugins;
1542
+ this.isDevMode = isDevMode;
1541
1543
  this.plugins = this.plugins.filter((p) => !!p && require_CompilerPlugin.isCompilerPlugin(p));
1542
1544
  }
1543
1545
  /**
@@ -1698,6 +1700,7 @@ var CommonDirectiveTransformer = class extends require_CompilerPlugin.CompilerPl
1698
1700
  if (!this.options.enabled) return null;
1699
1701
  if (!this.transformer) return null;
1700
1702
  if (/\.json$/.test(params.id)) return null;
1703
+ if (!params.code.includes(this.options.directive)) return null;
1701
1704
  return {
1702
1705
  code: (await this.transformer(params.code.toString(), params.id)).contents,
1703
1706
  map: null
@@ -1731,6 +1734,7 @@ var MacroPlugin = class extends require_CompilerPlugin.CompilerPlugin {
1731
1734
  async transform(params) {
1732
1735
  if (!this.options.enabled) return null;
1733
1736
  if (/\.json$/.test(params.id)) return null;
1737
+ if (!params.code.includes("use macro")) return null;
1734
1738
  const { contents } = await this.macroTransformer.transform(params.code, params.id);
1735
1739
  return {
1736
1740
  code: typeof contents === "string" ? contents : new TextDecoder().decode(contents),
@@ -4618,4 +4622,4 @@ Object.defineProperty(exports, 'useStore', {
4618
4622
  return useStore;
4619
4623
  }
4620
4624
  });
4621
- //# sourceMappingURL=commandkit-Dc56U1Ri.js.map
4625
+ //# sourceMappingURL=commandkit-DfAoP5wK.js.map