@webmobix/i18next-plugins
Advanced tools
+14
-12
@@ -9,3 +9,3 @@ const u = { | ||
| }; | ||
| class a extends Error { | ||
| class l extends Error { | ||
| constructor(s, t = !1) { | ||
@@ -34,4 +34,4 @@ super(s), this.retry = t; | ||
| }), !(!o || !r || !e)) { | ||
| for (const l of s) | ||
| this.pendingMissingKeys.push({ namespace: t, key: i, language: l, fallbackValue: n }); | ||
| for (const a of s) | ||
| this.pendingMissingKeys.push({ namespace: t, key: i, language: a, fallbackValue: n }); | ||
| this.flushTimer !== null && clearTimeout(this.flushTimer), this.flushTimer = setTimeout(() => { | ||
@@ -66,6 +66,8 @@ this.flushMissingKeys(); | ||
| (e) => { | ||
| const { ok: h, status: l } = e; | ||
| if (!h) { | ||
| const g = l >= 500 && l < 600; | ||
| throw new a(`failed loading ${r}`, g); | ||
| const { ok: h, status: a } = e; | ||
| if (console.debug( | ||
| `[leo-translate:backend] Fetching translations from ${r}: ${a} ${e.statusText}` | ||
| ), !h) { | ||
| const p = a >= 500 && a < 600; | ||
| throw new l(`failed loading ${r}`, p); | ||
| } | ||
@@ -75,3 +77,3 @@ return e.text(); | ||
| () => { | ||
| throw new a(`failed loading ${r}`); | ||
| throw new l(`failed loading ${r}`); | ||
| } | ||
@@ -82,6 +84,6 @@ ).then((e) => { | ||
| } catch { | ||
| throw new a(`failed parsing ${r} to json`, !1); | ||
| throw new l(`failed parsing ${r} to json`, !1); | ||
| } | ||
| }).catch((e) => { | ||
| e instanceof a && i(e.message, e.retry); | ||
| e instanceof l && i(e.message, e.retry); | ||
| }); | ||
@@ -91,5 +93,5 @@ } | ||
| c.type = "backend"; | ||
| let p = c; | ||
| let g = c; | ||
| export { | ||
| p as LeoBackend | ||
| g as LeoBackend | ||
| }; |
+8
-7
| { | ||
| "name": "@webmobix/i18next-plugins", | ||
| "version": "0.0.3", | ||
| "version": "0.0.4", | ||
| "description": "i18next backend and postProcessor plugins for Leo Translate", | ||
| "type": "module", | ||
| "license": "MIT", | ||
| "packageManager": "pnpm@10.24.0", | ||
| "bin": { | ||
@@ -31,2 +32,7 @@ "leo-translate": "./dist/cli.js" | ||
| }, | ||
| "scripts": { | ||
| "build": "vite build && tsc --emitDeclarationOnly", | ||
| "dev": "vite build --watch", | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "peerDependencies": { | ||
@@ -52,8 +58,3 @@ "i18next": ">=23.0.0" | ||
| "open": "^11.0.0" | ||
| }, | ||
| "scripts": { | ||
| "build": "vite build && tsc --emitDeclarationOnly", | ||
| "dev": "vite build --watch", | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| } | ||
| } | ||
| } |
40597
0.38%957
0.21%