commandkit 0.1.11-dev.20250417143532 → 0.1.11-dev.20250422144359
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +53 -190
- package/dist/index.js.map +1 -1
- package/package.json +2 -7
package/dist/index.d.ts
CHANGED
|
@@ -1181,7 +1181,7 @@ declare function isCachedFunction(fn: GenericFunction): boolean;
|
|
|
1181
1181
|
* @private
|
|
1182
1182
|
* @internal
|
|
1183
1183
|
*/
|
|
1184
|
-
declare const
|
|
1184
|
+
declare const __SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: any;
|
|
1185
1185
|
|
|
1186
1186
|
interface Command {
|
|
1187
1187
|
id: string;
|
|
@@ -1998,4 +1998,4 @@ declare function devOnly<T extends (...args: any[]) => any>(fn: T): T;
|
|
|
1998
1998
|
*/
|
|
1999
1999
|
declare function bootstrapCommandkitCLI(argv: string[], options?: commander.ParseOptions | undefined): Promise<void>;
|
|
2000
2000
|
|
|
2001
|
-
export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type BootstrapFunction, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, COMMANDKIT_BOOTSTRAP_MODE, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, ChannelSelectMenu, ChannelSelectMenuKit, type ChannelSelectMenuKitPredicate, type ChannelSelectMenuProps, type ChatInputCommand, type ChatInputCommandContext, type Command, type CommandBuilderLike, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitHMREvent, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandKitPlugin, CommandKitPluginRuntime, type CommandKitSelectMenuBuilderInteractionCollectorDispatch, type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, type CommandKitSelectMenuBuilderOnEnd, CommandRegistrar, type CommandSource, type CommandTypeData, CommandsRouter, type CommandsRouterOptions, type CommonBuilderKit, type CommonPluginRuntime, type CommonSelectMenuProps, CompilerPlugin, CompilerPluginRuntime, Context, type ContextParameters, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, Fragment, type FragmentElementProps, type GenericFunction, HMREventType, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, MemoryCache, MentionableSelectMenu, MentionableSelectMenuKit, type MentionableSelectMenuKitPredicate, type MentionableSelectMenuProps, type Message, type MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type Middleware, MiddlewareContext, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnChannelSelectMenuKitSubmit, type OnLoadArgs, type OnLoadOptions, type OnLoadResult, type OnMentionableSelectMenuKitSubmit, type OnModalKitEnd, type OnModalKitSubmit, type OnResolveArgs, type OnResolveOptions, type OnResolveResult, type OnRoleSelectMenuKitSubmit, type OnSelectMenuKitEnd, type OnSelectMenuKitSubmit, type OnStringSelectMenuKitSubmit, type OnUserSelectMenuKitSubmit, ParagraphInput, type ParsedCommandData, type ParsedEvent, type ParsedMessageCommand, type PluginTransformParameters, type PreRegisterCommandsEvent, type PreparedAppCommandExecution, type ResolvableCommand, type ResolveBuilderInteraction, type ResolveKind, type ResolveResult, RoleSelectMenu, RoleSelectMenuKit, type RoleSelectMenuKitPredicate, type RoleSelectMenuProps, type RunCommand, RuntimePlugin, type SelectMenuKitPredicate, type SelectMenuProps, type Setup, ShortInput, type SlashCommandMiddlewareContext, StringSelectMenu, StringSelectMenuKit, type StringSelectMenuKitPredicate, StringSelectMenuOption, type StringSelectMenuOptionProps, type StringSelectMenuProps, TextInput, type TextInputProps, type TransformedResult, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, UserSelectMenu, UserSelectMenuKit, type UserSelectMenuKitPredicate, type UserSelectMenuProps, after, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfter, commandkit, createElement, createLogger, debounce, CommandKit as default, defineConfig, devOnly, exitContext, exitMiddleware, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getCurrentDirectory, getElement, getSourceDirectories, invalidate, isCachedFunction, isCommandKitElement, isCompilerPlugin, isInteractionSource, isMessageSource, isRuntimePlugin, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, redirect, rethrow, revalidate, useEnvironment, version
|
|
2001
|
+
export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type BootstrapFunction, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, COMMANDKIT_BOOTSTRAP_MODE, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, type CacheContext, type CacheEntry, type CacheMetadata, CacheProvider, ChannelSelectMenu, ChannelSelectMenuKit, type ChannelSelectMenuKitPredicate, type ChannelSelectMenuProps, type ChatInputCommand, type ChatInputCommandContext, type Command, type CommandBuilderLike, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitHMREvent, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandKitPlugin, CommandKitPluginRuntime, type CommandKitSelectMenuBuilderInteractionCollectorDispatch, type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, type CommandKitSelectMenuBuilderOnEnd, CommandRegistrar, type CommandSource, type CommandTypeData, CommandsRouter, type CommandsRouterOptions, type CommonBuilderKit, type CommonPluginRuntime, type CommonSelectMenuProps, CompilerPlugin, CompilerPluginRuntime, Context, type ContextParameters, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, EventsRouter, type EventsRouterOptions, type EventsTree, Fragment, type FragmentElementProps, type GenericFunction, HMREventType, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, MemoryCache, MentionableSelectMenu, MentionableSelectMenuKit, type MentionableSelectMenuKitPredicate, type MentionableSelectMenuProps, type Message, type MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type Middleware, MiddlewareContext, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnChannelSelectMenuKitSubmit, type OnLoadArgs, type OnLoadOptions, type OnLoadResult, type OnMentionableSelectMenuKitSubmit, type OnModalKitEnd, type OnModalKitSubmit, type OnResolveArgs, type OnResolveOptions, type OnResolveResult, type OnRoleSelectMenuKitSubmit, type OnSelectMenuKitEnd, type OnSelectMenuKitSubmit, type OnStringSelectMenuKitSubmit, type OnUserSelectMenuKitSubmit, ParagraphInput, type ParsedCommandData, type ParsedEvent, type ParsedMessageCommand, type PluginTransformParameters, type PreRegisterCommandsEvent, type PreparedAppCommandExecution, type ResolvableCommand, type ResolveBuilderInteraction, type ResolveKind, type ResolveResult, RoleSelectMenu, RoleSelectMenuKit, type RoleSelectMenuKitPredicate, type RoleSelectMenuProps, type RunCommand, RuntimePlugin, type SelectMenuKitPredicate, type SelectMenuProps, type Setup, ShortInput, type SlashCommandMiddlewareContext, StringSelectMenu, StringSelectMenuKit, type StringSelectMenuKitPredicate, StringSelectMenuOption, type StringSelectMenuOptionProps, type StringSelectMenuProps, TextInput, type TextInputProps, type TransformedResult, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, UserSelectMenu, UserSelectMenuKit, type UserSelectMenuKitPredicate, type UserSelectMenuProps, __SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, after, bootstrapCommandkitCLI, cache, cacheLife, cacheTag, cancelAfter, commandkit, createElement, createLogger, debounce, CommandKit as default, defineConfig, devOnly, exitContext, exitMiddleware, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getCurrentDirectory, getElement, getSourceDirectories, invalidate, isCachedFunction, isCommandKitElement, isCompilerPlugin, isInteractionSource, isMessageSource, isRuntimePlugin, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, redirect, rethrow, revalidate, useEnvironment, version };
|
package/dist/index.js
CHANGED
|
@@ -2572,187 +2572,26 @@ var init_plugins = __esm({
|
|
|
2572
2572
|
}
|
|
2573
2573
|
});
|
|
2574
2574
|
|
|
2575
|
-
// src/plugins/plugin-runtime/builtin/
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
const CACHE_IDENTIFIER = options.importName;
|
|
2580
|
-
const ASYNC_ONLY = options.asyncOnly ?? true;
|
|
2581
|
-
const transformer = /* @__PURE__ */ __name(async (source, args) => {
|
|
2582
|
-
var _a;
|
|
2583
|
-
const ast = parser.parse(source, {
|
|
2584
|
-
sourceType: "module",
|
|
2585
|
-
plugins: ["typescript", "jsx"]
|
|
2586
|
-
});
|
|
2587
|
-
let state = {
|
|
2588
|
-
needsImport: false,
|
|
2589
|
-
hasExistingImport: false,
|
|
2590
|
-
cacheIdentifierName: CACHE_IDENTIFIER,
|
|
2591
|
-
modifications: []
|
|
2592
|
-
};
|
|
2593
|
-
traverse(ast, {
|
|
2594
|
-
Program: {
|
|
2595
|
-
enter(path3) {
|
|
2596
|
-
const binding = path3.scope.getBinding(CACHE_IDENTIFIER);
|
|
2597
|
-
if (binding) {
|
|
2598
|
-
state.cacheIdentifierName = `${CACHE_IDENTIFIER}_${generateRandomString()}`;
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
},
|
|
2602
|
-
ImportDeclaration(path3) {
|
|
2603
|
-
if (path3.node.source.value === IMPORT_PATH && path3.node.specifiers.some(
|
|
2604
|
-
(spec) => t.isImportSpecifier(spec) && // @ts-ignore
|
|
2605
|
-
spec.imported.name === CACHE_IDENTIFIER
|
|
2606
|
-
)) {
|
|
2607
|
-
state.hasExistingImport = true;
|
|
2608
|
-
if (state.cacheIdentifierName !== CACHE_IDENTIFIER) {
|
|
2609
|
-
state.modifications.push(() => {
|
|
2610
|
-
path3.node.specifiers.forEach((spec) => {
|
|
2611
|
-
if (t.isImportSpecifier(spec) && // @ts-ignore
|
|
2612
|
-
spec.imported.name === CACHE_IDENTIFIER) {
|
|
2613
|
-
spec.local.name = state.cacheIdentifierName;
|
|
2614
|
-
}
|
|
2615
|
-
});
|
|
2616
|
-
});
|
|
2617
|
-
}
|
|
2618
|
-
}
|
|
2619
|
-
},
|
|
2620
|
-
"FunctionDeclaration|FunctionExpression|ArrowFunctionExpression|ObjectMethod"(path3) {
|
|
2621
|
-
var _a2, _b, _c;
|
|
2622
|
-
const body = t.isBlockStatement(path3.node.body) ? path3.node.body : null;
|
|
2623
|
-
const hasUseCache = (_a2 = body == null ? void 0 : body.directives) == null ? void 0 : _a2.some(
|
|
2624
|
-
(d) => d.value.value === DIRECTIVE
|
|
2625
|
-
);
|
|
2626
|
-
if (!hasUseCache && !t.isBlockStatement(path3.node.body)) {
|
|
2627
|
-
const parentFunction = path3.findParent(
|
|
2628
|
-
(p) => (p.isFunction() || p.isProgram()) && "directives" in p.node
|
|
2629
|
-
);
|
|
2630
|
-
if (!((_b = parentFunction == null ? void 0 : parentFunction.node.directives) == null ? void 0 : _b.some(
|
|
2631
|
-
(d) => d.value.value === DIRECTIVE
|
|
2632
|
-
))) {
|
|
2633
|
-
return;
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
if (hasUseCache || !t.isBlockStatement(path3.node.body)) {
|
|
2637
|
-
if (ASYNC_ONLY && !path3.node.async) {
|
|
2638
|
-
throw new Error(
|
|
2639
|
-
`"${DIRECTIVE}" directive may only be used in async functions at ${args.path}
|
|
2640
|
-
|
|
2641
|
-
${path3.toString()}
|
|
2642
|
-
^^^^${"-".repeat(6)} This function must be async`
|
|
2643
|
-
);
|
|
2644
|
-
}
|
|
2645
|
-
state.needsImport = true;
|
|
2646
|
-
const isDeclaration = t.isFunctionDeclaration(path3.node);
|
|
2647
|
-
const name = isDeclaration ? (_c = path3.node.id) == null ? void 0 : _c.name : void 0;
|
|
2648
|
-
const newBody = t.isBlockStatement(path3.node.body) ? t.blockStatement(
|
|
2649
|
-
path3.node.body.body,
|
|
2650
|
-
path3.node.body.directives.filter(
|
|
2651
|
-
(d) => d.value.value !== DIRECTIVE
|
|
2652
|
-
)
|
|
2653
|
-
) : path3.node.body;
|
|
2654
|
-
const wrapped = t.callExpression(
|
|
2655
|
-
t.identifier(state.cacheIdentifierName),
|
|
2656
|
-
[t.arrowFunctionExpression(path3.node.params, newBody, true)]
|
|
2657
|
-
);
|
|
2658
|
-
state.modifications.push(() => {
|
|
2659
|
-
if (t.isObjectMethod(path3.node)) {
|
|
2660
|
-
path3.replaceWith(
|
|
2661
|
-
t.objectProperty(t.identifier(path3.node.key.name), wrapped)
|
|
2662
|
-
);
|
|
2663
|
-
} else if (name) {
|
|
2664
|
-
path3.replaceWith(
|
|
2665
|
-
t.variableDeclaration(
|
|
2666
|
-
"const",
|
|
2667
|
-
[
|
|
2668
|
-
t.variableDeclarator(t.identifier(name), wrapped)
|
|
2669
|
-
]
|
|
2670
|
-
)
|
|
2671
|
-
);
|
|
2672
|
-
} else if (!t.isVariableDeclarator(path3.parent)) {
|
|
2673
|
-
path3.replaceWith(wrapped);
|
|
2674
|
-
} else {
|
|
2675
|
-
path3.parent.init = wrapped;
|
|
2676
|
-
}
|
|
2677
|
-
});
|
|
2678
|
-
}
|
|
2679
|
-
}
|
|
2680
|
-
});
|
|
2681
|
-
if (state.modifications.length > 0) {
|
|
2682
|
-
if (state.needsImport && !state.hasExistingImport) {
|
|
2683
|
-
ast.program.body.unshift(
|
|
2684
|
-
t.importDeclaration(
|
|
2685
|
-
[
|
|
2686
|
-
t.importSpecifier(
|
|
2687
|
-
t.identifier(state.cacheIdentifierName),
|
|
2688
|
-
t.identifier(CACHE_IDENTIFIER)
|
|
2689
|
-
)
|
|
2690
|
-
],
|
|
2691
|
-
t.stringLiteral(IMPORT_PATH)
|
|
2692
|
-
)
|
|
2693
|
-
);
|
|
2694
|
-
}
|
|
2695
|
-
state.modifications.forEach((modify) => modify());
|
|
2696
|
-
}
|
|
2697
|
-
const { code } = generate(ast);
|
|
2698
|
-
return {
|
|
2699
|
-
contents: code,
|
|
2700
|
-
loader: (_a = args.path) == null ? void 0 : _a.split(".").pop()
|
|
2701
|
-
};
|
|
2702
|
-
}, "transformer");
|
|
2703
|
-
return transformer;
|
|
2704
|
-
}
|
|
2705
|
-
var parser, import_traverse, import_generator, t, traverse, generate, generateRandomString;
|
|
2706
|
-
var init_directive_transformer = __esm({
|
|
2707
|
-
"src/plugins/plugin-runtime/builtin/common/directive-transformer.ts"() {
|
|
2708
|
-
"use strict";
|
|
2709
|
-
init_cjs_shims();
|
|
2710
|
-
parser = __toESM(require("@babel/parser"));
|
|
2711
|
-
import_traverse = __toESM(require("@babel/traverse"));
|
|
2712
|
-
import_generator = __toESM(require("@babel/generator"));
|
|
2713
|
-
t = __toESM(require("@babel/types"));
|
|
2714
|
-
traverse = import_traverse.default.default || import_traverse.default;
|
|
2715
|
-
generate = import_generator.default.default || import_generator.default;
|
|
2716
|
-
generateRandomString = /* @__PURE__ */ __name((length = 6) => {
|
|
2717
|
-
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
2718
|
-
return Array.from(
|
|
2719
|
-
{ length },
|
|
2720
|
-
() => chars[Math.floor(Math.random() * chars.length)]
|
|
2721
|
-
).join("");
|
|
2722
|
-
}, "generateRandomString");
|
|
2723
|
-
__name(createDirectiveTransformer, "createDirectiveTransformer");
|
|
2724
|
-
}
|
|
2725
|
-
});
|
|
2726
|
-
|
|
2727
|
-
// src/plugins/plugin-runtime/builtin/cache/UseCacheTransformer.ts
|
|
2728
|
-
var cacheDirectivePlugin;
|
|
2729
|
-
var init_UseCacheTransformer = __esm({
|
|
2730
|
-
"src/plugins/plugin-runtime/builtin/cache/UseCacheTransformer.ts"() {
|
|
2731
|
-
"use strict";
|
|
2732
|
-
init_cjs_shims();
|
|
2733
|
-
init_directive_transformer();
|
|
2734
|
-
cacheDirectivePlugin = createDirectiveTransformer({
|
|
2735
|
-
directive: "use cache",
|
|
2736
|
-
importPath: "commandkit",
|
|
2737
|
-
importName: "zxcvbnm____",
|
|
2738
|
-
asyncOnly: true
|
|
2739
|
-
});
|
|
2740
|
-
}
|
|
2741
|
-
});
|
|
2742
|
-
|
|
2743
|
-
// src/plugins/plugin-runtime/builtin/cache/CachePlugin.ts
|
|
2744
|
-
var _CachePlugin, CachePlugin;
|
|
2745
|
-
var init_CachePlugin = __esm({
|
|
2746
|
-
"src/plugins/plugin-runtime/builtin/cache/CachePlugin.ts"() {
|
|
2575
|
+
// src/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.ts
|
|
2576
|
+
var _CommonDirectiveTransformer, CommonDirectiveTransformer;
|
|
2577
|
+
var init_CommonDirectiveTransformer = __esm({
|
|
2578
|
+
"src/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.ts"() {
|
|
2747
2579
|
"use strict";
|
|
2748
2580
|
init_cjs_shims();
|
|
2749
2581
|
init_plugins();
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2582
|
+
_CommonDirectiveTransformer = class _CommonDirectiveTransformer extends CompilerPlugin {
|
|
2583
|
+
transformer = null;
|
|
2584
|
+
async activate(ctx) {
|
|
2585
|
+
const { createDirectiveTransformer } = await import("directive-to-hof");
|
|
2586
|
+
this.transformer = createDirectiveTransformer(this.options);
|
|
2587
|
+
}
|
|
2588
|
+
async deactivate(ctx) {
|
|
2589
|
+
this.transformer = null;
|
|
2590
|
+
}
|
|
2753
2591
|
async transform(params) {
|
|
2754
2592
|
if (!this.options.enabled) return null;
|
|
2755
|
-
|
|
2593
|
+
if (!this.transformer) return null;
|
|
2594
|
+
const result = await this.transformer(
|
|
2756
2595
|
params.contents.toString(),
|
|
2757
2596
|
params.path
|
|
2758
2597
|
);
|
|
@@ -2762,6 +2601,30 @@ var init_CachePlugin = __esm({
|
|
|
2762
2601
|
};
|
|
2763
2602
|
}
|
|
2764
2603
|
};
|
|
2604
|
+
__name(_CommonDirectiveTransformer, "CommonDirectiveTransformer");
|
|
2605
|
+
CommonDirectiveTransformer = _CommonDirectiveTransformer;
|
|
2606
|
+
}
|
|
2607
|
+
});
|
|
2608
|
+
|
|
2609
|
+
// src/plugins/plugin-runtime/builtin/CachePlugin.ts
|
|
2610
|
+
var _CachePlugin, CachePlugin;
|
|
2611
|
+
var init_CachePlugin = __esm({
|
|
2612
|
+
"src/plugins/plugin-runtime/builtin/CachePlugin.ts"() {
|
|
2613
|
+
"use strict";
|
|
2614
|
+
init_cjs_shims();
|
|
2615
|
+
init_CommonDirectiveTransformer();
|
|
2616
|
+
_CachePlugin = class _CachePlugin extends CommonDirectiveTransformer {
|
|
2617
|
+
name = "CachePlugin";
|
|
2618
|
+
constructor(options) {
|
|
2619
|
+
super({
|
|
2620
|
+
...options,
|
|
2621
|
+
directive: "use cache",
|
|
2622
|
+
importPath: "commandkit",
|
|
2623
|
+
importName: "__SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED",
|
|
2624
|
+
asyncOnly: true
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
};
|
|
2765
2628
|
__name(_CachePlugin, "CachePlugin");
|
|
2766
2629
|
CachePlugin = _CachePlugin;
|
|
2767
2630
|
}
|
|
@@ -3129,8 +2992,8 @@ var init_MessageCommandParser = __esm({
|
|
|
3129
2992
|
__name(_MessageCommandParser, "MessageCommandParser");
|
|
3130
2993
|
MessageCommandParser = _MessageCommandParser;
|
|
3131
2994
|
_MessageCommandOptions = class _MessageCommandOptions {
|
|
3132
|
-
constructor(
|
|
3133
|
-
this.parser =
|
|
2995
|
+
constructor(parser) {
|
|
2996
|
+
this.parser = parser;
|
|
3134
2997
|
}
|
|
3135
2998
|
assertOption(name, required = false) {
|
|
3136
2999
|
const option = this.parser.getOption(name);
|
|
@@ -3696,8 +3559,8 @@ var init_Context = __esm({
|
|
|
3696
3559
|
}
|
|
3697
3560
|
get options() {
|
|
3698
3561
|
if (this.isMessage()) {
|
|
3699
|
-
const
|
|
3700
|
-
return
|
|
3562
|
+
const parser = this.config.messageCommandParser;
|
|
3563
|
+
return parser.options;
|
|
3701
3564
|
} else {
|
|
3702
3565
|
const interaction = this.interaction;
|
|
3703
3566
|
return interaction.options;
|
|
@@ -4322,12 +4185,12 @@ var init_AppCommandHandler = __esm({
|
|
|
4322
4185
|
}
|
|
4323
4186
|
async prepareCommandRun(source, cmdName) {
|
|
4324
4187
|
var _a;
|
|
4325
|
-
let
|
|
4188
|
+
let parser;
|
|
4326
4189
|
if (!cmdName) {
|
|
4327
4190
|
if (source instanceof import_discord16.Message) {
|
|
4328
4191
|
if (source.author.bot) return null;
|
|
4329
4192
|
const prefix = await this.commandkit.config.getMessageCommandPrefix(source);
|
|
4330
|
-
|
|
4193
|
+
parser = new MessageCommandParser(
|
|
4331
4194
|
source,
|
|
4332
4195
|
Array.isArray(prefix) ? prefix : [prefix],
|
|
4333
4196
|
(command) => {
|
|
@@ -4350,7 +4213,7 @@ var init_AppCommandHandler = __esm({
|
|
|
4350
4213
|
}
|
|
4351
4214
|
);
|
|
4352
4215
|
try {
|
|
4353
|
-
const fullCommand =
|
|
4216
|
+
const fullCommand = parser.getFullCommand();
|
|
4354
4217
|
const parts = fullCommand.split(" ");
|
|
4355
4218
|
cmdName = parts[0];
|
|
4356
4219
|
} catch (e) {
|
|
@@ -4383,7 +4246,7 @@ var init_AppCommandHandler = __esm({
|
|
|
4383
4246
|
return {
|
|
4384
4247
|
command: loadedCommand,
|
|
4385
4248
|
middlewares,
|
|
4386
|
-
messageCommandParser:
|
|
4249
|
+
messageCommandParser: parser
|
|
4387
4250
|
};
|
|
4388
4251
|
}
|
|
4389
4252
|
async reloadCommands() {
|
|
@@ -5579,7 +5442,7 @@ var init_version = __esm({
|
|
|
5579
5442
|
"use strict";
|
|
5580
5443
|
init_cjs_shims();
|
|
5581
5444
|
version = /* @__MACRO__ $version */
|
|
5582
|
-
"0.1.11-dev.
|
|
5445
|
+
"0.1.11-dev.20250422144359";
|
|
5583
5446
|
}
|
|
5584
5447
|
});
|
|
5585
5448
|
|
|
@@ -6497,6 +6360,7 @@ __export(index_exports, {
|
|
|
6497
6360
|
TextInput: () => TextInput,
|
|
6498
6361
|
UserSelectMenu: () => UserSelectMenu,
|
|
6499
6362
|
UserSelectMenuKit: () => UserSelectMenuKit,
|
|
6363
|
+
__SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: () => __SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
6500
6364
|
after: () => after,
|
|
6501
6365
|
bootstrapCommandkitCLI: () => bootstrapCommandkitCLI,
|
|
6502
6366
|
cache: () => cache,
|
|
@@ -6534,8 +6398,7 @@ __export(index_exports, {
|
|
|
6534
6398
|
rethrow: () => rethrow,
|
|
6535
6399
|
revalidate: () => revalidate,
|
|
6536
6400
|
useEnvironment: () => useEnvironment,
|
|
6537
|
-
version: () => version
|
|
6538
|
-
zxcvbnm____: () => zxcvbnm____
|
|
6401
|
+
version: () => version
|
|
6539
6402
|
});
|
|
6540
6403
|
module.exports = __toCommonJS(index_exports);
|
|
6541
6404
|
init_cjs_shims();
|
|
@@ -6726,7 +6589,7 @@ function isCachedFunction(fn) {
|
|
|
6726
6589
|
return Object.prototype.hasOwnProperty.call(fn, CACHED_FN_SYMBOL);
|
|
6727
6590
|
}
|
|
6728
6591
|
__name(isCachedFunction, "isCachedFunction");
|
|
6729
|
-
var
|
|
6592
|
+
var __SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = useCache;
|
|
6730
6593
|
|
|
6731
6594
|
// src/app/index.ts
|
|
6732
6595
|
init_cjs_shims();
|
|
@@ -6871,6 +6734,7 @@ var index_default = CommandKit;
|
|
|
6871
6734
|
TextInput,
|
|
6872
6735
|
UserSelectMenu,
|
|
6873
6736
|
UserSelectMenuKit,
|
|
6737
|
+
__SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
6874
6738
|
after,
|
|
6875
6739
|
bootstrapCommandkitCLI,
|
|
6876
6740
|
cache,
|
|
@@ -6907,7 +6771,6 @@ var index_default = CommandKit;
|
|
|
6907
6771
|
rethrow,
|
|
6908
6772
|
revalidate,
|
|
6909
6773
|
useEnvironment,
|
|
6910
|
-
version
|
|
6911
|
-
zxcvbnm____
|
|
6774
|
+
version
|
|
6912
6775
|
});
|
|
6913
6776
|
//# sourceMappingURL=index.js.map
|