@wolfstar/shared-http-pieces 2.0.1 โ 2.0.2
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/README.md +4 -3
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +43 -7
- package/dist/register.js.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -23,9 +23,10 @@ The shared commands used for Star Network's HTTP-only bots.
|
|
|
23
23
|
- Define `locales/{{lng}}/commands/shared:infoEmbedDescription` as a string. This is the content displayed in `/info`'s embed description.
|
|
24
24
|
- Define the information variables.
|
|
25
25
|
- Importing `@wolfstar/shared-http-pieces/register` registers a `preGenericsInitialization` hook
|
|
26
|
-
that adds this package's bundled locales to your `Client`'s i18n
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
that adds this package's bundled locales and `commands/shared` namespace to your `Client`'s i18n
|
|
27
|
+
configuration automatically, while retaining the consumer's own locale path and namespaces. As
|
|
28
|
+
long as it's imported before `new Client(...)`, no manual wiring is required. The resolved path
|
|
29
|
+
is also exported as `localesPath`, if you need it directly.
|
|
29
30
|
|
|
30
31
|
## Usage
|
|
31
32
|
|
package/dist/register.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","names":[],"sources":["../src/register.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"register.d.ts","names":[],"sources":["../src/register.ts"],"mappings":";;;;;;cAWa"}
|
package/dist/register.js
CHANGED
|
@@ -7,6 +7,7 @@ import { EmbedBuilder, TimestampStyles, time } from "@discordjs/builders";
|
|
|
7
7
|
import { applyLocalizedBuilder, getSupportedUserLanguageName, getSupportedUserLanguageT } from "@wolfstar/plugin-i18next";
|
|
8
8
|
import { ButtonStyle, ComponentType, MessageFlags } from "discord-api-types/v10";
|
|
9
9
|
import { cpus, uptime } from "node:os";
|
|
10
|
+
import { getRootData } from "@sapphire/pieces";
|
|
10
11
|
|
|
11
12
|
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/decorate.js
|
|
12
13
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -195,6 +196,47 @@ container.stores.loadPiece({
|
|
|
195
196
|
store: "listeners"
|
|
196
197
|
});
|
|
197
198
|
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/lib/register-i18n.ts
|
|
201
|
+
const sharedNamespace = "commands/shared";
|
|
202
|
+
function addSharedNamespace(options, discoveredNamespaces) {
|
|
203
|
+
const configuredNamespaces = options?.ns === void 0 ? [] : [options.ns].flat();
|
|
204
|
+
return {
|
|
205
|
+
...options,
|
|
206
|
+
ns: [.../* @__PURE__ */ new Set([
|
|
207
|
+
...discoveredNamespaces,
|
|
208
|
+
...configuredNamespaces,
|
|
209
|
+
sharedNamespace
|
|
210
|
+
])]
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Adds this package's locales without losing locales and namespaces discovered by the consumer.
|
|
215
|
+
*
|
|
216
|
+
* `@wolfstar/plugin-i18next@2` lets `backend.paths` replace its generated consumer path and only
|
|
217
|
+
* discovers namespaces below `defaultLanguageDirectory`. Supplying both values explicitly keeps
|
|
218
|
+
* the consumer resources and makes this package's namespace available to i18next.
|
|
219
|
+
*/
|
|
220
|
+
function registerSharedLocales(i18n, localesPath) {
|
|
221
|
+
const languagesDirectory = i18n.defaultLanguageDirectory ?? join(getRootData().root, "languages");
|
|
222
|
+
const consumerLocalesPath = join(languagesDirectory, "{{lng}}", "{{ns}}.json");
|
|
223
|
+
const configuredI18next = i18n.i18next;
|
|
224
|
+
return {
|
|
225
|
+
...i18n,
|
|
226
|
+
backend: {
|
|
227
|
+
...i18n.backend,
|
|
228
|
+
paths: [.../* @__PURE__ */ new Set([
|
|
229
|
+
consumerLocalesPath,
|
|
230
|
+
...i18n.backend?.paths ?? [],
|
|
231
|
+
localesPath
|
|
232
|
+
])]
|
|
233
|
+
},
|
|
234
|
+
i18next(namespaces, languages) {
|
|
235
|
+
return addSharedNamespace(typeof configuredI18next === "function" ? configuredI18next(namespaces, languages) : configuredI18next, namespaces);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
198
240
|
//#endregion
|
|
199
241
|
//#region src/register.ts
|
|
200
242
|
/**
|
|
@@ -214,13 +256,7 @@ const localesPath = join(fileURLToPath(new URL("../src/locales", import.meta.url
|
|
|
214
256
|
Client.plugins.registerPreGenericsInitializationHook((options) => {
|
|
215
257
|
const { i18n } = options;
|
|
216
258
|
if (!i18n) return;
|
|
217
|
-
options.i18n =
|
|
218
|
-
...i18n,
|
|
219
|
-
backend: {
|
|
220
|
-
...i18n.backend,
|
|
221
|
-
paths: [...i18n.backend?.paths ?? [], localesPath]
|
|
222
|
-
}
|
|
223
|
-
};
|
|
259
|
+
options.i18n = registerSharedLocales(i18n, localesPath);
|
|
224
260
|
}, "@wolfstar/shared-http-pieces");
|
|
225
261
|
await import("@wolfstar/plugin-i18next/register");
|
|
226
262
|
|
package/dist/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","names":["SharedListener","SharedListener","SharedListener"],"sources":["../src/commands/info.ts","../src/listeners/SharedAutocompleteError.ts","../src/listeners/SharedCommandError.ts","../src/listeners/SharedError.ts","../src/listeners/SharedInteractionHandlerError.ts","../src/register.ts"],"sourcesContent":["import { EmbedBuilder, time, TimestampStyles } from '@discordjs/builders';\nimport { Command, container, RegisterCommand } from '@wolfstar/http-framework';\nimport { applyLocalizedBuilder, getSupportedUserLanguageName, getSupportedUserLanguageT, type TFunction } from '@wolfstar/plugin-i18next';\nimport {\n\tButtonStyle,\n\tComponentType,\n\tMessageFlags,\n\ttype APIActionRowComponent,\n\ttype APIComponentInMessageActionRow,\n\ttype APIEmbedField\n} from 'discord-api-types/v10';\nimport { cpus, uptime, type CpuInfo } from 'node:os';\nimport { getInvite, getRepository } from '../lib/information.js';\n\ntype TranslateFn = TFunction;\n\n@RegisterCommand((builder) => applyLocalizedBuilder(builder, 'commands/shared:info'))\nexport class SharedCommand extends Command {\n\tpublic override chatInputRun(interaction: Command.ChatInputInteraction) {\n\t\tconst t = getSupportedUserLanguageT(interaction) as TranslateFn;\n\t\tconst lng = getSupportedUserLanguageName(interaction);\n\t\tconst embed = new EmbedBuilder()\n\t\t\t.setDescription(t('commands/shared:infoEmbedDescription'))\n\t\t\t.addFields(this.getUptimeStatistics(t), this.getServerUsageStatistics(t, lng));\n\t\tconst components = this.getComponents(t);\n\n\t\treturn interaction.reply({ embeds: [embed.toJSON()], components, flags: MessageFlags.Ephemeral });\n\t}\n\n\tprivate getUptimeStatistics(t: TranslateFn): APIEmbedField {\n\t\tconst now = Date.now();\n\t\tconst nowSeconds = Math.round(now / 1000);\n\n\t\treturn {\n\t\t\tname: t('commands/shared:infoFieldUptimeTitle'),\n\t\t\tvalue: t('commands/shared:infoFieldUptimeValue', {\n\t\t\t\thost: time(Math.round(nowSeconds - uptime()), TimestampStyles.RelativeTime),\n\t\t\t\tclient: time(Math.round(nowSeconds - process.uptime()), TimestampStyles.RelativeTime)\n\t\t\t})\n\t\t};\n\t}\n\n\tprivate getServerUsageStatistics(t: TranslateFn, lng: string): APIEmbedField {\n\t\tconst usage = process.memoryUsage();\n\n\t\treturn {\n\t\t\tname: t('commands/shared:infoFieldServerUsageTitle'),\n\t\t\tvalue: t('commands/shared:infoFieldServerUsageValue', {\n\t\t\t\tcpu: cpus().map(SharedCommand.formatCpuInfo.bind(null)).join(' | '),\n\t\t\t\theapUsed: (usage.heapUsed / 1048576).toLocaleString(lng, { maximumFractionDigits: 2 }),\n\t\t\t\theapTotal: (usage.heapTotal / 1048576).toLocaleString(lng, { maximumFractionDigits: 2 })\n\t\t\t})\n\t\t};\n\t}\n\n\tprivate getComponents(t: TranslateFn) {\n\t\tconst url = getInvite();\n\t\tconst support = this.getSupportComponent(t);\n\t\tconst github = this.getGitHubComponent(t);\n\t\tconst donate = this.getDonateComponent(t);\n\t\tconst data = url\n\t\t\t? [this.getActionRow(support, this.getInviteComponent(t, url)), this.getActionRow(github, donate)]\n\t\t\t: [this.getActionRow(support, github, donate)];\n\n\t\treturn data;\n\t}\n\n\tprivate getActionRow(...components: APIComponentInMessageActionRow[]): APIActionRowComponent<APIComponentInMessageActionRow> {\n\t\treturn { type: ComponentType.ActionRow, components };\n\t}\n\n\tprivate getSupportComponent(t: TranslateFn): APIComponentInMessageActionRow {\n\t\treturn {\n\t\t\ttype: ComponentType.Button,\n\t\t\tstyle: ButtonStyle.Link,\n\t\t\tlabel: t('commands/shared:infoButtonSupport'),\n\t\t\temoji: { name: '๐' },\n\t\t\turl: 'https://discord.gg/6gakFR2'\n\t\t};\n\t}\n\n\tprivate getInviteComponent(t: TranslateFn, url: string): APIComponentInMessageActionRow {\n\t\treturn {\n\t\t\ttype: ComponentType.Button,\n\t\t\tstyle: ButtonStyle.Link,\n\t\t\tlabel: t('commands/shared:infoButtonInvite'),\n\t\t\temoji: { name: '๐' },\n\t\t\turl\n\t\t};\n\t}\n\n\tprivate getGitHubComponent(t: TranslateFn): APIComponentInMessageActionRow {\n\t\treturn {\n\t\t\ttype: ComponentType.Button,\n\t\t\tstyle: ButtonStyle.Link,\n\t\t\tlabel: t('commands/shared:infoButtonGitHub'),\n\t\t\temoji: { id: '950888087188283422', name: 'github2' },\n\t\t\turl: getRepository()\n\t\t};\n\t}\n\n\tprivate getDonateComponent(t: TranslateFn): APIComponentInMessageActionRow {\n\t\treturn {\n\t\t\ttype: ComponentType.Button,\n\t\t\tstyle: ButtonStyle.Link,\n\t\t\tlabel: t('commands/shared:infoButtonDonate'),\n\t\t\temoji: { name: '๐งก' },\n\t\t\turl: 'https://donate.wolfstar.rocks'\n\t\t};\n\t}\n\n\tprivate static formatCpuInfo({ times }: CpuInfo) {\n\t\treturn `${Math.round(((times.user + times.nice + times.sys + times.irq) / times.idle) * 10000) / 100}%`;\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'info', piece: SharedCommand as any, store: 'commands' });\n","import { captureException } from '@sentry/node';\nimport { Listener, container, type ClientEventAutocompleteContext, type ClientEvents } from '@wolfstar/http-framework';\nimport { isSentryInitialized } from '../lib/sentry.js';\n\nexport class SharedListener extends Listener {\n\tpublic constructor(context: Listener.LoaderContext, options: Listener.Options) {\n\t\tsuper(context, { ...options, event: 'autocompleteError' satisfies keyof ClientEvents, enabled: isSentryInitialized() });\n\t}\n\n\tpublic run(error: unknown, context: ClientEventAutocompleteContext) {\n\t\tcaptureException(error, (scope) => scope.setLevel('error').setTag('event', this.name).setExtra('command', context.command.name));\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'SharedAutocompleteError', piece: SharedListener as any, store: 'listeners' });\n","import { captureException } from '@sentry/node';\nimport { Listener, container, type ClientEventCommandContext, type ClientEvents } from '@wolfstar/http-framework';\nimport { isSentryInitialized } from '../lib/sentry.js';\n\nexport class SharedListener extends Listener {\n\tpublic constructor(context: Listener.LoaderContext, options: Listener.Options) {\n\t\tsuper(context, { ...options, event: 'commandError' satisfies keyof ClientEvents, enabled: isSentryInitialized() });\n\t}\n\n\tpublic run(error: unknown, context: ClientEventCommandContext) {\n\t\tcaptureException(error, (scope) => scope.setLevel('error').setTag('event', this.name).setExtra('command', context.command.name));\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'SharedCommandError', piece: SharedListener as any, store: 'listeners' });\n","import { captureException } from '@sentry/node';\nimport { Listener, container, type ClientEvents } from '@wolfstar/http-framework';\nimport { isSentryInitialized } from '../lib/sentry.js';\n\nexport class SharedListener extends Listener {\n\tpublic constructor(context: Listener.LoaderContext, options: Listener.Options) {\n\t\tsuper(context, { ...options, event: 'error' satisfies keyof ClientEvents, enabled: isSentryInitialized() });\n\t}\n\n\tpublic run(error: unknown) {\n\t\tcaptureException(error, (scope) => scope.setLevel('error').setTag('event', this.name));\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'SharedError', piece: SharedListener as any, store: 'listeners' });\n","import { captureException } from '@sentry/node';\nimport { Listener, container, type ClientEventInteractionHandlerContext, type ClientEvents } from '@wolfstar/http-framework';\nimport { isSentryInitialized } from '../lib/sentry.js';\n\nexport class SharedListener extends Listener {\n\tpublic constructor(context: Listener.LoaderContext, options: Listener.Options) {\n\t\tsuper(context, { ...options, event: 'interactionHandlerError' satisfies keyof ClientEvents, enabled: isSentryInitialized() });\n\t}\n\n\tpublic run(error: unknown, context: ClientEventInteractionHandlerContext) {\n\t\tcaptureException(error, (scope) => scope.setLevel('error').setTag('event', this.name).setExtra('handler', context.handler.name));\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'SharedInteractionHandlerError', piece: SharedListener as any, store: 'listeners' });\n","import { Client } from '@wolfstar/http-framework';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport './commands/_load.js';\nimport './listeners/_load.js';\n\n/**\n * Path pattern for this package's bundled locales, in the format\n * `@wolfstar/plugin-i18next` expects for `i18n.backend.paths`.\n */\nexport const localesPath = join(fileURLToPath(new URL('../src/locales', import.meta.url)), '{{lng}}', '{{ns}}.json');\n\n/**\n * `@wolfstar/plugin-i18next` reads `Client`'s `i18n` option exactly once, in its own\n * `preGenericsInitialization` hook, and has no API to register extra locale directories\n * afterwards. Hooks run in registration order, so registering this one *before* importing\n * the plugin's `register` entrypoint below guarantees it runs first and can splice this\n * package's locales into `options.i18n.backend.paths` before the plugin builds its\n * `InternationalizationHandler` โ consumers that only import this module keep working\n * without having to list `localesPath` in their own `Client` config.\n */\nClient.plugins.registerPreGenericsInitializationHook((options) => {\n\tconst { i18n } = options;\n\tif (!i18n) return;\n\toptions.i18n = { ...i18n, backend: { ...i18n.backend, paths: [...(i18n.backend?.paths ?? []), localesPath] } };\n}, '@wolfstar/shared-http-pieces');\n\n// A dynamic import, not a static one: static imports are hoisted above the hook\n// registration above, which would let the plugin's own hook register โ and run โ first.\nawait import('@wolfstar/plugin-i18next/register');\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBO,IAAM,iCAAN,MAAM,sBAAsB,QAAQ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AAS;GAAE,GAAG;GAAS,OAAO;GAAwD,SAAS,oBAAoB;EAAE,CAAC;CAC7H;CAEA,AAAO,IAAI,OAAgB,SAA+C;EACzE,iBAAiB,QAAQ,UAAU,MAAM,SAAS,OAAO,CAAC,CAAC,OAAO,SAAS,KAAK,IAAI,CAAC,CAAC,SAAS,WAAW,QAAQ,QAAQ,IAAI,CAAC;CAChI;AACD;AAEK,UAAU,OAAO,UAAU;CAAE,MAAM;CAAiC,OAAO;CAAuB,OAAO;AAAY,CAAC;;;;;;;;ACJ3H,MAAa,cAAc,KAAK,cAAc,IAAI,IAAI,kBAAkB,YAAY,GAAG,CAAC,GAAG,WAAW,aAAa;;;;;;;;;;AAWnH,OAAO,QAAQ,uCAAuC,YAAY;CACjE,MAAM,EAAE,SAAS;CACjB,IAAI,CAAC,MAAM;CACX,QAAQ,OAAO;EAAE,GAAG;EAAM,SAAS;GAAE,GAAG,KAAK;GAAS,OAAO,CAAC,GAAI,KAAK,SAAS,SAAS,CAAC,GAAI,WAAW;EAAE;CAAE;AAC9G,GAAG,8BAA8B;AAIjC,MAAM,OAAO"}
|
|
1
|
+
{"version":3,"file":"register.js","names":["SharedListener","SharedListener","SharedListener"],"sources":["../src/commands/info.ts","../src/listeners/SharedAutocompleteError.ts","../src/listeners/SharedCommandError.ts","../src/listeners/SharedError.ts","../src/listeners/SharedInteractionHandlerError.ts","../src/lib/register-i18n.ts","../src/register.ts"],"sourcesContent":["import { EmbedBuilder, time, TimestampStyles } from '@discordjs/builders';\nimport { Command, container, RegisterCommand } from '@wolfstar/http-framework';\nimport { applyLocalizedBuilder, getSupportedUserLanguageName, getSupportedUserLanguageT, type TFunction } from '@wolfstar/plugin-i18next';\nimport {\n\tButtonStyle,\n\tComponentType,\n\tMessageFlags,\n\ttype APIActionRowComponent,\n\ttype APIComponentInMessageActionRow,\n\ttype APIEmbedField\n} from 'discord-api-types/v10';\nimport { cpus, uptime, type CpuInfo } from 'node:os';\nimport { getInvite, getRepository } from '../lib/information.js';\n\ntype TranslateFn = TFunction;\n\n@RegisterCommand((builder) => applyLocalizedBuilder(builder, 'commands/shared:info'))\nexport class SharedCommand extends Command {\n\tpublic override chatInputRun(interaction: Command.ChatInputInteraction) {\n\t\tconst t = getSupportedUserLanguageT(interaction) as TranslateFn;\n\t\tconst lng = getSupportedUserLanguageName(interaction);\n\t\tconst embed = new EmbedBuilder()\n\t\t\t.setDescription(t('commands/shared:infoEmbedDescription'))\n\t\t\t.addFields(this.getUptimeStatistics(t), this.getServerUsageStatistics(t, lng));\n\t\tconst components = this.getComponents(t);\n\n\t\treturn interaction.reply({ embeds: [embed.toJSON()], components, flags: MessageFlags.Ephemeral });\n\t}\n\n\tprivate getUptimeStatistics(t: TranslateFn): APIEmbedField {\n\t\tconst now = Date.now();\n\t\tconst nowSeconds = Math.round(now / 1000);\n\n\t\treturn {\n\t\t\tname: t('commands/shared:infoFieldUptimeTitle'),\n\t\t\tvalue: t('commands/shared:infoFieldUptimeValue', {\n\t\t\t\thost: time(Math.round(nowSeconds - uptime()), TimestampStyles.RelativeTime),\n\t\t\t\tclient: time(Math.round(nowSeconds - process.uptime()), TimestampStyles.RelativeTime)\n\t\t\t})\n\t\t};\n\t}\n\n\tprivate getServerUsageStatistics(t: TranslateFn, lng: string): APIEmbedField {\n\t\tconst usage = process.memoryUsage();\n\n\t\treturn {\n\t\t\tname: t('commands/shared:infoFieldServerUsageTitle'),\n\t\t\tvalue: t('commands/shared:infoFieldServerUsageValue', {\n\t\t\t\tcpu: cpus().map(SharedCommand.formatCpuInfo.bind(null)).join(' | '),\n\t\t\t\theapUsed: (usage.heapUsed / 1048576).toLocaleString(lng, { maximumFractionDigits: 2 }),\n\t\t\t\theapTotal: (usage.heapTotal / 1048576).toLocaleString(lng, { maximumFractionDigits: 2 })\n\t\t\t})\n\t\t};\n\t}\n\n\tprivate getComponents(t: TranslateFn) {\n\t\tconst url = getInvite();\n\t\tconst support = this.getSupportComponent(t);\n\t\tconst github = this.getGitHubComponent(t);\n\t\tconst donate = this.getDonateComponent(t);\n\t\tconst data = url\n\t\t\t? [this.getActionRow(support, this.getInviteComponent(t, url)), this.getActionRow(github, donate)]\n\t\t\t: [this.getActionRow(support, github, donate)];\n\n\t\treturn data;\n\t}\n\n\tprivate getActionRow(...components: APIComponentInMessageActionRow[]): APIActionRowComponent<APIComponentInMessageActionRow> {\n\t\treturn { type: ComponentType.ActionRow, components };\n\t}\n\n\tprivate getSupportComponent(t: TranslateFn): APIComponentInMessageActionRow {\n\t\treturn {\n\t\t\ttype: ComponentType.Button,\n\t\t\tstyle: ButtonStyle.Link,\n\t\t\tlabel: t('commands/shared:infoButtonSupport'),\n\t\t\temoji: { name: '๐' },\n\t\t\turl: 'https://discord.gg/6gakFR2'\n\t\t};\n\t}\n\n\tprivate getInviteComponent(t: TranslateFn, url: string): APIComponentInMessageActionRow {\n\t\treturn {\n\t\t\ttype: ComponentType.Button,\n\t\t\tstyle: ButtonStyle.Link,\n\t\t\tlabel: t('commands/shared:infoButtonInvite'),\n\t\t\temoji: { name: '๐' },\n\t\t\turl\n\t\t};\n\t}\n\n\tprivate getGitHubComponent(t: TranslateFn): APIComponentInMessageActionRow {\n\t\treturn {\n\t\t\ttype: ComponentType.Button,\n\t\t\tstyle: ButtonStyle.Link,\n\t\t\tlabel: t('commands/shared:infoButtonGitHub'),\n\t\t\temoji: { id: '950888087188283422', name: 'github2' },\n\t\t\turl: getRepository()\n\t\t};\n\t}\n\n\tprivate getDonateComponent(t: TranslateFn): APIComponentInMessageActionRow {\n\t\treturn {\n\t\t\ttype: ComponentType.Button,\n\t\t\tstyle: ButtonStyle.Link,\n\t\t\tlabel: t('commands/shared:infoButtonDonate'),\n\t\t\temoji: { name: '๐งก' },\n\t\t\turl: 'https://donate.wolfstar.rocks'\n\t\t};\n\t}\n\n\tprivate static formatCpuInfo({ times }: CpuInfo) {\n\t\treturn `${Math.round(((times.user + times.nice + times.sys + times.irq) / times.idle) * 10000) / 100}%`;\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'info', piece: SharedCommand as any, store: 'commands' });\n","import { captureException } from '@sentry/node';\nimport { Listener, container, type ClientEventAutocompleteContext, type ClientEvents } from '@wolfstar/http-framework';\nimport { isSentryInitialized } from '../lib/sentry.js';\n\nexport class SharedListener extends Listener {\n\tpublic constructor(context: Listener.LoaderContext, options: Listener.Options) {\n\t\tsuper(context, { ...options, event: 'autocompleteError' satisfies keyof ClientEvents, enabled: isSentryInitialized() });\n\t}\n\n\tpublic run(error: unknown, context: ClientEventAutocompleteContext) {\n\t\tcaptureException(error, (scope) => scope.setLevel('error').setTag('event', this.name).setExtra('command', context.command.name));\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'SharedAutocompleteError', piece: SharedListener as any, store: 'listeners' });\n","import { captureException } from '@sentry/node';\nimport { Listener, container, type ClientEventCommandContext, type ClientEvents } from '@wolfstar/http-framework';\nimport { isSentryInitialized } from '../lib/sentry.js';\n\nexport class SharedListener extends Listener {\n\tpublic constructor(context: Listener.LoaderContext, options: Listener.Options) {\n\t\tsuper(context, { ...options, event: 'commandError' satisfies keyof ClientEvents, enabled: isSentryInitialized() });\n\t}\n\n\tpublic run(error: unknown, context: ClientEventCommandContext) {\n\t\tcaptureException(error, (scope) => scope.setLevel('error').setTag('event', this.name).setExtra('command', context.command.name));\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'SharedCommandError', piece: SharedListener as any, store: 'listeners' });\n","import { captureException } from '@sentry/node';\nimport { Listener, container, type ClientEvents } from '@wolfstar/http-framework';\nimport { isSentryInitialized } from '../lib/sentry.js';\n\nexport class SharedListener extends Listener {\n\tpublic constructor(context: Listener.LoaderContext, options: Listener.Options) {\n\t\tsuper(context, { ...options, event: 'error' satisfies keyof ClientEvents, enabled: isSentryInitialized() });\n\t}\n\n\tpublic run(error: unknown) {\n\t\tcaptureException(error, (scope) => scope.setLevel('error').setTag('event', this.name));\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'SharedError', piece: SharedListener as any, store: 'listeners' });\n","import { captureException } from '@sentry/node';\nimport { Listener, container, type ClientEventInteractionHandlerContext, type ClientEvents } from '@wolfstar/http-framework';\nimport { isSentryInitialized } from '../lib/sentry.js';\n\nexport class SharedListener extends Listener {\n\tpublic constructor(context: Listener.LoaderContext, options: Listener.Options) {\n\t\tsuper(context, { ...options, event: 'interactionHandlerError' satisfies keyof ClientEvents, enabled: isSentryInitialized() });\n\t}\n\n\tpublic run(error: unknown, context: ClientEventInteractionHandlerContext) {\n\t\tcaptureException(error, (scope) => scope.setLevel('error').setTag('event', this.name).setExtra('handler', context.handler.name));\n\t}\n}\n\nvoid container.stores.loadPiece({ name: 'SharedInteractionHandlerError', piece: SharedListener as any, store: 'listeners' });\n","import { getRootData } from '@sapphire/pieces';\nimport type { InternationalizationOptions } from '@wolfstar/plugin-i18next';\nimport type { InitOptions } from 'i18next';\nimport { join } from 'node:path';\n\nexport const sharedNamespace = 'commands/shared';\n\nfunction addSharedNamespace(options: InitOptions | undefined, discoveredNamespaces: string[]): InitOptions {\n\tconst configuredNamespaces = options?.ns === undefined ? [] : [options.ns].flat();\n\n\treturn {\n\t\t...options,\n\t\tns: [...new Set([...discoveredNamespaces, ...configuredNamespaces, sharedNamespace])]\n\t};\n}\n\n/**\n * Adds this package's locales without losing locales and namespaces discovered by the consumer.\n *\n * `@wolfstar/plugin-i18next@2` lets `backend.paths` replace its generated consumer path and only\n * discovers namespaces below `defaultLanguageDirectory`. Supplying both values explicitly keeps\n * the consumer resources and makes this package's namespace available to i18next.\n */\nexport function registerSharedLocales(i18n: InternationalizationOptions, localesPath: string): InternationalizationOptions {\n\tconst languagesDirectory = i18n.defaultLanguageDirectory ?? join(getRootData().root, 'languages');\n\tconst consumerLocalesPath = join(languagesDirectory, '{{lng}}', '{{ns}}.json');\n\tconst configuredI18next = i18n.i18next;\n\n\treturn {\n\t\t...i18n,\n\t\tbackend: {\n\t\t\t...i18n.backend,\n\t\t\tpaths: [...new Set([consumerLocalesPath, ...(i18n.backend?.paths ?? []), localesPath])]\n\t\t},\n\t\ti18next(namespaces, languages) {\n\t\t\tconst options = typeof configuredI18next === 'function' ? configuredI18next(namespaces, languages) : configuredI18next;\n\t\t\treturn addSharedNamespace(options, namespaces);\n\t\t}\n\t};\n}\n","import { Client } from '@wolfstar/http-framework';\nimport { join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport './commands/_load.js';\nimport './listeners/_load.js';\nimport { registerSharedLocales } from './lib/register-i18n.js';\n\n/**\n * Path pattern for this package's bundled locales, in the format\n * `@wolfstar/plugin-i18next` expects for `i18n.backend.paths`.\n */\nexport const localesPath = join(fileURLToPath(new URL('../src/locales', import.meta.url)), '{{lng}}', '{{ns}}.json');\n\n/**\n * `@wolfstar/plugin-i18next` reads `Client`'s `i18n` option exactly once, in its own\n * `preGenericsInitialization` hook, and has no API to register extra locale directories\n * afterwards. Hooks run in registration order, so registering this one *before* importing\n * the plugin's `register` entrypoint below guarantees it runs first and can splice this\n * package's locales into `options.i18n.backend.paths` before the plugin builds its\n * `InternationalizationHandler` โ consumers that only import this module keep working\n * without having to list `localesPath` in their own `Client` config.\n */\nClient.plugins.registerPreGenericsInitializationHook((options) => {\n\tconst { i18n } = options;\n\tif (!i18n) return;\n\toptions.i18n = registerSharedLocales(i18n, localesPath);\n}, '@wolfstar/shared-http-pieces');\n\n// A dynamic import, not a static one: static imports are hoisted above the hook\n// registration above, which would let the plugin's own hook register โ and run โ first.\nawait import('@wolfstar/plugin-i18next/register');\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiBO,IAAM,iCAAN,MAAM,sBAAsB,QAAQ;CAC1C,AAAgB,aAAa,aAA2C;EACvE,MAAM,IAAI,0BAA0B,WAAW;EAC/C,MAAM,MAAM,6BAA6B,WAAW;EACpD,MAAM,QAAQ,IAAI,aAAa,CAAC,CAC9B,eAAe,EAAE,sCAAsC,CAAC,CAAC,CACzD,UAAU,KAAK,oBAAoB,CAAC,GAAG,KAAK,yBAAyB,GAAG,GAAG,CAAC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
|
|
4
4
|
"description": "The common pieces for Star Network's HTTP-only bots",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@discordjs/builders": "^1.14.1",
|
|
51
51
|
"@discordjs/collection": "^2.1.1",
|
|
52
|
+
"@sapphire/pieces": "^4.4.1",
|
|
52
53
|
"@sentry/node": "^10.73.0",
|
|
53
54
|
"@wolfstar/env-utilities": "^2.0.8",
|
|
54
55
|
"@wolfstar/http-framework": "^3.6.0",
|
|
@@ -58,14 +59,17 @@
|
|
|
58
59
|
"tslib": "^2.8.1"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
62
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
61
63
|
"@wolfstar/i18next-type-generator": "^3.1.2",
|
|
62
64
|
"golar": "^0.1.10",
|
|
63
|
-
"typescript": "~7.0.2"
|
|
65
|
+
"typescript": "~7.0.2",
|
|
66
|
+
"vitest": "^4.1.11"
|
|
64
67
|
},
|
|
65
68
|
"engines": {
|
|
66
69
|
"node": ">=20"
|
|
67
70
|
},
|
|
68
71
|
"scripts": {
|
|
72
|
+
"test": "vitest run",
|
|
69
73
|
"build": "tsdown --config-loader unrun",
|
|
70
74
|
"watch": "tsdown --config-loader unrun --watch",
|
|
71
75
|
"typecheck": "golar tsc -p ../../tsconfig.json",
|