@shuo-li/i18n 1.0.1 → 1.0.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.
@@ -24,7 +24,7 @@ interface SSEConfig {
24
24
  }
25
25
  interface I18nInitOptions {
26
26
  language: string;
27
- version?: number;
27
+ version?: number | string;
28
28
  languages?: string[];
29
29
  modules?: string[];
30
30
  stores: StoreConfig[];
@@ -24,7 +24,7 @@ interface SSEConfig {
24
24
  }
25
25
  interface I18nInitOptions {
26
26
  language: string;
27
- version?: number;
27
+ version?: number | string;
28
28
  languages?: string[];
29
29
  modules?: string[];
30
30
  stores: StoreConfig[];
@@ -123,9 +123,6 @@ var SSEClient = class {
123
123
  function buildKey(moduleCode, langCode, store) {
124
124
  return store.cacheGroupKey ? `${moduleCode}_${langCode}_${store.cacheGroupKey}` : `${moduleCode}_${langCode}`;
125
125
  }
126
- function buildUnloginKey(langCode) {
127
- return `UNLOGIN_${langCode}`;
128
- }
129
126
  function flatToNested(flat) {
130
127
  const result = {};
131
128
  for (const [key, value] of Object.entries(flat)) {
@@ -303,12 +300,17 @@ async function initI18n(options) {
303
300
  if (currentPromise) closeSSE();
304
301
  currentSig = sig;
305
302
  initOptions = options;
306
- currentPromise = _initI18n(options).catch((err) => {
303
+ const p = _initI18n(options).then(() => {
304
+ if (!options.apiContext.isLoggedIn()) {
305
+ currentPromise = null;
306
+ }
307
+ }).catch((err) => {
307
308
  currentSig = null;
308
309
  currentPromise = null;
309
310
  throw err;
310
311
  });
311
- return currentPromise;
312
+ currentPromise = p;
313
+ return p;
312
314
  }
313
315
  async function ensureModules(moduleCodes) {
314
316
  const toLoad = moduleCodes.filter((m) => {
@@ -394,38 +396,41 @@ async function _initI18n(options) {
394
396
  }
395
397
  async function checkCacheVersion(storage, options) {
396
398
  if (options.version == null) return;
397
- const stored = Number(await storage.getMeta("cache_version") ?? 0);
398
- if (options.version <= stored) return;
399
+ const current = String(options.version);
400
+ const stored = await storage.getMeta("cache_version");
401
+ if (stored === current) return;
399
402
  for (const store of options.stores) {
400
403
  await storage.clearStore(store.name);
401
404
  }
402
- await storage.setMeta("cache_version", String(options.version));
405
+ await storage.setMeta("cache_version", current);
403
406
  }
404
407
  async function doUnloginPull(storage, options) {
405
408
  const { apiContext } = options;
406
409
  if (!apiContext.unloginPull) return;
407
- const unloginStoreName = resolvedStores[0].name;
410
+ const baseStore = resolvedStores[0];
408
411
  try {
409
412
  const blocks = await doFetch(apiContext.unloginPull, options);
410
413
  for (const block of blocks) {
411
414
  for (const mod of block.modules ?? []) {
412
- if (mod.moduleCode !== "UNLOGIN") continue;
413
- await storage.putRecord(unloginStoreName, {
414
- key: buildUnloginKey(block.langCode),
415
- moduleCode: "UNLOGIN",
415
+ const key = buildKey(mod.moduleCode, block.langCode, baseStore);
416
+ const existing = await storage.getRecord(baseStore.name, key);
417
+ const parsed = parseI18nValues(mod.i18nValues ?? []);
418
+ const resources = deepMerge(
419
+ existing?.resources ?? {},
420
+ flatToNested(parsed)
421
+ );
422
+ await storage.putRecord(baseStore.name, {
423
+ key,
424
+ moduleCode: mod.moduleCode,
416
425
  langCode: block.langCode,
417
426
  version: mod.version ?? 0,
418
- resources: flatToNested(parseI18nValues(mod.i18nValues ?? []))
427
+ resources
419
428
  });
420
429
  }
421
430
  }
422
431
  } catch {
423
432
  }
424
- i18n.addResourceBundle(currentLang, "UNLOGIN", getStaticLocale("UNLOGIN", currentLang), true, false);
425
- const dbUnlogin = await storage.getRecord(unloginStoreName, buildUnloginKey(currentLang));
426
- if (dbUnlogin?.resources) {
427
- i18n.addResourceBundle(currentLang, "UNLOGIN", dbUnlogin.resources, true, true);
428
- }
433
+ await injectCurrentLanguageModules(currentLang);
429
434
  await i18n.changeLanguage(currentLang);
430
435
  emitI18nResourcesUpdated();
431
436
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/core/cacheEvents.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/core/cacheEvents.ts
2
2
  var I18N_RESOURCES_UPDATED_EVENT = "golucky:i18n-resources-updated";
3
3
  function emitI18nResourcesUpdated() {
4
4
  if (typeof window === "undefined") return;
@@ -123,9 +123,6 @@ var SSEClient = class {
123
123
  function buildKey(moduleCode, langCode, store) {
124
124
  return store.cacheGroupKey ? `${moduleCode}_${langCode}_${store.cacheGroupKey}` : `${moduleCode}_${langCode}`;
125
125
  }
126
- function buildUnloginKey(langCode) {
127
- return `UNLOGIN_${langCode}`;
128
- }
129
126
  function flatToNested(flat) {
130
127
  const result = {};
131
128
  for (const [key, value] of Object.entries(flat)) {
@@ -303,12 +300,17 @@ async function initI18n(options) {
303
300
  if (currentPromise) closeSSE();
304
301
  currentSig = sig;
305
302
  initOptions = options;
306
- currentPromise = _initI18n(options).catch((err) => {
303
+ const p = _initI18n(options).then(() => {
304
+ if (!options.apiContext.isLoggedIn()) {
305
+ currentPromise = null;
306
+ }
307
+ }).catch((err) => {
307
308
  currentSig = null;
308
309
  currentPromise = null;
309
310
  throw err;
310
311
  });
311
- return currentPromise;
312
+ currentPromise = p;
313
+ return p;
312
314
  }
313
315
  async function ensureModules(moduleCodes) {
314
316
  const toLoad = moduleCodes.filter((m) => {
@@ -394,38 +396,41 @@ async function _initI18n(options) {
394
396
  }
395
397
  async function checkCacheVersion(storage, options) {
396
398
  if (options.version == null) return;
397
- const stored = Number(await _asyncNullishCoalesce(await storage.getMeta("cache_version"), async () => ( 0)));
398
- if (options.version <= stored) return;
399
+ const current = String(options.version);
400
+ const stored = await storage.getMeta("cache_version");
401
+ if (stored === current) return;
399
402
  for (const store of options.stores) {
400
403
  await storage.clearStore(store.name);
401
404
  }
402
- await storage.setMeta("cache_version", String(options.version));
405
+ await storage.setMeta("cache_version", current);
403
406
  }
404
407
  async function doUnloginPull(storage, options) {
405
408
  const { apiContext } = options;
406
409
  if (!apiContext.unloginPull) return;
407
- const unloginStoreName = resolvedStores[0].name;
410
+ const baseStore = resolvedStores[0];
408
411
  try {
409
412
  const blocks = await doFetch(apiContext.unloginPull, options);
410
413
  for (const block of blocks) {
411
414
  for (const mod of _nullishCoalesce(block.modules, () => ( []))) {
412
- if (mod.moduleCode !== "UNLOGIN") continue;
413
- await storage.putRecord(unloginStoreName, {
414
- key: buildUnloginKey(block.langCode),
415
- moduleCode: "UNLOGIN",
415
+ const key = buildKey(mod.moduleCode, block.langCode, baseStore);
416
+ const existing = await storage.getRecord(baseStore.name, key);
417
+ const parsed = parseI18nValues(_nullishCoalesce(mod.i18nValues, () => ( [])));
418
+ const resources = deepMerge(
419
+ _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _21 => _21.resources]), () => ( {})),
420
+ flatToNested(parsed)
421
+ );
422
+ await storage.putRecord(baseStore.name, {
423
+ key,
424
+ moduleCode: mod.moduleCode,
416
425
  langCode: block.langCode,
417
426
  version: _nullishCoalesce(mod.version, () => ( 0)),
418
- resources: flatToNested(parseI18nValues(_nullishCoalesce(mod.i18nValues, () => ( []))))
427
+ resources
419
428
  });
420
429
  }
421
430
  }
422
431
  } catch (e4) {
423
432
  }
424
- _i18next2.default.addResourceBundle(currentLang, "UNLOGIN", getStaticLocale("UNLOGIN", currentLang), true, false);
425
- const dbUnlogin = await storage.getRecord(unloginStoreName, buildUnloginKey(currentLang));
426
- if (_optionalChain([dbUnlogin, 'optionalAccess', _21 => _21.resources])) {
427
- _i18next2.default.addResourceBundle(currentLang, "UNLOGIN", dbUnlogin.resources, true, true);
428
- }
433
+ await injectCurrentLanguageModules(currentLang);
429
434
  await _i18next2.default.changeLanguage(currentLang);
430
435
  emitI18nResourcesUpdated();
431
436
  }
package/dist/index.cjs CHANGED
@@ -7,7 +7,7 @@ var _chunkAJJKJPNBcjs = require('./chunk-AJJKJPNB.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkEYLGQY2Xcjs = require('./chunk-EYLGQY2X.cjs');
10
+ var _chunkK5VX3COHcjs = require('./chunk-K5VX3COH.cjs');
11
11
 
12
12
  // src/index.ts
13
13
  var _i18next = require('i18next'); var _i18next2 = _interopRequireDefault(_i18next);
@@ -203,7 +203,7 @@ if (!_i18next2.default.isInitialized) {
203
203
  }
204
204
  });
205
205
  }
206
- var { initI18n, closeSSE, ensureModules, getResource, getAllRecordsByModule } = _chunkEYLGQY2Xcjs.createI18nManager.call(void 0, {
206
+ var { initI18n, closeSSE, ensureModules, getResource, getAllRecordsByModule } = _chunkK5VX3COHcjs.createI18nManager.call(void 0, {
207
207
  storage: new IndexedDBAdapter(),
208
208
  workerWritesDB: true,
209
209
  createWorker: () => new (0, _chunkAJJKJPNBcjs.WebWorkerAdapter)(
@@ -220,4 +220,4 @@ var { initI18n, closeSSE, ensureModules, getResource, getAllRecordsByModule } =
220
220
 
221
221
 
222
222
 
223
- exports.I18N_RESOURCES_UPDATED_EVENT = _chunkEYLGQY2Xcjs.I18N_RESOURCES_UPDATED_EVENT; exports.closeSSE = closeSSE; exports.emitI18nResourcesUpdated = _chunkEYLGQY2Xcjs.emitI18nResourcesUpdated; exports.ensureModules = ensureModules; exports.getAllRecordsByModule = getAllRecordsByModule; exports.getResource = getResource; exports.initI18n = initI18n; exports.useDict = _chunkAJJKJPNBcjs.useDict; exports.useTranslation = _chunkAJJKJPNBcjs.useTranslation;
223
+ exports.I18N_RESOURCES_UPDATED_EVENT = _chunkK5VX3COHcjs.I18N_RESOURCES_UPDATED_EVENT; exports.closeSSE = closeSSE; exports.emitI18nResourcesUpdated = _chunkK5VX3COHcjs.emitI18nResourcesUpdated; exports.ensureModules = ensureModules; exports.getAllRecordsByModule = getAllRecordsByModule; exports.getResource = getResource; exports.initI18n = initI18n; exports.useDict = _chunkAJJKJPNBcjs.useDict; exports.useTranslation = _chunkAJJKJPNBcjs.useTranslation;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from './cacheEvents-CAjfH0vs.cjs';
2
- export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, W as WorkerLike, h as emitI18nResourcesUpdated } from './cacheEvents-CAjfH0vs.cjs';
1
+ import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from './cacheEvents-CDBRPnHU.cjs';
2
+ export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, W as WorkerLike, h as emitI18nResourcesUpdated } from './cacheEvents-CDBRPnHU.cjs';
3
3
  export { u as useDict } from './hooks-ClO29Chr.cjs';
4
4
  export { useTranslation } from 'react-i18next';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from './cacheEvents-CAjfH0vs.js';
2
- export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, W as WorkerLike, h as emitI18nResourcesUpdated } from './cacheEvents-CAjfH0vs.js';
1
+ import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from './cacheEvents-CDBRPnHU.js';
2
+ export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, W as WorkerLike, h as emitI18nResourcesUpdated } from './cacheEvents-CDBRPnHU.js';
3
3
  export { u as useDict } from './hooks-ClO29Chr.js';
4
4
  export { useTranslation } from 'react-i18next';
5
5
 
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  I18N_RESOURCES_UPDATED_EVENT,
8
8
  createI18nManager,
9
9
  emitI18nResourcesUpdated
10
- } from "./chunk-2GMRPNQB.js";
10
+ } from "./chunk-IWP4252C.js";
11
11
 
12
12
  // src/index.ts
13
13
  import i18n from "i18next";
package/dist/mp/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkEYLGQY2Xcjs = require('../chunk-EYLGQY2X.cjs');
5
+ var _chunkK5VX3COHcjs = require('../chunk-K5VX3COH.cjs');
6
6
 
7
7
  // src/storage/wx-sqlite.ts
8
8
  var DB_NAME = "i18n_cache";
@@ -215,7 +215,7 @@ function wxFetch(input, init) {
215
215
  }
216
216
 
217
217
  // src/mp/index.ts
218
- var { initI18n, closeSSE, ensureModules, getResource, getAllRecordsByModule } = _chunkEYLGQY2Xcjs.createI18nManager.call(void 0, {
218
+ var { initI18n, closeSSE, ensureModules, getResource, getAllRecordsByModule } = _chunkK5VX3COHcjs.createI18nManager.call(void 0, {
219
219
  storage: new WxSQLiteAdapter(),
220
220
  createWorker: () => new WxWorkerAdapter(wx.createWorker("workers/preload-worker-mp.js")),
221
221
  fetchFn: wxFetch
@@ -228,4 +228,4 @@ var { initI18n, closeSSE, ensureModules, getResource, getAllRecordsByModule } =
228
228
 
229
229
 
230
230
 
231
- exports.I18N_RESOURCES_UPDATED_EVENT = _chunkEYLGQY2Xcjs.I18N_RESOURCES_UPDATED_EVENT; exports.closeSSE = closeSSE; exports.emitI18nResourcesUpdated = _chunkEYLGQY2Xcjs.emitI18nResourcesUpdated; exports.ensureModules = ensureModules; exports.getAllRecordsByModule = getAllRecordsByModule; exports.getResource = getResource; exports.initI18n = initI18n;
231
+ exports.I18N_RESOURCES_UPDATED_EVENT = _chunkK5VX3COHcjs.I18N_RESOURCES_UPDATED_EVENT; exports.closeSSE = closeSSE; exports.emitI18nResourcesUpdated = _chunkK5VX3COHcjs.emitI18nResourcesUpdated; exports.ensureModules = ensureModules; exports.getAllRecordsByModule = getAllRecordsByModule; exports.getResource = getResource; exports.initI18n = initI18n;
@@ -1,5 +1,5 @@
1
- import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from '../cacheEvents-CAjfH0vs.cjs';
2
- export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, h as emitI18nResourcesUpdated } from '../cacheEvents-CAjfH0vs.cjs';
1
+ import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from '../cacheEvents-CDBRPnHU.cjs';
2
+ export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, h as emitI18nResourcesUpdated } from '../cacheEvents-CDBRPnHU.cjs';
3
3
 
4
4
  declare const initI18n: typeof initI18n$1;
5
5
  declare const closeSSE: typeof closeSSE$1;
@@ -1,5 +1,5 @@
1
- import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from '../cacheEvents-CAjfH0vs.js';
2
- export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, h as emitI18nResourcesUpdated } from '../cacheEvents-CAjfH0vs.js';
1
+ import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from '../cacheEvents-CDBRPnHU.js';
2
+ export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, h as emitI18nResourcesUpdated } from '../cacheEvents-CDBRPnHU.js';
3
3
 
4
4
  declare const initI18n: typeof initI18n$1;
5
5
  declare const closeSSE: typeof closeSSE$1;
package/dist/mp/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  I18N_RESOURCES_UPDATED_EVENT,
3
3
  createI18nManager,
4
4
  emitI18nResourcesUpdated
5
- } from "../chunk-2GMRPNQB.js";
5
+ } from "../chunk-IWP4252C.js";
6
6
 
7
7
  // src/storage/wx-sqlite.ts
8
8
  var DB_NAME = "i18n_cache";
@@ -7,7 +7,7 @@ var _chunkAJJKJPNBcjs = require('../chunk-AJJKJPNB.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkEYLGQY2Xcjs = require('../chunk-EYLGQY2X.cjs');
10
+ var _chunkK5VX3COHcjs = require('../chunk-K5VX3COH.cjs');
11
11
 
12
12
  // src/native/index.ts
13
13
  var _i18next = require('i18next'); var _i18next2 = _interopRequireDefault(_i18next);
@@ -155,7 +155,7 @@ if (!_i18next2.default.isInitialized) {
155
155
  }
156
156
  });
157
157
  }
158
- var { initI18n, closeSSE, ensureModules, getResource, getAllRecordsByModule } = _chunkEYLGQY2Xcjs.createI18nManager.call(void 0, {
158
+ var { initI18n, closeSSE, ensureModules, getResource, getAllRecordsByModule } = _chunkK5VX3COHcjs.createI18nManager.call(void 0, {
159
159
  storage: new SQLiteAdapter(),
160
160
  // Hermes Worker(RN 0.71+),API 与 Web Worker 一致
161
161
  createWorker: () => new (0, _chunkAJJKJPNBcjs.WebWorkerAdapter)(
@@ -172,4 +172,4 @@ var { initI18n, closeSSE, ensureModules, getResource, getAllRecordsByModule } =
172
172
 
173
173
 
174
174
 
175
- exports.I18N_RESOURCES_UPDATED_EVENT = _chunkEYLGQY2Xcjs.I18N_RESOURCES_UPDATED_EVENT; exports.closeSSE = closeSSE; exports.emitI18nResourcesUpdated = _chunkEYLGQY2Xcjs.emitI18nResourcesUpdated; exports.ensureModules = ensureModules; exports.getAllRecordsByModule = getAllRecordsByModule; exports.getResource = getResource; exports.initI18n = initI18n; exports.useDict = _chunkAJJKJPNBcjs.useDict; exports.useTranslation = _chunkAJJKJPNBcjs.useTranslation;
175
+ exports.I18N_RESOURCES_UPDATED_EVENT = _chunkK5VX3COHcjs.I18N_RESOURCES_UPDATED_EVENT; exports.closeSSE = closeSSE; exports.emitI18nResourcesUpdated = _chunkK5VX3COHcjs.emitI18nResourcesUpdated; exports.ensureModules = ensureModules; exports.getAllRecordsByModule = getAllRecordsByModule; exports.getResource = getResource; exports.initI18n = initI18n; exports.useDict = _chunkAJJKJPNBcjs.useDict; exports.useTranslation = _chunkAJJKJPNBcjs.useTranslation;
@@ -1,5 +1,5 @@
1
- import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from '../cacheEvents-CAjfH0vs.cjs';
2
- export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, h as emitI18nResourcesUpdated } from '../cacheEvents-CAjfH0vs.cjs';
1
+ import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from '../cacheEvents-CDBRPnHU.cjs';
2
+ export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, h as emitI18nResourcesUpdated } from '../cacheEvents-CDBRPnHU.cjs';
3
3
  export { u as useDict } from '../hooks-ClO29Chr.cjs';
4
4
  export { useTranslation } from 'react-i18next';
5
5
 
@@ -1,5 +1,5 @@
1
- import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from '../cacheEvents-CAjfH0vs.js';
2
- export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, h as emitI18nResourcesUpdated } from '../cacheEvents-CAjfH0vs.js';
1
+ import { c as closeSSE$1, e as ensureModules$1, g as getAllRecordsByModule$1, a as getResource$1, i as initI18n$1 } from '../cacheEvents-CDBRPnHU.js';
2
+ export { I as I18N_RESOURCES_UPDATED_EVENT, b as I18nInitOptions, P as PullLangBlock, R as ResourceRecord, S as SSEMessage, d as StandardPullParams, f as StoreConfig, h as emitI18nResourcesUpdated } from '../cacheEvents-CDBRPnHU.js';
3
3
  export { u as useDict } from '../hooks-ClO29Chr.js';
4
4
  export { useTranslation } from 'react-i18next';
5
5
 
@@ -7,7 +7,7 @@ import {
7
7
  I18N_RESOURCES_UPDATED_EVENT,
8
8
  createI18nManager,
9
9
  emitI18nResourcesUpdated
10
- } from "../chunk-2GMRPNQB.js";
10
+ } from "../chunk-IWP4252C.js";
11
11
 
12
12
  // src/native/index.ts
13
13
  import i18n from "i18next";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shuo-li/i18n",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Cross-platform i18n library for Web, React Native and WeChat MiniProgram",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",