feat: module icons

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
TrèsAbhiandCopilot committed 2026-04-29 16:27:13 -05:00
1 parent 3a60535564
commit 44e7cd7505
16 files changed
+206 -14

No files matched your search

+6 -6
View File
@@ -46,7 +46,7 @@ export abstract class AbstractAPI {
return supported;
}
@Cache<[string, string, boolean]>((...args) => args.join("-"))
@Cache()
async groupedGameStrings(locale: string, group: string, prefix: boolean) {
this.assertLocale(locale);
@@ -64,9 +64,7 @@ export abstract class AbstractAPI {
}
}
export function Cache<Arguments extends unknown[]>(
discriminator: (...args: Arguments) => string = (...args) => args.join("-"),
) {
export function Cache<Arguments extends unknown[]>(disableInDev = false) {
const cache = new WeakMap<object, Map<string, Promise<unknown>>>();
return function (
@@ -77,7 +75,7 @@ export function Cache<Arguments extends unknown[]>(
const original = descriptor.value;
descriptor.value = function (...args: Arguments) {
const key = discriminator(...args);
const key = args.join("-");
let thisCache = cache.get(this);
@@ -86,7 +84,9 @@ export function Cache<Arguments extends unknown[]>(
cache.set(this, thisCache);
}
if (thisCache.has(key)) {
const disabled = disableInDev && import.meta.env.DEV;
if (thisCache.has(key) && !disabled) {
return thisCache.get(key);
}
+1 -1
View File
@@ -186,7 +186,7 @@ export class ServerAPI extends AbstractAPI {
return tiers;
}
@Cache()
@Cache(true)
async strings(locale: string) {
const localized = (await globbedStrings[
`../../../../i18n/strings/${locale}.json`