@zachhandley/ez-i18n 0.1.5 → 0.1.7

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/dist/index.js CHANGED
@@ -361,6 +361,7 @@ export function t(key, params) {
361
361
  // HMR support for dev mode
362
362
  handleHotUpdate({ file, server }) {
363
363
  if (!isDev) return;
364
+ if (!file.endsWith(".json")) return;
364
365
  for (const info of translationInfo.values()) {
365
366
  if (info.files.includes(file)) {
366
367
  const mod = server.moduleGraph.getModuleById(RESOLVED_PREFIX + VIRTUAL_TRANSLATIONS);
@@ -469,7 +470,7 @@ function generateDevTranslationsModule(translationInfo, projectRoot, pathBasedNa
469
470
  });
470
471
  loaderEntries.push(` ${JSON.stringify(locale)}: async () => {
471
472
  const fileInfos = [${fileEntries.join(", ")}];
472
- const modules = await Promise.all(fileInfos.map(f => import(f.path)));
473
+ const modules = await Promise.all(fileInfos.map(f => import(/* @vite-ignore */ f.path)));
473
474
  const wrapped = modules.map((m, i) => __wrapWithNamespace(fileInfos[i].namespace, m.default ?? m));
474
475
  return __deepMerge({}, ...wrapped);
475
476
  }`);
@@ -542,7 +543,7 @@ function generateBuildTranslationsModule(translationInfo, projectRoot, pathBased
542
543
  });
543
544
  loaderEntries.push(` ${JSON.stringify(locale)}: async () => {
544
545
  const fileInfos = [${fileEntries.join(", ")}];
545
- const modules = await Promise.all(fileInfos.map(f => import(f.path)));
546
+ const modules = await Promise.all(fileInfos.map(f => import(/* @vite-ignore */ f.path)));
546
547
  const wrapped = modules.map((m, i) => __wrapWithNamespace(fileInfos[i].namespace, m.default ?? m));
547
548
  return __deepMerge({}, ...wrapped);
548
549
  }`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zachhandley/ez-i18n",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -269,6 +269,9 @@ export function t(key, params) {
269
269
  handleHotUpdate({ file, server }) {
270
270
  if (!isDev) return;
271
271
 
272
+ // Only process JSON files
273
+ if (!file.endsWith('.json')) return;
274
+
272
275
  // Check if the changed file is a translation file
273
276
  for (const info of translationInfo.values()) {
274
277
  if (info.files.includes(file)) {
@@ -412,7 +415,7 @@ function generateDevTranslationsModule(
412
415
 
413
416
  loaderEntries.push(` ${JSON.stringify(locale)}: async () => {
414
417
  const fileInfos = [${fileEntries.join(', ')}];
415
- const modules = await Promise.all(fileInfos.map(f => import(f.path)));
418
+ const modules = await Promise.all(fileInfos.map(f => import(/* @vite-ignore */ f.path)));
416
419
  const wrapped = modules.map((m, i) => __wrapWithNamespace(fileInfos[i].namespace, m.default ?? m));
417
420
  return __deepMerge({}, ...wrapped);
418
421
  }`);
@@ -503,7 +506,7 @@ function generateBuildTranslationsModule(
503
506
 
504
507
  loaderEntries.push(` ${JSON.stringify(locale)}: async () => {
505
508
  const fileInfos = [${fileEntries.join(', ')}];
506
- const modules = await Promise.all(fileInfos.map(f => import(f.path)));
509
+ const modules = await Promise.all(fileInfos.map(f => import(/* @vite-ignore */ f.path)));
507
510
  const wrapped = modules.map((m, i) => __wrapWithNamespace(fileInfos[i].namespace, m.default ?? m));
508
511
  return __deepMerge({}, ...wrapped);
509
512
  }`);