@i18n-micro/devtools-ui 1.2.1 → 1.2.3

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
@@ -24,10 +24,3 @@ This package is primarily used internally by other `@i18n-micro` packages for De
24
24
  ## License
25
25
 
26
26
  MIT
27
-
28
-
29
-
30
-
31
-
32
-
33
-
@@ -1,80 +1,77 @@
1
- function u(d) {
2
- const { adapter: s, locales: g = [], defaultLocale: i = "en", translationDir: l = "src/locales" } = d, f = () => {
3
- const r = {}, n = s.getRouteCache();
4
- for (const [a, t] of Object.entries(n)) {
5
- if (!t || typeof t != "object" || Array.isArray(t) || Object.keys(t).length === 0)
1
+ import { buildSourceRootPath as g, buildSourcePagePath as p } from "@i18n-micro/utils/merge-source";
2
+ import { parseTranslationRelativePath as b } from "@i18n-micro/utils/parse-path";
3
+ function w(u) {
4
+ const { adapter: n, locales: f = [], defaultLocale: i = "en", translationDir: c = "src/locales" } = u, d = () => {
5
+ const o = {}, t = n.getRouteCache();
6
+ for (const [e, a] of Object.entries(t)) {
7
+ if (!a || typeof a != "object" || Array.isArray(a) || Object.keys(a).length === 0)
6
8
  continue;
7
- const c = a.indexOf(":");
8
- if (c === -1)
9
+ const s = e.indexOf(":");
10
+ if (s === -1)
9
11
  continue;
10
- const e = a.substring(0, c), o = a.substring(c + 1);
11
- o === "index" ? r[`${e}.json`] = t : r[`pages/${o}/${e}.json`] = t;
12
+ const r = e.substring(0, s), l = e.substring(s + 1);
13
+ o[l === "index" ? g(r) : p(l, r)] = a;
12
14
  }
13
- return r;
15
+ return o;
14
16
  };
15
17
  return {
16
18
  async getLocalesAndTranslations() {
17
- return f();
19
+ return d();
18
20
  },
19
21
  async getConfigs() {
20
22
  return {
21
- defaultLocale: i || s.getCurrentLocale?.() || "en",
22
- fallbackLocale: s.getFallbackLocale?.() || i || "en",
23
- locales: g || [],
24
- translationDir: l || "locales"
23
+ defaultLocale: i || n.getCurrentLocale?.() || "en",
24
+ fallbackLocale: n.getFallbackLocale?.() || i || "en",
25
+ locales: f || [],
26
+ translationDir: c || "locales"
25
27
  };
26
28
  },
27
- async saveTranslation(r, n) {
29
+ async saveTranslation(o, t) {
28
30
  try {
29
- const a = r.replace(/^\/+/, "").replace(/\/+/g, "/"), t = a.match(/^pages\/([^/]+)\/([^/]+)\.json$/);
30
- if (t) {
31
- const [, e, o] = t;
32
- o && e && s.addRouteTranslations(o, e, n, !1);
33
- } else {
34
- const e = a.match(/^([^/]+)\.json$/);
35
- if (e) {
36
- const [, o] = e;
37
- o && s.addTranslations(o, n, !1);
38
- } else
39
- throw new Error(`Unknown file path format: ${r}`);
40
- }
41
- const c = l ? `${l}/${a}` : a;
31
+ const e = o.replace(/^\/+/, "").replace(/\/+/g, "/"), a = b(e);
32
+ if (a.type === "page")
33
+ n.addRouteTranslations(a.locale, a.pageName, t, !1);
34
+ else if (a.type === "root")
35
+ n.addTranslations(a.locale, t, !1);
36
+ else
37
+ throw new Error(`Unknown file path format: ${o}`);
38
+ const s = c ? `${c}/${e}` : e;
42
39
  try {
43
- const e = await fetch("/__i18n_api/save", {
40
+ const r = await fetch("/__i18n_api/save", {
44
41
  method: "POST",
45
42
  headers: {
46
43
  "Content-Type": "application/json"
47
44
  },
48
45
  body: JSON.stringify({
49
- file: c,
50
- content: n
46
+ file: s,
47
+ content: t
51
48
  })
52
49
  });
53
- if (!e.ok) {
54
- const o = await e.json().catch(() => ({ error: "Unknown error" }));
55
- throw new Error(o.error || `Network response was not ok: ${e.statusText}`);
50
+ if (!r.ok) {
51
+ const l = await r.json().catch(() => ({ error: "Unknown error" }));
52
+ throw new Error(l.error || `Network response was not ok: ${r.statusText}`);
56
53
  }
57
- console.log(`[i18n-bridge] Saved to disk: ${c}`);
58
- } catch (e) {
54
+ console.log(`[i18n-bridge] Saved to disk: ${s}`);
55
+ } catch (r) {
59
56
  if (typeof localStorage < "u") {
60
- console.warn("[i18n-bridge] Server save failed, falling back to localStorage:", e);
61
- const o = `i18n_save_${r}`;
62
- localStorage.setItem(o, JSON.stringify(n, null, 2));
57
+ console.warn("[i18n-bridge] Server save failed, falling back to localStorage:", r);
58
+ const l = `i18n_save_${o}`;
59
+ localStorage.setItem(l, JSON.stringify(t, null, 2));
63
60
  } else
64
- throw e;
61
+ throw r;
65
62
  }
66
- } catch (a) {
67
- throw new Error(`Failed to save: ${a instanceof Error ? a.message : String(a)}`);
63
+ } catch (e) {
64
+ throw new Error(`Failed to save: ${e instanceof Error ? e.message : String(e)}`);
68
65
  }
69
66
  },
70
- onLocalesUpdate(r) {
71
- return s.subscribe(() => {
72
- r(f());
67
+ onLocalesUpdate(o) {
68
+ return n.subscribe(() => {
69
+ o(d());
73
70
  });
74
71
  }
75
72
  };
76
73
  }
77
74
  export {
78
- u as createBridge
75
+ w as createBridge
79
76
  };
80
77
  //# sourceMappingURL=create-bridge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-bridge.js","sources":["../../src/bridge/create-bridge.ts"],"sourcesContent":["import type { Locale, ModuleOptions } from '@i18n-micro/types'\nimport type { I18nDevToolsBridge, LocaleData, TranslationContent } from './interface'\n\n/**\n * Adapter interface for accessing i18n instance data\n * Each framework package will implement this adapter for their specific i18n instance\n */\nexport interface BridgeAdapter {\n /**\n * Get translations cache\n * Keys are in format \"locale:routeName\" (e.g., \"en:index\", \"en:home\")\n */\n getRouteCache: () => Record<string, TranslationContent>\n\n /**\n * Add or update translations for a locale\n */\n addTranslations: (locale: string, content: TranslationContent, merge: boolean) => void\n\n /**\n * Add or update route-specific translations\n */\n addRouteTranslations: (locale: string, routeName: string, content: TranslationContent, merge: boolean) => void\n\n /**\n * Subscribe to changes in translations\n * @returns Unsubscribe function\n */\n subscribe: (callback: () => void) => () => void\n\n /**\n * Get current locale (optional)\n */\n getCurrentLocale?: () => string\n\n /**\n * Get fallback locale (optional)\n */\n getFallbackLocale?: () => string\n}\n\nexport interface CreateBridgeOptions {\n adapter: BridgeAdapter\n locales?: Locale[]\n defaultLocale?: string\n translationDir?: string\n}\n\n/**\n * Create a universal bridge for DevTools communication\n * This bridge works with any framework by using an adapter pattern\n */\nexport function createBridge(options: CreateBridgeOptions): I18nDevToolsBridge {\n const { adapter, locales = [], defaultLocale = 'en', translationDir = 'src/locales' } = options\n\n // Helper function to build locale data from cache\n const buildLocaleData = (): LocaleData => {\n const data: LocaleData = {}\n\n // All translations are stored as \"locale:routeName\" (e.g., \"en:index\", \"en:about\")\n const routeCache = adapter.getRouteCache()\n for (const [key, content] of Object.entries(routeCache)) {\n if (!content || typeof content !== 'object' || Array.isArray(content) || Object.keys(content).length === 0) {\n continue\n }\n\n const separatorIndex = key.indexOf(':')\n if (separatorIndex === -1) {\n continue\n }\n\n const locale = key.substring(0, separatorIndex)\n const routeName = key.substring(separatorIndex + 1)\n\n if (routeName === 'index') {\n // Index (root-level) translations -> {locale}.json\n data[`${locale}.json`] = content\n } else {\n // Page-specific translations -> pages/{routeName}/{locale}.json\n data[`pages/${routeName}/${locale}.json`] = content\n }\n }\n\n return data\n }\n\n return {\n async getLocalesAndTranslations(): Promise<LocaleData> {\n return buildLocaleData()\n },\n\n async getConfigs(): Promise<ModuleOptions> {\n return {\n defaultLocale: defaultLocale || adapter.getCurrentLocale?.() || 'en',\n fallbackLocale: adapter.getFallbackLocale?.() || defaultLocale || 'en',\n locales: locales || [],\n translationDir: translationDir || 'locales',\n } as ModuleOptions\n },\n\n async saveTranslation(filePath: string, content: TranslationContent): Promise<void> {\n try {\n // 1. Update state in memory (Hot Update)\n // Normalize path: remove leading / and extra slashes\n const normalizedPath = filePath.replace(/^\\/+/, '').replace(/\\/+/g, '/')\n\n // Parse virtual file path back to locale and route\n const pageMatch = normalizedPath.match(/^pages\\/([^/]+)\\/([^/]+)\\.json$/)\n\n if (pageMatch) {\n const [, routeName, locale] = pageMatch\n // Update route cache (overwrite, merge = false)\n if (locale && routeName) {\n adapter.addRouteTranslations(locale, routeName, content, false)\n }\n } else {\n // 2. Check for global: {locale}.json\n const globalMatch = normalizedPath.match(/^([^/]+)\\.json$/)\n if (globalMatch) {\n const [, locale] = globalMatch\n // Update global cache (overwrite, merge = false)\n if (locale) {\n adapter.addTranslations(locale, content, false)\n }\n } else {\n throw new Error(`Unknown file path format: ${filePath}`)\n }\n }\n\n // 2. Send request to server to save file to disk\n // Build real path relative to project root\n const realFilePath = translationDir ? `${translationDir}/${normalizedPath}` : normalizedPath\n\n try {\n const response = await fetch('/__i18n_api/save', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n file: realFilePath,\n content,\n }),\n })\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => ({ error: 'Unknown error' }))\n throw new Error(errorData.error || `Network response was not ok: ${response.statusText}`)\n }\n\n console.log(`[i18n-bridge] Saved to disk: ${realFilePath}`)\n } catch (serverError) {\n // Fallback: Save to localStorage if server is unavailable (e.g., in production preview)\n if (typeof localStorage !== 'undefined') {\n console.warn('[i18n-bridge] Server save failed, falling back to localStorage:', serverError)\n const storageKey = `i18n_save_${filePath}`\n localStorage.setItem(storageKey, JSON.stringify(content, null, 2))\n } else {\n // If no server and no localStorage, throw error\n throw serverError\n }\n }\n } catch (error) {\n throw new Error(`Failed to save: ${error instanceof Error ? error.message : String(error)}`)\n }\n },\n\n onLocalesUpdate(callback: (data: LocaleData) => void): () => void {\n // Subscribe to changes in i18n instance\n const unsubscribe = adapter.subscribe(() => {\n // On any change, rebuild data and send to DevTools\n callback(buildLocaleData())\n })\n return unsubscribe\n },\n }\n}\n"],"names":["createBridge","options","adapter","locales","defaultLocale","translationDir","buildLocaleData","data","routeCache","key","content","separatorIndex","locale","routeName","filePath","normalizedPath","pageMatch","globalMatch","realFilePath","response","errorData","serverError","storageKey","error","callback"],"mappings":"AAoDO,SAASA,EAAaC,GAAkD;AAC7E,QAAM,EAAE,SAAAC,GAAS,SAAAC,IAAU,CAAA,GAAI,eAAAC,IAAgB,MAAM,gBAAAC,IAAiB,cAAA,IAAkBJ,GAGl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ridge.ts"],"sourcesContent":["import type { Locale, ModuleOptions } from '@i18n-micro/types'\nimport { buildSourcePagePath, buildSourceRootPath } from '@i18n-micro/utils/merge-source'\nimport { parseTranslationRelativePath } from '@i18n-micro/utils/parse-path'\nimport type { I18nDevToolsBridge, LocaleData, TranslationContent } from './interface'\n\n/**\n * Adapter interface for accessing i18n instance data\n * Each framework package will implement this adapter for their specific i18n instance\n */\nexport interface BridgeAdapter {\n /**\n * Get translations cache\n * Keys are in format \"locale:routeName\" (e.g., \"en:index\", \"en:home\")\n */\n getRouteCache: () => Record<string, TranslationContent>\n\n /**\n * Add or update translations for a locale\n */\n addTranslations: (locale: string, content: TranslationContent, merge: boolean) => void\n\n /**\n * Add or update route-specific translations\n */\n addRouteTranslations: (locale: string, routeName: string, content: TranslationContent, merge: boolean) => void\n\n /**\n * Subscribe to changes in translations\n * @returns Unsubscribe function\n */\n subscribe: (callback: () => void) => () => void\n\n /**\n * Get current locale (optional)\n */\n getCurrentLocale?: () => string\n\n /**\n * Get fallback locale (optional)\n */\n getFallbackLocale?: () => string\n}\n\nexport interface CreateBridgeOptions {\n adapter: BridgeAdapter\n locales?: Locale[]\n defaultLocale?: string\n translationDir?: string\n}\n\n/**\n * Create a universal bridge for DevTools communication\n * This bridge works with any framework by using an adapter pattern\n */\nexport function createBridge(options: CreateBridgeOptions): I18nDevToolsBridge {\n const { adapter, locales = [], defaultLocale = 'en', translationDir = 'src/locales' } = options\n\n // Helper function to build locale data from cache\n const buildLocaleData = (): LocaleData => {\n const data: LocaleData = {}\n\n // All translations are stored as \"locale:routeName\" (e.g., \"en:index\", \"en:about\")\n const routeCache = adapter.getRouteCache()\n for (const [key, content] of Object.entries(routeCache)) {\n if (!content || typeof content !== 'object' || Array.isArray(content) || Object.keys(content).length === 0) {\n continue\n }\n\n const separatorIndex = key.indexOf(':')\n if (separatorIndex === -1) {\n continue\n }\n\n const locale = key.substring(0, separatorIndex)\n const routeName = key.substring(separatorIndex + 1)\n\n data[routeName === 'index' ? buildSourceRootPath(locale) : buildSourcePagePath(routeName, locale)] = content\n }\n\n return data\n }\n\n return {\n async getLocalesAndTranslations(): Promise<LocaleData> {\n return buildLocaleData()\n },\n\n async getConfigs(): Promise<ModuleOptions> {\n return {\n defaultLocale: defaultLocale || adapter.getCurrentLocale?.() || 'en',\n fallbackLocale: adapter.getFallbackLocale?.() || defaultLocale || 'en',\n locales: locales || [],\n translationDir: translationDir || 'locales',\n } as ModuleOptions\n },\n\n async saveTranslation(filePath: string, content: TranslationContent): Promise<void> {\n try {\n // 1. Update state in memory (Hot Update)\n // Normalize path: remove leading / and extra slashes\n const normalizedPath = filePath.replace(/^\\/+/, '').replace(/\\/+/g, '/')\n\n const parsedPath = parseTranslationRelativePath(normalizedPath)\n\n if (parsedPath.type === 'page') {\n adapter.addRouteTranslations(parsedPath.locale, parsedPath.pageName, content, false)\n } else if (parsedPath.type === 'root') {\n adapter.addTranslations(parsedPath.locale, content, false)\n } else {\n throw new Error(`Unknown file path format: ${filePath}`)\n }\n\n // 2. Send request to server to save file to disk\n // Build real path relative to project root\n const realFilePath = translationDir ? `${translationDir}/${normalizedPath}` : normalizedPath\n\n try {\n const response = await fetch('/__i18n_api/save', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n file: realFilePath,\n content,\n }),\n })\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => ({ error: 'Unknown error' }))\n throw new Error(errorData.error || `Network response was not ok: ${response.statusText}`)\n }\n\n console.log(`[i18n-bridge] Saved to disk: ${realFilePath}`)\n } catch (serverError) {\n // Fallback: Save to localStorage if server is unavailable (e.g., in production preview)\n if (typeof localStorage !== 'undefined') {\n console.warn('[i18n-bridge] Server save failed, falling back to localStorage:', serverError)\n const storageKey = `i18n_save_${filePath}`\n localStorage.setItem(storageKey, JSON.stringify(content, null, 2))\n } else {\n // If no server and no localStorage, throw error\n throw serverError\n }\n }\n } catch (error) {\n throw new Error(`Failed to save: ${error instanceof Error ? error.message : String(error)}`)\n }\n },\n\n onLocalesUpdate(callback: (data: LocaleData) => void): () => void {\n // Subscribe to changes in i18n instance\n const unsubscribe = adapter.subscribe(() => {\n // On any change, rebuild data and send to DevTools\n callback(buildLocaleData())\n })\n return unsubscribe\n },\n }\n}\n"],"names":["createBridge","options","adapter","locales","defaultLocale","translationDir","buildLocaleData","data","routeCache","key","content","separatorIndex","locale","routeName","buildSourceRootPath","buildSourcePagePath","filePath","normalizedPath","parsedPath","parseTranslationRelativePath","realFilePath","response","errorData","serverError","storageKey","error","callback"],"mappings":";;AAsDO,SAASA,EAAaC,GAAkD;AAC7E,QAAM,EAAE,SAAAC,GAAS,SAAAC,IAAU,CAAA,GAAI,eAAAC,IAAgB,MAAM,gBAAAC,IAAiB,cAAA,IAAkBJ,GAGlFK,IAAkB,MAAkB;AACxC,UAAMC,IAAmB,CAAA,GAGnBC,IAAaN,EAAQ,cAAA;AAC3B,eAAW,CAACO,GAAKC,CAAO,KAAK,OAAO,QAAQF,CAAU,GAAG;AACvD,UAAI,CAACE,KAAW,OAAOA,KAAY,YAAY,MAAM,QAAQA,CAAO,KAAK,OAAO,KAAKA,CAAO,EAAE,WAAW;AACvG;AAGF,YAAMC,IAAiBF,EAAI,QAAQ,GAAG;AACtC,UAAIE,MAAmB;AACrB;AAGF,YAAMC,IAASH,EAAI,UAAU,GAAGE,CAAc,GACxCE,IAAYJ,EAAI,UAAUE,IAAiB,CAAC;AAElD,MAAAJ,EAAKM,MAAc,UAAUC,EAAoBF,CAAM,IAAIG,EAAoBF,GAAWD,CAAM,CAAC,IAAIF;AAAA,IACvG;AAEA,WAAOH;AAAA,EACT;AAEA,SAAO;AAAA,IACL,MAAM,4BAAiD;AACrD,aAAOD,EAAA;AAAA,IACT;AAAA,IAEA,MAAM,aAAqC;AACzC,aAAO;AAAA,QACL,eAAeF,KAAiBF,EAAQ,mBAAA,KAAwB;AAAA,QAChE,gBAAgBA,EAAQ,oBAAA,KAAyBE,KAAiB;AAAA,QAClE,SA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,SAASE,GAAO;AACd,cAAM,IAAI,MAAM,mBAAmBA,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK,CAAC,EAAE;AAAA,MAC7F;AAAA,IACF;AAAA,IAEA,gBAAgBC,GAAkD;AAMhE,aAJoBxB,EAAQ,UAAU,MAAM;AAE1C,QAAAwB,EAASpB,GAAiB;AAAA,MAC5B,CAAC;AAAA,IAEH;AAAA,EAAA;AAEJ;"}
@@ -29,11 +29,22 @@ export declare function createI18nState(): {
29
29
  plugin?: boolean | undefined;
30
30
  hooks?: boolean | undefined;
31
31
  components?: boolean | undefined;
32
+ serverTranslationPreload?: boolean | undefined;
32
33
  defaultLocale?: string | undefined;
33
34
  apiBaseUrl?: string | undefined;
34
35
  apiBaseClientHost?: string | undefined;
35
36
  apiBaseServerHost?: string | undefined;
36
37
  translationDir?: string | undefined;
38
+ translationPayloads?: {
39
+ mode?: "premerged" | "source" | undefined;
40
+ serverAssets?: boolean | undefined;
41
+ serverHandler?: boolean | undefined;
42
+ publicAssets?: boolean | undefined;
43
+ prerenderRoutes?: boolean | undefined;
44
+ publicDir?: string | undefined;
45
+ warnFileCount?: number | undefined;
46
+ warnSizeBytes?: number | undefined;
47
+ } | undefined;
37
48
  autoDetectLanguage?: boolean | undefined;
38
49
  autoDetectPath?: string | undefined;
39
50
  disableWatcher?: boolean | undefined;
@@ -84,11 +95,22 @@ export declare function createI18nState(): {
84
95
  plugin?: boolean | undefined;
85
96
  hooks?: boolean | undefined;
86
97
  components?: boolean | undefined;
98
+ serverTranslationPreload?: boolean | undefined;
87
99
  defaultLocale?: string | undefined;
88
100
  apiBaseUrl?: string | undefined;
89
101
  apiBaseClientHost?: string | undefined;
90
102
  apiBaseServerHost?: string | undefined;
91
103
  translationDir?: string | undefined;
104
+ translationPayloads?: {
105
+ mode?: "premerged" | "source" | undefined;
106
+ serverAssets?: boolean | undefined;
107
+ serverHandler?: boolean | undefined;
108
+ publicAssets?: boolean | undefined;
109
+ prerenderRoutes?: boolean | undefined;
110
+ publicDir?: string | undefined;
111
+ warnFileCount?: number | undefined;
112
+ warnSizeBytes?: number | undefined;
113
+ } | undefined;
92
114
  autoDetectLanguage?: boolean | undefined;
93
115
  autoDetectPath?: string | undefined;
94
116
  disableWatcher?: boolean | undefined;
@@ -164,11 +186,22 @@ export declare function useI18nState(): {
164
186
  plugin?: boolean | undefined;
165
187
  hooks?: boolean | undefined;
166
188
  components?: boolean | undefined;
189
+ serverTranslationPreload?: boolean | undefined;
167
190
  defaultLocale?: string | undefined;
168
191
  apiBaseUrl?: string | undefined;
169
192
  apiBaseClientHost?: string | undefined;
170
193
  apiBaseServerHost?: string | undefined;
171
194
  translationDir?: string | undefined;
195
+ translationPayloads?: {
196
+ mode?: "premerged" | "source" | undefined;
197
+ serverAssets?: boolean | undefined;
198
+ serverHandler?: boolean | undefined;
199
+ publicAssets?: boolean | undefined;
200
+ prerenderRoutes?: boolean | undefined;
201
+ publicDir?: string | undefined;
202
+ warnFileCount?: number | undefined;
203
+ warnSizeBytes?: number | undefined;
204
+ } | undefined;
172
205
  autoDetectLanguage?: boolean | undefined;
173
206
  autoDetectPath?: string | undefined;
174
207
  disableWatcher?: boolean | undefined;
@@ -219,11 +252,22 @@ export declare function useI18nState(): {
219
252
  plugin?: boolean | undefined;
220
253
  hooks?: boolean | undefined;
221
254
  components?: boolean | undefined;
255
+ serverTranslationPreload?: boolean | undefined;
222
256
  defaultLocale?: string | undefined;
223
257
  apiBaseUrl?: string | undefined;
224
258
  apiBaseClientHost?: string | undefined;
225
259
  apiBaseServerHost?: string | undefined;
226
260
  translationDir?: string | undefined;
261
+ translationPayloads?: {
262
+ mode?: "premerged" | "source" | undefined;
263
+ serverAssets?: boolean | undefined;
264
+ serverHandler?: boolean | undefined;
265
+ publicAssets?: boolean | undefined;
266
+ prerenderRoutes?: boolean | undefined;
267
+ publicDir?: string | undefined;
268
+ warnFileCount?: number | undefined;
269
+ warnSizeBytes?: number | undefined;
270
+ } | undefined;
227
271
  autoDetectLanguage?: boolean | undefined;
228
272
  autoDetectPath?: string | undefined;
229
273
  disableWatcher?: boolean | undefined;
package/dist/index.d.cts CHANGED
@@ -16,4 +16,4 @@ export type { I18nDevToolsBridge } from './bridge/interface';
16
16
  export { createRpcClient } from './rpc/client';
17
17
  export { setupRpcHost } from './rpc/host';
18
18
  export type { JsonRpcEvent, JsonRpcRequest, JsonRpcResponse } from './rpc/types';
19
- export type { JSONValue, LocaleData, TranslationContent, TreeNode, } from './types';
19
+ export type { JSONValue, LocaleData, TranslationContent, TreeNode } from './types';
package/dist/index.d.ts CHANGED
@@ -16,4 +16,4 @@ export type { I18nDevToolsBridge } from './bridge/interface';
16
16
  export { createRpcClient } from './rpc/client';
17
17
  export { setupRpcHost } from './rpc/host';
18
18
  export type { JsonRpcEvent, JsonRpcRequest, JsonRpcResponse } from './rpc/types';
19
- export type { JSONValue, LocaleData, TranslationContent, TreeNode, } from './types';
19
+ export type { JSONValue, LocaleData, TranslationContent, TreeNode } from './types';