@vielzeug/i18nit 1.2.0 → 2.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intl.js","names":[],"sources":["../src/intl.ts"],"sourcesContent":["import type { Locale, PluralForm } from './types';\n\n/* -------------------- Cache Container -------------------- */\n\n/** Holds all Intl formatter caches for one I18n instance — GC'd with the instance. */\nexport type IntlCaches = {\n dateFormat: Map<string, Intl.DateTimeFormat>;\n listFormat: Map<string, Intl.ListFormat>;\n numberFormat: Map<string, Intl.NumberFormat>;\n pluralRules: Map<string, Intl.PluralRules>;\n relativeTimeFormat: Map<string, Intl.RelativeTimeFormat>;\n};\n\nexport function makeIntlCaches(): IntlCaches {\n return {\n dateFormat: new Map(),\n listFormat: new Map(),\n numberFormat: new Map(),\n pluralRules: new Map(),\n relativeTimeFormat: new Map(),\n };\n}\n\n/* -------------------- Cache Helpers -------------------- */\n\nfunction intlFmt<F extends object>(cache: Map<string, F>, key: string, build: () => F): F {\n let fmt = cache.get(key);\n\n if (!fmt) {\n fmt = build();\n cache.set(key, fmt);\n }\n\n return fmt;\n}\n\n/**\n * Builds a stable string key for an Intl formatter cache.\n * Call this once per formatter construction path — not on every format call — so key\n * serialization cost is paid only on cache misses.\n */\nfunction intlKey(locale: string, options?: object): string {\n return options ? `${locale}:${JSON.stringify(options, Object.keys(options).sort())}` : locale;\n}\n\n/* -------------------- Format Functions -------------------- */\n\nexport function formatNumber(\n caches: IntlCaches,\n value: number,\n options: Intl.NumberFormatOptions | undefined,\n locale: Locale,\n): string {\n const key = intlKey(locale, options);\n\n try {\n return intlFmt(caches.numberFormat, key, () => new Intl.NumberFormat(locale, options)).format(value);\n } catch {\n return String(value);\n }\n}\n\nexport function formatDate(\n caches: IntlCaches,\n value: Date | number,\n options: Intl.DateTimeFormatOptions | undefined,\n locale: Locale,\n): string {\n const d = typeof value === 'number' ? new Date(value) : value;\n const key = intlKey(locale, options);\n\n try {\n return intlFmt(caches.dateFormat, key, () => new Intl.DateTimeFormat(locale, options)).format(d);\n } catch {\n return d.toString();\n }\n}\n\nexport function formatRelative(\n caches: IntlCaches,\n value: number,\n unit: Intl.RelativeTimeFormatUnit,\n options: Intl.RelativeTimeFormatOptions | undefined,\n locale: Locale,\n): string {\n const key = intlKey(locale, options);\n\n try {\n return intlFmt(caches.relativeTimeFormat, key, () => new Intl.RelativeTimeFormat(locale, options)).format(\n value,\n unit,\n );\n } catch {\n return String(value);\n }\n}\n\nexport function formatList(caches: IntlCaches, items: unknown[], locale: string, type: 'and' | 'or'): string {\n if (items.length === 0) return '';\n\n const stringItems = items.map(String);\n const intlType = type === 'and' ? 'conjunction' : 'disjunction';\n\n try {\n return intlFmt(\n caches.listFormat,\n `${locale}:${intlType}`,\n () => new Intl.ListFormat(locale, { style: 'long', type: intlType }),\n ).format(stringItems);\n } catch {\n // Fallback for environments without Intl.ListFormat\n if (stringItems.length === 1) return stringItems[0];\n\n if (stringItems.length === 2) return `${stringItems[0]} ${type} ${stringItems[1]}`;\n\n return `${stringItems.slice(0, -1).join(', ')} ${type} ${stringItems.at(-1)}`;\n }\n}\n\nexport function getPluralForm(caches: IntlCaches, locale: Locale, count: number): PluralForm {\n const n = Math.floor(Math.abs(count));\n\n try {\n return intlFmt(caches.pluralRules, locale, () => new Intl.PluralRules(locale)).select(n) as PluralForm;\n } catch {\n return n === 1 ? 'one' : 'other';\n }\n}\n"],"mappings":";AAaA,SAAgB,IAA6B;AAC3C,QAAO;EACL,4BAAY,IAAI,KAAK;EACrB,4BAAY,IAAI,KAAK;EACrB,8BAAc,IAAI,KAAK;EACvB,6BAAa,IAAI,KAAK;EACtB,oCAAoB,IAAI,KAAK;EAC9B;;AAKH,SAAS,EAA0B,GAAuB,GAAa,GAAmB;CACxF,IAAI,IAAM,EAAM,IAAI,EAAI;AAOxB,QALK,MACH,IAAM,GAAO,EACb,EAAM,IAAI,GAAK,EAAI,GAGd;;AAQT,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GAAG,EAAK,GAAG,EAAY,OAEvE,GAAG,EAAY,MAAM,GAAG,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,EAAK,GAAG,EAAY,GAAG,GAAG;;;AAI/E,SAAgB,EAAc,GAAoB,GAAgB,GAA2B;CAC3F,IAAM,IAAI,KAAK,MAAM,KAAK,IAAI,EAAM,CAAC;AAErC,KAAI;AACF,SAAO,EAAQ,EAAO,aAAa,SAAc,IAAI,KAAK,YAAY,EAAO,CAAC,CAAC,OAAO,EAAE;SAClF;AACN,SAAO,MAAM,IAAI,QAAQ"}
@@ -0,0 +1,117 @@
1
+ export type Locale = string;
2
+ export type Unsubscribe = () => void;
3
+ export type PluralForm = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
4
+ export type PluralMessages = Partial<Record<PluralForm, string>> & {
5
+ other: string;
6
+ };
7
+ export type MessageValue = string | PluralMessages;
8
+ export type Messages = {
9
+ [key: string]: MessageValue | Messages;
10
+ };
11
+ export type Vars = Record<string, unknown>;
12
+ /**
13
+ * Recursively makes all message keys optional, allowing partial locale catalogs.
14
+ * Use when a secondary locale only translates a subset of the primary locale's messages.
15
+ */
16
+ export type DeepPartialMessages<T extends Messages> = {
17
+ [K in keyof T]?: T[K] extends MessageValue ? MessageValue : T[K] extends Messages ? DeepPartialMessages<T[K]> : MessageValue;
18
+ };
19
+ /**
20
+ * Recursive type that extracts all dot-notation keys from a Messages shape for type-safe translation.
21
+ * Type-safe resolution is provided up to 8 levels of nesting; deeper paths resolve to `string`.
22
+ */
23
+ export type TranslationKey<T extends Messages, P extends string = '', D extends readonly 0[] = []> = D['length'] extends 8 ? string : {
24
+ [K in keyof T & string]: T[K] extends MessageValue ? P extends '' ? K : `${P}.${K}` : T[K] extends Messages ? TranslationKey<T[K], P extends '' ? K : `${P}.${K}`, [...D, 0]> : never;
25
+ }[keyof T & string];
26
+ /** The `key` parameter type for `t()` — enforces known dot-notation paths when `T` is concrete, allows any string otherwise. */
27
+ export type TranslationKeyParam<T extends Messages> = [TranslationKey<T>] extends [never] ? string : TranslationKey<T> | (string & {});
28
+ /** Extracts dot-notation keys from `T` whose final value is `PluralMessages`, for compile-time `count` enforcement. */
29
+ export type PluralKeys<T extends Messages, P extends string = '', D extends readonly 0[] = []> = D['length'] extends 8 ? never : {
30
+ [K in keyof T & string]: T[K] extends PluralMessages ? P extends '' ? K : `${P}.${K}` : T[K] extends Messages ? PluralKeys<T[K], P extends '' ? K : `${P}.${K}`, [...D, 0]> : never;
31
+ }[keyof T & string];
32
+ export type Loader = (locale: Locale) => Promise<Messages>;
33
+ export type SwitchMode = 'strict' | 'best-effort';
34
+ /** The reason a `subscribe()` listener was notified. */
35
+ export type LocaleChangeReason = 'locale-change' | 'catalog-update';
36
+ /** Payload passed to every `subscribe()` listener. */
37
+ export type LocaleChangeEvent = {
38
+ locale: Locale;
39
+ reason: LocaleChangeReason;
40
+ };
41
+ /** Type alias for a `subscribe()` listener function. */
42
+ export type LocaleChangeListener = (event: LocaleChangeEvent) => void;
43
+ /**
44
+ * Diagnostic event passed to `onDiagnostic`. Each `kind` carries relevant context:
45
+ * - `'subscriber-error'` — a subscriber callback threw; treat as a programming error.
46
+ * - `'loader-error'` — a locale loader rejected; treat as a recoverable I/O failure.
47
+ */
48
+ export type DiagnosticEvent = {
49
+ error: unknown;
50
+ kind: 'subscriber-error';
51
+ } | {
52
+ error: unknown;
53
+ kind: 'loader-error';
54
+ locale: Locale;
55
+ };
56
+ /** Keys of `T` whose values are nested `Messages` objects (i.e. valid scope targets). */
57
+ export type NamespaceKeys<T extends Messages> = string extends keyof T ? string : {
58
+ [K in keyof T & string]: T[K] extends Messages ? K : never;
59
+ }[keyof T & string];
60
+ export type I18nOptions<T extends Messages = Messages> = {
61
+ fallback?: Locale | Locale[];
62
+ loaders?: Record<Locale, Loader>;
63
+ locale?: Locale;
64
+ /**
65
+ * Static message bundles. Each locale can be a full or partial catalog.
66
+ * For a partial secondary locale, annotate it with `DeepPartialMessages<M>` to get compile-time
67
+ * checks that the subset matches the primary locale's shape.
68
+ */
69
+ messages?: Record<string, T | DeepPartialMessages<T>>;
70
+ /**
71
+ * Receives diagnostic events for both subscriber errors and loader failures.
72
+ * `'subscriber-error'` events indicate a programming error in a listener.
73
+ * `'loader-error'` events are recoverable I/O failures and include the failing `locale`.
74
+ * Defaults to `console.error` for subscriber errors and `console.warn` for loader errors.
75
+ */
76
+ onDiagnostic?: (event: DiagnosticEvent) => void;
77
+ onMissing?: (key: string, locale: Locale) => string | undefined;
78
+ /** Default mode for `ensureLocale()` and `switchLocale()`. */
79
+ switchMode?: SwitchMode;
80
+ };
81
+ export type BoundI18n<T extends Messages = Messages> = {
82
+ currency(value: number, currency: string, options?: Omit<Intl.NumberFormatOptions, 'style' | 'currency'>): string;
83
+ date(value: Date | number, options?: Intl.DateTimeFormatOptions): string;
84
+ has(key: string): boolean;
85
+ /** Like `has()`, but only checks the exact locale without walking the fallback chain. */
86
+ hasOwn(key: string): boolean;
87
+ list(items: unknown[], type?: 'and' | 'or'): string;
88
+ readonly locale: Locale;
89
+ number(value: number, options?: Intl.NumberFormatOptions): string;
90
+ relative(value: number, unit: Intl.RelativeTimeFormatUnit, options?: Intl.RelativeTimeFormatOptions): string;
91
+ /** Returns a translator scoped to a namespace key. Only keys whose values are nested message objects are valid. */
92
+ scope<K extends NamespaceKeys<T>>(ns: K): BoundI18n<T[K] & Messages>;
93
+ /** Translates a plural key — requires `{ count: number }` when `T` is concrete and the key resolves to `PluralMessages`. */
94
+ t<K extends PluralKeys<T>>(key: K, vars: {
95
+ count: number;
96
+ } & Vars): string;
97
+ t(key: TranslationKeyParam<T>, vars?: Vars): string;
98
+ withLocale(locale: Locale): BoundI18n<T>;
99
+ };
100
+ export type I18n<T extends Messages = Messages> = BoundI18n<T> & {
101
+ [Symbol.asyncDispose](): Promise<void>;
102
+ [Symbol.dispose](): void;
103
+ add(locale: Locale, messages: Messages): void;
104
+ batch(fn: () => void): void;
105
+ dispose(): void;
106
+ ensureLocale(locale: Locale, mode?: SwitchMode): Promise<void>;
107
+ hasLocale(locale: Locale): boolean;
108
+ isReady(locale: Locale): boolean;
109
+ readonly loadableLocales: Locale[];
110
+ readonly locales: Locale[];
111
+ registerLoader(locale: Locale, loader: Loader): void;
112
+ reload(locale: Locale): Promise<void>;
113
+ replace(locale: Locale, messages: Messages): void;
114
+ subscribe(listener: (event: LocaleChangeEvent) => void, immediate?: boolean): Unsubscribe;
115
+ switchLocale(locale: Locale, mode?: SwitchMode): Promise<void>;
116
+ };
117
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3E,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAErF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,cAAc,CAAC;AAEnD,MAAM,MAAM,QAAQ,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,CAAA;CAAE,CAAC;AAElE,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,QAAQ,IAAI;KACnD,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,GACtC,YAAY,GACZ,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GACnB,mBAAmB,CAAC,CAAC,CAAC,CAAC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AAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAClD,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC1F,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vielzeug/i18nit",
3
- "version": "1.2.0",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -10,15 +10,25 @@
10
10
  "types": "dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
+ "source": "./src/index.ts",
14
+ "types": "./dist/index.d.ts",
13
15
  "import": "./dist/index.js",
14
16
  "require": "./dist/index.cjs"
17
+ },
18
+ "./core": {
19
+ "source": "./src/index.ts",
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/i18nit.js",
22
+ "require": "./dist/i18nit.cjs"
15
23
  }
16
24
  },
17
25
  "scripts": {
18
- "build": "tsc && vite build",
19
- "fix": "biome check --write --unsafe src",
20
- "lint": "biome check src",
21
- "prepublishOnly": "npm run build",
26
+ "build": "vite build && pnpm run build:core && pnpm run build:types",
27
+ "build:core": "vite build --config vite.bundle.config.ts",
28
+ "build:types": "tsc -p tsconfig.declarations.json",
29
+ "fix": "eslint --fix src",
30
+ "lint": "eslint src",
31
+ "prepublishOnly": "pnpm run build",
22
32
  "preview": "vite preview",
23
33
  "test": "vitest"
24
34
  },
@@ -27,9 +37,9 @@
27
37
  "registry": "https://registry.npmjs.org/"
28
38
  },
29
39
  "devDependencies": {
30
- "typescript": "~5.9.3",
31
- "vite": "^7.3.1",
32
- "vite-plugin-dts": "^4.5.4",
33
- "vitest": "^4.0.18"
40
+ "@types/node": "^25.5.0",
41
+ "typescript": "~6.0.2",
42
+ "vite": "^8.0.3",
43
+ "vitest": "^4.1.2"
34
44
  }
35
45
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}