commandkit 0.1.11-dev.20250417143823 → 0.1.11-dev.20250423160629
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 +59 -194
- 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
|
@@ -206,10 +206,12 @@ function makeContextAwareFunction(env, fn, finalizer) {
|
|
|
206
206
|
}
|
|
207
207
|
} finally {
|
|
208
208
|
if (typeof finalizer === "function") {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
setImmediate(async () => {
|
|
210
|
+
try {
|
|
211
|
+
await finalizer(...args);
|
|
212
|
+
} catch {
|
|
213
|
+
}
|
|
214
|
+
});
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
217
|
});
|
|
@@ -2572,187 +2574,26 @@ var init_plugins = __esm({
|
|
|
2572
2574
|
}
|
|
2573
2575
|
});
|
|
2574
2576
|
|
|
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"() {
|
|
2577
|
+
// src/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.ts
|
|
2578
|
+
var _CommonDirectiveTransformer, CommonDirectiveTransformer;
|
|
2579
|
+
var init_CommonDirectiveTransformer = __esm({
|
|
2580
|
+
"src/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.ts"() {
|
|
2747
2581
|
"use strict";
|
|
2748
2582
|
init_cjs_shims();
|
|
2749
2583
|
init_plugins();
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2584
|
+
_CommonDirectiveTransformer = class _CommonDirectiveTransformer extends CompilerPlugin {
|
|
2585
|
+
transformer = null;
|
|
2586
|
+
async activate(ctx) {
|
|
2587
|
+
const { createDirectiveTransformer } = await import("directive-to-hof");
|
|
2588
|
+
this.transformer = createDirectiveTransformer(this.options);
|
|
2589
|
+
}
|
|
2590
|
+
async deactivate(ctx) {
|
|
2591
|
+
this.transformer = null;
|
|
2592
|
+
}
|
|
2753
2593
|
async transform(params) {
|
|
2754
2594
|
if (!this.options.enabled) return null;
|
|
2755
|
-
|
|
2595
|
+
if (!this.transformer) return null;
|
|
2596
|
+
const result = await this.transformer(
|
|
2756
2597
|
params.contents.toString(),
|
|
2757
2598
|
params.path
|
|
2758
2599
|
);
|
|
@@ -2762,6 +2603,30 @@ var init_CachePlugin = __esm({
|
|
|
2762
2603
|
};
|
|
2763
2604
|
}
|
|
2764
2605
|
};
|
|
2606
|
+
__name(_CommonDirectiveTransformer, "CommonDirectiveTransformer");
|
|
2607
|
+
CommonDirectiveTransformer = _CommonDirectiveTransformer;
|
|
2608
|
+
}
|
|
2609
|
+
});
|
|
2610
|
+
|
|
2611
|
+
// src/plugins/plugin-runtime/builtin/CachePlugin.ts
|
|
2612
|
+
var _CachePlugin, CachePlugin;
|
|
2613
|
+
var init_CachePlugin = __esm({
|
|
2614
|
+
"src/plugins/plugin-runtime/builtin/CachePlugin.ts"() {
|
|
2615
|
+
"use strict";
|
|
2616
|
+
init_cjs_shims();
|
|
2617
|
+
init_CommonDirectiveTransformer();
|
|
2618
|
+
_CachePlugin = class _CachePlugin extends CommonDirectiveTransformer {
|
|
2619
|
+
name = "CachePlugin";
|
|
2620
|
+
constructor(options) {
|
|
2621
|
+
super({
|
|
2622
|
+
...options,
|
|
2623
|
+
directive: "use cache",
|
|
2624
|
+
importPath: "commandkit",
|
|
2625
|
+
importName: "__SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED",
|
|
2626
|
+
asyncOnly: true
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2629
|
+
};
|
|
2765
2630
|
__name(_CachePlugin, "CachePlugin");
|
|
2766
2631
|
CachePlugin = _CachePlugin;
|
|
2767
2632
|
}
|
|
@@ -3129,8 +2994,8 @@ var init_MessageCommandParser = __esm({
|
|
|
3129
2994
|
__name(_MessageCommandParser, "MessageCommandParser");
|
|
3130
2995
|
MessageCommandParser = _MessageCommandParser;
|
|
3131
2996
|
_MessageCommandOptions = class _MessageCommandOptions {
|
|
3132
|
-
constructor(
|
|
3133
|
-
this.parser =
|
|
2997
|
+
constructor(parser) {
|
|
2998
|
+
this.parser = parser;
|
|
3134
2999
|
}
|
|
3135
3000
|
assertOption(name, required = false) {
|
|
3136
3001
|
const option = this.parser.getOption(name);
|
|
@@ -3696,8 +3561,8 @@ var init_Context = __esm({
|
|
|
3696
3561
|
}
|
|
3697
3562
|
get options() {
|
|
3698
3563
|
if (this.isMessage()) {
|
|
3699
|
-
const
|
|
3700
|
-
return
|
|
3564
|
+
const parser = this.config.messageCommandParser;
|
|
3565
|
+
return parser.options;
|
|
3701
3566
|
} else {
|
|
3702
3567
|
const interaction = this.interaction;
|
|
3703
3568
|
return interaction.options;
|
|
@@ -4322,12 +4187,12 @@ var init_AppCommandHandler = __esm({
|
|
|
4322
4187
|
}
|
|
4323
4188
|
async prepareCommandRun(source, cmdName) {
|
|
4324
4189
|
var _a;
|
|
4325
|
-
let
|
|
4190
|
+
let parser;
|
|
4326
4191
|
if (!cmdName) {
|
|
4327
4192
|
if (source instanceof import_discord16.Message) {
|
|
4328
4193
|
if (source.author.bot) return null;
|
|
4329
4194
|
const prefix = await this.commandkit.config.getMessageCommandPrefix(source);
|
|
4330
|
-
|
|
4195
|
+
parser = new MessageCommandParser(
|
|
4331
4196
|
source,
|
|
4332
4197
|
Array.isArray(prefix) ? prefix : [prefix],
|
|
4333
4198
|
(command) => {
|
|
@@ -4350,7 +4215,7 @@ var init_AppCommandHandler = __esm({
|
|
|
4350
4215
|
}
|
|
4351
4216
|
);
|
|
4352
4217
|
try {
|
|
4353
|
-
const fullCommand =
|
|
4218
|
+
const fullCommand = parser.getFullCommand();
|
|
4354
4219
|
const parts = fullCommand.split(" ");
|
|
4355
4220
|
cmdName = parts[0];
|
|
4356
4221
|
} catch (e) {
|
|
@@ -4383,7 +4248,7 @@ var init_AppCommandHandler = __esm({
|
|
|
4383
4248
|
return {
|
|
4384
4249
|
command: loadedCommand,
|
|
4385
4250
|
middlewares,
|
|
4386
|
-
messageCommandParser:
|
|
4251
|
+
messageCommandParser: parser
|
|
4387
4252
|
};
|
|
4388
4253
|
}
|
|
4389
4254
|
async reloadCommands() {
|
|
@@ -5579,7 +5444,7 @@ var init_version = __esm({
|
|
|
5579
5444
|
"use strict";
|
|
5580
5445
|
init_cjs_shims();
|
|
5581
5446
|
version = /* @__MACRO__ $version */
|
|
5582
|
-
"0.1.11-dev.
|
|
5447
|
+
"0.1.11-dev.20250423160629";
|
|
5583
5448
|
}
|
|
5584
5449
|
});
|
|
5585
5450
|
|
|
@@ -6497,6 +6362,7 @@ __export(index_exports, {
|
|
|
6497
6362
|
TextInput: () => TextInput,
|
|
6498
6363
|
UserSelectMenu: () => UserSelectMenu,
|
|
6499
6364
|
UserSelectMenuKit: () => UserSelectMenuKit,
|
|
6365
|
+
__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
6366
|
after: () => after,
|
|
6501
6367
|
bootstrapCommandkitCLI: () => bootstrapCommandkitCLI,
|
|
6502
6368
|
cache: () => cache,
|
|
@@ -6534,8 +6400,7 @@ __export(index_exports, {
|
|
|
6534
6400
|
rethrow: () => rethrow,
|
|
6535
6401
|
revalidate: () => revalidate,
|
|
6536
6402
|
useEnvironment: () => useEnvironment,
|
|
6537
|
-
version: () => version
|
|
6538
|
-
zxcvbnm____: () => zxcvbnm____
|
|
6403
|
+
version: () => version
|
|
6539
6404
|
});
|
|
6540
6405
|
module.exports = __toCommonJS(index_exports);
|
|
6541
6406
|
init_cjs_shims();
|
|
@@ -6726,7 +6591,7 @@ function isCachedFunction(fn) {
|
|
|
6726
6591
|
return Object.prototype.hasOwnProperty.call(fn, CACHED_FN_SYMBOL);
|
|
6727
6592
|
}
|
|
6728
6593
|
__name(isCachedFunction, "isCachedFunction");
|
|
6729
|
-
var
|
|
6594
|
+
var __SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = useCache;
|
|
6730
6595
|
|
|
6731
6596
|
// src/app/index.ts
|
|
6732
6597
|
init_cjs_shims();
|
|
@@ -6871,6 +6736,7 @@ var index_default = CommandKit;
|
|
|
6871
6736
|
TextInput,
|
|
6872
6737
|
UserSelectMenu,
|
|
6873
6738
|
UserSelectMenuKit,
|
|
6739
|
+
__SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
6874
6740
|
after,
|
|
6875
6741
|
bootstrapCommandkitCLI,
|
|
6876
6742
|
cache,
|
|
@@ -6907,7 +6773,6 @@ var index_default = CommandKit;
|
|
|
6907
6773
|
rethrow,
|
|
6908
6774
|
revalidate,
|
|
6909
6775
|
useEnvironment,
|
|
6910
|
-
version
|
|
6911
|
-
zxcvbnm____
|
|
6776
|
+
version
|
|
6912
6777
|
});
|
|
6913
6778
|
//# sourceMappingURL=index.js.map
|