@hyphacommerce/i18n 0.0.0-stage → 0.1.0-beta.4
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/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/README.md +276 -2
- package/dist/bin.mjs +250 -0
- package/dist/check.d.ts +49 -0
- package/dist/check.js +139 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +122 -0
- package/dist/react.d.ts +28 -0
- package/dist/react.js +57 -0
- package/dist/translator-B9SeoqOu.js +241 -0
- package/dist/translator-BxDsP96P.d.ts +60 -0
- package/package.json +63 -3
package/dist/react.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as createTranslator } from "./translator-B9SeoqOu.js";
|
|
3
|
+
import { createContext, createElement, useContext, useMemo } from "react";
|
|
4
|
+
// src/react.ts
|
|
5
|
+
const I18nContext = createContext(null);
|
|
6
|
+
/**
|
|
7
|
+
* Gives the components under it their translator. A provider inside another of the same
|
|
8
|
+
* language adds its messages to the outer one's (its own win), so a nested layout hands
|
|
9
|
+
* over only the namespaces its routes add.
|
|
10
|
+
*/
|
|
11
|
+
function I18nProvider(props) {
|
|
12
|
+
const { language, fallback, locale, onMissing, children } = props;
|
|
13
|
+
const outer = useContext(I18nContext);
|
|
14
|
+
const inherited = outer?.language === language ? outer.messages : void 0;
|
|
15
|
+
const own = props.messages;
|
|
16
|
+
const provided = useMemo(() => {
|
|
17
|
+
const messages = inherited ? {
|
|
18
|
+
...inherited,
|
|
19
|
+
...own
|
|
20
|
+
} : own;
|
|
21
|
+
return {
|
|
22
|
+
translator: createTranslator(language, messages, {
|
|
23
|
+
fallback,
|
|
24
|
+
locale,
|
|
25
|
+
onMissing,
|
|
26
|
+
onError: (error, key) => console.error(`i18n: ${key} (${language})`, error)
|
|
27
|
+
}),
|
|
28
|
+
language,
|
|
29
|
+
messages
|
|
30
|
+
};
|
|
31
|
+
}, [
|
|
32
|
+
language,
|
|
33
|
+
inherited,
|
|
34
|
+
own,
|
|
35
|
+
fallback,
|
|
36
|
+
locale,
|
|
37
|
+
onMissing
|
|
38
|
+
]);
|
|
39
|
+
return createElement(I18nContext, { value: provided }, children);
|
|
40
|
+
}
|
|
41
|
+
function useTranslator() {
|
|
42
|
+
const provided = useContext(I18nContext);
|
|
43
|
+
if (!provided) throw new Error("useT and useLanguage need an <I18nProvider> above them");
|
|
44
|
+
return provided.translator;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The translator of the nearest `I18nProvider`. An app types it with its keys once
|
|
48
|
+
* (`export const useAppT = () => useT<Key>()`), so an unknown key doesn't compile.
|
|
49
|
+
*/
|
|
50
|
+
function useT() {
|
|
51
|
+
return useTranslator();
|
|
52
|
+
}
|
|
53
|
+
/** The language of the nearest `I18nProvider`. */
|
|
54
|
+
function useLanguage() {
|
|
55
|
+
return useTranslator().language;
|
|
56
|
+
}
|
|
57
|
+
export { I18nProvider, useLanguage, useT };
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { IntlMessageFormat } from "intl-messageformat";
|
|
2
|
+
// src/languages.ts
|
|
3
|
+
/** The tag as BCP 47 spells it (`sr-latn` → `sr-Latn`), or undefined when it isn't one. */
|
|
4
|
+
function canonicalLanguage(tag) {
|
|
5
|
+
try {
|
|
6
|
+
return Intl.getCanonicalLocales(tag)[0];
|
|
7
|
+
} catch {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The languages of an `Accept-Language` header, most wanted first (by `q`, then by
|
|
13
|
+
* position). Leaves out `*`, anything refused with `q=0` and what isn't a language tag.
|
|
14
|
+
*/
|
|
15
|
+
function parseAcceptLanguage(header) {
|
|
16
|
+
if (!header) return [];
|
|
17
|
+
const wanted = [];
|
|
18
|
+
for (const item of header.split(",")) {
|
|
19
|
+
const [range = "", ...params] = item.split(";").map((part) => part.trim());
|
|
20
|
+
if (range === "" || range === "*") continue;
|
|
21
|
+
const tag = canonicalLanguage(range);
|
|
22
|
+
if (tag === void 0) continue;
|
|
23
|
+
let q = 1;
|
|
24
|
+
for (const param of params) {
|
|
25
|
+
const match = /^q\s*=\s*([0-9.]+)$/i.exec(param);
|
|
26
|
+
if (match) q = Number(match[1]);
|
|
27
|
+
}
|
|
28
|
+
if (!(q > 0 && q <= 1)) continue;
|
|
29
|
+
if (!wanted.some((other) => other.tag === tag)) wanted.push({
|
|
30
|
+
tag,
|
|
31
|
+
q
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return wanted.toSorted((a, b) => b.q - a.q).map((item) => item.tag);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The language of `available` for the first of `wanted` that has one, in `available`'s
|
|
38
|
+
* spelling. Each wanted tag is tried fully before the next: the exact tag, then the tag
|
|
39
|
+
* with its last parts taken off one at a time (`de-CH` → `de`, `sr-Latn-RS` →
|
|
40
|
+
* `sr-Latn` → `sr`), then wider, the first available tag of the same language (`sr` or
|
|
41
|
+
* `sr-RS` → `sr-Latn`, `de` → `de-AT`). Compared without case.
|
|
42
|
+
*
|
|
43
|
+
* So what a reader asks for first wins, even widened: `sr-RS, sr, en-US, en` against
|
|
44
|
+
* `en` and `sr-Latn` is `sr-Latn`. Widening never crosses scripts: a wanted tag that
|
|
45
|
+
* names one (`sr-Cyrl`, `zh-Hant`) only gets a tag with that script or with none, since
|
|
46
|
+
* its reader may not read another.
|
|
47
|
+
*/
|
|
48
|
+
function matchLanguage(wanted, available) {
|
|
49
|
+
const spelled = /* @__PURE__ */ new Map();
|
|
50
|
+
for (const tag of available) {
|
|
51
|
+
const lower = tag.toLowerCase();
|
|
52
|
+
if (!spelled.has(lower)) spelled.set(lower, tag);
|
|
53
|
+
}
|
|
54
|
+
for (const tag of wanted) {
|
|
55
|
+
const parts = tag.trim().toLowerCase().split("-");
|
|
56
|
+
while (parts.length > 0) {
|
|
57
|
+
const found = spelled.get(parts.join("-"));
|
|
58
|
+
if (found !== void 0) return found;
|
|
59
|
+
parts.pop();
|
|
60
|
+
if (parts.at(-1)?.length === 1) parts.pop();
|
|
61
|
+
}
|
|
62
|
+
const { primary, script } = subtags(tag);
|
|
63
|
+
if (!primary) continue;
|
|
64
|
+
const wider = available.find((other) => {
|
|
65
|
+
const has = subtags(other);
|
|
66
|
+
if (has.primary !== primary) return false;
|
|
67
|
+
return script === void 0 || has.script === void 0 || has.script === script;
|
|
68
|
+
});
|
|
69
|
+
if (wider !== void 0) return wider;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** A tag's language and, when it names one, its script (four letters, right after the language). */
|
|
73
|
+
function subtags(tag) {
|
|
74
|
+
const [primary = "", second = ""] = tag.trim().toLowerCase().split("-");
|
|
75
|
+
return {
|
|
76
|
+
primary,
|
|
77
|
+
script: /^[a-z]{4}$/.test(second) ? second : void 0
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const RTL_SCRIPTS = /* @__PURE__ */ new Set([
|
|
81
|
+
"adlm",
|
|
82
|
+
"arab",
|
|
83
|
+
"hebr",
|
|
84
|
+
"mand",
|
|
85
|
+
"nkoo",
|
|
86
|
+
"rohg",
|
|
87
|
+
"samr",
|
|
88
|
+
"syrc",
|
|
89
|
+
"thaa"
|
|
90
|
+
]);
|
|
91
|
+
const RTL_LANGUAGES = /* @__PURE__ */ new Set([
|
|
92
|
+
"ar",
|
|
93
|
+
"arc",
|
|
94
|
+
"ckb",
|
|
95
|
+
"dv",
|
|
96
|
+
"fa",
|
|
97
|
+
"he",
|
|
98
|
+
"iw",
|
|
99
|
+
"ks",
|
|
100
|
+
"nqo",
|
|
101
|
+
"ps",
|
|
102
|
+
"sd",
|
|
103
|
+
"syr",
|
|
104
|
+
"ug",
|
|
105
|
+
"ur",
|
|
106
|
+
"yi",
|
|
107
|
+
"ji"
|
|
108
|
+
]);
|
|
109
|
+
/** The direction `language` is written in: by its script when the tag names one, else by the language. */
|
|
110
|
+
function directionOf(language) {
|
|
111
|
+
const [primary = "", ...rest] = language.toLowerCase().split(/[-_]/);
|
|
112
|
+
const script = rest.find((part) => part.length === 4 && /^[a-z]+$/.test(part));
|
|
113
|
+
if (script !== void 0) return RTL_SCRIPTS.has(script) ? "rtl" : "ltr";
|
|
114
|
+
return RTL_LANGUAGES.has(primary) ? "rtl" : "ltr";
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The locale to format numbers, money and dates with: the language in a country
|
|
118
|
+
* (`de` + `CH` → `de-CH`, `sr-Latn` + `rs` → `sr-Latn-RS`). A tag that already names a
|
|
119
|
+
* region keeps it; a tag that isn't one is returned as given.
|
|
120
|
+
*/
|
|
121
|
+
function localeOf(language, country) {
|
|
122
|
+
try {
|
|
123
|
+
const locale = new Intl.Locale(language);
|
|
124
|
+
if (locale.region !== void 0 || country === void 0) return locale.toString();
|
|
125
|
+
return new Intl.Locale(language, { region: country.toUpperCase() }).toString();
|
|
126
|
+
} catch {
|
|
127
|
+
return language;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The locale list every `Intl.*` formatter takes: the locale, then English. A runtime
|
|
132
|
+
* without the locale's data then formats as English rather than as its own default,
|
|
133
|
+
* which differs between a server and a browser.
|
|
134
|
+
*/
|
|
135
|
+
function withEnglish(locale) {
|
|
136
|
+
return locale.toLowerCase() === "en" ? ["en"] : [locale, "en"];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Reads a storefront URL's locale segment: `de` is a country in its market's default
|
|
140
|
+
* language, `en-de` and `sr-latn-rs` a language (`en`, `sr-Latn`) in a country, the
|
|
141
|
+
* last part. Undefined for anything else.
|
|
142
|
+
*/
|
|
143
|
+
function parseLocaleSegment(segment) {
|
|
144
|
+
const parts = segment.toLowerCase().split("-");
|
|
145
|
+
const country = parts.pop();
|
|
146
|
+
if (country === void 0 || !/^[a-z]{2}$/.test(country)) return void 0;
|
|
147
|
+
if (parts.length === 0) return { country };
|
|
148
|
+
if (!/^[a-z]{2,3}$/.test(parts[0] ?? "")) return void 0;
|
|
149
|
+
const language = canonicalLanguage(parts.join("-"));
|
|
150
|
+
if (language === void 0) return void 0;
|
|
151
|
+
return {
|
|
152
|
+
language,
|
|
153
|
+
country
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/** The segment for a country, in a language when one is named: `parseLocaleSegment`'s inverse. */
|
|
157
|
+
function formatLocaleSegment(locale) {
|
|
158
|
+
const country = locale.country.toLowerCase();
|
|
159
|
+
return locale.language === void 0 ? country : `${locale.language.toLowerCase()}-${country}`;
|
|
160
|
+
}
|
|
161
|
+
// src/translator.ts
|
|
162
|
+
/**
|
|
163
|
+
* A translator for `language` over `messages`. A key `messages` lacks is read from
|
|
164
|
+
* `fallback`, and one neither has is shown as the key itself. Compiled messages are
|
|
165
|
+
* kept for the translator's life: make one per request and language (or per catalog),
|
|
166
|
+
* not one per call.
|
|
167
|
+
*
|
|
168
|
+
* `Keys` is inferred from the catalogs; name it (`createTranslator<Key>(…)`) when they
|
|
169
|
+
* were loaded as plain `Messages`.
|
|
170
|
+
*/
|
|
171
|
+
function createTranslator(language, messages, options = {}) {
|
|
172
|
+
const { fallback, onMissing, onError } = options;
|
|
173
|
+
const locale = options.locale ?? language;
|
|
174
|
+
const locales = withEnglish(locale);
|
|
175
|
+
const catalog = messages;
|
|
176
|
+
const fallbackCatalog = fallback ?? {};
|
|
177
|
+
const compiled = /* @__PURE__ */ new Map();
|
|
178
|
+
function find(key) {
|
|
179
|
+
const known = compiled.get(key);
|
|
180
|
+
if (known !== void 0) return known;
|
|
181
|
+
let source = own(catalog, key);
|
|
182
|
+
if (source === void 0) {
|
|
183
|
+
source = own(fallbackCatalog, key);
|
|
184
|
+
onMissing?.({
|
|
185
|
+
key,
|
|
186
|
+
language,
|
|
187
|
+
shown: source === void 0 ? "key" : "fallback"
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
let format = null;
|
|
191
|
+
if (source !== void 0) try {
|
|
192
|
+
format = new IntlMessageFormat(source, locales);
|
|
193
|
+
} catch (error) {
|
|
194
|
+
report(error, key);
|
|
195
|
+
}
|
|
196
|
+
compiled.set(key, format);
|
|
197
|
+
return format;
|
|
198
|
+
}
|
|
199
|
+
function report(error, key) {
|
|
200
|
+
if (!onError) throw error;
|
|
201
|
+
onError(error, key);
|
|
202
|
+
}
|
|
203
|
+
function parts(key, values) {
|
|
204
|
+
const format = find(key);
|
|
205
|
+
if (!format) return [key];
|
|
206
|
+
try {
|
|
207
|
+
const formatted = format.format(values ? keyed(values) : void 0);
|
|
208
|
+
return Array.isArray(formatted) ? formatted : [formatted];
|
|
209
|
+
} catch (error) {
|
|
210
|
+
report(error, key);
|
|
211
|
+
return [key];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const t = (key, values) => parts(key, values).join("");
|
|
215
|
+
const has = (key) => own(catalog, key) !== void 0 || own(fallbackCatalog, key) !== void 0;
|
|
216
|
+
return Object.assign(t, {
|
|
217
|
+
rich: parts,
|
|
218
|
+
has,
|
|
219
|
+
language,
|
|
220
|
+
locale
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* A catalog's own entry: never `toString` or another inherited property, and never an
|
|
225
|
+
* empty message, which is a translation not written yet rather than one that says nothing.
|
|
226
|
+
*/
|
|
227
|
+
function own(catalog, key) {
|
|
228
|
+
const message = Object.hasOwn(catalog, key) ? catalog[key] : void 0;
|
|
229
|
+
return message === void 0 || message.trim() === "" ? void 0 : message;
|
|
230
|
+
}
|
|
231
|
+
/** The values with each tag function handed a key: its position among the message's tags. */
|
|
232
|
+
function keyed(values) {
|
|
233
|
+
let next = 0;
|
|
234
|
+
const out = {};
|
|
235
|
+
for (const [name, value] of Object.entries(values)) out[name] = isTagFunction(value) ? (chunks) => value(chunks, next++) : value;
|
|
236
|
+
return out;
|
|
237
|
+
}
|
|
238
|
+
function isTagFunction(value) {
|
|
239
|
+
return typeof value === "function";
|
|
240
|
+
}
|
|
241
|
+
export { localeOf as a, parseLocaleSegment as c, formatLocaleSegment as i, withEnglish as l, canonicalLanguage as n, matchLanguage as o, directionOf as r, parseAcceptLanguage as s, createTranslator as t };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** A catalog: full keys (`cart.items_count`) to ICU MessageFormat strings. */
|
|
2
|
+
type Messages = Readonly<Record<string, string>>;
|
|
3
|
+
/** A catalog that may lack some of `Keys`: another language's, still being translated. */
|
|
4
|
+
type MessagesFor<Keys extends string> = { readonly [K in Keys]?: string; };
|
|
5
|
+
/** What a placeholder takes. */
|
|
6
|
+
type Value = string | number | bigint | boolean | Date | null | undefined;
|
|
7
|
+
type Values = Readonly<Record<string, Value>>;
|
|
8
|
+
/**
|
|
9
|
+
* What a tag (`<link>…</link>`) is given: what's inside it, already formatted, and a
|
|
10
|
+
* `key` unique within the message, for frameworks whose lists want one (React).
|
|
11
|
+
*/
|
|
12
|
+
type TagFunction<T> = (chunks: (string | T)[], key: number) => string | T;
|
|
13
|
+
type RichValues<T> = Readonly<Record<string, Value | T | TagFunction<T>>>;
|
|
14
|
+
/** Why a key couldn't be shown as its catalog has it. */
|
|
15
|
+
interface Missing {
|
|
16
|
+
key: string;
|
|
17
|
+
language: string;
|
|
18
|
+
/** `fallback`: shown from the fallback catalog; `key`: no catalog has it, the key is shown. */
|
|
19
|
+
shown: "fallback" | "key";
|
|
20
|
+
}
|
|
21
|
+
interface TranslatorOptions<Keys extends string = string> {
|
|
22
|
+
/** The catalog for keys `messages` lacks: the source language's. */
|
|
23
|
+
fallback?: MessagesFor<Keys>;
|
|
24
|
+
/**
|
|
25
|
+
* What numbers, dates and plurals are formatted for, when it's more than the language:
|
|
26
|
+
* `de-CH` for German in Switzerland. Defaults to `language`.
|
|
27
|
+
*/
|
|
28
|
+
locale?: string;
|
|
29
|
+
/** Told once per key that `messages` lacks. */
|
|
30
|
+
onMissing?: (missing: Missing) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Told when a message can't be formatted (broken syntax, a value it needs wasn't
|
|
33
|
+
* given); the key is shown in its place. Throws the error when absent.
|
|
34
|
+
*/
|
|
35
|
+
onError?: (error: unknown, key: string) => void;
|
|
36
|
+
}
|
|
37
|
+
interface Translator<Keys extends string = string> {
|
|
38
|
+
/** The message for `key`, formatted with `values`. */
|
|
39
|
+
(key: Keys, values?: Values): string;
|
|
40
|
+
/**
|
|
41
|
+
* The same where values may be functions for the message's tags and objects of the
|
|
42
|
+
* caller's (elements): the parts in order, usable as React children.
|
|
43
|
+
*/
|
|
44
|
+
rich<T>(key: Keys, values?: RichValues<T>): (string | T)[];
|
|
45
|
+
/** Whether `key` is a message of this translator's catalog or its fallback. */
|
|
46
|
+
has(key: string): boolean;
|
|
47
|
+
readonly language: string;
|
|
48
|
+
readonly locale: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A translator for `language` over `messages`. A key `messages` lacks is read from
|
|
52
|
+
* `fallback`, and one neither has is shown as the key itself. Compiled messages are
|
|
53
|
+
* kept for the translator's life: make one per request and language (or per catalog),
|
|
54
|
+
* not one per call.
|
|
55
|
+
*
|
|
56
|
+
* `Keys` is inferred from the catalogs; name it (`createTranslator<Key>(…)`) when they
|
|
57
|
+
* were loaded as plain `Messages`.
|
|
58
|
+
*/
|
|
59
|
+
declare function createTranslator<Keys extends string = string>(language: string, messages: MessagesFor<Keys>, options?: TranslatorOptions<Keys>): Translator<Keys>;
|
|
60
|
+
export { TagFunction as a, Value as c, RichValues as i, Values as l, MessagesFor as n, Translator as o, Missing as r, TranslatorOptions as s, Messages as t, createTranslator as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyphacommerce/i18n",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0-beta.4",
|
|
4
|
+
"description": "Translations for Hypha's apps: ICU MessageFormat catalogs with typed keys, language matching and storefront locale segments, a React provider, a pseudo-language and a catalog check. Web APIs only, so it runs on Node, Workers and in browsers.",
|
|
5
|
+
"homepage": "https://hyphacommerce.com",
|
|
6
|
+
"bugs": "https://github.com/hyphacommerce/hypha/issues",
|
|
7
|
+
"license": "MIT OR Apache-2.0",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/hyphacommerce/hypha.git",
|
|
11
|
+
"directory": "packages/i18n"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"hypha-i18n-check": "./dist/bin.mjs"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"LICENSE-MIT",
|
|
19
|
+
"LICENSE-APACHE",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./react": {
|
|
30
|
+
"types": "./dist/react.d.ts",
|
|
31
|
+
"default": "./dist/react.js"
|
|
32
|
+
},
|
|
33
|
+
"./check": {
|
|
34
|
+
"types": "./dist/check.d.ts",
|
|
35
|
+
"default": "./dist/check.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@formatjs/icu-messageformat-parser": "3.5.18",
|
|
43
|
+
"intl-messageformat": "11.2.15"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "26.6.5",
|
|
47
|
+
"@types/react": "19.3.0",
|
|
48
|
+
"@types/react-dom": "19.3.0",
|
|
49
|
+
"react": "19.3.1",
|
|
50
|
+
"react-dom": "19.3.1",
|
|
51
|
+
"typescript": "5.9.3"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": ">=19.0.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"react": {
|
|
58
|
+
"optional": true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsdown",
|
|
63
|
+
"test": "node --test src/*.test.ts scripts/*.test.ts",
|
|
64
|
+
"typecheck": "tsc --noEmit"
|
|
65
|
+
}
|
|
6
66
|
}
|