commandkit 1.2.0-rc.4 → 1.2.0-rc.5
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/{EventWorkerContext-BEezHh5-.d.ts → EventWorkerContext-D9frVhVe.d.ts} +2 -2
- package/dist/{RuntimePlugin-CBgBLXTG.js → RuntimePlugin-eTdFJwGd.js} +2 -1
- package/dist/RuntimePlugin-eTdFJwGd.js.map +1 -0
- package/dist/analytics/analytics-engine.d.ts +1 -1
- package/dist/analytics/analytics-engine.js +5 -5
- package/dist/analytics/analytics-provider.d.ts +1 -1
- package/dist/analytics/utils.js +5 -5
- package/dist/{analytics-engine-Iu_1uJop.d.ts → analytics-engine-CtMbeudW.d.ts} +7 -1
- package/dist/app/commands/AppCommandRunner.d.ts +1 -1
- package/dist/app/commands/AppCommandRunner.js +5 -5
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +5 -5
- package/dist/app/events/EventWorkerContext.d.ts +2 -2
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
- package/dist/app/handlers/AppCommandHandler.js +5 -5
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +5 -5
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.js +5 -5
- package/dist/app/middlewares/permissions.d.ts +1 -1
- package/dist/app/middlewares/permissions.js +5 -5
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +5 -5
- package/dist/{build-Yhb1VjD0.js → build-D52II1qS.js} +4 -3
- package/dist/build-D52II1qS.js.map +1 -0
- package/dist/cli/build.d.ts +1 -1
- package/dist/cli/build.js +6 -6
- package/dist/cli/common.d.ts +1 -1
- package/dist/cli/development.js +6 -6
- package/dist/cli/generators.js +33 -5
- package/dist/cli/generators.js.map +1 -1
- package/dist/cli/information.js +1 -1
- package/dist/cli/init.js +6 -6
- package/dist/cli/production.js +6 -6
- package/dist/{commandkit-c0sAaK0G.js → commandkit-BPtNCbV8.js} +15 -4
- package/dist/commandkit-BPtNCbV8.js.map +1 -0
- package/dist/commandkit.d.ts +1 -1
- package/dist/commandkit.js +5 -5
- package/dist/components/index.js +5 -5
- package/dist/components/v1/button/Button.js +5 -5
- package/dist/components/v1/button/ButtonKit.js +5 -5
- package/dist/components/v1/modal/Modal.js +5 -5
- package/dist/components/v1/modal/ModalKit.js +5 -5
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +5 -5
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +5 -5
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +5 -5
- package/dist/components/v1/select-menu/SelectMenu.js +5 -5
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +5 -5
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +5 -5
- package/dist/config/config.d.ts +2 -2
- package/dist/config/config.js +5 -5
- package/dist/config/default.d.ts +1 -1
- package/dist/config/default.js +5 -5
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.js +5 -5
- package/dist/config/types.d.ts +1 -1
- package/dist/config/utils.d.ts +1 -1
- package/dist/config/utils.js +1 -1
- package/dist/{config-ClEaYnf1.d.ts → config-E42bG1RK.d.ts} +2 -2
- package/dist/context/async-context.d.ts +1 -1
- package/dist/context/async-context.js +5 -5
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +5 -5
- package/dist/events/CommandKitEventsChannel.d.ts +1 -1
- package/dist/{feature-flags-Dxi9TI2e.js → feature-flags-BZ3mW1xe.js} +2 -2
- package/dist/{feature-flags-Dxi9TI2e.js.map → feature-flags-BZ3mW1xe.js.map} +1 -1
- package/dist/flags/FlagProvider.d.ts +1 -1
- package/dist/flags/feature-flags.d.ts +1 -1
- package/dist/flags/feature-flags.js +6 -6
- package/dist/flags/store.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/{init-CrFvqdxZ.js → init-BjFLN5XX.js} +2 -2
- package/dist/{init-CrFvqdxZ.js.map → init-BjFLN5XX.js.map} +1 -1
- package/dist/logger/DefaultLogger.js +5 -5
- package/dist/logger/Logger.js +5 -5
- package/dist/plugins/CompilerPlugin.d.ts +1 -1
- package/dist/plugins/PluginCommon.d.ts +1 -1
- package/dist/plugins/RuntimePlugin.d.ts +1 -1
- package/dist/plugins/RuntimePlugin.js +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +5 -5
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +5 -5
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +5 -5
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +5 -5
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +5 -5
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/runtime.js +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/{resolve-file-url-DHTQj2mU.js → resolve-file-url-DYjaxg_S.js} +1 -1
- package/dist/{resolve-file-url-DHTQj2mU.js.map → resolve-file-url-DYjaxg_S.js.map} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/dev-hooks.d.ts +1 -1
- package/dist/utils/dev-hooks.js +5 -5
- package/dist/utils/resolve-file-url.js +1 -1
- package/dist/utils/utilities.js +5 -5
- package/dist/{utils-BnXM4eKk.js → utils-KsNof0Xz.js} +1 -1
- package/dist/{utils-BnXM4eKk.js.map → utils-KsNof0Xz.js.map} +1 -1
- package/dist/{version-BoHnO-Go.js → version-DBXZ4wRb.js} +2 -2
- package/dist/{version-BoHnO-Go.js.map → version-DBXZ4wRb.js.map} +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/RuntimePlugin-CBgBLXTG.js.map +0 -1
- package/dist/build-Yhb1VjD0.js.map +0 -1
- package/dist/commandkit-c0sAaK0G.js.map +0 -1
- /package/dist/{runtime-5fxB4uhe.js → runtime-DB9CiPfe.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandKit } from "./analytics-engine-
|
|
1
|
+
import { CommandKit } from "./analytics-engine-CtMbeudW.js";
|
|
2
2
|
import { ParsedEvent } from "./EventsRouter-BacqK6z3.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 { EventWorkerContext, eventWorkerContext, getEventWorkerContext, isEventWorkerContext, runInEventWorkerContext };
|
|
43
|
-
//# sourceMappingURL=EventWorkerContext-
|
|
43
|
+
//# sourceMappingURL=EventWorkerContext-D9frVhVe.d.ts.map
|
|
@@ -6,6 +6,7 @@ const require_PluginCommon = require('./PluginCommon-Di1xIa8d.js');
|
|
|
6
6
|
*/
|
|
7
7
|
var RuntimePlugin = class extends require_PluginCommon.PluginCommon {
|
|
8
8
|
type = require_PluginCommon.PluginType.Runtime;
|
|
9
|
+
preload = /* @__PURE__ */ new Set();
|
|
9
10
|
/**
|
|
10
11
|
* Called before commands are loaded
|
|
11
12
|
*/
|
|
@@ -130,4 +131,4 @@ Object.defineProperty(exports, 'isRuntimePlugin', {
|
|
|
130
131
|
return isRuntimePlugin;
|
|
131
132
|
}
|
|
132
133
|
});
|
|
133
|
-
//# sourceMappingURL=RuntimePlugin-
|
|
134
|
+
//# sourceMappingURL=RuntimePlugin-eTdFJwGd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuntimePlugin-eTdFJwGd.js","names":[],"sources":["../src/plugins/RuntimePlugin.ts"],"sourcesContent":["import { Interaction, Message } from 'discord.js';\nimport {\n isPlugin,\n PluginCommon,\n PluginOptions,\n PluginType,\n} from './PluginCommon';\nimport type { CommandKitPluginRuntime } from './plugin-runtime/CommandKitPluginRuntime';\nimport { CommandBuilderLike, PreparedAppCommandExecution } from '../app';\nimport { CommandKitEnvironment } from '../context/environment';\nimport { CommandKitHMREvent } from '../utils/dev-hooks';\nimport { PreRegisterCommandsEvent } from '../app/register/CommandRegistrar';\nimport { CommandKitEventDispatch } from './types';\n\n/**\n * CommandKit plugin that runs at the runtime.\n */\nexport abstract class RuntimePlugin<\n T extends PluginOptions = PluginOptions,\n> extends PluginCommon<T, CommandKitPluginRuntime> {\n public readonly type = PluginType.Runtime;\n public readonly preload = new Set<string>();\n\n /**\n * Called before commands are loaded\n */\n public async onBeforeCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands are loaded\n */\n public async onAfterCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before events are loaded\n */\n public async onBeforeEventsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after events are loaded\n */\n public async onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void> {}\n\n /**\n * Called before the client logs in\n */\n public async onBeforeClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after the client logs in\n */\n public async onAfterClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before interaction is handled\n * @param interaction The interaction\n */\n public async onBeforeInteraction(\n ctx: CommandKitPluginRuntime,\n interaction: Interaction,\n ): Promise<void> {}\n\n /**\n * Called before message command is processed\n * @param message The message\n */\n public async onBeforeMessageCommand(\n ctx: CommandKitPluginRuntime,\n message: Message,\n ): Promise<void> {}\n\n /**\n * Called before command is executed. This method can execute the command itself.\n * @param source The source that triggered the command\n * @param command The command\n * @param execute The function that executes the command\n */\n public async executeCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n source: Interaction | Message,\n command: PreparedAppCommandExecution,\n execute: () => Promise<any>,\n ): Promise<boolean> {\n return false;\n }\n\n /**\n * Called after events router is initialized\n * @param ctx The context\n */\n public async onEventsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands router is initialized\n * @param ctx The context\n */\n public async onCommandsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called when HMR event is received\n * @param ctx The context\n * @param event The event\n */\n public async performHMR(\n ctx: CommandKitPluginRuntime,\n event: CommandKitHMREvent,\n ): Promise<void> {}\n\n /**\n * Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.\n * @param ctx The context\n * @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command\n */\n async prepareCommand(\n ctx: CommandKitPluginRuntime,\n commands: CommandBuilderLike,\n ): Promise<CommandBuilderLike | null> {\n return null;\n }\n\n /**\n * Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.\n * @param ctx The context\n * @param data The command registration data\n */\n async onBeforeRegisterCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before global commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGlobalCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforePrepareGuildCommandsRegistration(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGuildCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called after command and all of its deferred functions are executed.\n * @param ctx The context\n * @param env The environment of the command. This environment contains the command execution data such as command context and more.\n */\n async onAfterCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n ) {}\n\n /**\n * Called before emitting an event\n * @param ctx The context\n * @param event The event that is being emitted\n */\n public async willEmitEvent(\n ctx: CommandKitPluginRuntime,\n event: CommandKitEventDispatch,\n ) {}\n}\n\nexport function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin {\n return (\n plugin instanceof RuntimePlugin ||\n (isPlugin(plugin) && plugin.type === PluginType.Runtime)\n );\n}\n"],"mappings":";;;;;;AAiBA,IAAsB,gBAAtB,cAEA,kCAAyC;CACvC,AAAgB,OAAO,gCAAW;CAClC,AAAgB,0BAAU,IAAI;;;;CAK9B,MAAa,qBACb,KACgB;;;;CAKhB,MAAa,oBACb,KACgB;;;;CAKhB,MAAa,mBACb,KACgB;;;;CAKhB,MAAa,kBAAkB,KAA6C;;;;CAK5E,MAAa,oBACb,KACgB;;;;CAKhB,MAAa,mBACb,KACgB;;;;;CAMhB,MAAa,oBACb,KACA,aACgB;;;;;CAMhB,MAAa,uBACb,KACA,SACgB;;;;;;;CAQhB,MAAa,eACb,KACA,KACA,QACA,SACA,SACmB;AACjB,SAAO;;;;;;CAOT,MAAa,mBACb,KACgB;;;;;CAMhB,MAAa,qBACb,KACgB;;;;;;CAOhB,MAAa,WACb,KACA,OACgB;;;;;;CAOhB,MAAM,eACN,KACA,UACqC;AACnC,SAAO;;;;;;;CAQT,MAAM,yBACN,KACA,OACgB;;;;;;;CAQhB,MAAM,+BACN,KACA,OACgB;;;;;;;CAQhB,MAAM,yCACN,KACA,OACgB;;;;;;;CAQhB,MAAM,8BACN,KACA,OACgB;;;;;;CAOhB,MAAM,eACN,KACA,KACA;;;;;;CAOA,MAAa,cACb,KACA,OACA;;AAGF,SAAgB,gBAAgB,QAA0C;AACxE,QACE,kBAAkB,iBAClB,8BAAS,WAAW,OAAO,SAAS,gCAAW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalyticsEngine, FilterFunction } from "../analytics-engine-
|
|
1
|
+
import { AnalyticsEngine, FilterFunction } from "../analytics-engine-CtMbeudW.js";
|
|
2
2
|
import "../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../ModalKit-Btz58KYn.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../error-codes-Ds0bnPvT.js');
|
|
4
|
-
const require_commandkit = require('../commandkit-
|
|
4
|
+
const require_commandkit = require('../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../common-CcfjYnPG.js');
|
|
6
6
|
require('../common-vnMIelAE.js');
|
|
7
7
|
require('../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../RuntimePlugin-
|
|
20
|
+
require('../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../types-q0Nm882H.js');
|
|
22
|
-
require('../
|
|
23
|
-
require('../
|
|
24
|
-
require('../
|
|
22
|
+
require('../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../utils-KsNof0Xz.js');
|
|
25
25
|
require('../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../constants-DxfYtA6t.js');
|
|
27
27
|
require('../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalyticsEvent, AnalyticsProvider, IdentifyEvent } from "../analytics-engine-
|
|
1
|
+
import { AnalyticsEvent, AnalyticsProvider, IdentifyEvent } from "../analytics-engine-CtMbeudW.js";
|
|
2
2
|
import "../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../ModalKit-Btz58KYn.js";
|
package/dist/analytics/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../error-codes-Ds0bnPvT.js');
|
|
4
|
-
const require_commandkit = require('../commandkit-
|
|
4
|
+
const require_commandkit = require('../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../common-CcfjYnPG.js');
|
|
6
6
|
require('../common-vnMIelAE.js');
|
|
7
7
|
require('../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../RuntimePlugin-
|
|
20
|
+
require('../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../types-q0Nm882H.js');
|
|
22
|
-
require('../
|
|
23
|
-
require('../
|
|
24
|
-
require('../
|
|
22
|
+
require('../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../utils-KsNof0Xz.js');
|
|
25
25
|
require('../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../constants-DxfYtA6t.js');
|
|
27
27
|
require('../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -1091,6 +1091,7 @@ declare function registerDevHooks(commandkit: CommandKit): void;
|
|
|
1091
1091
|
*/
|
|
1092
1092
|
declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CommandKitPluginRuntime> {
|
|
1093
1093
|
readonly type = PluginType.Runtime;
|
|
1094
|
+
readonly preload: Set<string>;
|
|
1094
1095
|
/**
|
|
1095
1096
|
* Called before commands are loaded
|
|
1096
1097
|
*/
|
|
@@ -1478,6 +1479,11 @@ declare class CommandKitPluginRuntime {
|
|
|
1478
1479
|
* @param plugin The plugin to be fetched.
|
|
1479
1480
|
*/
|
|
1480
1481
|
get<T extends Constructable<any>>(plugin: T): InstanceType<T> | null;
|
|
1482
|
+
/**
|
|
1483
|
+
* Pre-loads the specified entrypoints for the given plugin.
|
|
1484
|
+
* @param plugin The plugin to pre-load.
|
|
1485
|
+
*/
|
|
1486
|
+
preload(plugin: RuntimePlugin): Promise<void>;
|
|
1481
1487
|
/**
|
|
1482
1488
|
* Soft registers a plugin in the runtime.
|
|
1483
1489
|
* @param plugin The plugin to be registered.
|
|
@@ -2237,4 +2243,4 @@ declare class AnalyticsEngine {
|
|
|
2237
2243
|
}
|
|
2238
2244
|
//#endregion
|
|
2239
2245
|
export { AnalyticsEngine, AnalyticsEvent, AnalyticsProvider, AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitCompilerOptions, CommandKitConfig, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandMetadata, CommandMetadataFunction, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomAppCommandProps, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, DeepPartial, DeepRequired, EvaluationContext, EventFlagContext, EventHandler, EventListener, FeatureFlag, FeatureFlagDefinition, FilterFunction, FlagConfiguration, FlagProvider, FlagRunner, FlagStore, GenericFunction, IdentifyEvent, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, IpcMessageCommand, JsonFlagProvider, LegacyCommandMetadata, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, ResolvedCommandKitConfig, RunCommand, RunCommandOptions, RuntimePlugin, SlashCommandMiddlewareContext, TemplateHandler, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, mergeDeep, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, setFlagProvider, useEnvironment };
|
|
2240
|
-
//# sourceMappingURL=analytics-engine-
|
|
2246
|
+
//# sourceMappingURL=analytics-engine-CtMbeudW.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppCommandRunner, RunCommandOptions } from "../../analytics-engine-
|
|
1
|
+
import { AppCommandRunner, RunCommandOptions } from "../../analytics-engine-CtMbeudW.js";
|
|
2
2
|
import "../../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../../ModalKit-Btz58KYn.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../../error-codes-Ds0bnPvT.js');
|
|
4
|
-
const require_commandkit = require('../../commandkit-
|
|
4
|
+
const require_commandkit = require('../../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../../common-CcfjYnPG.js');
|
|
6
6
|
require('../../common-vnMIelAE.js');
|
|
7
7
|
require('../../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../../RuntimePlugin-
|
|
20
|
+
require('../../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../../types-q0Nm882H.js');
|
|
22
|
-
require('../../
|
|
23
|
-
require('../../
|
|
24
|
-
require('../../
|
|
22
|
+
require('../../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../../utils-KsNof0Xz.js');
|
|
25
25
|
require('../../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../../constants-DxfYtA6t.js');
|
|
27
27
|
require('../../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyCommandExecute, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, ChatInputCommand, ChatInputCommandContext, CommandContextOptions, CommandExecutionMode, Context, ContextParameters, InteractionCommandContext, InteractionCommandMiddlewareContext, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, SlashCommandMiddlewareContext, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext } from "../../analytics-engine-
|
|
1
|
+
import { AnyCommandExecute, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, ChatInputCommand, ChatInputCommandContext, CommandContextOptions, CommandExecutionMode, Context, ContextParameters, InteractionCommandContext, InteractionCommandMiddlewareContext, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, SlashCommandMiddlewareContext, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext } from "../../analytics-engine-CtMbeudW.js";
|
|
2
2
|
import "../../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../../ModalKit-Btz58KYn.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../../error-codes-Ds0bnPvT.js');
|
|
4
|
-
const require_commandkit = require('../../commandkit-
|
|
4
|
+
const require_commandkit = require('../../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../../common-CcfjYnPG.js');
|
|
6
6
|
require('../../common-vnMIelAE.js');
|
|
7
7
|
require('../../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../../RuntimePlugin-
|
|
20
|
+
require('../../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../../types-q0Nm882H.js');
|
|
22
|
-
require('../../
|
|
23
|
-
require('../../
|
|
24
|
-
require('../../
|
|
22
|
+
require('../../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../../utils-KsNof0Xz.js');
|
|
25
25
|
require('../../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../../constants-DxfYtA6t.js');
|
|
27
27
|
require('../../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../analytics-engine-
|
|
1
|
+
import "../../analytics-engine-CtMbeudW.js";
|
|
2
2
|
import "../../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../../ModalKit-Btz58KYn.js";
|
|
@@ -29,5 +29,5 @@ import "../../CommandsRouter-CoOA7hkf.js";
|
|
|
29
29
|
import "../../EventsRouter-BacqK6z3.js";
|
|
30
30
|
import "../../index-DKcmsWXw.js";
|
|
31
31
|
import "../../constants-MKu-Q1jh.js";
|
|
32
|
-
import { EventWorkerContext, eventWorkerContext, getEventWorkerContext, isEventWorkerContext, runInEventWorkerContext } from "../../EventWorkerContext-
|
|
32
|
+
import { EventWorkerContext, eventWorkerContext, getEventWorkerContext, isEventWorkerContext, runInEventWorkerContext } from "../../EventWorkerContext-D9frVhVe.js";
|
|
33
33
|
export { EventWorkerContext, eventWorkerContext, getEventWorkerContext, isEventWorkerContext, runInEventWorkerContext };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppCommand, AppCommandHandler, AppCommandNative, CommandBuilderLike, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandTypeData, CustomAppCommandProps, LoadedCommand, PreparedAppCommandExecution, ResolvableCommand, RunCommand } from "../../analytics-engine-
|
|
1
|
+
import { AppCommand, AppCommandHandler, AppCommandNative, CommandBuilderLike, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandTypeData, CustomAppCommandProps, LoadedCommand, PreparedAppCommandExecution, ResolvableCommand, RunCommand } from "../../analytics-engine-CtMbeudW.js";
|
|
2
2
|
import "../../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../../ModalKit-Btz58KYn.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../../error-codes-Ds0bnPvT.js');
|
|
4
|
-
const require_commandkit = require('../../commandkit-
|
|
4
|
+
const require_commandkit = require('../../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../../common-CcfjYnPG.js');
|
|
6
6
|
require('../../common-vnMIelAE.js');
|
|
7
7
|
require('../../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../../RuntimePlugin-
|
|
20
|
+
require('../../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../../types-q0Nm882H.js');
|
|
22
|
-
require('../../
|
|
23
|
-
require('../../
|
|
24
|
-
require('../../
|
|
22
|
+
require('../../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../../utils-KsNof0Xz.js');
|
|
25
25
|
require('../../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../../constants-DxfYtA6t.js');
|
|
27
27
|
require('../../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppEventsHandler, AppEventsHandlerLoadedData, EventListener, LoadedEvent } from "../../analytics-engine-
|
|
1
|
+
import { AppEventsHandler, AppEventsHandlerLoadedData, EventListener, LoadedEvent } from "../../analytics-engine-CtMbeudW.js";
|
|
2
2
|
import "../../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../../ModalKit-Btz58KYn.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../../error-codes-Ds0bnPvT.js');
|
|
4
|
-
const require_commandkit = require('../../commandkit-
|
|
4
|
+
const require_commandkit = require('../../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../../common-CcfjYnPG.js');
|
|
6
6
|
require('../../common-vnMIelAE.js');
|
|
7
7
|
require('../../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../../RuntimePlugin-
|
|
20
|
+
require('../../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../../types-q0Nm882H.js');
|
|
22
|
-
require('../../
|
|
23
|
-
require('../../
|
|
24
|
-
require('../../
|
|
22
|
+
require('../../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../../utils-KsNof0Xz.js');
|
|
25
25
|
require('../../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../../constants-DxfYtA6t.js');
|
|
27
27
|
require('../../EventWorkerContext-TZIKxVCu.js');
|
package/dist/app/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContextOptions, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandExecutionMode, CommandRegistrar, CommandTypeData, Context, ContextParameters, CustomAppCommandProps, InteractionCommandContext, InteractionCommandMiddlewareContext, LoadedCommand, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, RunCommand, SlashCommandMiddlewareContext, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext } from "../analytics-engine-
|
|
1
|
+
import { AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContextOptions, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandExecutionMode, CommandRegistrar, CommandTypeData, Context, ContextParameters, CustomAppCommandProps, InteractionCommandContext, InteractionCommandMiddlewareContext, LoadedCommand, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, RunCommand, SlashCommandMiddlewareContext, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext } from "../analytics-engine-CtMbeudW.js";
|
|
2
2
|
import "../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../ModalKit-Btz58KYn.js";
|
package/dist/app/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../error-codes-Ds0bnPvT.js');
|
|
4
|
-
const require_commandkit = require('../commandkit-
|
|
4
|
+
const require_commandkit = require('../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../common-CcfjYnPG.js');
|
|
6
6
|
require('../common-vnMIelAE.js');
|
|
7
7
|
require('../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../RuntimePlugin-
|
|
20
|
+
require('../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../types-q0Nm882H.js');
|
|
22
|
-
require('../
|
|
23
|
-
require('../
|
|
24
|
-
require('../
|
|
22
|
+
require('../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../utils-KsNof0Xz.js');
|
|
25
25
|
require('../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../constants-DxfYtA6t.js');
|
|
27
27
|
require('../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../../error-codes-Ds0bnPvT.js');
|
|
4
|
-
const require_commandkit = require('../../commandkit-
|
|
4
|
+
const require_commandkit = require('../../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../../common-CcfjYnPG.js');
|
|
6
6
|
require('../../common-vnMIelAE.js');
|
|
7
7
|
require('../../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../../RuntimePlugin-
|
|
20
|
+
require('../../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../../types-q0Nm882H.js');
|
|
22
|
-
require('../../
|
|
23
|
-
require('../../
|
|
24
|
-
require('../../
|
|
22
|
+
require('../../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../../utils-KsNof0Xz.js');
|
|
25
25
|
require('../../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../../constants-DxfYtA6t.js');
|
|
27
27
|
require('../../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandRegistrar, PreRegisterCommandsEvent } from "../../analytics-engine-
|
|
1
|
+
import { CommandRegistrar, PreRegisterCommandsEvent } from "../../analytics-engine-CtMbeudW.js";
|
|
2
2
|
import "../../EventInterceptor-x-R2qshQ.js";
|
|
3
3
|
import "../../ButtonKit-C7r7RPNf.js";
|
|
4
4
|
import "../../ModalKit-Btz58KYn.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../../error-codes-Ds0bnPvT.js');
|
|
4
|
-
const require_commandkit = require('../../commandkit-
|
|
4
|
+
const require_commandkit = require('../../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../../common-CcfjYnPG.js');
|
|
6
6
|
require('../../common-vnMIelAE.js');
|
|
7
7
|
require('../../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../../RuntimePlugin-
|
|
20
|
+
require('../../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../../types-q0Nm882H.js');
|
|
22
|
-
require('../../
|
|
23
|
-
require('../../
|
|
24
|
-
require('../../
|
|
22
|
+
require('../../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../../utils-KsNof0Xz.js');
|
|
25
25
|
require('../../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../../constants-DxfYtA6t.js');
|
|
27
27
|
require('../../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-nOFOJqeH.js');
|
|
2
|
-
const require_commandkit = require('./commandkit-
|
|
2
|
+
const require_commandkit = require('./commandkit-BPtNCbV8.js');
|
|
3
3
|
const require_constants = require('./constants-B5_Ta7PR.js');
|
|
4
|
-
const require_utils = require('./utils-
|
|
4
|
+
const require_utils = require('./utils-KsNof0Xz.js');
|
|
5
5
|
const require_common = require('./common-DNADUU3_.js');
|
|
6
6
|
const require_env = require('./env-_68PRRoA.js');
|
|
7
7
|
const require_type_checker = require('./type-checker-1Iu1jJcy.js');
|
|
@@ -93,6 +93,7 @@ async function buildApplication({ plugins, rolldownPlugins, isDev, configPath })
|
|
|
93
93
|
"!**/*.spec.*",
|
|
94
94
|
...config.entrypoints ?? []
|
|
95
95
|
])),
|
|
96
|
+
outputOptions: { sanitizeFileName: (name) => name },
|
|
96
97
|
unbundle: isDev ? true : ((_config$compilerOptio = config.compilerOptions) === null || _config$compilerOptio === void 0 ? void 0 : _config$compilerOptio.disableChunking) ?? false
|
|
97
98
|
}, (_config$compilerOptio2 = config.compilerOptions) === null || _config$compilerOptio2 === void 0 ? void 0 : _config$compilerOptio2.tsdown));
|
|
98
99
|
await require_common.copyLocaleFiles("src", dest);
|
|
@@ -167,4 +168,4 @@ Object.defineProperty(exports, 'buildApplication', {
|
|
|
167
168
|
return buildApplication;
|
|
168
169
|
}
|
|
169
170
|
});
|
|
170
|
-
//# sourceMappingURL=build-
|
|
171
|
+
//# sourceMappingURL=build-D52II1qS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-D52II1qS.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 { build, 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 } 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 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 );\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': 'js',\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\nimport { commandkit } from 'commandkit';\nimport { Client } from 'discord.js';\n\nasync function bootstrap() {\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,KAAK,QACzB,CAAC,OAAO,EAAE,KAAK,QAAQ,EAAE,WAAW;AAIzC,QAAO;EACL,GAAG;EACH,GAAG;EACH,GAAI,QACJ;GACE,UAAU;GACV,2BAA2B;GAC3B,mBAAmB;GACnB,oBAAoB;MAEtB;GACE,UAAU;GACV,2BAA2B;GAC3B,mBAAmB;GACnB,oBAAoB;;;;;;;;AAS1B,eAAsB,iBAAiB,EACrC,SACA,iBACA,OACA,cAC0B;;CAC1B,MAAM,SAAS,MAAM,kCAAe;AAEpC,KAAI,CAAC,SAAS,gEAAC,OAAQ,oFAAY,mBACjC,OAAM,sCAAiB,cAAc;CAGvC,MAAM,gBAAgB,IAAI,yCACvB,WAAW;AAGd,qBAAoB;AAEpB,iBAAgB,KAAK,cAAc;AAEnC,KAAI;;EACF,MAAM,OAAO,QAAQ,gBAAgB,OAAO;AAG5C,2BAAa;AAEb,QAAM,cAAc;AAEpB,0BACE,wBACE;GACE,OAAO;GACP,KAAK;GACL,OAAO;GACP,QAAQ,CAAC;GACT,OAAO;GACP,QAAQ;GACR,QAAQ,CAAC,CAAC;GACV,cAAc;IACZ,WAAW,EACT,KAAK;KACH,SAAS;KACT,cAAc;;IAGlB,QAAQ,EACN,oBAAoB;IAEtB,SAAS,SAAS,gBAAgB;;AAChC,uEAAI,QAAS,6EAAS,SAAS,uBAAwB;AAEvD,YAAO,YAAY;;IAErB,QAAQ,OAAO,KAAK,eAAe;AACjC,SAAI,MAAO;AAEX,YAAO,WAAW,OAAO;;IAE3B,aAAa;KACX,SAAS;KACT,SAAS;;;GAGb,SAAS;GACT,UAAU;GACV,uBAAuB;GACvB,iCACA,OAAO,iFAAY,QAAQ,gBAAgB,kBAAiB;GAC5D,QAAQ;GACR,QAAQ;GACR,KAAK,yBAAyB,OAAO,OAAO,IAAI,CAAC,CAAC;GAClD,OAAO,MAAM,KACX,IAAI,IAAI;IACR;IACA,IAAI,OAAO;IACX;IACA;IACA;IACA,GAAI,OAAO,eAAe;;GAG5B,eAAe,EACb,mBAAmB,SAAS;GAE9B,UAAU,QACV,iCACA,OAAO,+FAAiB,oBAAmB;+BAE7C,OAAO,iGAAiB;AAI5B,QAAM,+BAAgB,OAAO;AAC7B,QAAM,gBACJ,cAAc,kCACd,CAAC,CAAC,OACF,CAAC,4BACD,OAAO,+FAAkB,QAAQ,gBAAgB,mBACjD,QAAQ,OAAO,SAEf,OAAO;UAEF,OAAO;AACd,UAAQ,MAAM,iBAAiB;AAC/B,MAAI,iBAAiB,MACnB,SAAQ,MAAM,kBAAkB,MAAM;AAExC,UAAQ,KAAK;WACL;AAER,QAAM,cAAc;;;AAIxB,MAAM,aAAa,QAAiB;iBACnB,MAAM,6BAAiB,6BAAiB,KAAK,MAAM,IAAI,EAAE,IAAI,KAAK,MAAM;;;;;;;;AASzF,MAAM,kBAAkB;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;EACA,KAAK;AAEL,MAAM,mBAAmB,SACzB,0BAA0B,KAAK,KAAK,QAAQ;AAE5C,eAAe,gBACf,YACA,OACA,qBACA,SACA;CACE,MAAM,OAAO,QAAQ,gBAAgB,WAAW;CAChD,MAAM,oCAAqB,YAAY,MAAM;AAG7C,6BAAe,eAAgB;CAE/B,MAAM,OAAO;EACb,QAAQ,oCAAoC,gBAAgB,CAAC,UAAU,QAAQ,sBAAsB,kBAAkB,KAAK,QAAQ,gBAAgB,CAAC,UAAU,SAAQ;;;;;;;;;;;;;;;;;;;;;AAsBvK,uCAAgB,eAAe"}
|
package/dist/cli/build.d.ts
CHANGED
package/dist/cli/build.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../colors-Cd4Oz-r-.js');
|
|
2
2
|
require('../ActionRow-CmTHbo2t.js');
|
|
3
3
|
require('../error-codes-Ds0bnPvT.js');
|
|
4
|
-
require('../commandkit-
|
|
4
|
+
require('../commandkit-BPtNCbV8.js');
|
|
5
5
|
require('../common-CcfjYnPG.js');
|
|
6
6
|
require('../common-vnMIelAE.js');
|
|
7
7
|
require('../container-z621KfH5.js');
|
|
@@ -17,11 +17,11 @@ require('../EventInterceptor-CQ4PBpBJ.js');
|
|
|
17
17
|
require('../constants-B5_Ta7PR.js');
|
|
18
18
|
require('../PluginCommon-Di1xIa8d.js');
|
|
19
19
|
require('../CompilerPlugin-CjoZAAR8.js');
|
|
20
|
-
require('../RuntimePlugin-
|
|
20
|
+
require('../RuntimePlugin-eTdFJwGd.js');
|
|
21
21
|
require('../types-q0Nm882H.js');
|
|
22
|
-
require('../
|
|
23
|
-
require('../
|
|
24
|
-
require('../
|
|
22
|
+
require('../resolve-file-url-DYjaxg_S.js');
|
|
23
|
+
require('../runtime-DB9CiPfe.js');
|
|
24
|
+
require('../utils-KsNof0Xz.js');
|
|
25
25
|
require('../types-package-DrnIdWLg.js');
|
|
26
26
|
require('../constants-DxfYtA6t.js');
|
|
27
27
|
require('../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -35,6 +35,6 @@ require('../CommandKitEventsChannel-Bgw0XCOl.js');
|
|
|
35
35
|
require('../store-CiqLHedg.js');
|
|
36
36
|
require('../env-_68PRRoA.js');
|
|
37
37
|
require('../type-checker-1Iu1jJcy.js');
|
|
38
|
-
const require_build = require('../build-
|
|
38
|
+
const require_build = require('../build-D52II1qS.js');
|
|
39
39
|
|
|
40
40
|
exports.buildApplication = require_build.buildApplication;
|
package/dist/cli/common.d.ts
CHANGED
package/dist/cli/development.js
CHANGED
|
@@ -2,7 +2,7 @@ const require_chunk = require('../chunk-nOFOJqeH.js');
|
|
|
2
2
|
const require_colors = require('../colors-Cd4Oz-r-.js');
|
|
3
3
|
require('../ActionRow-CmTHbo2t.js');
|
|
4
4
|
require('../error-codes-Ds0bnPvT.js');
|
|
5
|
-
const require_commandkit = require('../commandkit-
|
|
5
|
+
const require_commandkit = require('../commandkit-BPtNCbV8.js');
|
|
6
6
|
require('../common-CcfjYnPG.js');
|
|
7
7
|
require('../common-vnMIelAE.js');
|
|
8
8
|
require('../container-z621KfH5.js');
|
|
@@ -18,11 +18,11 @@ require('../EventInterceptor-CQ4PBpBJ.js');
|
|
|
18
18
|
const require_constants = require('../constants-B5_Ta7PR.js');
|
|
19
19
|
require('../PluginCommon-Di1xIa8d.js');
|
|
20
20
|
const require_CompilerPlugin = require('../CompilerPlugin-CjoZAAR8.js');
|
|
21
|
-
require('../RuntimePlugin-
|
|
21
|
+
require('../RuntimePlugin-eTdFJwGd.js');
|
|
22
22
|
require('../types-q0Nm882H.js');
|
|
23
|
-
require('../
|
|
24
|
-
require('../
|
|
25
|
-
require('../
|
|
23
|
+
require('../resolve-file-url-DYjaxg_S.js');
|
|
24
|
+
require('../runtime-DB9CiPfe.js');
|
|
25
|
+
require('../utils-KsNof0Xz.js');
|
|
26
26
|
require('../types-package-DrnIdWLg.js');
|
|
27
27
|
require('../constants-DxfYtA6t.js');
|
|
28
28
|
require('../EventWorkerContext-TZIKxVCu.js');
|
|
@@ -37,7 +37,7 @@ require('../store-CiqLHedg.js');
|
|
|
37
37
|
require('../env-_68PRRoA.js');
|
|
38
38
|
const require_app_process = require('../app-process-CjMovpoZ.js');
|
|
39
39
|
require('../type-checker-1Iu1jJcy.js');
|
|
40
|
-
const require_build = require('../build-
|
|
40
|
+
const require_build = require('../build-D52II1qS.js');
|
|
41
41
|
const node_crypto = require_chunk.__toESM(require("node:crypto"));
|
|
42
42
|
const path = require_chunk.__toESM(require("path"));
|
|
43
43
|
const chokidar = require_chunk.__toESM(require("chokidar"));
|
package/dist/cli/generators.js
CHANGED
|
@@ -76,6 +76,37 @@ export const message = async (ctx) => {
|
|
|
76
76
|
* @private
|
|
77
77
|
* @internal
|
|
78
78
|
*/
|
|
79
|
+
function TS_EVENT_SOURCE(name) {
|
|
80
|
+
const eventName = name[0].toUpperCase() + name.slice(1);
|
|
81
|
+
return `import type { EventHandler } from 'commandkit';
|
|
82
|
+
|
|
83
|
+
const ${eventName}: EventHandler<'${name}'> = async () => {
|
|
84
|
+
console.log('${name} event fired!');
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default ${eventName};
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @private
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
function JS_EVENT_SOURCE(name) {
|
|
95
|
+
const eventName = `on${name[0].toUpperCase() + name.slice(1)}`;
|
|
96
|
+
return `/**
|
|
97
|
+
* @type {import('commandkit').EventHandler<'${name}'>}
|
|
98
|
+
*/
|
|
99
|
+
const ${eventName} = async () => {
|
|
100
|
+
console.log('${name} event fired!');
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export default ${eventName};
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @private
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
79
110
|
async function generateCommand(name, customPath) {
|
|
80
111
|
const cmdPath = (0, path.join)(customPath || COMMANDS_DIR);
|
|
81
112
|
if (!(0, fs.existsSync)(cmdPath)) await (0, fs_promises.mkdir)(cmdPath, { recursive: true });
|
|
@@ -95,16 +126,13 @@ async function generateEvent(name, customPath) {
|
|
|
95
126
|
const eventPath = (0, path.join)(customPath || EVENTS_DIR, name);
|
|
96
127
|
if (!(0, fs.existsSync)(eventPath)) await (0, fs_promises.mkdir)(eventPath, { recursive: true });
|
|
97
128
|
const ext = determineExtension();
|
|
129
|
+
const isTypeScript = ext === "ts";
|
|
98
130
|
let filename = `event.${ext}`;
|
|
99
131
|
if ((0, fs.existsSync)((0, path.join)(eventPath, filename))) {
|
|
100
132
|
const count = (await (0, fs_promises.readdir)(eventPath)).length;
|
|
101
133
|
filename = `${String(count).padStart(2, "0")}_${filename}`;
|
|
102
134
|
}
|
|
103
|
-
const eventFile =
|
|
104
|
-
export default async function on${name[0].toUpperCase() + name.slice(1)}() {
|
|
105
|
-
console.log('${name} event fired!');
|
|
106
|
-
};
|
|
107
|
-
`.trim();
|
|
135
|
+
const eventFile = isTypeScript ? TS_EVENT_SOURCE(name) : JS_EVENT_SOURCE(name);
|
|
108
136
|
await (0, fs_promises.writeFile)((0, path.join)(eventPath, filename), eventFile);
|
|
109
137
|
console.log(require_colors.colors_default.green(`Event ${require_colors.colors_default.magenta(name)} created at ${require_colors.colors_default.blue(formatPath(eventPath))}/${require_colors.colors_default.magenta(filename)}`));
|
|
110
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generators.js","names":[],"sources":["../../src/cli/generators.ts"],"sourcesContent":["import { mkdir, writeFile, readdir } from 'fs/promises';\nimport { join } from 'path';\nimport { panic } from './common';\nimport { existsSync } from 'fs';\nimport colors from '../utils/colors';\nimport { COMMANDKIT_CWD } from '../utils/constants';\n\nconst BASE_PATH = COMMANDKIT_CWD;\nconst COMMANDS_DIR = join(BASE_PATH, 'src/app/commands');\nconst EVENTS_DIR = join(BASE_PATH, 'src/app/events');\n\n/**\n * @private\n * @internal\n */\nconst formatPath = (path: string) =>\n path.replace(COMMANDKIT_CWD, '.').replace(/\\\\/g, '/');\n\n/**\n * @private\n * @internal\n */\nfunction determineExtension() {\n return existsSync(join(BASE_PATH, 'tsconfig.json')) ? 'ts' : 'js';\n}\n\n/**\n * @private\n * @internal\n */\nfunction TS_COMMAND_SOURCE(name: string) {\n return `import type { CommandData, ChatInputCommand, MessageCommand } from 'commandkit';\n\nexport const command: CommandData = {\n name: '${name}',\n description: '${name} command',\n};\n\nexport const chatInput: ChatInputCommand = async (ctx) => {\n await ctx.interaction.reply('Hello from ${name}!');\n};\n\nexport const message: MessageCommand = async (ctx) => {\n await ctx.message.reply('Hello from ${name}!');\n};\n`;\n}\n\n/**\n * @private\n * @internal\n */\nfunction JS_COMMAND_SOURCE(name: string) {\n return `/**\n * @type {import('commandkit').CommandData}\n */\nexport const command = {\n name: '${name}',\n description: '${name} command',\n};\n\n/**\n * @type {import('commandkit').ChatInputCommand}\n */\nexport const chatInput = async (ctx) => {\n await ctx.interaction.reply('Hello from ${name}!');\n};\n\n/**\n * @type {import('commandkit').MessageCommand}\n */\nexport const message = async (ctx) => {\n await ctx.message.reply('Hello from ${name}!');\n};\n`;\n}\n\n/**\n * @private\n * @internal\n */\nexport async function generateCommand(name: string, customPath?: string) {\n const cmdPath = join(customPath || COMMANDS_DIR);\n if (!existsSync(cmdPath)) await mkdir(cmdPath, { recursive: true });\n\n const ext = determineExtension();\n const isTypeScript = ext === 'ts';\n\n const fileName = `${name}.${ext}`;\n\n if (existsSync(join(cmdPath, fileName))) {\n panic(`Command ${name} already exists.`);\n }\n\n const commandFile = isTypeScript\n ? TS_COMMAND_SOURCE(name)\n : JS_COMMAND_SOURCE(name);\n\n await writeFile(join(cmdPath, fileName), commandFile);\n\n console.log(\n colors.green(\n `Command ${colors.magenta(name)} created at ${colors.blue(formatPath(`${cmdPath}/${fileName}`))}`,\n ),\n );\n}\n\n/**\n * @private\n * @internal\n */\nexport async function generateEvent(name: string, customPath?: string) {\n const eventPath = join(customPath || EVENTS_DIR, name);\n if (!existsSync(eventPath)) await mkdir(eventPath, { recursive: true });\n\n const ext = determineExtension();\n\n let filename = `event.${ext}`;\n\n if (existsSync(join(eventPath, filename))) {\n const count = (await readdir(eventPath)).length;\n filename = `${String(count).padStart(2, '0')}_${filename}`;\n }\n\n const eventFile =
|
|
1
|
+
{"version":3,"file":"generators.js","names":[],"sources":["../../src/cli/generators.ts"],"sourcesContent":["import { mkdir, writeFile, readdir } from 'fs/promises';\nimport { join } from 'path';\nimport { panic } from './common';\nimport { existsSync } from 'fs';\nimport colors from '../utils/colors';\nimport { COMMANDKIT_CWD } from '../utils/constants';\n\nconst BASE_PATH = COMMANDKIT_CWD;\nconst COMMANDS_DIR = join(BASE_PATH, 'src/app/commands');\nconst EVENTS_DIR = join(BASE_PATH, 'src/app/events');\n\n/**\n * @private\n * @internal\n */\nconst formatPath = (path: string) =>\n path.replace(COMMANDKIT_CWD, '.').replace(/\\\\/g, '/');\n\n/**\n * @private\n * @internal\n */\nfunction determineExtension() {\n return existsSync(join(BASE_PATH, 'tsconfig.json')) ? 'ts' : 'js';\n}\n\n/**\n * @private\n * @internal\n */\nfunction TS_COMMAND_SOURCE(name: string) {\n return `import type { CommandData, ChatInputCommand, MessageCommand } from 'commandkit';\n\nexport const command: CommandData = {\n name: '${name}',\n description: '${name} command',\n};\n\nexport const chatInput: ChatInputCommand = async (ctx) => {\n await ctx.interaction.reply('Hello from ${name}!');\n};\n\nexport const message: MessageCommand = async (ctx) => {\n await ctx.message.reply('Hello from ${name}!');\n};\n`;\n}\n\n/**\n * @private\n * @internal\n */\nfunction JS_COMMAND_SOURCE(name: string) {\n return `/**\n * @type {import('commandkit').CommandData}\n */\nexport const command = {\n name: '${name}',\n description: '${name} command',\n};\n\n/**\n * @type {import('commandkit').ChatInputCommand}\n */\nexport const chatInput = async (ctx) => {\n await ctx.interaction.reply('Hello from ${name}!');\n};\n\n/**\n * @type {import('commandkit').MessageCommand}\n */\nexport const message = async (ctx) => {\n await ctx.message.reply('Hello from ${name}!');\n};\n`;\n}\n\n/**\n * @private\n * @internal\n */\nfunction TS_EVENT_SOURCE(name: string) {\n const eventName = name[0].toUpperCase() + name.slice(1);\n return `import type { EventHandler } from 'commandkit';\n\nconst ${eventName}: EventHandler<'${name}'> = async () => {\n console.log('${name} event fired!');\n};\n\nexport default ${eventName};\n`;\n}\n\n/**\n * @private\n * @internal\n */\nfunction JS_EVENT_SOURCE(name: string) {\n const eventName = `on${name[0].toUpperCase() + name.slice(1)}`;\n return `/**\n * @type {import('commandkit').EventHandler<'${name}'>}\n */\nconst ${eventName} = async () => {\n console.log('${name} event fired!');\n};\n\nexport default ${eventName};\n`;\n}\n\n/**\n * @private\n * @internal\n */\nexport async function generateCommand(name: string, customPath?: string) {\n const cmdPath = join(customPath || COMMANDS_DIR);\n if (!existsSync(cmdPath)) await mkdir(cmdPath, { recursive: true });\n\n const ext = determineExtension();\n const isTypeScript = ext === 'ts';\n\n const fileName = `${name}.${ext}`;\n\n if (existsSync(join(cmdPath, fileName))) {\n panic(`Command ${name} already exists.`);\n }\n\n const commandFile = isTypeScript\n ? TS_COMMAND_SOURCE(name)\n : JS_COMMAND_SOURCE(name);\n\n await writeFile(join(cmdPath, fileName), commandFile);\n\n console.log(\n colors.green(\n `Command ${colors.magenta(name)} created at ${colors.blue(formatPath(`${cmdPath}/${fileName}`))}`,\n ),\n );\n}\n\n/**\n * @private\n * @internal\n */\nexport async function generateEvent(name: string, customPath?: string) {\n const eventPath = join(customPath || EVENTS_DIR, name);\n if (!existsSync(eventPath)) await mkdir(eventPath, { recursive: true });\n\n const ext = determineExtension();\n const isTypeScript = ext === 'ts';\n\n let filename = `event.${ext}`;\n\n if (existsSync(join(eventPath, filename))) {\n const count = (await readdir(eventPath)).length;\n filename = `${String(count).padStart(2, '0')}_${filename}`;\n }\n\n const eventFile = isTypeScript\n ? TS_EVENT_SOURCE(name)\n : JS_EVENT_SOURCE(name);\n\n await writeFile(join(eventPath, filename), eventFile);\n\n console.log(\n colors.green(\n `Event ${colors.magenta(name)} created at ${colors.blue(formatPath(eventPath))}/${colors.magenta(filename)}`,\n ),\n );\n}\n"],"mappings":";;;;;;;;;;AAOA,MAAM,YAAY;AAClB,MAAM,8BAAoB,WAAW;AACrC,MAAM,4BAAkB,WAAW;;;;;AAMnC,MAAM,cAAc,WACpB,OAAK,QAAQ,kCAAgB,KAAK,QAAQ,OAAO;;;;;AAMjD,SAAS,qBAAqB;AAC5B,0CAAuB,WAAW,oBAAoB,OAAO;;;;;;AAO/D,SAAS,kBAAkB,MAAc;AACvC,QAAO;;;WAGE,KAAK;kBACE,KAAK;;;;4CAIqB,KAAK;;;;wCAIT,KAAK;;;;;;;;AAS7C,SAAS,kBAAkB,MAAc;AACvC,QAAO;;;;WAIE,KAAK;kBACE,KAAK;;;;;;;4CAOqB,KAAK;;;;;;;wCAOT,KAAK;;;;;;;;AAS7C,SAAS,gBAAgB,MAAc;CACrC,MAAM,YAAY,KAAK,GAAG,gBAAgB,KAAK,MAAM;AACrD,QAAO;;QAED,UAAU,kBAAkB,KAAK;iBACxB,KAAK;;;iBAGL,UAAU;;;;;;;AAQ3B,SAAS,gBAAgB,MAAc;CACrC,MAAM,YAAY,KAAK,KAAK,GAAG,gBAAgB,KAAK,MAAM;AAC1D,QAAO;+CACsC,KAAK;;QAE5C,UAAU;iBACD,KAAK;;;iBAGL,UAAU;;;;;;;AAQ3B,eAAsB,gBAAgB,MAAc,YAAqB;CACvE,MAAM,yBAAe,cAAc;AACnC,KAAI,oBAAY,SAAU,8BAAY,SAAS,EAAE,WAAW;CAE5D,MAAM,MAAM;CACZ,MAAM,eAAe,QAAQ;CAE7B,MAAM,WAAW,GAAG,KAAK,GAAG;AAE5B,uCAAoB,SAAS,WAC3B,sBAAM,WAAW,KAAK;CAGxB,MAAM,cAAc,eACpB,kBAAkB,QAClB,kBAAkB;AAElB,iDAAqB,SAAS,WAAW;AAEzC,SAAQ,IACN,8BAAO,MACL,WAAW,8BAAO,QAAQ,MAAM,cAAc,8BAAO,KAAK,WAAW,GAAG,QAAQ,GAAG;;;;;;AASzF,eAAsB,cAAc,MAAc,YAAqB;CACrE,MAAM,2BAAiB,cAAc,YAAY;AACjD,KAAI,oBAAY,WAAY,8BAAY,WAAW,EAAE,WAAW;CAEhE,MAAM,MAAM;CACZ,MAAM,eAAe,QAAQ;CAE7B,IAAI,WAAW,SAAS;AAExB,uCAAoB,WAAW,YAAY;EACzC,MAAM,SAAS,+BAAc,YAAY;AACzC,aAAW,GAAG,OAAO,OAAO,SAAS,GAAG,KAAK,GAAG;;CAGlD,MAAM,YAAY,eAClB,gBAAgB,QAChB,gBAAgB;AAEhB,iDAAqB,WAAW,WAAW;AAE3C,SAAQ,IACN,8BAAO,MACL,SAAS,8BAAO,QAAQ,MAAM,cAAc,8BAAO,KAAK,WAAW,YAAY,GAAG,8BAAO,QAAQ"}
|