commandkit 1.0.0-dev.20250511124349 → 1.0.0-dev.20250512143211

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.js CHANGED
@@ -59,75 +59,6 @@ var init_colors = __esm({
59
59
  }
60
60
  });
61
61
 
62
- // src/cache/CacheProvider.ts
63
- var _CacheProvider, CacheProvider;
64
- var init_CacheProvider = __esm({
65
- "src/cache/CacheProvider.ts"() {
66
- "use strict";
67
- init_cjs_shims();
68
- _CacheProvider = class _CacheProvider {
69
- };
70
- __name(_CacheProvider, "CacheProvider");
71
- CacheProvider = _CacheProvider;
72
- }
73
- });
74
-
75
- // src/cache/MemoryCache.ts
76
- var _cache, _MemoryCache, MemoryCache;
77
- var init_MemoryCache = __esm({
78
- "src/cache/MemoryCache.ts"() {
79
- "use strict";
80
- init_cjs_shims();
81
- init_CacheProvider();
82
- _MemoryCache = class _MemoryCache extends CacheProvider {
83
- constructor() {
84
- super(...arguments);
85
- __privateAdd(this, _cache, /* @__PURE__ */ new Map());
86
- }
87
- async get(key) {
88
- const entry = __privateGet(this, _cache).get(key);
89
- if (!entry) {
90
- return void 0;
91
- }
92
- if (entry.ttl && Date.now() > entry.ttl) {
93
- __privateGet(this, _cache).delete(key);
94
- return void 0;
95
- }
96
- return entry;
97
- }
98
- async set(key, value, ttl) {
99
- const entry = {
100
- value,
101
- ttl: ttl != null ? Date.now() + ttl : void 0
102
- };
103
- __privateGet(this, _cache).set(key, entry);
104
- }
105
- async exists(key) {
106
- return __privateGet(this, _cache).has(key);
107
- }
108
- async delete(key) {
109
- __privateGet(this, _cache).delete(key);
110
- }
111
- async clear() {
112
- __privateGet(this, _cache).clear();
113
- }
114
- async expire(key, ttl) {
115
- const entry = __privateGet(this, _cache).get(key);
116
- if (!entry) return;
117
- const _ttl = Date.now() + ttl;
118
- if (_ttl < Date.now()) {
119
- __privateGet(this, _cache).delete(key);
120
- return;
121
- }
122
- entry.ttl = _ttl;
123
- }
124
- };
125
- _cache = new WeakMap();
126
- __name(_MemoryCache, "MemoryCache");
127
- MemoryCache = _MemoryCache;
128
- }
129
- });
130
-
131
62
  // src/components/v1/action-row/ActionRow.ts
