commandkit 0.1.11-dev.20250331145527 → 0.1.11-dev.20250402101800
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 +13 -0
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1673,6 +1673,13 @@ type CommandSource = Interaction | Message$1;
|
|
|
1673
1673
|
declare function isMessageSource(source: CommandSource): source is Message$1;
|
|
1674
1674
|
declare function isInteractionSource(source: CommandSource): source is Interaction;
|
|
1675
1675
|
|
|
1676
|
+
interface CommandKitHMREvent {
|
|
1677
|
+
event: string;
|
|
1678
|
+
path: string;
|
|
1679
|
+
accept: () => void;
|
|
1680
|
+
preventDefault: () => void;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1676
1683
|
declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CommandKitPluginRuntime> {
|
|
1677
1684
|
/**
|
|
1678
1685
|
* Called before commands are loaded
|
|
@@ -1730,6 +1737,12 @@ declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> ex
|
|
|
1730
1737
|
* @param ctx The context
|
|
1731
1738
|
*/
|
|
1732
1739
|
onCommandsRouterInit(ctx: CommandKitPluginRuntime): Promise<void>;
|
|
1740
|
+
/**
|
|
1741
|
+
* Called when HMR event is received
|
|
1742
|
+
* @param ctx The context
|
|
1743
|
+
* @param event The event
|
|
1744
|
+
*/
|
|
1745
|
+
performHMR(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent): Promise<void>;
|
|
1733
1746
|
}
|
|
1734
1747
|
declare function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin;
|
|
1735
1748
|
|
package/dist/index.js
CHANGED
|
@@ -2021,6 +2021,13 @@ var init_RuntimePlugin = __esm({
|
|
|
2021
2021
|
*/
|
|
2022
2022
|
async onCommandsRouterInit(ctx) {
|
|
2023
2023
|
}
|
|
2024
|
+
/**
|
|
2025
|
+
* Called when HMR event is received
|
|
2026
|
+
* @param ctx The context
|
|
2027
|
+
* @param event The event
|
|
2028
|
+
*/
|
|
2029
|
+
async performHMR(ctx, event) {
|
|
2030
|
+
}
|
|
2024
2031
|
};
|
|
2025
2032
|
__name(_RuntimePlugin, "RuntimePlugin");
|
|
2026
2033
|
RuntimePlugin = _RuntimePlugin;
|
|
@@ -5346,13 +5353,30 @@ var init_loader = __esm({
|
|
|
5346
5353
|
// src/utils/dev-hooks.ts
|
|
5347
5354
|
function registerDevHooks(commandkit2) {
|
|
5348
5355
|
if (!COMMANDKIT_IS_DEV) return;
|
|
5349
|
-
process.on("message", (message) => {
|
|
5356
|
+
process.on("message", async (message) => {
|
|
5350
5357
|
if (typeof message !== "object" || message === null) return;
|
|
5351
5358
|
const { event, path: path2 } = message;
|
|
5352
5359
|
if (!event) return;
|
|
5353
5360
|
if (process.env.COMMANDKIT_DEBUG_HMR === "true") {
|
|
5354
5361
|
Logger.info(`Received HMR event: ${event}${path2 ? ` for ${path2}` : ""}`);
|
|
5355
5362
|
}
|
|
5363
|
+
let accepted = false, prevented = false;
|
|
5364
|
+
const hmrEvent = {
|
|
5365
|
+
accept() {
|
|
5366
|
+
accepted = true;
|
|
5367
|
+
},
|
|
5368
|
+
preventDefault() {
|
|
5369
|
+
prevented = false;
|
|
5370
|
+
},
|
|
5371
|
+
path: path2,
|
|
5372
|
+
event
|
|
5373
|
+
};
|
|
5374
|
+
await commandkit2.plugins.execute(async (ctx, plugin) => {
|
|
5375
|
+
var _a;
|
|
5376
|
+
if (accepted) return;
|
|
5377
|
+
await ((_a = plugin.performHMR) == null ? void 0 : _a.call(plugin, ctx, hmrEvent));
|
|
5378
|
+
});
|
|
5379
|
+
if (prevented) return;
|
|
5356
5380
|
switch (event) {
|
|
5357
5381
|
case "reload-commands":
|
|
5358
5382
|
commandkit2.commandHandler.reloadCommands();
|
|
@@ -5716,7 +5740,7 @@ var init_version = __esm({
|
|
|
5716
5740
|
"use strict";
|
|
5717
5741
|
init_cjs_shims();
|
|
5718
5742
|
version = /* @__MACRO__ $version */
|
|
5719
|
-
"0.1.11-dev.
|
|
5743
|
+
"0.1.11-dev.20250402101800";
|
|
5720
5744
|
}
|
|
5721
5745
|
});
|
|
5722
5746
|
|