verbaly 0.69.0 → 0.70.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
@@ -29,7 +29,7 @@ t('EMo3ph4u', { name, count }); // ← fully typed, tree-shakeable
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-DGiThMCG.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-DGiThMCG.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-DGiThMCG.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-DGiThMCG.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
@@ -43,9 +43,10 @@ type Take<S extends string, D extends string> = S extends `${infer A}${D}${strin
43
43
  type Trim<S extends string> = S extends ` ${infer R}` ? Trim<R> : S extends `${infer R} ` ? Trim<R> : S;
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
+ 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;
46
48
  interface TFunction<D extends DictionaryInput = DictionaryInput> {
47
- <K extends KeysOf<D>>(key: K, ...args: TArgs<MessageAt<D, K>>): string;
48
- (strings: TemplateStringsArray, ...values: 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-DGiThMCG.d.ts.map
99
+ //# sourceMappingURL=types-DtKybAU-.d.cts.map
@@ -43,9 +43,10 @@ type Take<S extends string, D extends string> = S extends `${infer A}${D}${strin
43
43
  type Trim<S extends string> = S extends ` ${infer R}` ? Trim<R> : S extends `${infer R} ` ? Trim<R> : S;
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
+ 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;
46
48
  interface TFunction<D extends DictionaryInput = DictionaryInput> {
47
- <K extends KeysOf<D>>(key: K, ...args: TArgs<MessageAt<D, K>>): string;
48
- (strings: TemplateStringsArray, ...values: 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-DGiThMCG.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.0",
3
+ "version": "0.70.0",
4
4
  "description": "Effortless i18n: write natural text, ship type-safe, tree-shakeable translations.",
5
5
  "keywords": [
6
6
  "i18n",