commandkit 1.0.0-dev.20250601022625 → 1.0.0-dev.20250601132421
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/{CommandKit-DbKHr6qT.js → CommandKit-BhdXwM9b.js} +90 -15
- package/dist/CommandKit-BhdXwM9b.js.map +1 -0
- package/dist/{CommandKit-DDSUNOAe.d.ts → CommandKit-Dbkak3_n.d.ts} +11 -8
- package/dist/CommandKit.d.ts +1 -1
- package/dist/CommandKit.js +2 -7
- package/dist/{EventWorkerContext-CjU5wt-a.d.ts → EventWorkerContext-6BHysn1E.d.ts} +2 -2
- package/dist/app/commands/AppCommandRunner.d.ts +1 -1
- package/dist/app/commands/AppCommandRunner.js +1 -1
- package/dist/app/commands/Context.d.ts +1 -1
- package/dist/app/commands/Context.js +1 -1
- package/dist/app/events/EventWorkerContext.d.ts +2 -2
- package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
- package/dist/app/handlers/AppCommandHandler.js +1 -1
- package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
- package/dist/app/handlers/AppEventsHandler.js +1 -1
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.js +1 -1
- package/dist/app/register/CommandRegistrar.d.ts +1 -1
- package/dist/app/register/CommandRegistrar.js +1 -1
- package/dist/{build-BB9ezwQN.js → build-D45Rr7KV.js} +10 -6
- package/dist/{build-BB9ezwQN.js.map → build-D45Rr7KV.js.map} +1 -1
- package/dist/cli/app-process.d.ts +2 -2
- package/dist/cli/build.d.ts +1 -1
- package/dist/cli/build.js +2 -2
- package/dist/cli/common.d.ts +5 -5
- package/dist/cli/development.js +2 -2
- package/dist/cli/information.js +1 -1
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/init.js +2 -2
- package/dist/cli/production.d.ts +2 -2
- package/dist/cli/production.js +2 -2
- package/dist/components/index.js +1 -1
- package/dist/components/v1/button/Button.js +1 -1
- package/dist/components/v1/button/ButtonKit.js +1 -1
- package/dist/components/v1/modal/Modal.js +1 -1
- package/dist/components/v1/modal/ModalKit.js +1 -1
- package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +1 -1
- package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +1 -1
- package/dist/components/v1/select-menu/RoleSelectMenuKit.js +1 -1
- package/dist/components/v1/select-menu/SelectMenu.js +1 -1
- package/dist/components/v1/select-menu/StringSelectMenuKit.js +1 -1
- package/dist/components/v1/select-menu/UserSelectMenuKit.js +1 -1
- package/dist/config/config.d.ts +4 -4
- package/dist/config/config.js +1 -1
- package/dist/config/default.d.ts +3 -3
- package/dist/config/default.js +1 -1
- package/dist/config/loader.d.ts +3 -3
- package/dist/config/loader.js +1 -1
- package/dist/config/types.d.ts +2 -2
- package/dist/config/utils.d.ts +3 -3
- package/dist/{config-LPxTebft.d.ts → config-1zOALegW.d.ts} +3 -3
- package/dist/context/async-context.d.ts +1 -1
- package/dist/context/async-context.js +1 -1
- package/dist/context/environment.d.ts +1 -1
- package/dist/context/environment.js +1 -1
- package/dist/events/CommandKitEventsChannel.d.ts +1 -1
- package/dist/{feature-flags-DqKVc2-p.js → feature-flags-xogLBr7K.js} +2 -2
- package/dist/{feature-flags-DqKVc2-p.js.map → feature-flags-xogLBr7K.js.map} +1 -1
- package/dist/flags/feature-flags.d.ts +1 -1
- package/dist/flags/feature-flags.js +2 -2
- package/dist/flags/store.d.ts +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +5 -10
- package/dist/{init-O2deAczC.js → init-B6_jkuag.js} +2 -2
- package/dist/{init-O2deAczC.js.map → init-B6_jkuag.js.map} +1 -1
- package/dist/{init-_e3eZTUb.d.ts → init-CT348Okf.d.ts} +3 -3
- package/dist/logger/DefaultLogger.js +1 -1
- package/dist/logger/Logger.js +1 -1
- 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/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +1 -1
- package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -1
- package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +1 -1
- package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
- package/dist/plugins/types.d.ts +1 -1
- package/dist/{types-w2bWHUve.d.ts → types-BiXh_it_.d.ts} +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/{utilities-oDL3vjhR.d.ts → utilities-DpA7EalK.d.ts} +12 -2
- package/dist/utils/colors.d.ts +2 -2
- package/dist/utils/dev-hooks.d.ts +1 -1
- package/dist/utils/dev-hooks.js +1 -1
- package/dist/utils/utilities.d.ts +2 -2
- package/dist/utils/utilities.js +2 -1
- package/dist/{utils-Dprjd7Oz.d.ts → utils-IW7KDBhF.d.ts} +2 -2
- package/dist/{version-DIaL-6Qv.js → version-B_LxfzVV.js} +2 -2
- package/dist/{version-DIaL-6Qv.js.map → version-B_LxfzVV.js.map} +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/CommandKit-DbKHr6qT.js.map +0 -1
|
@@ -1448,6 +1448,61 @@ function stopEvents() {
|
|
|
1448
1448
|
if (!require_EventWorkerContext.eventWorkerContext.getStore()) throw new Error("stopEvents() may only be called inside an event handler");
|
|
1449
1449
|
throw new StopEventPropagationError();
|
|
1450
1450
|
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Creates a simple proxy object that mirrors the target object.
|
|
1453
|
+
* @param target The target object to proxy.
|
|
1454
|
+
* @returns The proxied object.
|
|
1455
|
+
*/
|
|
1456
|
+
function createProxy(target) {
|
|
1457
|
+
let _target = target;
|
|
1458
|
+
const proxy = new Proxy(_target, {
|
|
1459
|
+
get(target$1, prop, receiver) {
|
|
1460
|
+
return Reflect.get(_target, prop, receiver);
|
|
1461
|
+
},
|
|
1462
|
+
set(target$1, prop, value, receiver) {
|
|
1463
|
+
return Reflect.set(_target, prop, value, receiver);
|
|
1464
|
+
},
|
|
1465
|
+
deleteProperty(target$1, prop) {
|
|
1466
|
+
return Reflect.deleteProperty(_target, prop);
|
|
1467
|
+
},
|
|
1468
|
+
has(target$1, prop) {
|
|
1469
|
+
return Reflect.has(_target, prop);
|
|
1470
|
+
},
|
|
1471
|
+
ownKeys(target$1) {
|
|
1472
|
+
return Reflect.ownKeys(_target);
|
|
1473
|
+
},
|
|
1474
|
+
getOwnPropertyDescriptor(target$1, prop) {
|
|
1475
|
+
return Reflect.getOwnPropertyDescriptor(_target, prop);
|
|
1476
|
+
},
|
|
1477
|
+
defineProperty(target$1, prop, attributes) {
|
|
1478
|
+
return Reflect.defineProperty(_target, prop, attributes);
|
|
1479
|
+
},
|
|
1480
|
+
getPrototypeOf(target$1) {
|
|
1481
|
+
return Reflect.getPrototypeOf(_target);
|
|
1482
|
+
},
|
|
1483
|
+
setPrototypeOf(target$1, proto) {
|
|
1484
|
+
return Reflect.setPrototypeOf(_target, proto);
|
|
1485
|
+
},
|
|
1486
|
+
isExtensible(target$1) {
|
|
1487
|
+
return Reflect.isExtensible(_target);
|
|
1488
|
+
},
|
|
1489
|
+
preventExtensions(target$1) {
|
|
1490
|
+
return Reflect.preventExtensions(_target);
|
|
1491
|
+
},
|
|
1492
|
+
apply(target$1, thisArg, args) {
|
|
1493
|
+
return Reflect.apply(_target, thisArg, args);
|
|
1494
|
+
},
|
|
1495
|
+
construct(target$1, args, newTarget) {
|
|
1496
|
+
return Reflect.construct(_target, args, newTarget);
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
return {
|
|
1500
|
+
proxy,
|
|
1501
|
+
setTarget(newTarget) {
|
|
1502
|
+
_target = newTarget;
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1451
1506
|
|
|
1452
1507
|
//#endregion
|
|
1453
1508
|
//#region src/app/register/CommandRegistrar.ts
|
|
@@ -2685,7 +2740,6 @@ function registerDevHooks(commandkit$1) {
|
|
|
2685
2740
|
|
|
2686
2741
|
//#endregion
|
|
2687
2742
|
//#region src/CommandKit.ts
|
|
2688
|
-
let commandkit;
|
|
2689
2743
|
const bootstrapHooks = /* @__PURE__ */ new Set();
|
|
2690
2744
|
const onApplicationBootstrapHooks = /* @__PURE__ */ new Set();
|
|
2691
2745
|
/**
|
|
@@ -2722,7 +2776,8 @@ function onApplicationBootstrap(fn) {
|
|
|
2722
2776
|
}
|
|
2723
2777
|
var CommandKit = class CommandKit extends node_events.default {
|
|
2724
2778
|
#started = false;
|
|
2725
|
-
|
|
2779
|
+
#clientProxy = createProxy({});
|
|
2780
|
+
#client;
|
|
2726
2781
|
eventInterceptor;
|
|
2727
2782
|
static createElement = require_element.createElement;
|
|
2728
2783
|
static Fragment = require_element.Fragment;
|
|
@@ -2745,14 +2800,12 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
2745
2800
|
* @param options - The default CommandKit configuration.
|
|
2746
2801
|
* @see {@link https://commandkit.js.org/docs/guide/commandkit-setup}
|
|
2747
2802
|
*/
|
|
2748
|
-
constructor(options) {
|
|
2803
|
+
constructor(options = {}) {
|
|
2749
2804
|
if (CommandKit.instance) process.emitWarning("CommandKit instance already exists. Having multiple instance in same project is discouraged and it may lead to unexpected behavior.", { code: "MultiInstanceWarning" });
|
|
2750
|
-
if (!options.client) throw new Error(require_colors.colors_default.red("\"client\" is required when instantiating CommandKit."));
|
|
2751
2805
|
super();
|
|
2752
|
-
this.options = options;
|
|
2753
2806
|
if (!CommandKit.instance) CommandKit.instance = this;
|
|
2807
|
+
if (options === null || options === void 0 ? void 0 : options.client) this.setClient(options.client);
|
|
2754
2808
|
this.plugins = new CommandKitPluginRuntime(this);
|
|
2755
|
-
commandkit = CommandKit.instance;
|
|
2756
2809
|
this.#bootstrapHooks();
|
|
2757
2810
|
}
|
|
2758
2811
|
async #bootstrapHooks() {
|
|
@@ -2781,7 +2834,7 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
2781
2834
|
*/
|
|
2782
2835
|
async start(token) {
|
|
2783
2836
|
if (this.#started) return;
|
|
2784
|
-
if (!this
|
|
2837
|
+
if (!this.#client) throw new Error(require_colors.colors_default.red("\"client\" is required when starting CommandKit."));
|
|
2785
2838
|
this.eventInterceptor = new require_EventInterceptor.EventInterceptor(this.client);
|
|
2786
2839
|
if (require_constants.COMMANDKIT_IS_DEV) try {
|
|
2787
2840
|
registerDevHooks(this);
|
|
@@ -2793,7 +2846,7 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
2793
2846
|
await this.#init();
|
|
2794
2847
|
this.commandHandler.registerCommandHandler();
|
|
2795
2848
|
this.incrementClientListenersCount();
|
|
2796
|
-
if (token !== false && !this.
|
|
2849
|
+
if (token !== false && !this.client.isReady()) {
|
|
2797
2850
|
this.client.once(discord_js.Events.ClientReady, async () => {
|
|
2798
2851
|
await this.commandHandler.registrar.register();
|
|
2799
2852
|
});
|
|
@@ -2801,13 +2854,13 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
2801
2854
|
var _plugin$onBeforeClien;
|
|
2802
2855
|
return (_plugin$onBeforeClien = plugin.onBeforeClientLogin) === null || _plugin$onBeforeClien === void 0 ? void 0 : _plugin$onBeforeClien.call(plugin, ctx);
|
|
2803
2856
|
});
|
|
2804
|
-
const botToken = token ?? this.
|
|
2805
|
-
await this.
|
|
2857
|
+
const botToken = token ?? this.client.token ?? process.env.TOKEN ?? process.env.DISCORD_TOKEN;
|
|
2858
|
+
await this.client.login(botToken);
|
|
2806
2859
|
await this.plugins.execute((ctx, plugin) => {
|
|
2807
2860
|
var _plugin$onAfterClient;
|
|
2808
2861
|
return (_plugin$onAfterClient = plugin.onAfterClientLogin) === null || _plugin$onAfterClient === void 0 ? void 0 : _plugin$onAfterClient.call(plugin, ctx);
|
|
2809
2862
|
});
|
|
2810
|
-
} else if (this.
|
|
2863
|
+
} else if (this.client.isReady()) await this.commandHandler.registrar.register();
|
|
2811
2864
|
this.#started = true;
|
|
2812
2865
|
await this.#applicationBootstrapHooks();
|
|
2813
2866
|
}
|
|
@@ -2846,7 +2899,22 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
2846
2899
|
* Get the client attached to this CommandKit instance.
|
|
2847
2900
|
*/
|
|
2848
2901
|
get client() {
|
|
2849
|
-
|
|
2902
|
+
var _this$clientProxy;
|
|
2903
|
+
const client = this.#client || ((_this$clientProxy = this.#clientProxy) === null || _this$clientProxy === void 0 ? void 0 : _this$clientProxy.proxy);
|
|
2904
|
+
if (!client) throw new Error("Client instance is not set");
|
|
2905
|
+
return client;
|
|
2906
|
+
}
|
|
2907
|
+
/**
|
|
2908
|
+
* Sets the client attached to this CommandKit instance.
|
|
2909
|
+
* @param client The client to set.
|
|
2910
|
+
*/
|
|
2911
|
+
setClient(client) {
|
|
2912
|
+
this.#client = client;
|
|
2913
|
+
if (this.#clientProxy) {
|
|
2914
|
+
this.#clientProxy.setTarget(client);
|
|
2915
|
+
this.#clientProxy = null;
|
|
2916
|
+
}
|
|
2917
|
+
return this;
|
|
2850
2918
|
}
|
|
2851
2919
|
async #init() {
|
|
2852
2920
|
const appDir$1 = this.getAppDirectory();
|
|
@@ -2895,13 +2963,13 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
2895
2963
|
* Increment the client listeners count.
|
|
2896
2964
|
*/
|
|
2897
2965
|
incrementClientListenersCount() {
|
|
2898
|
-
this.
|
|
2966
|
+
this.client.setMaxListeners(this.client.getMaxListeners() + 1);
|
|
2899
2967
|
}
|
|
2900
2968
|
/**
|
|
2901
2969
|
* Decrement the client listeners count.
|
|
2902
2970
|
*/
|
|
2903
2971
|
decrementClientListenersCount() {
|
|
2904
|
-
this.
|
|
2972
|
+
this.client.setMaxListeners(this.client.getMaxListeners() - 1);
|
|
2905
2973
|
}
|
|
2906
2974
|
/**
|
|
2907
2975
|
* Path to the app directory. Returns `null` if not found.
|
|
@@ -2922,6 +2990,7 @@ var CommandKit = class CommandKit extends node_events.default {
|
|
|
2922
2990
|
}
|
|
2923
2991
|
}
|
|
2924
2992
|
};
|
|
2993
|
+
const commandkit = CommandKit.instance || new CommandKit();
|
|
2925
2994
|
|
|
2926
2995
|
//#endregion
|
|
2927
2996
|
Object.defineProperty(exports, 'AppCommandHandler', {
|
|
@@ -3152,6 +3221,12 @@ Object.defineProperty(exports, 'createLogger', {
|
|
|
3152
3221
|
return createLogger;
|
|
3153
3222
|
}
|
|
3154
3223
|
});
|
|
3224
|
+
Object.defineProperty(exports, 'createProxy', {
|
|
3225
|
+
enumerable: true,
|
|
3226
|
+
get: function () {
|
|
3227
|
+
return createProxy;
|
|
3228
|
+
}
|
|
3229
|
+
});
|
|
3155
3230
|
Object.defineProperty(exports, 'debounce', {
|
|
3156
3231
|
enumerable: true,
|
|
3157
3232
|
get: function () {
|
|
@@ -3278,4 +3353,4 @@ Object.defineProperty(exports, 'useEnvironment', {
|
|
|
3278
3353
|
return useEnvironment;
|
|
3279
3354
|
}
|
|
3280
3355
|
});
|
|
3281
|
-
//# sourceMappingURL=CommandKit-
|
|
3356
|
+
//# sourceMappingURL=CommandKit-BhdXwM9b.js.map
|