132
63
  function ActionRow(props) {
133
64
  const row = new import_discord.ActionRowBuilder();
@@ -2087,6 +2018,9 @@ var init_constants = __esm({
2087
2018
  });
2088
2019
 
2089
2020
  // src/plugins/PluginCommon.ts
2021
+ function isPlugin(plugin) {
2022
+ return plugin instanceof PluginCommon;
2023
+ }
2090
2024
  var import_node_crypto, _PluginCommon, PluginCommon;
2091
2025
  var init_PluginCommon = __esm({
2092
2026
  "src/plugins/PluginCommon.ts"() {
@@ -2112,12 +2046,13 @@ var init_PluginCommon = __esm({
2112
2046
  };
2113
2047
  __name(_PluginCommon, "PluginCommon");
2114
2048
  PluginCommon = _PluginCommon;
2049
+ __name(isPlugin, "isPlugin");
2115
2050
  }
2116
2051
  });
2117
2052
 
2118
2053
  // src/plugins/CompilerPlugin.ts
2119
2054
  function isCompilerPlugin(plugin) {
2120
- return plugin instanceof CompilerPlugin;
2055
+ return isPlugin(plugin) && plugin.type === "compiler" /* Compiler */;
2121
2056
  }
2122
2057
  var _CompilerPlugin, CompilerPlugin;
2123
2058
  var init_CompilerPlugin = __esm({
@@ -2126,6 +2061,7 @@ var init_CompilerPlugin = __esm({
2126
2061
  init_cjs_shims();
2127
2062
  init_PluginCommon();
2128
2063
  _CompilerPlugin = class _CompilerPlugin extends PluginCommon {
2064
+ type = "compiler" /* Compiler */;
2129
2065
  /**
2130
2066
  * Called when transformation is requested to this plugin
2131
2067
  * @param params The parameters for the transformation
@@ -2161,7 +2097,7 @@ var init_CompilerPlugin = __esm({
2161
2097
 
2162
2098
  // src/plugins/RuntimePlugin.ts
2163
2099
  function isRuntimePlugin(plugin) {
2164
- return plugin instanceof RuntimePlugin;
2100
+ return isPlugin(plugin) && plugin.type === "runtime" /* Runtime */;
2165
2101
  }
2166
2102
  var _RuntimePlugin, RuntimePlugin;
2167
2103
  var init_RuntimePlugin = __esm({
@@ -2170,6 +2106,7 @@ var init_RuntimePlugin = __esm({
2170
2106
  init_cjs_shims();
2171
2107
  init_PluginCommon();
2172
2108
  _RuntimePlugin = class _RuntimePlugin extends PluginCommon {
2109
+ type = "runtime" /* Runtime */;
2173
2110
  /**
2174
2111
  * Called before commands are loaded
2175
2112
  */
@@ -2763,21 +2700,6 @@ var init_runtime = __esm({
2763
2700
  }
2764
2701
  });
2765
2702
 
2766
- // src/plugins/index.ts
2767
- var init_plugins = __esm({
2768
- "src/plugins/index.ts"() {
2769
- "use strict";
2770
- init_cjs_shims();
2771
- init_CompilerPlugin();
2772
- init_RuntimePlugin();
2773
- init_types2();
2774
- init_CommandKitPluginRuntime();
2775
- init_CompilerPluginRuntime();
2776
- init_types3();
2777
- init_runtime();
2778
- }
2779
- });
2780
-
2781
2703
  // src/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.ts
2782
2704
  var _CommonDirectiveTransformer, CommonDirectiveTransformer;
2783
2705
  var init_CommonDirectiveTransformer = __esm({
@@ -2812,27 +2734,19 @@ var init_CommonDirectiveTransformer = __esm({
2812
2734
  }
2813
2735
  });
2814
2736
 
2815
- // src/plugins/plugin-runtime/builtin/CachePlugin.ts
2816
- var _CachePlugin, CachePlugin;
2817
- var init_CachePlugin = __esm({
2818
- "src/plugins/plugin-runtime/builtin/CachePlugin.ts"() {
2737
+ // src/plugins/index.ts
2738
+ var init_plugins = __esm({
2739
+ "src/plugins/index.ts"() {
2819
2740
  "use strict";
2820
2741
  init_cjs_shims();
2742
+ init_CompilerPlugin();
2743
+ init_RuntimePlugin();
2744
+ init_types2();
2745
+ init_CommandKitPluginRuntime();
2746
+ init_CompilerPluginRuntime();
2747
+ init_types3();
2748
+ init_runtime();
2821
2749
  init_CommonDirectiveTransformer();
2822
- _CachePlugin = class _CachePlugin extends CommonDirectiveTransformer {
2823
- name = "CachePlugin";
2824
- constructor(options) {
2825
- super({
2826
- ...options,
2827
- directive: "use cache",
2828
- importPath: "commandkit",
2829
- importName: "__SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED",
2830
- asyncOnly: true
2831
- });
2832
- }
2833
- };
2834
- __name(_CachePlugin, "CachePlugin");
2835
- CachePlugin = _CachePlugin;
2836
2750
  }
2837
2751
  });
2838
2752
 
@@ -2876,20 +2790,13 @@ var init_default = __esm({
2876
2790
  "src/config/default.ts"() {
2877
2791
  "use strict";
2878
2792
  init_cjs_shims();
2879
- init_CachePlugin();
2880
2793
  init_MacroPlugin();
2881
2794
  defaultConfig = {
2882
- plugins: [
2883
- new CachePlugin({ enabled: true }),
2884
- new MacroPlugin({ enabled: true })
2885
- ],
2795
+ plugins: [new MacroPlugin({ enabled: true })],
2886
2796
  esbuildPlugins: [],
2887
2797
  compilerOptions: {
2888
2798
  macro: {
2889
2799
  development: false
2890
- },
2891
- cache: {
2892
- development: true
2893
2800
  }
2894
2801
  },
2895
2802
  static: true,
@@ -2912,16 +2819,12 @@ function getConfig() {
2912
2819
  return defined;
2913
2820
  }
2914
2821
  function defineConfig(config = {}) {
2915
- var _a, _b;
2822
+ var _a;
2916
2823
  defined = {
2917
2824
  compilerOptions: {
2918
- cache: {
2919
- ...defaultConfig.compilerOptions.cache,
2920
- ...(_a = config.compilerOptions) == null ? void 0 : _a.cache
2921
- },
2922
2825
  macro: {
2923
2826
  ...defaultConfig.compilerOptions.macro,
2924
- ...(_b = config.compilerOptions) == null ? void 0 : _b.macro
2827
+ ...(_a = config.compilerOptions) == null ? void 0 : _a.macro
2925
2828
  }
2926
2829
  },
2927
2830
  distDir: config.distDir ?? defaultConfig.distDir,
@@ -2933,10 +2836,9 @@ function defineConfig(config = {}) {
2933
2836
  ...config.esbuildPlugins ?? [],
2934
2837
  ...defaultConfig.esbuildPlugins ?? []
2935
2838
  ],
2936
- plugins: [
2937
- ...config.plugins ?? [],
2938
- ...defaultConfig.plugins ?? []
2939
- ],
2839
+ plugins: [...config.plugins ?? [], ...defaultConfig.plugins ?? []].flat(
2840
+ Infinity
2841
+ ),
2940
2842
  sourceMap: {
2941
2843
  ...defaultConfig.sourceMap,
2942
2844
  ...config.sourceMap
@@ -3019,7 +2921,7 @@ function findAppDirectory() {
3019
2921
  }
3020
2922
  return null;
3021
2923
  }
3022
- function debounce(fn, ms2) {
2924
+ function debounce(fn, ms) {
3023
2925
  let timer = null;
3024
2926
  let resolve = null;
3025
2927
  return (...args) => {
@@ -3036,7 +2938,7 @@ function debounce(fn, ms2) {
3036
2938
  res(result);
3037
2939
  timer = null;
3038
2940
  resolve = null;
3039
- }, ms2);
2941
+ }, ms);
3040
2942
  });
3041
2943
  };
3042
2944
  }
@@ -5429,8 +5331,6 @@ var init_CommandKit = __esm({
5429
5331
  init_cjs_shims();
5430
5332
  import_node_events2 = __toESM(require("events"));
5431
5333
  init_colors();
5432
- init_CacheProvider();
5433
- init_MemoryCache();
5434
5334
  init_components();
5435
5335
  init_EventInterceptor();
5436
5336
  import_discord26 = require("discord.js");
@@ -5489,9 +5389,6 @@ var init_CommandKit = __esm({
5489
5389
  __publicField(this, "eventHandler", new AppEventsHandler(this));
5490
5390
  __publicField(this, "plugins");
5491
5391
  __publicField(this, "events", new CommandKitEventsChannel(this));
5492
- if (options.cacheProvider !== null && (!options.cacheProvider || !(options.cacheProvider instanceof CacheProvider))) {
5493
- options.cacheProvider = new MemoryCache();
5494
- }
5495
5392
  this.plugins = new CommandKitPluginRuntime(this);
5496
5393
  if (!_CommandKit.instance) {
5497
5394
  _CommandKit.instance = this;
@@ -5578,26 +5475,6 @@ var init_CommandKit = __esm({
5578
5475
  this.config.defaultLocale = locale;
5579
5476
  return this;
5580
5477
  }
5581
- /**
5582
- * Sets the cache provider.
5583
- * @param provider The cache provider.
5584
- */
5585
- setCacheProvider(provider) {
5586
- if (!(provider instanceof CacheProvider)) {
5587
- throw new Error(
5588
- colors_default.red("Cache provider must be an instance of CacheProvider.")
5589
- );
5590
- }
5591
- this.options.cacheProvider = provider;
5592
- return this;
5593
- }
5594
- /**
5595
- * Resolves the current cache provider.
5596
- */
5597
- getCacheProvider() {
5598
- const provider = this.options.cacheProvider;
5599
- return provider ?? null;
5600
- }
5601
5478
  /**
5602
5479
  * Get the client attached to this CommandKit instance.
5603
5480
  */
@@ -5738,7 +5615,7 @@ var init_version = __esm({
5738
5615
  "use strict";
5739
5616
  init_cjs_shims();
5740
5617
  version = /* @__MACRO__ $version */
5741
- "1.0.0-dev.20250511124349";
5618
+ "1.0.0-dev.20250512143211";
5742
5619
  }
5743
5620
  });
5744
5621
 
@@ -6135,7 +6012,7 @@ async function bootstrapDevelopmentServer(configPath) {
6135
6012
  }, "waitForAcknowledgment");
6136
6013
  const sendHmrEvent = /* @__PURE__ */ __name(async (event, path3) => {
6137
6014
  if (!ps || !ps.send) return false;
6138
- const messageId = (0, import_node_crypto5.randomUUID)();
6015
+ const messageId = (0, import_node_crypto3.randomUUID)();
6139
6016
  const messagePromise = waitForAcknowledgment(messageId);
6140
6017
  ps.send({ event, path: path3, id: messageId });
6141
6018
  try {
@@ -6252,7 +6129,7 @@ ${colors_default.yellowBright("rc")} - Reload all commands
6252
6129
  ${colors_default.yellowBright("re")} - Reload all events`
6253
6130
  );
6254
6131
  }
6255
- var import_path2, import_chokidar, import_promises6, import_node_crypto5, isCommandSource, isEventSource;
6132
+ var import_path2, import_chokidar, import_promises6, import_node_crypto3, isCommandSource, isEventSource;
6256
6133
  var init_development = __esm({
6257
6134
  "src/cli/development.ts"() {
6258
6135
  "use strict";
@@ -6266,7 +6143,7 @@ var init_development = __esm({
6266
6143
  init_utilities();
6267
6144
  init_colors();
6268
6145
  import_promises6 = require("timers/promises");
6269
- import_node_crypto5 = require("crypto");
6146
+ import_node_crypto3 = require("crypto");
6270
6147
  init_constants();
6271
6148
  __name(buildAndStart, "buildAndStart");
6272
6149
  isCommandSource = /* @__PURE__ */ __name((p) => p.replaceAll("\\", "/").includes("src/app/commands"), "isCommandSource");
@@ -6599,7 +6476,7 @@ var init_information = __esm({
6599
6476
  import_node_fs10 = __toESM(require("fs"));
6600
6477
  import_node_path11 = __toESM(require("path"));
6601
6478
  knownPlugins = /* @__MACRO__ $getKnownPlugins */
6602
- ["@commandkit/devtools", "@commandkit/i18n", "@commandkit/legacy", "@commandkit/redis"];
6479
+ ["@commandkit/cache", "@commandkit/devtools", "@commandkit/i18n", "@commandkit/legacy", "@commandkit/redis"];
6603
6480
  __name(findPackageVersion, "findPackageVersion");
6604
6481
  __name(getBinaryVersion, "getBinaryVersion");
6605
6482
  __name(showInformation, "showInformation");
@@ -6617,7 +6494,6 @@ __export(index_exports, {
6617
6494
  COMMANDKIT_CACHE_TAG: () => COMMANDKIT_CACHE_TAG,
6618
6495
  COMMANDKIT_IS_DEV: () => COMMANDKIT_IS_DEV,
6619
6496
  COMMANDKIT_IS_TEST: () => COMMANDKIT_IS_TEST,
6620
- CacheProvider: () => CacheProvider,
6621
6497
  ChannelSelectMenu: () => ChannelSelectMenu,
6622
6498
  ChannelSelectMenuKit: () => ChannelSelectMenuKit,
6623
6499
  CommandExecutionMode: () => CommandExecutionMode,
@@ -6627,6 +6503,7 @@ __export(index_exports, {
6627
6503
  CommandKitPluginRuntime: () => CommandKitPluginRuntime,
6628
6504
  CommandRegistrar: () => CommandRegistrar,
6629
6505
  CommandsRouter: () => CommandsRouter,
6506
+ CommonDirectiveTransformer: () => CommonDirectiveTransformer,
6630
6507
  CompilerPlugin: () => CompilerPlugin,
6631
6508
  CompilerPluginRuntime: () => CompilerPluginRuntime,
6632
6509
  Container: () => Container,
@@ -6641,7 +6518,6 @@ __export(index_exports, {
6641
6518
  Logger: () => Logger,
6642
6519
  MediaGallery: () => MediaGallery,
6643
6520
  MediaGalleryItem: () => MediaGalleryItem,
6644
- MemoryCache: () => MemoryCache,
6645
6521
  MentionableSelectMenu: () => MentionableSelectMenu,
6646
6522
  MentionableSelectMenuKit: () => MentionableSelectMenuKit,
6647
6523
  MessageCommandOptions: () => MessageCommandOptions,
@@ -6665,12 +6541,8 @@ __export(index_exports, {
6665
6541
  Thumbnail: () => Thumbnail,
6666
6542
  UserSelectMenu: () => UserSelectMenu,
6667
6543
  UserSelectMenuKit: () => UserSelectMenuKit,
6668
- __SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: () => __SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
6669
6544
  after: () => after,
6670
6545
  bootstrapCommandkitCLI: () => bootstrapCommandkitCLI,
6671
- cache: () => cache,
6672
- cacheLife: () => cacheLife,
6673
- cacheTag: () => cacheTag,
6674
6546
  cancelAfter: () => cancelAfter,
6675
6547
  commandkit: () => commandkit,
6676
6548
  createElement: () => createElement,
@@ -6690,8 +6562,6 @@ __export(index_exports, {
6690
6562
  getElement: () => getElement,
6691
6563
  getEventWorkerContext: () => getEventWorkerContext,
6692
6564
  getSourceDirectories: () => getSourceDirectories,
6693
- invalidate: () => invalidate,
6694
- isCachedFunction: () => isCachedFunction,
6695
6565
  isCommandKitElement: () => isCommandKitElement,
6696
6566
  isCompilerPlugin: () => isCompilerPlugin,
6697
6567
  isInteractionSource: () => isInteractionSource,
@@ -6703,7 +6573,6 @@ __export(index_exports, {
6703
6573
  provideContext: () => provideContext,
6704
6574
  redirect: () => redirect,
6705
6575
  rethrow: () => rethrow,
6706
- revalidate: () => revalidate,
6707
6576
  runInEventWorkerContext: () => runInEventWorkerContext,
6708
6577
  stopEvents: () => stopEvents,
6709
6578
  useEnvironment: () => useEnvironment,
@@ -6718,188 +6587,6 @@ init_config();
6718
6587
  init_async_context();
6719
6588
  init_environment();
6720
6589
 
6721
- // src/cache/index.ts
6722
- init_cjs_shims();
6723
- init_CacheProvider();
6724
- init_MemoryCache();
6725
-
6726
- // src/cache/use-cache.ts
6727
- init_cjs_shims();
6728
- var import_node_async_hooks3 = require("async_hooks");
6729
- init_async_context();
6730
- var import_node_crypto4 = require("crypto");
6731
- var import_ms = __toESM(require("ms"));
6732
-
6733
- // src/cache/utils.ts
6734
- init_cjs_shims();
6735
- var import_node_crypto3 = require("crypto");
6736
- var tracker = 0n;
6737
- var references = /* @__PURE__ */ new WeakMap();
6738
- var PRIMITIVE_TYPES = /* @__PURE__ */ new Set(
6739
- [
6740
- "string",
6741
- "number",
6742
- "boolean",
6743
- "bigint",
6744
- "undefined"
6745
- ]
6746
- );
6747
- function isSerializablePrimitive(value) {
6748
- return value === null || PRIMITIVE_TYPES.has(typeof value);
6749
- }
6750
- __name(isSerializablePrimitive, "isSerializablePrimitive");
6751
- function createKey(val) {
6752
- return `commandkit:cache:object:${val}`;
6753
- }
6754
- __name(createKey, "createKey");
6755
- function getObjectId(obj) {
6756
- const primitive = isSerializablePrimitive(obj);
6757
- if (primitive) return createKey(obj);
6758
- if (obj instanceof Date) return createKey(obj.getTime());
6759
- if (obj instanceof RegExp) return createKey(obj);
6760
- const ref = references.get(obj);
6761
- if (ref) return createKey(ref);
6762
- const id = tracker++;
6763
- references.set(obj, id);
6764
- return createKey(id);
6765
- }
6766
- __name(getObjectId, "getObjectId");
6767
- async function createObjectHash(...args) {
6768
- const serializedKey = args.map(getObjectId).join(":");
6769
- try {
6770
- const hash = (0, import_node_crypto3.createHash)("sha256");
6771
- hash.update(serializedKey);
6772
- return hash.digest("hex");
6773
- } catch {
6774
- return serializedKey;
6775
- }
6776
- }
6777
- __name(createObjectHash, "createObjectHash");
6778
-
6779
- // src/cache/use-cache.ts
6780
- var cacheContext = new import_node_async_hooks3.AsyncLocalStorage();
6781
- var fnStore = /* @__PURE__ */ new Map();
6782
- var DEFAULT_TTL = (0, import_ms.default)("15m");
6783
- var CACHE_FN_ID = `__cache_fn_id_${Date.now()}__${Math.random()}__`;
6784
- var CACHED_FN_SYMBOL = Symbol("commandkit.cache.sentinel");
6785
- function getCacheProvider() {
6786
- const commandkit2 = getCommandKit(true);
6787
- const provider = commandkit2.getCacheProvider();
6788
- if (!provider) {
6789
- throw new Error(
6790
- `Cache provider was not found, please provide a cache provider to commandkit.`
6791
- );
6792
- }
6793
- return provider;
6794
- }
6795
- __name(getCacheProvider, "getCacheProvider");
6796
- function useCache(fn, id, params) {
6797
- const isLocal = id === CACHE_FN_ID;
6798
- if (id && !isLocal) {
6799
- throw new Error("Illegal use of cache function.");
6800
- }
6801
- const fnId = (0, import_node_crypto4.randomUUID)();
6802
- const memo = /* @__PURE__ */ __name(async (...args) => {
6803
- const forcedName = isLocal ? params == null ? void 0 : params.name : null;
6804
- const keyHash = forcedName ?? await createObjectHash(fnId, ...args);
6805
- const resolvedTTL = isLocal && (params == null ? void 0 : params.ttl) != null ? typeof params.ttl === "string" ? (0, import_ms.default)(params.ttl) : params.ttl : null;
6806
- return cacheContext.run(
6807
- {
6808
- params: {
6809
- name: keyHash,
6810
- ttl: resolvedTTL ?? DEFAULT_TTL
6811
- }
6812
- },
6813
- async () => {
6814
- const provider = getCacheProvider();
6815
- const context2 = cacheContext.getStore();
6816
- if (!context2) {
6817
- throw new Error("Cache context was not found.");
6818
- }
6819
- const storedFn = fnStore.get(keyHash);
6820
- const effectiveKey = (storedFn == null ? void 0 : storedFn.key) ?? context2.params.name;
6821
- const cached = await provider.get(effectiveKey);
6822
- if (cached && cached.value != null) return cached.value;
6823
- const result = await fn(...args);
6824
- if (result != null) {
6825
- const finalKey = context2.params.name;
6826
- const ttl = context2.params.ttl ?? DEFAULT_TTL;
6827
- await provider.set(finalKey, result, ttl);
6828
- fnStore.set(keyHash, {
6829
- key: finalKey,
6830
- hash: keyHash,
6831
- ttl,
6832
- original: fn,
6833
- memo
6834
- });
6835
- }
6836
- return result;
6837
- }
6838
- );
6839
- }, "memo");
6840
- if (!Object.prototype.hasOwnProperty.call(fn, CACHED_FN_SYMBOL)) {
6841
- Object.defineProperty(memo, CACHED_FN_SYMBOL, {
6842
- get() {
6843
- return true;
6844
- },
6845
- configurable: false,
6846
- enumerable: false
6847
- });
6848
- }
6849
- return memo;
6850
- }
6851
- __name(useCache, "useCache");
6852
- function cache(fn, params) {
6853
- return useCache(fn, CACHE_FN_ID, params);
6854
- }
6855
- __name(cache, "cache");
6856
- function cacheTag(tag) {
6857
- const context2 = cacheContext.getStore();
6858
- if (!context2) {
6859
- throw new Error("cacheTag() must be called inside a cached function.");
6860
- }
6861
- if (!tag) {
6862
- throw new Error("cacheTag() must be called with a tag name.");
6863
- }
6864
- context2.params.name = tag;
6865
- }
6866
- __name(cacheTag, "cacheTag");
6867
- function cacheLife(ttl) {
6868
- const context2 = cacheContext.getStore();
6869
- if (!context2) {
6870
- throw new Error("cacheLife() must be called inside a cached function.");
6871
- }
6872
- if (ttl == null || !["string", "number"].includes(typeof ttl)) {
6873
- throw new Error("cacheLife() must be called with a ttl.");
6874
- }
6875
- context2.params.ttl = typeof ttl === "string" ? (0, import_ms.default)(ttl) : ttl;
6876
- }
6877
- __name(cacheLife, "cacheLife");
6878
- async function invalidate(tag) {
6879
- const provider = getCacheProvider();
6880
- const entry = Array.from(fnStore.values()).find(
6881
- (v) => v.key === tag || v.hash === tag
6882
- );
6883
- if (!entry) return;
6884
- await provider.delete(entry.key);
6885
- }
6886
- __name(invalidate, "invalidate");
6887
- async function revalidate(tag, ...args) {
6888
- const provider = getCacheProvider();
6889
- const entry = Array.from(fnStore.values()).find(
6890
- (v) => v.key === tag || v.hash === tag
6891
- );
6892
- if (!entry) return void 0;
6893
- await provider.delete(entry.key);
6894
- return entry.memo(...args);
6895
- }
6896
- __name(revalidate, "revalidate");
6897
- function isCachedFunction(fn) {
6898
- return Object.prototype.hasOwnProperty.call(fn, CACHED_FN_SYMBOL);
6899
- }
6900
- __name(isCachedFunction, "isCachedFunction");
6901
- var __SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = useCache;
6902
-
6903
6590
  // src/app/index.ts
6904
6591
  init_cjs_shims();
6905
6592
  init_AppCommandHandler();
@@ -7005,7 +6692,6 @@ var index_default = CommandKit;
7005
6692
  COMMANDKIT_CACHE_TAG,
7006
6693
  COMMANDKIT_IS_DEV,
7007
6694
  COMMANDKIT_IS_TEST,
7008
- CacheProvider,
7009
6695
  ChannelSelectMenu,
7010
6696
  ChannelSelectMenuKit,
7011
6697
  CommandExecutionMode,
@@ -7015,6 +6701,7 @@ var index_default = CommandKit;
7015
6701
  CommandKitPluginRuntime,
7016
6702
  CommandRegistrar,
7017
6703
  CommandsRouter,
6704
+ CommonDirectiveTransformer,
7018
6705
  CompilerPlugin,
7019
6706
  CompilerPluginRuntime,
7020
6707
  Container,
@@ -7029,7 +6716,6 @@ var index_default = CommandKit;
7029
6716
  Logger,
7030
6717
  MediaGallery,
7031
6718
  MediaGalleryItem,
7032
- MemoryCache,
7033
6719
  MentionableSelectMenu,
7034
6720
  MentionableSelectMenuKit,
7035
6721
  MessageCommandOptions,
@@ -7053,12 +6739,8 @@ var index_default = CommandKit;
7053
6739
  Thumbnail,
7054
6740
  UserSelectMenu,
7055
6741
  UserSelectMenuKit,
7056
- __SECRET_USE_CACHE_INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
7057
6742
  after,
7058
6743
  bootstrapCommandkitCLI,
7059
- cache,
7060
- cacheLife,
7061
- cacheTag,
7062
6744
  cancelAfter,
7063
6745
  commandkit,
7064
6746
  createElement,
@@ -7077,8 +6759,6 @@ var index_default = CommandKit;
7077
6759
  getElement,
7078
6760
  getEventWorkerContext,
7079
6761
  getSourceDirectories,
7080
- invalidate,
7081
- isCachedFunction,
7082
6762
  isCommandKitElement,
7083
6763
  isCompilerPlugin,
7084
6764
  isInteractionSource,
@@ -7090,7 +6770,6 @@ var index_default = CommandKit;
7090
6770
  provideContext,
7091
6771
  redirect,
7092
6772
  rethrow,
7093
- revalidate,
7094
6773
  runInEventWorkerContext,
7095
6774
  stopEvents,
7096
6775
  useEnvironment,