verbaly 0.69.1 → 0.71.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/README.md CHANGED
@@ -23,13 +23,13 @@ Most i18n tools make you maintain key files by hand: keys drift from the code, n
23
23
  t`Hello ${name}, you have ${count} messages`;
24
24
 
25
25
  // The compiler generates: a stable key + inferred types + per-locale entries.
26
- t('EMo3ph4u', { name, count }); // ← fully typed, tree-shakeable
26
+ t('usNGUet6', { name, count }); // ← fully typed, tree-shakeable
27
27
 
28
28
  // Prefer readable keys? Opt in per message:
29
29
  t.id('inbox.title')`Hello ${name}`; // → t('inbox.title', { name })
30
30
  ```
31
31
 
32
- Missing a translation? **The build fails**, so raw keys never reach production. And a translation that dropped your `{name}` or flattened a plural block fails too: being filled in is not the same as working.
32
+ Missing a translation? **Every build says which ones**, and `verbaly check` stops your CI on them, so a raw key never reaches a release. A translation that dropped your `{name}` or flattened a plural block fails `check` too: being filled in is not the same as working.
33
33
 
34
34
  ## 🚀 Try it in 30 seconds
35
35
 
@@ -1,4 +1,4 @@
1
- import { b as Verbaly } from "./types-Ctwzzvaf.cjs";
1
+ import { b as Verbaly } from "./types-DtKybAU-.cjs";
2
2
  //#region src/devtools.d.ts
3
3
  export interface DevtoolsOptions {
4
4
  root?: ParentNode;
@@ -1,4 +1,4 @@
1
- import { b as Verbaly } from "./types-Ctwzzvaf.js";
1
+ import { b as Verbaly } from "./types-DtKybAU-.js";
2
2
  //#region src/devtools.d.ts
3
3
  export interface DevtoolsOptions {
4
4
  root?: ParentNode;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as MessageNode, S as IcuParser, T as parse, _ as TArgs, a as Formatter, b as Verbaly, c as LocaleLoader, d as MessageValue, f as ParamNames, g as ResolveStatus, h as ResolveInfo, i as FormatInfo, l as MessageAt, m as Register, n as DictionaryInput, o as KeysOf, p as Params, r as FlatKeys, s as Locale, t as AddMessagesOptions, u as MessageTree, v as TFunction, w as ParamNode, x as VerbalyOptions, y as Translate } from "./types-Ctwzzvaf.cjs";
1
+ import { C as MessageNode, S as IcuParser, T as parse, _ as TArgs, a as Formatter, b as Verbaly, c as LocaleLoader, d as MessageValue, f as ParamNames, g as ResolveStatus, h as ResolveInfo, i as FormatInfo, l as MessageAt, m as Register, n as DictionaryInput, o as KeysOf, p as Params, r as FlatKeys, s as Locale, t as AddMessagesOptions, u as MessageTree, v as TFunction, w as ParamNode, x as VerbalyOptions, y as Translate } from "./types-DtKybAU-.cjs";
2
2
  //#region src/instance.d.ts
3
3
  export declare function createVerbaly<const D extends DictionaryInput = DictionaryInput>(options?: VerbalyOptions<D>): Verbaly<D>;
4
4
  //#endregion
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as MessageNode, S as IcuParser, T as parse, _ as TArgs, a as Formatter, b as Verbaly, c as LocaleLoader, d as MessageValue, f as ParamNames, g as ResolveStatus, h as ResolveInfo, i as FormatInfo, l as MessageAt, m as Register, n as DictionaryInput, o as KeysOf, p as Params, r as FlatKeys, s as Locale, t as AddMessagesOptions, u as MessageTree, v as TFunction, w as ParamNode, x as VerbalyOptions, y as Translate } from "./types-Ctwzzvaf.js";
1
+ import { C as MessageNode, S as IcuParser, T as parse, _ as TArgs, a as Formatter, b as Verbaly, c as LocaleLoader, d as MessageValue, f as ParamNames, g as ResolveStatus, h as ResolveInfo, i as FormatInfo, l as MessageAt, m as Register, n as DictionaryInput, o as KeysOf, p as Params, r as FlatKeys, s as Locale, t as AddMessagesOptions, u as MessageTree, v as TFunction, w as ParamNode, x as VerbalyOptions, y as Translate } from "./types-DtKybAU-.js";
2
2
  //#region src/instance.d.ts
3
3
  export declare function createVerbaly<const D extends DictionaryInput = DictionaryInput>(options?: VerbalyOptions<D>): Verbaly<D>;
4
4
  //#endregion
@@ -44,8 +44,9 @@ type Trim<S extends string> = S extends ` ${infer R}` ? Trim<R> : S extends `${i
44
44
  type CleanName<N extends string> = N extends '' ? never : N extends `${string}{${string}` ? never : N extends `${string}\u0000${string}` ? never : N;
45
45
  type TArgs<S extends string> = [S] extends [never] ? [params?: Params] : string extends S ? [params?: Params] : [ParamNames<S>] extends [never] ? [] : [params: { [N in ParamNames<S> & string]: unknown; }];
46
46
  type FromData<K> = {} extends Record<K & string, 1> ? true : false;
47
+ type OneKey<K> = [K] extends [(K extends unknown ? (key: K) => void : never) extends ((key: infer One) => void) ? One : never] ? true : false;
47
48
  interface TFunction<D extends DictionaryInput = DictionaryInput> {
48
- <K extends KeysOf<D> | TemplateStringsArray | (string & {})>(first: K extends TemplateStringsArray ? K : FromData<K> extends true ? K : K extends KeysOf<D> ? K : KeysOf<D>, ...args: [K] extends [never] ? [params?: Params] : K extends TemplateStringsArray ? unknown[] : FromData<K> extends true ? [params?: Params] : K extends KeysOf<D> ? TArgs<MessageAt<D, K>> : unknown[]): string;
49
+ <K extends KeysOf<D> | TemplateStringsArray | (string & {})>(first: K extends TemplateStringsArray ? K : FromData<K> extends true ? K : K extends KeysOf<D> ? K : KeysOf<D>, ...args: [K] extends [never] ? [params?: Params] : OneKey<K> extends false ? [params?: Params] : K extends TemplateStringsArray ? unknown[] : FromData<K> extends true ? [params?: Params] : K extends KeysOf<D> ? TArgs<MessageAt<D, K>> : unknown[]): string;
49
50
  id(key: string): (strings: TemplateStringsArray, ...values: unknown[]) => string;
50
51
  }
51
52
  interface Register {}
@@ -95,4 +96,4 @@ interface Verbaly<D extends DictionaryInput = DictionaryInput> {
95
96
  }
96
97
  //#endregion
97
98
  export { MessageNode as C, IcuParser as S, parse as T, TArgs as _, Formatter as a, Verbaly as b, LocaleLoader as c, MessageValue as d, ParamNames as f, ResolveStatus as g, ResolveInfo as h, FormatInfo as i, MessageAt as l, Register as m, DictionaryInput as n, KeysOf as o, Params as p, FlatKeys as r, Locale as s, AddMessagesOptions as t, MessageTree as u, TFunction as v, ParamNode as w, VerbalyOptions as x, Translate as y };
98
- //# sourceMappingURL=types-Ctwzzvaf.d.ts.map
99
+ //# sourceMappingURL=types-DtKybAU-.d.cts.map
@@ -44,8 +44,9 @@ type Trim<S extends string> = S extends ` ${infer R}` ? Trim<R> : S extends `${i
44
44
  type CleanName<N extends string> = N extends '' ? never : N extends `${string}{${string}` ? never : N extends `${string}\u0000${string}` ? never : N;
45
45
  type TArgs<S extends string> = [S] extends [never] ? [params?: Params] : string extends S ? [params?: Params] : [ParamNames<S>] extends [never] ? [] : [params: { [N in ParamNames<S> & string]: unknown; }];
46
46
  type FromData<K> = {} extends Record<K & string, 1> ? true : false;
47
+ type OneKey<K> = [K] extends [(K extends unknown ? (key: K) => void : never) extends ((key: infer One) => void) ? One : never] ? true : false;
47
48
  interface TFunction<D extends DictionaryInput = DictionaryInput> {
48
- <K extends KeysOf<D> | TemplateStringsArray | (string & {})>(first: K extends TemplateStringsArray ? K : FromData<K> extends true ? K : K extends KeysOf<D> ? K : KeysOf<D>, ...args: [K] extends [never] ? [params?: Params] : K extends TemplateStringsArray ? unknown[] : FromData<K> extends true ? [params?: Params] : K extends KeysOf<D> ? TArgs<MessageAt<D, K>> : unknown[]): string;
49
+ <K extends KeysOf<D> | TemplateStringsArray | (string & {})>(first: K extends TemplateStringsArray ? K : FromData<K> extends true ? K : K extends KeysOf<D> ? K : KeysOf<D>, ...args: [K] extends [never] ? [params?: Params] : OneKey<K> extends false ? [params?: Params] : K extends TemplateStringsArray ? unknown[] : FromData<K> extends true ? [params?: Params] : K extends KeysOf<D> ? TArgs<MessageAt<D, K>> : unknown[]): string;
49
50
  id(key: string): (strings: TemplateStringsArray, ...values: unknown[]) => string;
50
51
  }
51
52
  interface Register {}
@@ -95,4 +96,4 @@ interface Verbaly<D extends DictionaryInput = DictionaryInput> {
95
96
  }
96
97
  //#endregion
97
98
  export { MessageNode as C, IcuParser as S, parse as T, TArgs as _, Formatter as a, Verbaly as b, LocaleLoader as c, MessageValue as d, ParamNames as f, ResolveStatus as g, ResolveInfo as h, FormatInfo as i, MessageAt as l, Register as m, DictionaryInput as n, KeysOf as o, Params as p, FlatKeys as r, Locale as s, AddMessagesOptions as t, MessageTree as u, TFunction as v, ParamNode as w, VerbalyOptions as x, Translate as y };
98
- //# sourceMappingURL=types-Ctwzzvaf.d.cts.map
99
+ //# sourceMappingURL=types-DtKybAU-.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verbaly",
3
- "version": "0.69.1",
3
+ "version": "0.71.0",
4
4
  "description": "Effortless i18n: write natural text, ship type-safe, tree-shakeable translations.",
5
5
  "keywords": [
6
6
  "i18n",
@@ -69,9 +69,9 @@
69
69
  "devDependencies": {
70
70
  "esbuild": "^0.28.2",
71
71
  "fast-check": "^4.10.2",
72
- "happy-dom": "^20.14.5",
73
- "i18next": "^26.4.2",
74
- "tinybench": "^6.2.1"
72
+ "happy-dom": "^21.0.1",
73
+ "i18next": "^26.4.4",
74
+ "tinybench": "^6.2.2"
75
75
  },
76
76
  "scripts": {
77
77
  "build": "tsdown",