diff --git a/package.json b/package.json index 9a65ac7cb..6a1134c7a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@sapphire/stopwatch": "^1.5.0", "@sapphire/ts-config": "^3.3.4", "@sapphire/utilities": "^3.11.0", - "@types/node": "^18.11.0", + "@types/node": "^18.11.3", "@types/node-fetch": "^2.6.2", "@types/ws": "^8.5.3", "@typescript-eslint/eslint-plugin": "^5.40.1", diff --git a/packages/i18next/package.json b/packages/i18next/package.json index f9e7ee828..e96826e3f 100644 --- a/packages/i18next/package.json +++ b/packages/i18next/package.json @@ -39,9 +39,9 @@ }, "dependencies": { "@sapphire/utilities": "^3.11.0", - "@skyra/i18next-backend": "^1.1.0", + "@skyra/i18next-backend": "^2.0.0", "chokidar": "^3.5.3", - "i18next": "^21.10.0", + "i18next": "^22.0.2", "tslib": "^2.4.0" }, "repository": { diff --git a/packages/i18next/src/index.ts b/packages/i18next/src/index.ts index eda8d3f1c..4f02d063d 100644 --- a/packages/i18next/src/index.ts +++ b/packages/i18next/src/index.ts @@ -1,4 +1,4 @@ -export { StringMap, TFunction, TFunctionKeys, TFunctionResult, TOptions } from 'i18next'; +export { TFunction, TOptions } from 'i18next'; export * from './lib/functions'; export * from './lib/InternationalizationHandler'; export * from './lib/types'; diff --git a/packages/i18next/src/lib/InternationalizationHandler.ts b/packages/i18next/src/lib/InternationalizationHandler.ts index 93b9ee92f..2451f9d57 100644 --- a/packages/i18next/src/lib/InternationalizationHandler.ts +++ b/packages/i18next/src/lib/InternationalizationHandler.ts @@ -2,11 +2,11 @@ import { Result } from '@sapphire/framework'; import { container, getRootData } from '@sapphire/pieces'; import { Awaitable, isFunction, NonNullObject } from '@sapphire/utilities'; import { Backend, PathResolvable } from '@skyra/i18next-backend'; -import i18next, { StringMap, TFunction, TFunctionKeys, TFunctionResult, TOptions } from 'i18next'; +import i18next, { TFunction, TOptions } from 'i18next'; import type { PathLike } from 'node:fs'; import { opendir } from 'node:fs/promises'; import { join } from 'node:path'; -import type { InternationalizationContext, InternationalizationOptions } from './types'; +import type { InternationalizationContext, InternationalizationOptions, StringMap, TFunctionKeys, TFunctionResult } from './types'; /** * A generalized class for handling `i18next` JSON files and their discovery. diff --git a/packages/i18next/src/lib/functions.ts b/packages/i18next/src/lib/functions.ts index cdc779e9d..a9fcd1055 100644 --- a/packages/i18next/src/lib/functions.ts +++ b/packages/i18next/src/lib/functions.ts @@ -2,14 +2,17 @@ import { container } from '@sapphire/pieces'; import { lazy, type NonNullObject } from '@sapphire/utilities'; import { APIApplicationCommandOptionChoice, Locale, type LocaleString } from 'discord-api-types/v10'; import { BaseCommandInteraction, Guild, Message, MessageComponentInteraction } from 'discord.js'; -import type { StringMap, TFunctionKeys, TFunctionResult, TOptions } from 'i18next'; +import type { TOptions } from 'i18next'; import type { BuilderWithDescription, BuilderWithName, BuilderWithNameAndDescription, InternationalizationContext, LocalizedData, - Target + StringMap, + Target, + TFunctionKeys, + TFunctionResult } from './types'; /** diff --git a/packages/i18next/src/lib/types.ts b/packages/i18next/src/lib/types.ts index 47176e108..82366397a 100644 --- a/packages/i18next/src/lib/types.ts +++ b/packages/i18next/src/lib/types.ts @@ -13,7 +13,19 @@ import type { User, VoiceChannel } from 'discord.js'; -import type { InitOptions } from 'i18next'; +import type { DefaultTFuncReturn, InitOptions, Namespace, TFuncKey, TFuncReturn, TypeOptions } from 'i18next'; + +export interface StringMap { + [key: string]: any; +} + +export type TFunctionKeys = TFuncKey | TemplateStringsArray extends infer A ? A : never; +export type TFunctionResult = TFuncReturn< + N, + TFunctionKeys, + DefaultTFuncReturn, + TKPrefix +>; /** * Configure whether to use Hot-Module-Replacement (HMR) for your i18next resources using these options. The minimum config to enable HMR is to set `enabled` to true. Any other properties are optional. diff --git a/yarn.lock b/yarn.lock index 2343a080b..bfef6c79e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -380,17 +380,6 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.10.5": - version: 0.10.5 - resolution: "@humanwhocodes/config-array@npm:0.10.5" - dependencies: - "@humanwhocodes/object-schema": ^1.2.1 - debug: ^4.1.1 - minimatch: ^3.0.4 - checksum: af4fa2633c57414be22ddba0a072cc611ef9a07104542fa24bde918a0153b89b6e08ca6a20ccc9079de6079e219e2406e38414d1b662db8bb59a3ba9d6eee6e3 - languageName: node - linkType: hard - "@humanwhocodes/config-array@npm:^0.11.6": version: 0.11.6 resolution: "@humanwhocodes/config-array@npm:0.11.6" @@ -707,10 +696,10 @@ __metadata: dependencies: "@favware/cliff-jumper": ^1.8.8 "@sapphire/utilities": ^3.11.0 - "@skyra/i18next-backend": ^1.1.0 + "@skyra/i18next-backend": ^2.0.0 chokidar: ^3.5.3 gen-esm-wrapper: ^1.1.3 - i18next: ^21.10.0 + i18next: ^22.0.2 tslib: ^2.4.0 typedoc: ^0.23.17 typedoc-json-parser: ^6.0.2 @@ -860,12 +849,12 @@ __metadata: languageName: node linkType: hard -"@skyra/i18next-backend@npm:^1.1.0": - version: 1.1.0 - resolution: "@skyra/i18next-backend@npm:1.1.0" +"@skyra/i18next-backend@npm:^2.0.0": + version: 2.0.0 + resolution: "@skyra/i18next-backend@npm:2.0.0" dependencies: tslib: ^2.4.0 - checksum: 1e89ac67b672e70fc16731da127c46d913222feae12208f621524cff67000c4d530673b11f6797d05f821a0c8705073a3d93eed6ccf865c55235ecbc917b0f1b + checksum: 20443db52a8b85fae133dcbba1d9b390b8d50e97c2e3a41652875658c7fdb87cfccc834eade143f0c0690be010f6e6476ed70037deb814fd98700594a5219882 languageName: node linkType: hard @@ -958,10 +947,10 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*": - version: 18.8.3 - resolution: "@types/node@npm:18.8.3" - checksum: 9201adc6dc389644c9f478f950ef8926a93e5827865dcd80d7d12fefacab665c96879c87cd6ec74d5eccdd998c4603d02e1e07a35d71a63fe4c20670a381f6ef +"@types/node@npm:*, @types/node@npm:^18.11.3": + version: 18.11.3 + resolution: "@types/node@npm:18.11.3" + checksum: 3a2a9142d891a90a195c296149bf64a69cc0abcc42f543be911ab22b2e0ead85ff077f90af92f0f13f6e3e5e72501469200fd753dfd1101825d4646a89d3ee47 languageName: node linkType: hard @@ -972,13 +961,6 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^18.11.0": - version: 18.11.0 - resolution: "@types/node@npm:18.11.0" - checksum: f27f899ab428e5732f04fadadc9203f44bdf3abf56474540ee27da90e4f2ba133faf87263cada4d2271955f92ee6a142bd50683c86290fe5070c19aac44fd654 - languageName: node - linkType: hard - "@types/normalize-package-data@npm:^2.4.0": version: 2.4.1 resolution: "@types/normalize-package-data@npm:2.4.1" @@ -1016,29 +998,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.33.1": - version: 5.39.0 - resolution: "@typescript-eslint/eslint-plugin@npm:5.39.0" - dependencies: - "@typescript-eslint/scope-manager": 5.39.0 - "@typescript-eslint/type-utils": 5.39.0 - "@typescript-eslint/utils": 5.39.0 - debug: ^4.3.4 - ignore: ^5.2.0 - regexpp: ^3.2.0 - semver: ^7.3.7 - tsutils: ^3.21.0 - peerDependencies: - "@typescript-eslint/parser": ^5.0.0 - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 9d6835f3c2558f2287c5a45dc7d3b17b19c6777b5915b6ad737d892e5938746a3e76c3efd0e01156da0b17432a50d1e02480efc5105e8f9c75f1a3d45e18d6ee - languageName: node - linkType: hard - -"@typescript-eslint/eslint-plugin@npm:^5.40.1": +"@typescript-eslint/eslint-plugin@npm:^5.33.1, @typescript-eslint/eslint-plugin@npm:^5.40.1": version: 5.40.1 resolution: "@typescript-eslint/eslint-plugin@npm:5.40.1" dependencies: @@ -1060,24 +1020,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.33.1": - version: 5.39.0 - resolution: "@typescript-eslint/parser@npm:5.39.0" - dependencies: - "@typescript-eslint/scope-manager": 5.39.0 - "@typescript-eslint/types": 5.39.0 - "@typescript-eslint/typescript-estree": 5.39.0 - debug: ^4.3.4 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: f55a1ef540e5c70d063e0112c0c4c950504d263ce180480973ca72c015a3e826942ebe8aa0a6bbd557def987b07d9d410784b6c96aa000679dfa3f4cb00e063c - languageName: node - linkType: hard - -"@typescript-eslint/parser@npm:^5.40.1": +"@typescript-eslint/parser@npm:^5.33.1, @typescript-eslint/parser@npm:^5.40.1": version: 5.40.1 resolution: "@typescript-eslint/parser@npm:5.40.1" dependencies: @@ -1094,16 +1037,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.39.0": - version: 5.39.0 - resolution: "@typescript-eslint/scope-manager@npm:5.39.0" - dependencies: - "@typescript-eslint/types": 5.39.0 - "@typescript-eslint/visitor-keys": 5.39.0 - checksum: 8d8b55eb219a23b3de64602ea23269fb1e16120ff03c58ebb7ed571372cbc591c5f4641b91ba1cf7fd02cf13f7bb906a7bd6e3db6da3543c97fcea8c61c15c07 - languageName: node - linkType: hard - "@typescript-eslint/scope-manager@npm:5.40.1": version: 5.40.1 resolution: "@typescript-eslint/scope-manager@npm:5.40.1" @@ -1114,23 +1047,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.39.0": - version: 5.39.0 - resolution: "@typescript-eslint/type-utils@npm:5.39.0" - dependencies: - "@typescript-eslint/typescript-estree": 5.39.0 - "@typescript-eslint/utils": 5.39.0 - debug: ^4.3.4 - tsutils: ^3.21.0 - peerDependencies: - eslint: "*" - peerDependenciesMeta: - typescript: - optional: true - checksum: 2bab5c1a8bc0956d8f9ba1fb6db56a89f8e40c4f7bb0c07b1581aa4ed4c8259a64d67bc9c6fccbdc8e62fc9330d30c3c5a84f30f28112ddb1e3995d2791a5ac2 - languageName: node - linkType: hard - "@typescript-eslint/type-utils@npm:5.40.1": version: 5.40.1 resolution: "@typescript-eslint/type-utils@npm:5.40.1" @@ -1148,13 +1064,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:5.39.0": - version: 5.39.0 - resolution: "@typescript-eslint/types@npm:5.39.0" - checksum: 5f67fe02adc87d594b6cc8ec5387d64419d4bbff701f4da51bf9929cdc50bc613df865e5a2457f13e4a637e8dfdb1fdf15fe8138f8968462de9e54ea056cc1a7 - languageName: node - linkType: hard - "@typescript-eslint/types@npm:5.40.1": version: 5.40.1 resolution: "@typescript-eslint/types@npm:5.40.1" @@ -1162,24 +1071,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.39.0": - version: 5.39.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.39.0" - dependencies: - "@typescript-eslint/types": 5.39.0 - "@typescript-eslint/visitor-keys": 5.39.0 - debug: ^4.3.4 - globby: ^11.1.0 - is-glob: ^4.0.3 - semver: ^7.3.7 - tsutils: ^3.21.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 86143dd9dd33ce65a20badbce5509ae4e77e9dfe202a6966dd416a8ce8147e5b05d12ce0b8f593ed7924797f6420d0bcd558c773042466e24386cdda24f24eb8 - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:5.40.1": version: 5.40.1 resolution: "@typescript-eslint/typescript-estree@npm:5.40.1" @@ -1198,22 +1089,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.39.0": - version: 5.39.0 - resolution: "@typescript-eslint/utils@npm:5.39.0" - dependencies: - "@types/json-schema": ^7.0.9 - "@typescript-eslint/scope-manager": 5.39.0 - "@typescript-eslint/types": 5.39.0 - "@typescript-eslint/typescript-estree": 5.39.0 - eslint-scope: ^5.1.1 - eslint-utils: ^3.0.0 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 460a883775c24ed1a328db15101d58e1207797c97d2347a6e1adb2e26ef56ac0b525a326d2dd74333daf00e2b2e3dd28d51e0d4c4c38cdade2d132d8b08917cb - languageName: node - linkType: hard - "@typescript-eslint/utils@npm:5.40.1": version: 5.40.1 resolution: "@typescript-eslint/utils@npm:5.40.1" @@ -1232,16 +1107,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.39.0": - version: 5.39.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.39.0" - dependencies: - "@typescript-eslint/types": 5.39.0 - eslint-visitor-keys: ^3.3.0 - checksum: 941e49fd1f4d2e42cd15a52a50f6f1102e2a83b173d182b5dd43ba3d7b7f0f1457d74fcaac710da4a19c28f804c78bc265d900802f4e2c7c46a608fff3204e7c - languageName: node - linkType: hard - "@typescript-eslint/visitor-keys@npm:5.40.1": version: 5.40.1 resolution: "@typescript-eslint/visitor-keys@npm:5.40.1" @@ -2795,55 +2660,7 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.22.0": - version: 8.25.0 - resolution: "eslint@npm:8.25.0" - dependencies: - "@eslint/eslintrc": ^1.3.3 - "@humanwhocodes/config-array": ^0.10.5 - "@humanwhocodes/module-importer": ^1.0.1 - ajv: ^6.10.0 - chalk: ^4.0.0 - cross-spawn: ^7.0.2 - debug: ^4.3.2 - doctrine: ^3.0.0 - escape-string-regexp: ^4.0.0 - eslint-scope: ^7.1.1 - eslint-utils: ^3.0.0 - eslint-visitor-keys: ^3.3.0 - espree: ^9.4.0 - esquery: ^1.4.0 - esutils: ^2.0.2 - fast-deep-equal: ^3.1.3 - file-entry-cache: ^6.0.1 - find-up: ^5.0.0 - glob-parent: ^6.0.1 - globals: ^13.15.0 - globby: ^11.1.0 - grapheme-splitter: ^1.0.4 - ignore: ^5.2.0 - import-fresh: ^3.0.0 - imurmurhash: ^0.1.4 - is-glob: ^4.0.0 - js-sdsl: ^4.1.4 - js-yaml: ^4.1.0 - json-stable-stringify-without-jsonify: ^1.0.1 - levn: ^0.4.1 - lodash.merge: ^4.6.2 - minimatch: ^3.1.2 - natural-compare: ^1.4.0 - optionator: ^0.9.1 - regexpp: ^3.2.0 - strip-ansi: ^6.0.1 - strip-json-comments: ^3.1.0 - text-table: ^0.2.0 - bin: - eslint: bin/eslint.js - checksum: 7acf2693b522b573657b53d2245b5522d3a131e4224b1cbf01e2c3579632fdbf62599284f68bc483e6e4eba23ae3643c9544744e0214a86e727cc361cedcd0fa - languageName: node - linkType: hard - -"eslint@npm:^8.26.0": +"eslint@npm:^8.22.0, eslint@npm:^8.26.0": version: 8.26.0 resolution: "eslint@npm:8.26.0" dependencies: @@ -3402,7 +3219,7 @@ __metadata: languageName: node linkType: hard -"glob-parent@npm:^6.0.1, glob-parent@npm:^6.0.2": +"glob-parent@npm:^6.0.2": version: 6.0.2 resolution: "glob-parent@npm:6.0.2" dependencies: @@ -3685,12 +3502,12 @@ __metadata: languageName: node linkType: hard -"i18next@npm:^21.10.0": - version: 21.10.0 - resolution: "i18next@npm:21.10.0" +"i18next@npm:^22.0.2": + version: 22.0.2 + resolution: "i18next@npm:22.0.2" dependencies: "@babel/runtime": ^7.17.2 - checksum: f997985e2d4d15a62a0936a82ff6420b97f3f971e776fe685bdd50b4de0cb4dc2198bc75efe6b152844794ebd5040d8060d6d152506a687affad534834836d81 + checksum: d779ea7f8e35ad8fd9d38521b670dab9440c6f51eab4347800058ee311a5e55abacac7e55cb1ff9f6898b4222a5f2aac72175f0dc1faeffbf3b4b37800f8f924 languageName: node linkType: hard @@ -5637,7 +5454,7 @@ __metadata: "@sapphire/stopwatch": ^1.5.0 "@sapphire/ts-config": ^3.3.4 "@sapphire/utilities": ^3.11.0 - "@types/node": ^18.11.0 + "@types/node": ^18.11.3 "@types/node-fetch": ^2.6.2 "@types/ws": ^8.5.3 "@typescript-eslint/eslint-plugin": ^5.40.1 @@ -6435,23 +6252,7 @@ __metadata: languageName: node linkType: hard -"typedoc@npm:^0.23.16": - version: 0.23.16 - resolution: "typedoc@npm:0.23.16" - dependencies: - lunr: ^2.3.9 - marked: ^4.0.19 - minimatch: ^5.1.0 - shiki: ^0.11.1 - peerDependencies: - typescript: 4.6.x || 4.7.x || 4.8.x - bin: - typedoc: bin/typedoc - checksum: 3574ee4a5fe3ca485b8a7d18cbe745bffe6d21886fcbc09c59551d0442d90b6391d435b06245199293914500c4f237fd0e7cc3eec678f1f8ee796b88b3d96089 - languageName: node - linkType: hard - -"typedoc@npm:^0.23.17": +"typedoc@npm:^0.23.16, typedoc@npm:^0.23.17": version: 0.23.17 resolution: "typedoc@npm:0.23.17" dependencies: