@bleedingdev/modern-js-create 3.2.0-ultramodern.94 → 3.2.0-ultramodern.95

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.
Files changed (2) hide show
  1. package/dist/index.js +12 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1904,9 +1904,15 @@ function createAppRuntimeConfig(app, scope, remotes = []) {
1904
1904
  ` : '';
1905
1905
  return `import { defineRuntimeConfig } from '@modern-js/runtime';
1906
1906
  ${'shell' === app.kind ? "import { ultramodernBoundaryDebuggerPlugin } from '@modern-js/runtime/boundary-debugger';\n" : ''}import { createInstance } from 'i18next';
1907
+ import csResource from '../locales/cs/${appI18nNamespace(app)}.json';
1908
+ import enResource from '../locales/en/${appI18nNamespace(app)}.json';
1907
1909
  import { ultramodernRouteNamespace } from './routes/ultramodern-route-metadata';
1908
1910
 
1909
1911
  const i18nInstance = createInstance();
1912
+ const resources = {
1913
+ cs: { [ultramodernRouteNamespace]: csResource },
1914
+ en: { [ultramodernRouteNamespace]: enResource },
1915
+ } as const;
1910
1916
 
1911
1917
  export default defineRuntimeConfig({
1912
1918
  i18n: {
@@ -1918,6 +1924,7 @@ export default defineRuntimeConfig({
1918
1924
  escapeValue: false,
1919
1925
  },
1920
1926
  ns: [ultramodernRouteNamespace, 'translation'],
1927
+ resources,
1921
1928
  supportedLngs: ['en', 'cs'],
1922
1929
  },
1923
1930
  },
@@ -4585,8 +4592,11 @@ const checkRuntimeResources = (filePath, text) => {
4585
4592
  if (!relative(filePath).endsWith('/src/modern.runtime.ts')) {
4586
4593
  return;
4587
4594
  }
4588
- if (/initOptions\\s*:\\s*\\{[\\s\\S]*?\\bresources\\s*:/u.test(text)) {
4589
- fail(\`\${relative(filePath)} must not inline i18n resources in modern.runtime.ts; use locale JSON files.\`);
4595
+ const importsLocaleResources =
4596
+ /import\\s+csResource\\s+from\\s+['"]\\.\\.\\/locales\\/cs\\/[^'"]+\\.json['"]/u.test(text) &&
4597
+ /import\\s+enResource\\s+from\\s+['"]\\.\\.\\/locales\\/en\\/[^'"]+\\.json['"]/u.test(text);
4598
+ if (!importsLocaleResources || !/initOptions\\s*:\\s*\\{[\\s\\S]*?\\bresources\\s*,/u.test(text)) {
4599
+ fail(\`\${relative(filePath)} must register locale JSON resources in modern.runtime.ts so Worker SSR and hydration use the same first-render translations.\`);
4590
4600
  }
4591
4601
  };
4592
4602
 
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "engines": {
22
22
  "node": ">=20"
23
23
  },
24
- "version": "3.2.0-ultramodern.94",
24
+ "version": "3.2.0-ultramodern.95",
25
25
  "types": "./dist/types/index.d.ts",
26
26
  "main": "./dist/index.js",
27
27
  "bin": {
@@ -41,7 +41,7 @@
41
41
  "@types/node": "^25.9.1",
42
42
  "@typescript/native-preview": "7.0.0-dev.20260527.2",
43
43
  "tsx": "^4.22.3",
44
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.94"
44
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.2.0-ultramodern.95"
45
45
  },
46
46
  "publishConfig": {
47
47
  "registry": "https://registry.npmjs.org/",
@@ -54,6 +54,6 @@
54
54
  "start": "node ./dist/index.js"
55
55
  },
56
56
  "ultramodern": {
57
- "frameworkVersion": "3.2.0-ultramodern.94"
57
+ "frameworkVersion": "3.2.0-ultramodern.95"
58
58
  }
59
59
  }