fimo 0.7.0-experimental.1 → 0.7.0-experimental.11

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 (310) hide show
  1. package/assets/content-templates/hooks-template.eta +27 -73
  2. package/assets/content-templates/types-template.eta +1 -4
  3. package/assets/skills/fimo/SKILL.md +2 -2
  4. package/assets/skills/fimo/references/content.md +42 -46
  5. package/assets/skills/fimo/references/locales.md +0 -8
  6. package/assets/skills/fimo/references/setup-react-router.md +2 -2
  7. package/assets/skills/fimo/references/ui.md +1 -1
  8. package/assets/skills/fimo-cli/references/content.md +14 -17
  9. package/assets/skills/fimo-cli/references/locales.md +0 -6
  10. package/assets/skills/fimo-migration/SKILL.md +22 -2
  11. package/assets/skills/fimo-migration/references/content.md +8 -0
  12. package/assets/skills/fimo-migration/references/manifest.md +35 -0
  13. package/assets/skills/fimo-migration/references/qa.md +24 -2
  14. package/assets/skills/fimo-migration/references/workflow.md +12 -1
  15. package/assets/skills/fimo-migration/references/wrap.md +617 -0
  16. package/assets/skills/fimo-studio/references/visual-editing.md +5 -3
  17. package/dist/build/vite/plugins/translations.d.ts +2 -8
  18. package/dist/build/vite/plugins/translations.d.ts.map +1 -1
  19. package/dist/build/vite/plugins/translations.js +3 -121
  20. package/dist/cli/bundle.json +1 -1
  21. package/dist/cli/index.js +20644 -12459
  22. package/dist/runtime/app/FimoProviders.d.ts +1 -11
  23. package/dist/runtime/app/FimoProviders.d.ts.map +1 -1
  24. package/dist/runtime/app/FimoProviders.js +2 -23
  25. package/dist/runtime/astro/index.d.ts +2 -0
  26. package/dist/runtime/astro/index.d.ts.map +1 -0
  27. package/dist/runtime/astro/index.js +3 -0
  28. package/dist/runtime/astro/server.d.ts +3 -0
  29. package/dist/runtime/astro/server.d.ts.map +1 -0
  30. package/dist/runtime/astro/server.js +6 -0
  31. package/dist/runtime/content/utils/retrieve-data-sources.d.ts +0 -1
  32. package/dist/runtime/content/utils/retrieve-data-sources.d.ts.map +1 -1
  33. package/dist/runtime/content/utils/retrieve-data-sources.js +4 -27
  34. package/dist/runtime/i18n/FimoLocaleContext.d.ts.map +1 -1
  35. package/dist/runtime/i18n/FimoLocaleContext.js +1 -0
  36. package/dist/runtime/next/FimoNextProviders.d.ts +24 -0
  37. package/dist/runtime/next/FimoNextProviders.d.ts.map +1 -0
  38. package/dist/runtime/next/FimoNextProviders.js +20 -0
  39. package/dist/runtime/next/FimoNextScripts.d.ts +10 -0
  40. package/dist/runtime/next/FimoNextScripts.d.ts.map +1 -0
  41. package/dist/runtime/next/FimoNextScripts.js +19 -0
  42. package/dist/runtime/next/index.d.ts +14 -0
  43. package/dist/runtime/next/index.d.ts.map +1 -0
  44. package/dist/runtime/next/index.js +14 -0
  45. package/dist/runtime/next/server.d.ts +2 -0
  46. package/dist/runtime/next/server.d.ts.map +1 -0
  47. package/dist/runtime/next/server.js +4 -0
  48. package/dist/runtime/nuxt/composables.d.ts +9 -0
  49. package/dist/runtime/nuxt/composables.d.ts.map +1 -0
  50. package/dist/runtime/nuxt/composables.js +57 -0
  51. package/dist/runtime/nuxt/index.d.ts +3 -0
  52. package/dist/runtime/nuxt/index.d.ts.map +1 -0
  53. package/dist/runtime/nuxt/index.js +6 -0
  54. package/dist/runtime/nuxt/server.d.ts +3 -0
  55. package/dist/runtime/nuxt/server.d.ts.map +1 -0
  56. package/dist/runtime/nuxt/server.js +6 -0
  57. package/dist/runtime/paths/get-fimo-paths.d.ts.map +1 -1
  58. package/dist/runtime/paths/get-fimo-paths.js +5 -15
  59. package/dist/runtime/primitives/labels-hook.d.ts +33 -0
  60. package/dist/runtime/primitives/labels-hook.d.ts.map +1 -0
  61. package/dist/runtime/primitives/labels-hook.js +41 -0
  62. package/dist/runtime/primitives/labels-store.d.ts +12 -0
  63. package/dist/runtime/primitives/labels-store.d.ts.map +1 -0
  64. package/dist/runtime/primitives/labels-store.js +60 -0
  65. package/dist/runtime/primitives/labels-store.test.d.ts +2 -0
  66. package/dist/runtime/primitives/labels-store.test.d.ts.map +1 -0
  67. package/dist/runtime/primitives/labels-store.test.js +66 -0
  68. package/dist/runtime/primitives/lib/primitives.d.ts +2 -2
  69. package/dist/runtime/primitives/lib/primitives.d.ts.map +1 -1
  70. package/dist/runtime/primitives/lib/query.d.ts +3 -5
  71. package/dist/runtime/primitives/lib/query.d.ts.map +1 -1
  72. package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts +5 -3
  73. package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts.map +1 -1
  74. package/dist/runtime/primitives/lib/useFimoLiveValue.js +11 -4
  75. package/dist/runtime/primitives/public-surface.test.js +5 -9
  76. package/dist/runtime/primitives/translations.d.ts +1 -27
  77. package/dist/runtime/primitives/translations.d.ts.map +1 -1
  78. package/dist/runtime/primitives/translations.js +7 -85
  79. package/dist/runtime/react/FimoSpaProviders.d.ts +36 -0
  80. package/dist/runtime/react/FimoSpaProviders.d.ts.map +1 -0
  81. package/dist/runtime/react/FimoSpaProviders.js +63 -0
  82. package/dist/runtime/react/index.d.ts +33 -0
  83. package/dist/runtime/react/index.d.ts.map +1 -0
  84. package/dist/runtime/react/index.js +39 -0
  85. package/dist/runtime/remix/FimoRemixProviders.d.ts +16 -0
  86. package/dist/runtime/remix/FimoRemixProviders.d.ts.map +1 -0
  87. package/dist/runtime/remix/FimoRemixProviders.js +12 -0
  88. package/dist/runtime/remix/FimoRemixScripts.d.ts +10 -0
  89. package/dist/runtime/remix/FimoRemixScripts.d.ts.map +1 -0
  90. package/dist/runtime/remix/FimoRemixScripts.js +19 -0
  91. package/dist/runtime/remix/index.d.ts +12 -0
  92. package/dist/runtime/remix/index.d.ts.map +1 -0
  93. package/dist/runtime/remix/index.js +11 -0
  94. package/dist/runtime/remix/server.d.ts +2 -0
  95. package/dist/runtime/remix/server.d.ts.map +1 -0
  96. package/dist/runtime/remix/server.js +2 -0
  97. package/dist/runtime/seo/buildSeoForPath.d.ts +3 -1
  98. package/dist/runtime/seo/buildSeoForPath.d.ts.map +1 -1
  99. package/dist/runtime/seo/buildSeoForPath.js +1 -4
  100. package/dist/runtime/shared/display-routes.d.ts +14 -0
  101. package/dist/runtime/shared/display-routes.d.ts.map +1 -0
  102. package/dist/runtime/shared/display-routes.js +25 -0
  103. package/dist/runtime/shared/fimo-config.server.d.ts.map +1 -1
  104. package/dist/runtime/shared/fimo-config.server.js +1 -0
  105. package/dist/runtime/shared/fimo-config.types.d.ts +2 -0
  106. package/dist/runtime/shared/fimo-config.types.d.ts.map +1 -1
  107. package/dist/runtime/shared/i18n-messages.d.ts +29 -0
  108. package/dist/runtime/shared/i18n-messages.d.ts.map +1 -0
  109. package/dist/runtime/shared/i18n-messages.js +79 -0
  110. package/dist/runtime/shared/i18n-messages.test.d.ts +2 -0
  111. package/dist/runtime/shared/i18n-messages.test.d.ts.map +1 -0
  112. package/dist/runtime/shared/i18n-messages.test.js +39 -0
  113. package/dist/runtime/shared/labels-fetch.pure.d.ts +17 -0
  114. package/dist/runtime/shared/labels-fetch.pure.d.ts.map +1 -0
  115. package/dist/runtime/shared/labels-fetch.pure.js +71 -0
  116. package/dist/runtime/shared/labels-fetch.server.d.ts +7 -0
  117. package/dist/runtime/shared/labels-fetch.server.d.ts.map +1 -0
  118. package/dist/runtime/shared/labels-fetch.server.js +97 -0
  119. package/dist/runtime/shared/labels-t.pure.d.ts +2 -0
  120. package/dist/runtime/shared/labels-t.pure.d.ts.map +1 -0
  121. package/dist/runtime/shared/labels-t.pure.js +10 -0
  122. package/dist/runtime/strapi/client.d.ts +26 -0
  123. package/dist/runtime/strapi/client.d.ts.map +1 -0
  124. package/dist/runtime/strapi/client.js +88 -0
  125. package/dist/runtime/strapi/client.test.d.ts +2 -0
  126. package/dist/runtime/strapi/client.test.d.ts.map +1 -0
  127. package/dist/runtime/strapi/client.test.js +64 -0
  128. package/dist/runtime/strapi/index.d.ts +5 -0
  129. package/dist/runtime/strapi/index.d.ts.map +1 -0
  130. package/dist/runtime/strapi/index.js +6 -0
  131. package/dist/runtime/strapi/reshape.d.ts +28 -0
  132. package/dist/runtime/strapi/reshape.d.ts.map +1 -0
  133. package/dist/runtime/strapi/reshape.js +79 -0
  134. package/dist/runtime/strapi/reshape.test.d.ts +2 -0
  135. package/dist/runtime/strapi/reshape.test.d.ts.map +1 -0
  136. package/dist/runtime/strapi/reshape.test.js +33 -0
  137. package/dist/runtime/svelte/index.d.ts +3 -0
  138. package/dist/runtime/svelte/index.d.ts.map +1 -0
  139. package/dist/runtime/svelte/index.js +7 -0
  140. package/dist/runtime/svelte/server.d.ts +3 -0
  141. package/dist/runtime/svelte/server.d.ts.map +1 -0
  142. package/dist/runtime/svelte/server.js +6 -0
  143. package/dist/runtime/vue/index.d.ts +3 -0
  144. package/dist/runtime/vue/index.d.ts.map +1 -0
  145. package/dist/runtime/vue/index.js +5 -0
  146. package/dist/runtime/vue/server.d.ts +3 -0
  147. package/dist/runtime/vue/server.d.ts.map +1 -0
  148. package/dist/runtime/vue/server.js +6 -0
  149. package/dist/runtime/wrapped/FimoFileLink.d.ts +17 -0
  150. package/dist/runtime/wrapped/FimoFileLink.d.ts.map +1 -0
  151. package/dist/runtime/wrapped/FimoFileLink.js +19 -0
  152. package/dist/runtime/wrapped/FimoMediaImage.d.ts +14 -0
  153. package/dist/runtime/wrapped/FimoMediaImage.d.ts.map +1 -0
  154. package/dist/runtime/wrapped/FimoMediaImage.js +20 -0
  155. package/dist/runtime/wrapped/FimoMediaVideo.d.ts +14 -0
  156. package/dist/runtime/wrapped/FimoMediaVideo.d.ts.map +1 -0
  157. package/dist/runtime/wrapped/FimoMediaVideo.js +20 -0
  158. package/dist/runtime/wrapped/FimoRichTextBlock.d.ts +23 -0
  159. package/dist/runtime/wrapped/FimoRichTextBlock.d.ts.map +1 -0
  160. package/dist/runtime/wrapped/FimoRichTextBlock.js +22 -0
  161. package/dist/runtime/wrapped/FimoText.d.ts +22 -0
  162. package/dist/runtime/wrapped/FimoText.d.ts.map +1 -0
  163. package/dist/runtime/wrapped/FimoText.js +20 -0
  164. package/dist/runtime/wrapped/WrappedContentContext.d.ts +28 -0
  165. package/dist/runtime/wrapped/WrappedContentContext.d.ts.map +1 -0
  166. package/dist/runtime/wrapped/WrappedContentContext.js +30 -0
  167. package/dist/runtime/wrapped/WrappedProviders.d.ts +33 -0
  168. package/dist/runtime/wrapped/WrappedProviders.d.ts.map +1 -0
  169. package/dist/runtime/wrapped/WrappedProviders.js +101 -0
  170. package/dist/runtime/wrapped/dom.d.ts +4 -0
  171. package/dist/runtime/wrapped/dom.d.ts.map +1 -0
  172. package/dist/runtime/wrapped/dom.js +23 -0
  173. package/dist/runtime/wrapped/dom.test.d.ts +2 -0
  174. package/dist/runtime/wrapped/dom.test.d.ts.map +1 -0
  175. package/dist/runtime/wrapped/dom.test.js +16 -0
  176. package/dist/runtime/wrapped/server.d.ts +77 -0
  177. package/dist/runtime/wrapped/server.d.ts.map +1 -0
  178. package/dist/runtime/wrapped/server.js +237 -0
  179. package/dist/runtime/wrapped/server.test.d.ts +2 -0
  180. package/dist/runtime/wrapped/server.test.d.ts.map +1 -0
  181. package/dist/runtime/wrapped/server.test.js +91 -0
  182. package/dist/scripts/apply-wrap-templates.d.ts +61 -0
  183. package/dist/scripts/apply-wrap-templates.js +132 -0
  184. package/dist/scripts/apply-wrap-templates.test.d.ts +1 -0
  185. package/dist/scripts/apply-wrap-templates.test.js +199 -0
  186. package/dist/scripts/apply-wrap.d.ts +46 -0
  187. package/dist/scripts/apply-wrap.js +278 -0
  188. package/dist/scripts/apply-wrap.test.d.ts +1 -0
  189. package/dist/scripts/apply-wrap.test.js +226 -0
  190. package/dist/scripts/cms/discover.d.ts +2 -0
  191. package/dist/scripts/cms/discover.js +17 -0
  192. package/dist/scripts/cms/example-content.d.ts +32 -0
  193. package/dist/scripts/cms/example-content.js +108 -0
  194. package/dist/scripts/cms/example-content.test.d.ts +1 -0
  195. package/dist/scripts/cms/example-content.test.js +66 -0
  196. package/dist/scripts/cms/strapi/detect.d.ts +2 -0
  197. package/dist/scripts/cms/strapi/detect.js +186 -0
  198. package/dist/scripts/cms/strapi/detect.test.d.ts +1 -0
  199. package/dist/scripts/cms/strapi/detect.test.js +56 -0
  200. package/dist/scripts/cms/strapi/index.d.ts +3 -0
  201. package/dist/scripts/cms/strapi/index.js +25 -0
  202. package/dist/scripts/cms/strapi/list-source.d.ts +17 -0
  203. package/dist/scripts/cms/strapi/list-source.js +90 -0
  204. package/dist/scripts/cms/strapi/list-source.test.d.ts +1 -0
  205. package/dist/scripts/cms/strapi/list-source.test.js +33 -0
  206. package/dist/scripts/cms/strapi/schema-map.d.ts +9 -0
  207. package/dist/scripts/cms/strapi/schema-map.js +149 -0
  208. package/dist/scripts/cms/strapi/schema-map.test.d.ts +1 -0
  209. package/dist/scripts/cms/strapi/schema-map.test.js +91 -0
  210. package/dist/scripts/cms/strapi/touchpoints.d.ts +31 -0
  211. package/dist/scripts/cms/strapi/touchpoints.js +145 -0
  212. package/dist/scripts/cms/strapi/touchpoints.test.d.ts +1 -0
  213. package/dist/scripts/cms/strapi/touchpoints.test.js +62 -0
  214. package/dist/scripts/cms/strapi/wire-client.d.ts +15 -0
  215. package/dist/scripts/cms/strapi/wire-client.js +107 -0
  216. package/dist/scripts/cms/strapi/wire-client.test.d.ts +1 -0
  217. package/dist/scripts/cms/strapi/wire-client.test.js +51 -0
  218. package/dist/scripts/cms/strapi/wiring.d.ts +17 -0
  219. package/dist/scripts/cms/strapi/wiring.js +36 -0
  220. package/dist/scripts/cms/strapi/wiring.test.d.ts +1 -0
  221. package/dist/scripts/cms/strapi/wiring.test.js +27 -0
  222. package/dist/scripts/cms/types.d.ts +117 -0
  223. package/dist/scripts/cms/types.js +11 -0
  224. package/dist/scripts/detect-framework.d.ts +39 -0
  225. package/dist/scripts/detect-framework.js +133 -0
  226. package/dist/scripts/detect-framework.test.d.ts +1 -0
  227. package/dist/scripts/detect-framework.test.js +122 -0
  228. package/dist/scripts/draft-rows.d.ts +19 -0
  229. package/dist/scripts/draft-rows.js +135 -0
  230. package/dist/scripts/draft-rows.test.d.ts +1 -0
  231. package/dist/scripts/draft-rows.test.js +113 -0
  232. package/dist/scripts/draft-schemas.d.ts +27 -0
  233. package/dist/scripts/draft-schemas.js +188 -0
  234. package/dist/scripts/draft-schemas.test.d.ts +1 -0
  235. package/dist/scripts/draft-schemas.test.js +152 -0
  236. package/dist/scripts/extract-translations.js +16 -11
  237. package/dist/scripts/extract-translations.test.d.ts +1 -0
  238. package/dist/scripts/extract-translations.test.js +104 -0
  239. package/dist/scripts/frameworks/astro/routes.d.ts +3 -0
  240. package/dist/scripts/frameworks/astro/routes.js +55 -0
  241. package/dist/scripts/frameworks/astro/template-style.d.ts +7 -0
  242. package/dist/scripts/frameworks/astro/template-style.js +19 -0
  243. package/dist/scripts/frameworks/discover.d.ts +70 -0
  244. package/dist/scripts/frameworks/discover.js +178 -0
  245. package/dist/scripts/frameworks/next/rewire.d.ts +30 -0
  246. package/dist/scripts/frameworks/next/rewire.js +258 -0
  247. package/dist/scripts/frameworks/next/rewire.test.d.ts +1 -0
  248. package/dist/scripts/frameworks/next/rewire.test.js +134 -0
  249. package/dist/scripts/frameworks/next/routes.d.ts +17 -0
  250. package/dist/scripts/frameworks/next/routes.js +134 -0
  251. package/dist/scripts/frameworks/next/routes.test.d.ts +1 -0
  252. package/dist/scripts/frameworks/next/routes.test.js +64 -0
  253. package/dist/scripts/frameworks/next/wiring.d.ts +33 -0
  254. package/dist/scripts/frameworks/next/wiring.js +186 -0
  255. package/dist/scripts/frameworks/next/wiring.test.d.ts +1 -0
  256. package/dist/scripts/frameworks/next/wiring.test.js +174 -0
  257. package/dist/scripts/frameworks/nuxt/routes.d.ts +3 -0
  258. package/dist/scripts/frameworks/nuxt/routes.js +54 -0
  259. package/dist/scripts/frameworks/nuxt/template-style.d.ts +9 -0
  260. package/dist/scripts/frameworks/nuxt/template-style.js +27 -0
  261. package/dist/scripts/frameworks/remix/routes.d.ts +3 -0
  262. package/dist/scripts/frameworks/remix/routes.js +50 -0
  263. package/dist/scripts/frameworks/support.d.ts +75 -0
  264. package/dist/scripts/frameworks/support.js +165 -0
  265. package/dist/scripts/frameworks/support.test.d.ts +1 -0
  266. package/dist/scripts/frameworks/support.test.js +87 -0
  267. package/dist/scripts/frameworks/sveltekit/routes.d.ts +3 -0
  268. package/dist/scripts/frameworks/sveltekit/routes.js +50 -0
  269. package/dist/scripts/frameworks/sveltekit/template-style.d.ts +9 -0
  270. package/dist/scripts/frameworks/sveltekit/template-style.js +54 -0
  271. package/dist/scripts/frameworks/vite/routes.d.ts +15 -0
  272. package/dist/scripts/frameworks/vite/routes.js +93 -0
  273. package/dist/scripts/frameworks/vite/routes.test.d.ts +1 -0
  274. package/dist/scripts/frameworks/vite/routes.test.js +73 -0
  275. package/dist/scripts/frameworks/vite/wiring.d.ts +10 -0
  276. package/dist/scripts/frameworks/vite/wiring.js +99 -0
  277. package/dist/scripts/frameworks/vite/wiring.test.d.ts +1 -0
  278. package/dist/scripts/frameworks/vite/wiring.test.js +88 -0
  279. package/dist/scripts/generated-types.test.js +1 -1
  280. package/dist/scripts/i18n-namespace.d.ts +27 -0
  281. package/dist/scripts/i18n-namespace.js +155 -0
  282. package/dist/scripts/lib/validation-report.d.ts +1 -0
  283. package/dist/scripts/lib/validation-report.js +3 -0
  284. package/dist/scripts/render-parity/capture.d.ts +56 -0
  285. package/dist/scripts/render-parity/capture.js +366 -0
  286. package/dist/scripts/render-parity/capture.test.d.ts +1 -0
  287. package/dist/scripts/render-parity/capture.test.js +306 -0
  288. package/dist/scripts/render-parity/compare.d.ts +59 -0
  289. package/dist/scripts/render-parity/compare.js +0 -0
  290. package/dist/scripts/render-parity/compare.test.d.ts +1 -0
  291. package/dist/scripts/render-parity/compare.test.js +98 -0
  292. package/dist/scripts/render-parity/normalize-html.d.ts +13 -0
  293. package/dist/scripts/render-parity/normalize-html.js +223 -0
  294. package/dist/scripts/render-parity/normalize-html.test.d.ts +1 -0
  295. package/dist/scripts/render-parity/normalize-html.test.js +58 -0
  296. package/dist/scripts/render-parity/types.d.ts +41 -0
  297. package/dist/scripts/render-parity/types.js +1 -0
  298. package/dist/scripts/resolve-routes.js +1 -1
  299. package/dist/scripts/scan-wrappable.d.ts +196 -0
  300. package/dist/scripts/scan-wrappable.js +1232 -0
  301. package/dist/scripts/scan-wrappable.test.d.ts +1 -0
  302. package/dist/scripts/scan-wrappable.test.js +521 -0
  303. package/dist/scripts/sync-schemas.test.js +4 -24
  304. package/dist/scripts/validate-route-metadata.js +11 -0
  305. package/dist/scripts/validate-schemas.test.js +2 -2
  306. package/package.json +92 -5
  307. package/templates/react-router/package.json +7 -10
  308. package/dist/runtime/paths/get-fimo-paths.test.d.ts +0 -2
  309. package/dist/runtime/paths/get-fimo-paths.test.d.ts.map +0 -1
  310. package/dist/runtime/paths/get-fimo-paths.test.js +0 -69
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FimoRemixScripts.d.ts","sourceRoot":"","sources":["../../../src/runtime/remix/FimoRemixScripts.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,mDAW/B"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Renders the Fimo preview client script in development so the Fimo Studio
4
+ * preview can select/edit elements. Mount inside <head> in the root layout.
5
+ *
6
+ * The script URL comes from FIMO_PREVIEW_SCRIPT_URL (written by
7
+ * `fimo init` for wrapped projects, pointing at `<apiUrl>/preview.js`).
8
+ * Renders nothing in production builds.
9
+ */
10
+ export function FimoRemixScripts() {
11
+ if (process.env.NODE_ENV !== 'development') {
12
+ return null;
13
+ }
14
+ const previewScriptUrl = process.env.FIMO_PREVIEW_SCRIPT_URL;
15
+ if (!previewScriptUrl) {
16
+ return null;
17
+ }
18
+ return _jsx("script", { type: "module", src: previewScriptUrl });
19
+ }
@@ -0,0 +1,12 @@
1
+ export { FimoRemixProviders } from './FimoRemixProviders.js';
2
+ export type { FimoRemixLabels, FimoRemixProvidersProps } from './FimoRemixProviders.js';
3
+ export { FimoRemixScripts } from './FimoRemixScripts.js';
4
+ export { FimoText } from '../wrapped/FimoText.js';
5
+ export { FimoRichTextBlock } from '../wrapped/FimoRichTextBlock.js';
6
+ export { FimoMediaImage } from '../wrapped/FimoMediaImage.js';
7
+ export { FimoMediaVideo } from '../wrapped/FimoMediaVideo.js';
8
+ export { FimoFileLink } from '../wrapped/FimoFileLink.js';
9
+ export { useWrappedMedia, useWrappedRichText } from '../wrapped/WrappedContentContext.js';
10
+ export type { WrappedMediaEntry, WrappedRichTextEntry } from '../wrapped/WrappedContentContext.js';
11
+ export { useLabels } from '../primitives/labels-hook.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/remix/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC1F,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AACnG,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,11 @@
1
+ // fimo/remix — the Remix adapter. Framework-neutral pieces live in
2
+ // ../wrapped and are re-exported; this module only adds the Remix wiring.
3
+ export { FimoRemixProviders } from './FimoRemixProviders.js';
4
+ export { FimoRemixScripts } from './FimoRemixScripts.js';
5
+ export { FimoText } from '../wrapped/FimoText.js';
6
+ export { FimoRichTextBlock } from '../wrapped/FimoRichTextBlock.js';
7
+ export { FimoMediaImage } from '../wrapped/FimoMediaImage.js';
8
+ export { FimoMediaVideo } from '../wrapped/FimoMediaVideo.js';
9
+ export { FimoFileLink } from '../wrapped/FimoFileLink.js';
10
+ export { useWrappedMedia, useWrappedRichText } from '../wrapped/WrappedContentContext.js';
11
+ export { useLabels } from '../primitives/labels-hook.js';
@@ -0,0 +1,2 @@
1
+ export * from '../wrapped/server.js';
2
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/runtime/remix/server.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ // fimo/remix/server — same framework-neutral loaders as every adapter.
2
+ export * from '../wrapped/server.js';
@@ -37,7 +37,9 @@ export declare function buildFimoMeta(args: {
37
37
  location: {
38
38
  pathname: string;
39
39
  };
40
- matches: readonly unknown[];
40
+ matches: {
41
+ data?: unknown;
42
+ }[];
41
43
  }): ({
42
44
  title: string;
43
45
  name?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"buildSeoForPath.d.ts","sourceRoot":"","sources":["../../../src/runtime/seo/buildSeoForPath.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAK1E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAExF;AA+BD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMrE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,OAAO,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAclG"}
1
+ {"version":3,"file":"buildSeoForPath.d.ts","sourceRoot":"","sources":["../../../src/runtime/seo/buildSeoForPath.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAK1E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAExF;AA+BD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMrE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAUpG"}
@@ -42,10 +42,7 @@ export function buildMetaForPath(pathname, routeData) {
42
42
  }
43
43
  export function buildFimoMeta(args) {
44
44
  const pathname = args.location.pathname;
45
- const firstMatch = args.matches[0];
46
- const rootData = firstMatch && typeof firstMatch === 'object' && 'data' in firstMatch
47
- ? firstMatch.data
48
- : undefined;
45
+ const rootData = args.matches[0]?.data;
49
46
  const routeData = rootData && typeof rootData === 'object' ? rootData.fimoMetaData : undefined;
50
47
  const seo = getSeoForPath(pathname, routeData);
51
48
  if (!seo) {
@@ -0,0 +1,14 @@
1
+ import type { FimoConfig } from './fimo-config.types.js';
2
+ export interface ParamInfo {
3
+ schema: string;
4
+ queryField: string;
5
+ displayField: string;
6
+ }
7
+ export interface DisplayRoute {
8
+ id: string;
9
+ name: string;
10
+ path: string;
11
+ params?: Record<string, ParamInfo>;
12
+ }
13
+ export declare function getDisplayRoutes(config: Pick<FimoConfig, 'routes'> | undefined): DisplayRoute[];
14
+ //# sourceMappingURL=display-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display-routes.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/display-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAmBD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,SAAS,GAAG,YAAY,EAAE,CAU/F"}
@@ -0,0 +1,25 @@
1
+ const titleCase = (seg) => seg
2
+ .replace(/[_\-]+/g, ' ')
3
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
4
+ .split(/\s+/)
5
+ .filter(Boolean)
6
+ .map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
7
+ .join(' ');
8
+ const generateRouteName = (path) => {
9
+ if (path === '/') {
10
+ return 'Home';
11
+ }
12
+ const firstSegment = path.replace(/^\//, '').split('/')[0];
13
+ return titleCase(firstSegment);
14
+ };
15
+ export function getDisplayRoutes(config) {
16
+ const configRoutes = config?.routes ?? {};
17
+ return Object.entries(configRoutes)
18
+ .filter(([, route]) => route.path)
19
+ .map(([id, route]) => ({
20
+ id,
21
+ path: route.path,
22
+ name: route.name || route.label || generateRouteName(route.path),
23
+ params: route.params,
24
+ }));
25
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"fimo-config.server.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/fimo-config.server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA4C,MAAM,wBAAwB,CAAC;AAiBnG;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAe3D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUxD"}
1
+ {"version":3,"file":"fimo-config.server.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/fimo-config.server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA4C,MAAM,wBAAwB,CAAC;AAkBnG;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAgB3D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUxD"}
@@ -20,6 +20,7 @@ export function getConfigServer(rootDir) {
20
20
  i18n: raw.i18n,
21
21
  routes: raw.routes,
22
22
  version: raw.version,
23
+ framework: raw.framework,
23
24
  };
24
25
  }
25
26
  catch {
@@ -57,5 +57,7 @@ export interface FimoConfig {
57
57
  i18n?: FimoI18nConfig;
58
58
  routes?: Record<string, FimoRouteConfig>;
59
59
  version?: string | number;
60
+ /** The project's framework. Absent means the Fimo template (react-router). */
61
+ framework?: 'react-router' | 'next' | string;
60
62
  }
61
63
  //# sourceMappingURL=fimo-config.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fimo-config.types.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/fimo-config.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtF,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B"}
1
+ {"version":3,"file":"fimo-config.types.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/fimo-config.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtF,GAAG,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,8EAA8E;IAC9E,SAAS,CAAC,EAAE,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;CAC9C"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Lossless bridge between a nested i18n message store (next-intl / i18next
3
+ * style: `{ home: { title: "…" } }`) and Fimo's FLAT per-locale label map
4
+ * (`{ "home.title": "…" }`). Ingestion flattens the store into labels;
5
+ * `loadFimoMessages` un-flattens the labels back so the app's own i18n
6
+ * runtime keeps rendering unchanged, now sourced from Fimo.
7
+ *
8
+ * String leaves and nested objects round-trip byte-for-byte, ICU strings
9
+ * (`{count, plural, …}`, `<tag>…</tag>`) kept opaque. Array/number/boolean
10
+ * leaves are rare in message stores and are NOT flattened — they stay in the
11
+ * caller's static base (deep-merged under the Fimo bundle).
12
+ */
13
+ /** Flatten a nested message object to dot-keyed string entries. Non-string
14
+ * leaves (arrays, numbers) are skipped — reported so the caller can note
15
+ * them. Keys already containing a dot are preserved verbatim. */
16
+ export declare function flattenMessages(messages: unknown, prefix?: string): {
17
+ flat: Record<string, string>;
18
+ skipped: string[];
19
+ };
20
+ /** Rebuild the nested message object from a flat dot-keyed map. Inverse of
21
+ * flattenMessages for string leaves. A key whose path collides with an
22
+ * already-set string (e.g. both `a` and `a.b` exist) keeps the deeper
23
+ * object and drops the scalar — message stores never have both. */
24
+ export declare function unflattenMessages(flat: Record<string, string>): Record<string, unknown>;
25
+ /** Deep-merge `override` (Fimo bundle) over `base` (static messages) so keys
26
+ * absent from Fimo fall back to the shipped file instead of next-intl's
27
+ * MISSING_MESSAGE. Objects merge recursively; leaves in `override` win. */
28
+ export declare function deepMergeMessages(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown>;
29
+ //# sourceMappingURL=i18n-messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-messages.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/i18n-messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;kEAEkE;AAClE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAmBnH;AAED;;;oEAGoE;AACpE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBvF;AAED;;4EAE4E;AAC5E,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Lossless bridge between a nested i18n message store (next-intl / i18next
3
+ * style: `{ home: { title: "…" } }`) and Fimo's FLAT per-locale label map
4
+ * (`{ "home.title": "…" }`). Ingestion flattens the store into labels;
5
+ * `loadFimoMessages` un-flattens the labels back so the app's own i18n
6
+ * runtime keeps rendering unchanged, now sourced from Fimo.
7
+ *
8
+ * String leaves and nested objects round-trip byte-for-byte, ICU strings
9
+ * (`{count, plural, …}`, `<tag>…</tag>`) kept opaque. Array/number/boolean
10
+ * leaves are rare in message stores and are NOT flattened — they stay in the
11
+ * caller's static base (deep-merged under the Fimo bundle).
12
+ */
13
+ /** Flatten a nested message object to dot-keyed string entries. Non-string
14
+ * leaves (arrays, numbers) are skipped — reported so the caller can note
15
+ * them. Keys already containing a dot are preserved verbatim. */
16
+ export function flattenMessages(messages, prefix = '') {
17
+ const flat = {};
18
+ const skipped = [];
19
+ if (!messages || typeof messages !== 'object' || Array.isArray(messages)) {
20
+ return { flat, skipped };
21
+ }
22
+ for (const [key, value] of Object.entries(messages)) {
23
+ const path = prefix ? `${prefix}.${key}` : key;
24
+ if (typeof value === 'string') {
25
+ flat[path] = value;
26
+ }
27
+ else if (value && typeof value === 'object' && !Array.isArray(value)) {
28
+ const nested = flattenMessages(value, path);
29
+ Object.assign(flat, nested.flat);
30
+ skipped.push(...nested.skipped);
31
+ }
32
+ else {
33
+ skipped.push(path);
34
+ }
35
+ }
36
+ return { flat, skipped };
37
+ }
38
+ /** Rebuild the nested message object from a flat dot-keyed map. Inverse of
39
+ * flattenMessages for string leaves. A key whose path collides with an
40
+ * already-set string (e.g. both `a` and `a.b` exist) keeps the deeper
41
+ * object and drops the scalar — message stores never have both. */
42
+ export function unflattenMessages(flat) {
43
+ const root = {};
44
+ for (const [flatKey, value] of Object.entries(flat)) {
45
+ const parts = flatKey.split('.');
46
+ let node = root;
47
+ for (let i = 0; i < parts.length - 1; i += 1) {
48
+ const part = parts[i];
49
+ const existing = node[part];
50
+ if (!existing || typeof existing !== 'object' || Array.isArray(existing)) {
51
+ node[part] = {};
52
+ }
53
+ node = node[part];
54
+ }
55
+ node[parts[parts.length - 1]] = value;
56
+ }
57
+ return root;
58
+ }
59
+ /** Deep-merge `override` (Fimo bundle) over `base` (static messages) so keys
60
+ * absent from Fimo fall back to the shipped file instead of next-intl's
61
+ * MISSING_MESSAGE. Objects merge recursively; leaves in `override` win. */
62
+ export function deepMergeMessages(base, override) {
63
+ const out = { ...base };
64
+ for (const [key, value] of Object.entries(override)) {
65
+ const current = out[key];
66
+ if (value &&
67
+ typeof value === 'object' &&
68
+ !Array.isArray(value) &&
69
+ current &&
70
+ typeof current === 'object' &&
71
+ !Array.isArray(current)) {
72
+ out[key] = deepMergeMessages(current, value);
73
+ }
74
+ else {
75
+ out[key] = value;
76
+ }
77
+ }
78
+ return out;
79
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=i18n-messages.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-messages.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/i18n-messages.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { deepMergeMessages, flattenMessages, unflattenMessages } from './i18n-messages.js';
3
+ describe('i18n message flatten/unflatten round-trip', () => {
4
+ const store = {
5
+ home: {
6
+ title: 'Welcome',
7
+ hero: { cta: 'Get started', sub: 'Ship faster' },
8
+ },
9
+ nav: { about: 'About', pricing: 'Pricing' },
10
+ cart: {
11
+ // ICU strings stay opaque.
12
+ items: '{count, plural, =0 {No items} one {# item} other {# items}}',
13
+ greeting: 'Hello {name}',
14
+ rich: 'Read the <link>docs</link>',
15
+ },
16
+ };
17
+ it('flattens nested namespaces to dot-keys and back byte-for-byte', () => {
18
+ const { flat, skipped } = flattenMessages(store);
19
+ expect(skipped).toEqual([]);
20
+ expect(flat['home.title']).toBe('Welcome');
21
+ expect(flat['home.hero.cta']).toBe('Get started');
22
+ expect(flat['cart.items']).toBe('{count, plural, =0 {No items} one {# item} other {# items}}');
23
+ expect(flat['cart.rich']).toBe('Read the <link>docs</link>');
24
+ // The whole store reconstructs exactly.
25
+ expect(unflattenMessages(flat)).toEqual(store);
26
+ });
27
+ it('reports non-string leaves as skipped instead of corrupting them', () => {
28
+ const { flat, skipped } = flattenMessages({ a: 'x', b: [1, 2], c: 3, d: { e: 'y' } });
29
+ expect(flat).toEqual({ a: 'x', 'd.e': 'y' });
30
+ expect(skipped.sort()).toEqual(['b', 'c']);
31
+ });
32
+ it('deep-merges the Fimo bundle over the static base (missing keys fall back)', () => {
33
+ const base = { home: { title: 'Old', cta: 'Base only' }, nav: { about: 'About' } };
34
+ const fromFimo = unflattenMessages({ 'home.title': 'Edited in Fimo' });
35
+ const merged = deepMergeMessages(base, fromFimo);
36
+ // Edited key wins; base-only keys survive.
37
+ expect(merged).toEqual({ home: { title: 'Edited in Fimo', cta: 'Base only' }, nav: { about: 'About' } });
38
+ });
39
+ });
@@ -0,0 +1,17 @@
1
+ export interface LabelBundle {
2
+ dictionaries: Record<string, Record<string, string>>;
3
+ defaultLocale: string;
4
+ locales: string[];
5
+ updatedAt: string | null;
6
+ }
7
+ export declare const API_URL_ENV_KEYS: readonly ["VITE_API_URL", "NEXT_PUBLIC_FIMO_API_URL", "NUXT_PUBLIC_FIMO_API_URL", "PUBLIC_FIMO_API_URL", "FIMO_API_URL"];
8
+ export declare function resolveTenantApiUrl(env: Record<string, string>): string | undefined;
9
+ export declare function serializeBundle(bundle: LabelBundle): string;
10
+ export declare function fetchLabelDictionary(apiUrl: string, locale: string): Promise<{
11
+ locale: string;
12
+ labels: Record<string, string>;
13
+ updatedAt: string | null;
14
+ }>;
15
+ export declare function fetchLabelBundle(apiUrl: string, locales: string[], defaultLocale: string): Promise<LabelBundle>;
16
+ export declare function fetchWithTimeout(url: URL, timeoutMs: number): Promise<Response>;
17
+ //# sourceMappingURL=labels-fetch.pure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels-fetch.pure.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/labels-fetch.pure.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAGD,eAAO,MAAM,gBAAgB,0HAMnB,CAAC;AAEX,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAOnF;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAM3D;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAwBvF;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAcrH;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAQrF"}
@@ -0,0 +1,71 @@
1
+ // Label fetching, PURE core: fetch/URL/AbortController only — no node
2
+ // builtins, importable from client-bundled code (Nuxt composables, universal
3
+ // SFCs). The node-flavored wrapper (env-file reading, config, signatures)
4
+ // lives in labels-fetch.server.ts.
5
+ // The tenant API base URL env var, in framework flavor order.
6
+ export const API_URL_ENV_KEYS = [
7
+ 'VITE_API_URL',
8
+ 'NEXT_PUBLIC_FIMO_API_URL',
9
+ 'NUXT_PUBLIC_FIMO_API_URL',
10
+ 'PUBLIC_FIMO_API_URL',
11
+ 'FIMO_API_URL',
12
+ ];
13
+ export function resolveTenantApiUrl(env) {
14
+ for (const key of API_URL_ENV_KEYS) {
15
+ if (env[key]) {
16
+ return env[key];
17
+ }
18
+ }
19
+ return undefined;
20
+ }
21
+ export function serializeBundle(bundle) {
22
+ return JSON.stringify({
23
+ dictionaries: bundle.dictionaries,
24
+ defaultLocale: bundle.defaultLocale,
25
+ locales: bundle.locales,
26
+ });
27
+ }
28
+ export async function fetchLabelDictionary(apiUrl, locale) {
29
+ const url = new URL('/labels', apiUrl);
30
+ url.searchParams.set('locale', locale);
31
+ const response = await fetchWithTimeout(url, 4000);
32
+ if (!response.ok) {
33
+ return { locale, labels: {}, updatedAt: null };
34
+ }
35
+ const body = (await response.json());
36
+ if (Array.isArray(body.data)) {
37
+ return {
38
+ locale,
39
+ labels: Object.fromEntries(body.data.map((row) => [row.key, row.value ?? row.defaultValue ?? ''])),
40
+ updatedAt: null,
41
+ };
42
+ }
43
+ return {
44
+ locale,
45
+ labels: body.data?.labels ?? {},
46
+ updatedAt: body.data?.updatedAt ?? null,
47
+ };
48
+ }
49
+ export async function fetchLabelBundle(apiUrl, locales, defaultLocale) {
50
+ const loaded = await Promise.all(locales.map((locale) => fetchLabelDictionary(apiUrl, locale).catch(() => ({ locale, labels: {}, updatedAt: null }))));
51
+ const sortedUpdatedAt = loaded
52
+ .map((entry) => entry.updatedAt)
53
+ .filter((value) => typeof value === 'string')
54
+ .sort();
55
+ return {
56
+ dictionaries: Object.fromEntries(loaded.map((entry) => [entry.locale, entry.labels])),
57
+ defaultLocale,
58
+ locales,
59
+ updatedAt: sortedUpdatedAt[sortedUpdatedAt.length - 1] ?? null,
60
+ };
61
+ }
62
+ export async function fetchWithTimeout(url, timeoutMs) {
63
+ const controller = new AbortController();
64
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
65
+ try {
66
+ return await fetch(url, { signal: controller.signal });
67
+ }
68
+ finally {
69
+ clearTimeout(timeout);
70
+ }
71
+ }
@@ -0,0 +1,7 @@
1
+ import { type LabelBundle } from './labels-fetch.pure.js';
2
+ export { API_URL_ENV_KEYS, fetchLabelBundle, fetchLabelDictionary, fetchWithTimeout, resolveTenantApiUrl, serializeBundle, type LabelBundle, } from './labels-fetch.pure.js';
3
+ export declare function labelSignature(bundle: LabelBundle): string;
4
+ export declare function emptyLabelBundle(rootDir: string): LabelBundle;
5
+ export declare function loadLabelBundle(rootDir: string): Promise<LabelBundle>;
6
+ export declare function readProjectEnv(rootDir: string): Promise<Record<string, string>>;
7
+ //# sourceMappingURL=labels-fetch.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels-fetch.server.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/labels-fetch.server.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,KAAK,WAAW,GACjB,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAE1D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAU7D;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAwB3E;AAWD,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAWrF"}
@@ -0,0 +1,97 @@
1
+ // Framework-neutral label fetching (server-side). Shared by the Vite
2
+ // translations plugin (fimo/vite) and the Next server loaders (fimo/next/server).
3
+ // The fetch core is in labels-fetch.pure.ts (client-safe); this module adds
4
+ // the node-flavored parts: env-file reading, config resolution, signatures.
5
+ import { Buffer } from 'node:buffer';
6
+ import { readFile } from 'node:fs/promises';
7
+ import { join } from 'node:path';
8
+ import { getFimoDefaultLocale, getFimoLocales } from '../i18n/locale.js';
9
+ import { getConfigServer } from './fimo-config.server.js';
10
+ import { API_URL_ENV_KEYS, fetchLabelBundle, serializeBundle, } from './labels-fetch.pure.js';
11
+ export { API_URL_ENV_KEYS, fetchLabelBundle, fetchLabelDictionary, fetchWithTimeout, resolveTenantApiUrl, serializeBundle, } from './labels-fetch.pure.js';
12
+ export function labelSignature(bundle) {
13
+ return Buffer.from(serializeBundle(bundle)).toString('base64');
14
+ }
15
+ export function emptyLabelBundle(rootDir) {
16
+ const config = getConfigServer(rootDir);
17
+ const defaultLocale = getFimoDefaultLocale(config);
18
+ const locales = getFimoLocales(config);
19
+ return {
20
+ dictionaries: Object.fromEntries(locales.map((locale) => [locale, {}])),
21
+ defaultLocale,
22
+ locales,
23
+ updatedAt: null,
24
+ };
25
+ }
26
+ export async function loadLabelBundle(rootDir) {
27
+ const config = getConfigServer(rootDir);
28
+ const defaultLocale = getFimoDefaultLocale(config);
29
+ const locales = getFimoLocales(config);
30
+ const env = await readProjectEnv(rootDir);
31
+ const apiUrl = resolveTenantApiUrlFromEnv(env);
32
+ if (!apiUrl) {
33
+ return {
34
+ dictionaries: Object.fromEntries(locales.map((locale) => [locale, {}])),
35
+ defaultLocale,
36
+ locales,
37
+ updatedAt: null,
38
+ };
39
+ }
40
+ try {
41
+ return await fetchLabelBundle(apiUrl, locales, defaultLocale);
42
+ }
43
+ catch {
44
+ return {
45
+ dictionaries: Object.fromEntries(locales.map((locale) => [locale, {}])),
46
+ defaultLocale,
47
+ locales,
48
+ updatedAt: null,
49
+ };
50
+ }
51
+ }
52
+ function resolveTenantApiUrlFromEnv(env) {
53
+ for (const key of API_URL_ENV_KEYS) {
54
+ if (env[key]) {
55
+ return env[key];
56
+ }
57
+ }
58
+ return undefined;
59
+ }
60
+ export async function readProjectEnv(rootDir) {
61
+ const values = {
62
+ ...(await readEnvFile(join(rootDir, '.env'))),
63
+ ...(await readEnvFile(join(rootDir, '.env.local'))),
64
+ };
65
+ for (const key of API_URL_ENV_KEYS) {
66
+ if (process.env[key]) {
67
+ values[key] = process.env[key];
68
+ }
69
+ }
70
+ return values;
71
+ }
72
+ async function readEnvFile(filePath) {
73
+ try {
74
+ const content = await readFile(filePath, 'utf8');
75
+ const values = {};
76
+ for (const line of content.split(/\r?\n/)) {
77
+ const trimmed = line.trim();
78
+ if (!trimmed || trimmed.startsWith('#')) {
79
+ continue;
80
+ }
81
+ const index = trimmed.indexOf('=');
82
+ if (index === -1) {
83
+ continue;
84
+ }
85
+ const key = trimmed.slice(0, index).trim();
86
+ const value = trimmed
87
+ .slice(index + 1)
88
+ .trim()
89
+ .replace(/^['"]|['"]$/g, '');
90
+ values[key] = value;
91
+ }
92
+ return values;
93
+ }
94
+ catch {
95
+ return {};
96
+ }
97
+ }
@@ -0,0 +1,2 @@
1
+ export declare function makeFimoT(labels: Record<string, string> | null | undefined): (key: string, fallback?: string) => string;
2
+ //# sourceMappingURL=labels-t.pure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labels-t.pure.d.ts","sourceRoot":"","sources":["../../../src/runtime/shared/labels-t.pure.ts"],"names":[],"mappings":"AAOA,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,IACjE,KAAK,MAAM,EAAE,iBAAa,KAAG,MAAM,CAC5C"}
@@ -0,0 +1,10 @@
1
+ // Pure label accessor factory — no node builtins, no framework imports.
2
+ // Template frameworks load the dictionary server-side (+layout.server.ts
3
+ // load, a Vue data service, …), hand it to components through their own
4
+ // data flow, and build `t` locally:
5
+ //
6
+ // const t = makeFimoT(data.fimoLabels);
7
+ // <h1 {...fimoLabelAttrs('hero.title')}>{t('hero.title', 'Fallback')}</h1>
8
+ export function makeFimoT(labels) {
9
+ return (key, fallback = '') => labels?.[key] ?? fallback;
10
+ }
@@ -0,0 +1,26 @@
1
+ import { type FimoServerOptions } from '../wrapped/server.js';
2
+ export interface FimoStrapiFetchOptions extends FimoServerOptions {
3
+ /** Strapi REST path segment (pluralName) → Fimo type name. */
4
+ types: Record<string, string>;
5
+ /** Fimo type names that are single types (served as `{data:{}}`, not a list). */
6
+ singletons?: string[];
7
+ /** Path prefix before the content segment (Strapi default `/api`). */
8
+ apiPrefix?: string;
9
+ }
10
+ export interface ParsedStrapiUrl {
11
+ pluralName: string;
12
+ documentId?: string;
13
+ locale?: string;
14
+ pageSize?: number;
15
+ where?: Record<string, unknown>;
16
+ }
17
+ /**
18
+ * Parse a Strapi REST URL into the parts the Fimo read needs. Best-effort:
19
+ * pagination + locale + top-level `$eq` filters (enough for list, detail-by-slug,
20
+ * and singleton reads); richer `qs` filters are ignored (fake content tolerates
21
+ * an unfiltered set).
22
+ */
23
+ export declare function parseStrapiUrl(rawUrl: string, apiPrefix?: string): ParsedStrapiUrl | null;
24
+ /** Build a `fetch`-compatible function that serves scaffolded content from Fimo. */
25
+ export declare function createFimoStrapiFetch(options: FimoStrapiFetchOptions, realFetch?: typeof fetch): typeof fetch;
26
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/runtime/strapi/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG5E,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC/D,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAUD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,SAAS,GAAG,eAAe,GAAG,IAAI,CAkCzF;AAED,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,EAAE,SAAS,GAAE,OAAO,KAAa,GAAG,OAAO,KAAK,CAiCpH"}