seedcord 0.19.4 → 0.20.0

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/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as SEEDCORD_CONFIG_FILENAMES, t as version } from "./src-D64b48Ng.mjs";
1
+ import { n as SEEDCORD_CONFIG_FILENAMES, t as version } from "./src-BZWDzOCB.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { Command } from "@commander-js/extra-typings";
4
4
  import { LEVEL_COLOR, Logger, LoggerChannelRegistry } from "@seedcord/logger";
@@ -640,12 +640,18 @@ const IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
640
640
  const CONTROL_CHAR = 32;
641
641
  const HEX_RADIX = 16;
642
642
  function renderAugmentation(registry, target, plugins) {
643
- const keys = (plugins?.keys ?? []).toSorted(compare);
643
+ const keys = groupNames(plugins?.keys ?? []).toSorted(compare);
644
644
  const attached = plugins !== void 0 && keys.length > 0;
645
645
  const botImport = attached ? `import type ${BOT_BINDING} from '${escapeLiteral(plugins.specifier)}';\n\n` : "";
646
646
  const coreRows = attached ? ` interface Core {\n${renderPluginRows(keys)}\n }\n` : "";
647
647
  return `${`${BANNER}\n\n${botImport}// prettier-ignore\ndeclare module '${target}' {\n` + coreRows} interface SlashRegistry {\n${renderSlashRows(registry.slash)}\n }\n interface UserContextMenuRegistry {\n${renderContextMenuRows(registry.userContextMenus)}\n }\n interface MessageContextMenuRegistry {\n${renderContextMenuRows(registry.messageContextMenus)}\n }\n interface EmojiMap {\n${renderEmojiRows(registry.emojis)}\n }\n}\n\nexport {};\n`;
648
648
  }
649
+ function groupNames(keys) {
650
+ return [...new Set(keys.map((key) => {
651
+ const dot = key.indexOf(".");
652
+ return dot === -1 ? key : key.slice(0, dot);
653
+ }))];
654
+ }
649
655
  function renderPluginRows(keys) {
650
656
  return keys.map((key) => ` ${renderKey(key)}: (typeof ${BOT_BINDING})['${escapeLiteral(key)}'];`).join("\n");
651
657
  }