fimo 0.20.0 → 0.21.0-experimental.1

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 (322) hide show
  1. package/README.md +1 -1
  2. package/assets/agent-templates/_default/GOAL.md +10 -0
  3. package/assets/agent-templates/_default/capabilities.yaml +10 -0
  4. package/assets/content-templates/shared/types.eta +1 -1
  5. package/assets/skills/fimo-cli/SKILL.md +2 -1
  6. package/assets/skills/fimo-cli/references/agents.md +136 -36
  7. package/assets/skills/fimo-cli/references/branches.md +8 -5
  8. package/assets/skills/fimo-cli/references/deploy.md +11 -2
  9. package/assets/skills/fimo-cli/references/domains.md +12 -0
  10. package/assets/skills/fimo-cli/references/forms.md +1 -1
  11. package/assets/skills/fimo-cli/references/init.md +9 -2
  12. package/assets/skills/fimo-cli/references/locales.md +1 -1
  13. package/assets/skills/fimo-cli/references/mcp.md +1 -1
  14. package/assets/skills/fimo-cli/references/media.md +18 -1
  15. package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +3 -1
  16. package/assets/skills/fimo-cli/references/projects.md +7 -7
  17. package/assets/skills/fimo-code/assets/react-router-locales/navigation.tsx +1 -1
  18. package/assets/skills/fimo-code/references/assets.md +2 -2
  19. package/assets/skills/fimo-code/references/best-practices/next.md +1 -1
  20. package/assets/skills/fimo-code/references/content/schema.md +23 -0
  21. package/assets/skills/fimo-code/references/forms.md +1 -1
  22. package/assets/skills/fimo-code/references/frameworks/astro.md +8 -2
  23. package/assets/skills/fimo-code/references/frameworks/compatibility.md +9 -9
  24. package/assets/skills/fimo-code/references/frameworks/hosting.md +17 -13
  25. package/assets/skills/fimo-code/references/frameworks/next/app-router.md +8 -9
  26. package/assets/skills/fimo-code/references/frameworks/next/locales.md +5 -5
  27. package/assets/skills/fimo-code/references/frameworks/next/pages-router.md +5 -5
  28. package/assets/skills/fimo-code/references/frameworks/next.md +41 -32
  29. package/assets/skills/fimo-code/references/frameworks/react-router.md +10 -7
  30. package/assets/skills/fimo-code/references/frameworks/sveltekit.md +22 -15
  31. package/assets/skills/fimo-code/references/frameworks/vite-react.md +7 -5
  32. package/assets/skills/fimo-code/references/labels.md +4 -4
  33. package/assets/skills/fimo-code/references/locales.md +2 -2
  34. package/assets/skills/fimo-code/references/ui.md +4 -4
  35. package/assets/skills/fimo-migration/SKILL.md +51 -30
  36. package/assets/skills/fimo-migration/references/frameworks/nextjs.md +12 -15
  37. package/assets/skills/fimo-migration/references/media.md +12 -8
  38. package/assets/skills/fimo-migration/references/qa.md +12 -11
  39. package/assets/skills/fimo-migration/references/workers/content-planner.md +33 -4
  40. package/assets/skills/fimo-migration/references/workers/validator.md +10 -0
  41. package/assets/skills/fimo-migration/references/workers.md +19 -10
  42. package/assets/skills/fimo-migration/references/workflow.md +29 -11
  43. package/assets/skills/fimo-studio/references/ai-chat.md +1 -1
  44. package/assets/skills/fimo-studio/references/billing-and-credits.md +18 -1
  45. package/assets/skills/fimo-studio/references/cms.md +2 -0
  46. package/assets/skills/fimo-studio/references/preview-and-responsive.md +1 -0
  47. package/assets/starters/fimo-site/template/src/pages/Contact.tsx +1 -1
  48. package/assets/starters/fimo-site/template/src/pages/SiteContent.tsx +1 -1
  49. package/assets/starters/fimo-site/template/src/schemas/HomePage.ts +3 -3
  50. package/assets/starters/fimo-site/template/src/schemas/HomePage.types.ts +1 -1
  51. package/dist/build/astro/config.d.ts +13 -2
  52. package/dist/build/astro/config.js +9 -24
  53. package/dist/build/next/moved.d.ts +2 -0
  54. package/dist/build/next/moved.js +2 -0
  55. package/dist/build/react/router-moved.d.ts +2 -0
  56. package/dist/build/react/router-moved.js +2 -0
  57. package/dist/build/react/router-preset-moved.d.ts +2 -0
  58. package/dist/build/react/router-preset-moved.js +2 -0
  59. package/dist/build/react/router-routes-moved.d.ts +2 -0
  60. package/dist/build/react/router-routes-moved.js +2 -0
  61. package/dist/build/react/ui-moved.d.ts +2 -0
  62. package/dist/build/react/ui-moved.js +2 -0
  63. package/dist/build/react/vite-moved.d.ts +2 -0
  64. package/dist/build/react/vite-moved.js +2 -0
  65. package/dist/build/sveltekit/config.d.ts +5 -4
  66. package/dist/build/sveltekit/config.js +6 -15
  67. package/dist/build/sveltekit/moved.d.ts +13 -0
  68. package/dist/build/sveltekit/moved.js +3 -0
  69. package/dist/build/vite/data-id.d.ts +11 -0
  70. package/dist/build/vite/data-id.js +20 -0
  71. package/dist/build/vite/plugins/runtime-env.d.ts +1 -1
  72. package/dist/build/vite/plugins/runtime-env.js +6 -2
  73. package/dist/build/vite/runtime-env.d.ts +2 -0
  74. package/dist/build/vite/runtime-env.js +1 -0
  75. package/dist/cli/bundle.json +1 -1
  76. package/dist/cli/index.js +115 -110
  77. package/dist/runtime/content/client/internal.js +1 -1
  78. package/dist/runtime/content/index.d.ts +6 -1
  79. package/dist/runtime/content/index.js +6 -0
  80. package/dist/runtime/i18n/index.d.ts +2 -0
  81. package/dist/runtime/i18n/index.js +1 -0
  82. package/dist/runtime/labels/index.d.ts +3 -0
  83. package/dist/runtime/labels/index.js +2 -0
  84. package/dist/runtime/preview/index.d.ts +5 -0
  85. package/dist/runtime/preview/index.js +4 -0
  86. package/dist/runtime/preview/script.d.ts +3 -0
  87. package/dist/runtime/preview/script.js +14 -0
  88. package/dist/runtime/primitives/lib/index.d.ts +2 -0
  89. package/dist/runtime/primitives/lib/index.js +2 -0
  90. package/dist/runtime/seo/index.d.ts +0 -8
  91. package/dist/runtime/seo/index.js +0 -8
  92. package/dist/runtime/shared/config.d.ts +6 -0
  93. package/dist/runtime/shared/config.js +4 -0
  94. package/dist/runtime/shared/local-runtime-env.d.ts +2 -2
  95. package/dist/runtime/shared/local-runtime-env.js +7 -5
  96. package/dist/runtime/templates.d.ts +20 -4
  97. package/dist/runtime/templates.js +60 -18
  98. package/dist/scripts/extract-translations.js +8 -3
  99. package/dist/scripts/index.d.ts +3 -0
  100. package/dist/scripts/index.js +2 -0
  101. package/dist/scripts/sync-forms.js +21 -9
  102. package/dist/scripts/sync-schemas.js +129 -21
  103. package/dist/scripts/validate-schemas.js +63 -2
  104. package/package.json +72 -71
  105. package/release.json +2 -2
  106. package/templates/astro/AGENTS.md +1 -1
  107. package/templates/astro/astro.config.mjs +1 -1
  108. package/templates/astro/package.json +4 -2
  109. package/templates/astro/pnpm-workspace.yaml +6 -2
  110. package/templates/nextjs/.fimo/config.json +1 -2
  111. package/templates/nextjs/AGENTS.md +6 -16
  112. package/templates/nextjs/next.config.ts +4 -2
  113. package/templates/nextjs/package.json +4 -2
  114. package/templates/nextjs/pnpm-workspace.yaml +6 -2
  115. package/templates/nextjs/src/app/layout.tsx +16 -0
  116. package/templates/nextjs/src/locales.ts +3 -6
  117. package/templates/react-router/AGENTS.md +1 -1
  118. package/templates/react-router/package.json +5 -2
  119. package/templates/react-router/pnpm-workspace.yaml +6 -6
  120. package/templates/react-router/react-router.config.ts +1 -1
  121. package/templates/react-router/src/pages/legal/LegalPage.tsx +1 -1
  122. package/templates/react-router/src/root.tsx +1 -1
  123. package/templates/react-router/src/vite-env.d.ts +0 -1
  124. package/templates/react-router/vite.config.ts +1 -1
  125. package/templates/sveltekit/AGENTS.md +1 -1
  126. package/templates/sveltekit/package.json +4 -2
  127. package/templates/sveltekit/pnpm-workspace.yaml +6 -2
  128. package/templates/sveltekit/src/routes/+layout.server.ts +1 -1
  129. package/templates/sveltekit/src/routes/+layout.svelte +1 -1
  130. package/templates/sveltekit/svelte.config.js +1 -1
  131. package/templates/sveltekit/vite.config.ts +1 -1
  132. package/assets/sveltekit/components/Boolean.svelte +0 -19
  133. package/assets/sveltekit/components/Date.svelte +0 -33
  134. package/assets/sveltekit/components/DateTime.svelte +0 -35
  135. package/assets/sveltekit/components/FimoProvider.svelte +0 -35
  136. package/assets/sveltekit/components/Image.svelte +0 -80
  137. package/assets/sveltekit/components/Json.svelte +0 -18
  138. package/assets/sveltekit/components/Label.svelte +0 -16
  139. package/assets/sveltekit/components/Number.svelte +0 -21
  140. package/assets/sveltekit/components/RichText.svelte +0 -19
  141. package/assets/sveltekit/components/Text.svelte +0 -30
  142. package/assets/sveltekit/components/Video.svelte +0 -37
  143. package/assets/sveltekit/components/index.d.ts +0 -11
  144. package/assets/sveltekit/components/index.js +0 -11
  145. package/dist/build/next/config.d.ts +0 -17
  146. package/dist/build/next/config.js +0 -66
  147. package/dist/build/sveltekit/data-id.d.ts +0 -3
  148. package/dist/build/sveltekit/data-id.js +0 -171
  149. package/dist/build/sveltekit/files/edge.js +0 -68
  150. package/dist/build/sveltekit/files/serverless.js +0 -42
  151. package/dist/build/sveltekit/vite.d.ts +0 -12
  152. package/dist/build/sveltekit/vite.js +0 -14
  153. package/dist/build/vite/index.d.ts +0 -42
  154. package/dist/build/vite/index.js +0 -160
  155. package/dist/build/vite/plugins/content-sync.d.ts +0 -11
  156. package/dist/build/vite/plugins/content-sync.js +0 -41
  157. package/dist/build/vite/plugins/data-id.d.ts +0 -12
  158. package/dist/build/vite/plugins/data-id.js +0 -109
  159. package/dist/build/vite/plugins/fimo-config.d.ts +0 -12
  160. package/dist/build/vite/plugins/fimo-config.js +0 -68
  161. package/dist/build/vite/plugins/overlay.d.ts +0 -3
  162. package/dist/build/vite/plugins/overlay.js +0 -154
  163. package/dist/build/vite/plugins/robots.d.ts +0 -10
  164. package/dist/build/vite/plugins/robots.js +0 -56
  165. package/dist/build/vite/plugins/seo.d.ts +0 -3
  166. package/dist/build/vite/plugins/seo.js +0 -112
  167. package/dist/build/vite/plugins/server-config.d.ts +0 -3
  168. package/dist/build/vite/plugins/server-config.js +0 -36
  169. package/dist/build/vite/plugins/sitemap.d.ts +0 -3
  170. package/dist/build/vite/plugins/sitemap.js +0 -73
  171. package/dist/build/vite/plugins/translations.d.ts +0 -11
  172. package/dist/build/vite/plugins/translations.js +0 -601
  173. package/dist/runtime/app/FimoProviders.d.ts +0 -30
  174. package/dist/runtime/app/FimoProviders.js +0 -186
  175. package/dist/runtime/app/FimoScripts.d.ts +0 -14
  176. package/dist/runtime/app/FimoScripts.js +0 -48
  177. package/dist/runtime/app/index.d.ts +0 -8
  178. package/dist/runtime/app/index.js +0 -4
  179. package/dist/runtime/app/prefetch.d.ts +0 -9
  180. package/dist/runtime/app/prefetch.js +0 -39
  181. package/dist/runtime/content/DataSourcesProvider.d.ts +0 -4
  182. package/dist/runtime/content/DataSourcesProvider.js +0 -63
  183. package/dist/runtime/content/RefreshContentProvider.d.ts +0 -19
  184. package/dist/runtime/content/RefreshContentProvider.js +0 -71
  185. package/dist/runtime/content/client/createContentClient.d.ts +0 -7
  186. package/dist/runtime/content/client/createContentClient.js +0 -7
  187. package/dist/runtime/content/client/createSingletonClient.d.ts +0 -5
  188. package/dist/runtime/content/client/createSingletonClient.js +0 -6
  189. package/dist/runtime/content/client/react-content-client.d.ts +0 -10
  190. package/dist/runtime/content/client/react-content-client.js +0 -165
  191. package/dist/runtime/content/client/react-singleton-client.d.ts +0 -7
  192. package/dist/runtime/content/client/react-singleton-client.js +0 -38
  193. package/dist/runtime/content/client/types.d.ts +0 -42
  194. package/dist/runtime/content/client/types.js +0 -1
  195. package/dist/runtime/content/client/useQueryLocale.d.ts +0 -2
  196. package/dist/runtime/content/client/useQueryLocale.js +0 -5
  197. package/dist/runtime/content/client/vite-runtime.d.ts +0 -3
  198. package/dist/runtime/content/client/vite-runtime.js +0 -23
  199. package/dist/runtime/content/utils/retrieve-data-sources.d.ts +0 -29
  200. package/dist/runtime/content/utils/retrieve-data-sources.js +0 -107
  201. package/dist/runtime/core/AppErrorBoundary.d.ts +0 -10
  202. package/dist/runtime/core/AppErrorBoundary.js +0 -27
  203. package/dist/runtime/core/ViteLifecycles.d.ts +0 -5
  204. package/dist/runtime/core/ViteLifecycles.js +0 -35
  205. package/dist/runtime/i18n/FimoLocaleContext.d.ts +0 -9
  206. package/dist/runtime/i18n/FimoLocaleContext.js +0 -17
  207. package/dist/runtime/iframe/ConsoleErrorProvider.d.ts +0 -3
  208. package/dist/runtime/iframe/ConsoleErrorProvider.js +0 -103
  209. package/dist/runtime/iframe/ScreenshotProvider.d.ts +0 -3
  210. package/dist/runtime/iframe/ScreenshotProvider.js +0 -60
  211. package/dist/runtime/iframe/runtime/overlay-hmr.d.ts +0 -2
  212. package/dist/runtime/iframe/runtime/overlay-hmr.js +0 -27
  213. package/dist/runtime/iframe/runtime/overlay-runtime.d.ts +0 -2
  214. package/dist/runtime/iframe/runtime/overlay-runtime.js +0 -103
  215. package/dist/runtime/index.d.ts +0 -22
  216. package/dist/runtime/index.js +0 -23
  217. package/dist/runtime/next/client-runtime.d.ts +0 -3
  218. package/dist/runtime/next/client-runtime.js +0 -24
  219. package/dist/runtime/next/client.d.ts +0 -28
  220. package/dist/runtime/next/client.js +0 -25
  221. package/dist/runtime/next/facade.d.ts +0 -8
  222. package/dist/runtime/next/facade.js +0 -34
  223. package/dist/runtime/next/labels.d.ts +0 -7
  224. package/dist/runtime/next/labels.js +0 -9
  225. package/dist/runtime/next/preview.d.ts +0 -13
  226. package/dist/runtime/next/preview.js +0 -34
  227. package/dist/runtime/next/primitives/Text.d.ts +0 -10
  228. package/dist/runtime/next/primitives/Text.js +0 -18
  229. package/dist/runtime/next/primitives/server.d.ts +0 -11
  230. package/dist/runtime/next/primitives/server.js +0 -54
  231. package/dist/runtime/next/provider.d.ts +0 -18
  232. package/dist/runtime/next/provider.js +0 -39
  233. package/dist/runtime/next/server-runtime.d.ts +0 -3
  234. package/dist/runtime/next/server-runtime.js +0 -23
  235. package/dist/runtime/next/server.d.ts +0 -21
  236. package/dist/runtime/next/server.js +0 -16
  237. package/dist/runtime/primitives/index.d.ts +0 -16
  238. package/dist/runtime/primitives/index.js +0 -17
  239. package/dist/runtime/react/primitives/contracts.d.ts +0 -94
  240. package/dist/runtime/react/primitives/contracts.js +0 -1
  241. package/dist/runtime/react/primitives/editable/Boolean.d.ts +0 -5
  242. package/dist/runtime/react/primitives/editable/Boolean.js +0 -11
  243. package/dist/runtime/react/primitives/editable/Date.d.ts +0 -4
  244. package/dist/runtime/react/primitives/editable/Date.js +0 -12
  245. package/dist/runtime/react/primitives/editable/DateTime.d.ts +0 -4
  246. package/dist/runtime/react/primitives/editable/DateTime.js +0 -13
  247. package/dist/runtime/react/primitives/editable/Image.d.ts +0 -4
  248. package/dist/runtime/react/primitives/editable/Image.js +0 -10
  249. package/dist/runtime/react/primitives/editable/Json.d.ts +0 -5
  250. package/dist/runtime/react/primitives/editable/Json.js +0 -11
  251. package/dist/runtime/react/primitives/editable/RichText.d.ts +0 -4
  252. package/dist/runtime/react/primitives/editable/RichText.js +0 -11
  253. package/dist/runtime/react/primitives/editable/Text.d.ts +0 -20
  254. package/dist/runtime/react/primitives/editable/Text.js +0 -36
  255. package/dist/runtime/react/primitives/editable/Video.d.ts +0 -4
  256. package/dist/runtime/react/primitives/editable/Video.js +0 -10
  257. package/dist/runtime/react/primitives/renderers/DateRenderer.d.ts +0 -17
  258. package/dist/runtime/react/primitives/renderers/DateRenderer.js +0 -17
  259. package/dist/runtime/react/primitives/renderers/ImageRenderer.d.ts +0 -8
  260. package/dist/runtime/react/primitives/renderers/ImageRenderer.js +0 -31
  261. package/dist/runtime/react/primitives/renderers/RichTextRenderer.d.ts +0 -12
  262. package/dist/runtime/react/primitives/renderers/RichTextRenderer.js +0 -135
  263. package/dist/runtime/react/primitives/renderers/StaticImage.d.ts +0 -35
  264. package/dist/runtime/react/primitives/renderers/StaticImage.js +0 -58
  265. package/dist/runtime/react/primitives/renderers/VideoRenderer.d.ts +0 -8
  266. package/dist/runtime/react/primitives/renderers/VideoRenderer.js +0 -10
  267. package/dist/runtime/react/useFimoLiveValue.d.ts +0 -20
  268. package/dist/runtime/react/useFimoLiveValue.js +0 -43
  269. package/dist/runtime/react-router/active-routes.d.ts +0 -12
  270. package/dist/runtime/react-router/active-routes.js +0 -60
  271. package/dist/runtime/react-router/index.d.ts +0 -16
  272. package/dist/runtime/react-router/index.js +0 -20
  273. package/dist/runtime/react-router/legacy/routes.d.ts +0 -35
  274. package/dist/runtime/react-router/legacy/routes.js +0 -86
  275. package/dist/runtime/react-router/navigation-utils.d.ts +0 -8
  276. package/dist/runtime/react-router/navigation-utils.js +0 -36
  277. package/dist/runtime/react-router/navigation.d.ts +0 -12
  278. package/dist/runtime/react-router/navigation.js +0 -28
  279. package/dist/runtime/react-router/preset.d.ts +0 -30
  280. package/dist/runtime/react-router/preset.js +0 -33
  281. package/dist/runtime/routing/AppResetScrollOnNavigate.d.ts +0 -2
  282. package/dist/runtime/routing/AppResetScrollOnNavigate.js +0 -12
  283. package/dist/runtime/routing/AppRoutesProvider.d.ts +0 -25
  284. package/dist/runtime/routing/AppRoutesProvider.js +0 -112
  285. package/dist/runtime/seo/buildSeoForPath.d.ts +0 -74
  286. package/dist/runtime/seo/buildSeoForPath.js +0 -55
  287. package/dist/runtime/seo/htmlProps.d.ts +0 -13
  288. package/dist/runtime/seo/htmlProps.js +0 -15
  289. package/dist/runtime/sveltekit/content.d.ts +0 -25
  290. package/dist/runtime/sveltekit/content.js +0 -33
  291. package/dist/runtime/sveltekit/context-contract.d.ts +0 -5
  292. package/dist/runtime/sveltekit/context-contract.js +0 -2
  293. package/dist/runtime/sveltekit/context.d.ts +0 -8
  294. package/dist/runtime/sveltekit/context.js +0 -25
  295. package/dist/runtime/sveltekit/forms.d.ts +0 -15
  296. package/dist/runtime/sveltekit/forms.js +0 -15
  297. package/dist/runtime/sveltekit/index.d.ts +0 -9
  298. package/dist/runtime/sveltekit/index.js +0 -5
  299. package/dist/runtime/sveltekit/internal.d.ts +0 -6
  300. package/dist/runtime/sveltekit/internal.js +0 -12
  301. package/dist/runtime/sveltekit/labels.d.ts +0 -20
  302. package/dist/runtime/sveltekit/labels.js +0 -13
  303. package/dist/runtime/sveltekit/preview.d.ts +0 -28
  304. package/dist/runtime/sveltekit/preview.js +0 -82
  305. package/dist/runtime/sveltekit/runtime.d.ts +0 -9
  306. package/dist/runtime/sveltekit/runtime.js +0 -26
  307. package/dist/runtime/t/OptionalTracking.d.ts +0 -13
  308. package/dist/runtime/t/OptionalTracking.js +0 -28
  309. package/dist/runtime/t/Pageview.d.ts +0 -9
  310. package/dist/runtime/t/Pageview.js +0 -118
  311. package/dist/runtime/vite/Label.d.ts +0 -13
  312. package/dist/runtime/vite/Label.js +0 -16
  313. package/dist/runtime/vite/primitives/Images.d.ts +0 -4
  314. package/dist/runtime/vite/primitives/Images.js +0 -12
  315. package/dist/runtime/vite/translations.d.ts +0 -28
  316. package/dist/runtime/vite/translations.js +0 -103
  317. package/templates/nextjs/src/app/(default)/layout.tsx +0 -10
  318. package/templates/nextjs/src/app/[locale]/layout.tsx +0 -22
  319. package/templates/nextjs/src/app/[locale]/page.tsx +0 -1
  320. package/templates/nextjs/src/components/Document.tsx +0 -26
  321. package/templates/nextjs/src/components/FimoPreviewBridge.tsx +0 -13
  322. /package/templates/nextjs/src/app/{(default)/page.tsx → page.tsx} +0 -0
@@ -1,41 +0,0 @@
1
- import { resolve } from 'path';
2
- import { syncForms } from '../../../scripts/sync-forms.js';
3
- import { syncSchemas } from '../../../scripts/sync-schemas.js';
4
- /**
5
- * Keeps generated schema + form clients in sync while the Vite dev server is
6
- * running.
7
- *
8
- * Production builds are deliberately read-only. Explicit authoring commands
9
- * (`fimo validate`, `fimo schemas push`, and `fimo forms push`) own initial
10
- * generation before a build starts.
11
- */
12
- export default function contentSyncPlugin() {
13
- let rootDir = process.cwd();
14
- return {
15
- name: 'vite-plugin-fimo-content-sync',
16
- enforce: 'pre',
17
- configResolved(config) {
18
- rootDir = config.root;
19
- },
20
- configureServer(server) {
21
- const schemasGlob = resolve(rootDir, 'src/schemas');
22
- const formsGlob = resolve(rootDir, 'src/forms');
23
- server.watcher.add([schemasGlob, formsGlob]);
24
- server.watcher.on('add', onChange);
25
- server.watcher.on('change', onChange);
26
- server.watcher.on('unlink', onChange);
27
- function onChange(file) {
28
- if (!file.endsWith('.json')) {
29
- return;
30
- }
31
- if (file.startsWith(schemasGlob)) {
32
- syncSchemas({ cwd: rootDir, framework: 'vite', verbose: false });
33
- return;
34
- }
35
- if (file.startsWith(formsGlob)) {
36
- syncForms({ cwd: rootDir, verbose: false });
37
- }
38
- }
39
- },
40
- };
41
- }
@@ -1,12 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export default function dataIdPlugin(): Plugin;
3
- /**
4
- * 1-based line and 0-based column of `offset` in `code`. Shared with the
5
- * SvelteKit data-id plugin: both derive the stable `<path>#<line>-<column>`
6
- * id from it, so the convention must not change independently.
7
- */
8
- export declare function getLineColumn(code: string, offset: number): {
9
- line: number;
10
- column: number;
11
- };
12
- //# sourceMappingURL=data-id.d.ts.map
@@ -1,109 +0,0 @@
1
- import { createFilter } from '@rollup/pluginutils';
2
- import { parseSync } from 'oxc-parser';
3
- export default function dataIdPlugin() {
4
- let config;
5
- return {
6
- name: 'vite-plugin-data-id',
7
- enforce: 'pre',
8
- configResolved(resolvedConfig) {
9
- config = resolvedConfig;
10
- },
11
- async transform(code, id) {
12
- if (config?.command === 'build') {
13
- return null;
14
- }
15
- const filter = createFilter(/\.(jsx|tsx)$/);
16
- if (!filter(id)) {
17
- return null;
18
- }
19
- if (id.includes('components/ui/') || id.includes('.fimo/ui/')) {
20
- return null;
21
- }
22
- try {
23
- const result = parseSync(id, code);
24
- const ast = result.program;
25
- const insertions = [];
26
- function visit(node) {
27
- if (!node || typeof node !== 'object') {
28
- return;
29
- }
30
- if (node.type === 'JSXOpeningElement') {
31
- const attributes = node.attributes || [];
32
- const hasId = attributes.some((attr) => attr.type === 'JSXAttribute' &&
33
- attr.name?.type === 'JSXIdentifier' &&
34
- attr.name?.name === 'data-fimo-id');
35
- if (!hasId && node.start != null) {
36
- const line = getLineColumn(code, node.start);
37
- const relativePath = id.replace(process.cwd() + '/', '');
38
- const fimoId = `${relativePath}#${line.line}-${line.column}`;
39
- const nameEnd = getNameEnd(node);
40
- insertions.push({
41
- offset: nameEnd,
42
- value: ` data-fimo-id="${fimoId}"`,
43
- });
44
- }
45
- }
46
- for (const key of Object.keys(node)) {
47
- if (key === 'parent') {
48
- continue;
49
- }
50
- const child = node[key];
51
- if (Array.isArray(child)) {
52
- for (const item of child) {
53
- visit(item);
54
- }
55
- }
56
- else if (typeof child === 'object' && child !== null) {
57
- visit(child);
58
- }
59
- }
60
- }
61
- visit(ast);
62
- if (insertions.length === 0) {
63
- return null;
64
- }
65
- insertions.sort((a, b) => b.offset - a.offset);
66
- let transformed = code;
67
- for (const insertion of insertions) {
68
- transformed = transformed.slice(0, insertion.offset) + insertion.value + transformed.slice(insertion.offset);
69
- }
70
- return {
71
- code: transformed,
72
- map: null,
73
- };
74
- }
75
- catch {
76
- return null;
77
- }
78
- },
79
- };
80
- }
81
- /**
82
- * 1-based line and 0-based column of `offset` in `code`. Shared with the
83
- * SvelteKit data-id plugin: both derive the stable `<path>#<line>-<column>`
84
- * id from it, so the convention must not change independently.
85
- */
86
- export function getLineColumn(code, offset) {
87
- let line = 1;
88
- let column = 0;
89
- for (let i = 0; i < offset && i < code.length; i++) {
90
- if (code[i] === '\n') {
91
- line++;
92
- column = 0;
93
- }
94
- else {
95
- column++;
96
- }
97
- }
98
- return { line, column };
99
- }
100
- function getNameEnd(openingElement) {
101
- const name = openingElement.name;
102
- if (name?.end != null) {
103
- if (openingElement.typeParameters?.end != null) {
104
- return openingElement.typeParameters.end;
105
- }
106
- return name.end;
107
- }
108
- return openingElement.start;
109
- }
@@ -1,12 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- /**
3
- * Vite plugin that exposes the user's `.fimo/config.json`:
4
- * - As a virtual module `virtual:fimo-config` that browser-running package
5
- * code (fimo/seo, fimo/app) imports to read `seo`, `routes`, etc. without
6
- * relying on `readFileSync` at runtime.
7
- *
8
- * Edits to the project config invalidate the virtual module so HMR picks up
9
- * the new values without a full reload.
10
- */
11
- export default function fimoConfigPlugin(): Plugin;
12
- //# sourceMappingURL=fimo-config.d.ts.map
@@ -1,68 +0,0 @@
1
- import { readFileSync } from 'fs';
2
- import { resolveFimoConfigPath } from '../../../runtime/shared/fimo-config.server.js';
3
- const VIRTUAL_ID = 'virtual:fimo-config';
4
- const RESOLVED_ID = '\0' + VIRTUAL_ID;
5
- /**
6
- * Vite plugin that exposes the user's `.fimo/config.json`:
7
- * - As a virtual module `virtual:fimo-config` that browser-running package
8
- * code (fimo/seo, fimo/app) imports to read `seo`, `routes`, etc. without
9
- * relying on `readFileSync` at runtime.
10
- *
11
- * Edits to the project config invalidate the virtual module so HMR picks up
12
- * the new values without a full reload.
13
- */
14
- export default function fimoConfigPlugin() {
15
- let configPath = resolveFimoConfigPath(process.cwd());
16
- return {
17
- name: 'vite-plugin-fimo-config',
18
- config(userConfig) {
19
- const root = typeof userConfig.root === 'string' ? userConfig.root : process.cwd();
20
- configPath = resolveFimoConfigPath(root);
21
- },
22
- resolveId(id) {
23
- if (id === VIRTUAL_ID) {
24
- return RESOLVED_ID;
25
- }
26
- return null;
27
- },
28
- load(id) {
29
- if (id !== RESOLVED_ID) {
30
- return null;
31
- }
32
- this.addWatchFile(configPath);
33
- try {
34
- const raw = readFileSync(configPath, 'utf-8');
35
- return `export default ${raw};`;
36
- }
37
- catch {
38
- return 'export default {};';
39
- }
40
- },
41
- transformIndexHtml(html) {
42
- const lang = readHtmlLang(configPath);
43
- if (/<html\b[^>]*\blang=/.test(html)) {
44
- return html.replace(/(<html\b[^>]*\blang=["'])[^"']*(["'])/i, `$1${lang}$2`);
45
- }
46
- return html.replace(/<html\b([^>]*)>/i, `<html$1 lang="${lang}">`);
47
- },
48
- handleHotUpdate(ctx) {
49
- if (ctx.file !== configPath) {
50
- return;
51
- }
52
- const mod = ctx.server.moduleGraph.getModuleById(RESOLVED_ID);
53
- if (mod) {
54
- ctx.server.moduleGraph.invalidateModule(mod);
55
- return [mod];
56
- }
57
- },
58
- };
59
- }
60
- function readHtmlLang(configPath) {
61
- try {
62
- const raw = JSON.parse(readFileSync(configPath, 'utf-8'));
63
- return (raw.i18n?.defaultLocale ?? 'en').replace('_', '-');
64
- }
65
- catch {
66
- return 'en';
67
- }
68
- }
@@ -1,3 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export default function overlayPlugin(): Plugin;
3
- //# sourceMappingURL=overlay.d.ts.map
@@ -1,154 +0,0 @@
1
- import { readFileSync } from 'fs';
2
- import { dirname, resolve } from 'path';
3
- import { fileURLToPath } from 'url';
4
- // Compiled overlay runtime lives at `dist/runtime/iframe/runtime/*.js`
5
- // once this package is built. The plugin itself lives at
6
- // `dist/build/vite/plugins/overlay.js`, so the runtime is four directories up
7
- // (plugins → vite → build → dist) then back down into runtime/iframe/runtime/.
8
- function resolveRuntimeDir() {
9
- const here = dirname(fileURLToPath(import.meta.url));
10
- return resolve(here, '..', '..', '..', 'runtime', 'iframe', 'runtime');
11
- }
12
- // Two virtual modules so `FimoScripts` can wire both halves of the overlay:
13
- //
14
- // `virtual:fimo-overlay-runtime` — exports the runtime source as a string.
15
- // FimoScripts embeds it inline. Handles window.error +
16
- // unhandledrejection + DOM overlay. Inline because we want it loaded as
17
- // early as possible.
18
- //
19
- // `virtual:fimo-overlay-hmr` — a real ES module (side-effect import).
20
- // Handles vite:error / vite:afterUpdate. Must be vite-transformed so
21
- // `import.meta.hot` is defined; inline scripts bypass vite's transform.
22
- //
23
- // In production both resolve to no-ops so the overlay machinery is dev-only.
24
- // The previous `transformIndexHtml` approach only fired when vite served an
25
- // `index.html`, which react-router framework mode bypasses entirely.
26
- const VIRTUAL_RUNTIME = 'virtual:fimo-overlay-runtime';
27
- const VIRTUAL_HMR = 'virtual:fimo-overlay-hmr';
28
- // When the user's code has a parse / load error at the time of a full page
29
- // request (e.g. hard reload while the file is broken, or cold-loading the
30
- // preview iframe against a broken sandbox), vite serves a 500 HTML response
31
- // containing the structured error as a JS object literal:
32
- //
33
- // <script type="module">
34
- // const error = { message, stack, id, frame, pluginCode, ... };
35
- // const { ErrorOverlay } = await import("/@vite/client");
36
- // document.body.appendChild(new ErrorOverlay(error));
37
- // </script>
38
- //
39
- // In framework mode, none of the user's modules — including the inline
40
- // overlay-runtime and the side-effect HMR import — ever load on this kind of
41
- // response, so the parent UI is left blind. We extract that object literal
42
- // and append a script that postMessages it to `window.parent` using the same
43
- // `preview/error` + `app/error` shape the runtime uses, so the dashboard's
44
- // overlay state machine fires identically to the HMR path.
45
- function injectErrorForwarder(html) {
46
- // Vite's error page structure:
47
- // const error = { ...escaped JSON including the whole source as
48
- // `pluginCode` (which contains its own `};` sequences) }
49
- // <newline + spaces>try {
50
- // Anchor on `try {` (which always immediately follows) so the lazy
51
- // matcher backtracks past `}` sequences embedded inside the source.
52
- // The trailing `;` is optional — vite relies on ASI here.
53
- const match = html.match(/const error = (\{[\s\S]*?\})\s*;?\s*try\s*\{/);
54
- if (!match)
55
- return html;
56
- const errorLiteral = match[1];
57
- const script = '<script>(function(){try{var e=' +
58
- errorLiteral +
59
- ';if(window.parent&&window.parent!==window){' +
60
- 'var p={heading:"Build Error",message:(e&&e.message)||"",stack:(e&&e.stack)||""};' +
61
- 'window.parent.postMessage({type:"preview/error",payload:p},"*");' +
62
- 'window.parent.postMessage({type:"app/error",payload:p},"*");' +
63
- '}}catch(_){}}());</script>';
64
- if (html.includes('</body>'))
65
- return html.replace('</body>', script + '</body>');
66
- return html + script;
67
- }
68
- export default function overlayPlugin() {
69
- let isDev = false;
70
- return {
71
- name: 'vite-plugin-overlay',
72
- config(_, env) {
73
- isDev = env.command === 'serve';
74
- },
75
- resolveId(id) {
76
- if (id === VIRTUAL_RUNTIME || id === VIRTUAL_HMR)
77
- return id;
78
- return undefined;
79
- },
80
- load(id) {
81
- if (id === VIRTUAL_RUNTIME) {
82
- if (!isDev)
83
- return 'export default "";';
84
- try {
85
- const runtime = readFileSync(resolve(resolveRuntimeDir(), 'overlay-runtime.js'), 'utf-8');
86
- return `export default ${JSON.stringify(runtime)};`;
87
- }
88
- catch {
89
- return 'export default "";';
90
- }
91
- }
92
- if (id === VIRTUAL_HMR) {
93
- if (!isDev)
94
- return 'export {};';
95
- try {
96
- return readFileSync(resolve(resolveRuntimeDir(), 'overlay-hmr.js'), 'utf-8');
97
- }
98
- catch {
99
- return 'export {};';
100
- }
101
- }
102
- return undefined;
103
- },
104
- configureServer(server) {
105
- server.middlewares.use((_req, res, next) => {
106
- const chunks = [];
107
- const origWrite = res.write.bind(res);
108
- const origEnd = res.end.bind(res);
109
- let capturing = false;
110
- // Capture every 500 response; sniff by body content in
111
- // `injectErrorForwarder` since vite emits its error page without a
112
- // Content-Type at the moment res.end() is called.
113
- const shouldCapture = () => res.statusCode === 500;
114
- // The Connect / Node response.write & end signatures accept Buffer
115
- // | string | Uint8Array; we accept everything and normalise to Buffer
116
- // so concat works regardless of how vite chose to emit the chunks.
117
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
118
- res.write = function (chunk, ...rest) {
119
- if (!capturing && shouldCapture())
120
- capturing = true;
121
- if (capturing) {
122
- if (chunk)
123
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
124
- return true;
125
- }
126
- return origWrite(chunk, ...rest);
127
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
- };
129
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
- res.end = function (chunk, ...rest) {
131
- if (!capturing && shouldCapture())
132
- capturing = true;
133
- if (!capturing)
134
- return origEnd(chunk, ...rest);
135
- if (chunk)
136
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
137
- const html = injectErrorForwarder(Buffer.concat(chunks).toString('utf8'));
138
- const body = Buffer.from(html, 'utf8');
139
- // Vite sets Content-Length before us; rewrite to match the new body.
140
- try {
141
- res.setHeader('content-length', String(body.byteLength));
142
- }
143
- catch {
144
- // Headers already sent — ignore, content-length will be wrong but
145
- // browsers tolerate trailing data on HTTP/1.1 keep-alive.
146
- }
147
- return origEnd(body, ...rest);
148
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
149
- };
150
- next();
151
- });
152
- },
153
- };
154
- }
@@ -1,10 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- /**
3
- * Emit a minimal `robots.txt` (allow-all + Sitemap reference if `seo.url` is
4
- * set in `.fimo/config.json`). Serves at `/robots.txt` in dev; emits as a
5
- * static asset at build time.
6
- *
7
- * Opt-in via `fimo({ robots: true })` in your `vite.config.ts`.
8
- */
9
- export default function robotsPlugin(): Plugin;
10
- //# sourceMappingURL=robots.d.ts.map
@@ -1,56 +0,0 @@
1
- import { readFileSync } from 'fs';
2
- import { resolveFimoConfigPath } from '../../../runtime/shared/fimo-config.server.js';
3
- function readSeoUrl() {
4
- try {
5
- const raw = readFileSync(resolveFimoConfigPath(process.cwd()), 'utf-8');
6
- const config = JSON.parse(raw);
7
- return config.seo?.url;
8
- }
9
- catch {
10
- return undefined;
11
- }
12
- }
13
- function buildRobotsTxt(baseUrl) {
14
- const lines = ['User-agent: *', 'Allow: /'];
15
- if (baseUrl) {
16
- try {
17
- const sitemapUrl = new URL('/sitemap.xml', baseUrl).toString();
18
- lines.push('', `Sitemap: ${sitemapUrl}`);
19
- }
20
- catch {
21
- // Invalid baseUrl — skip the Sitemap directive.
22
- }
23
- }
24
- return lines.join('\n') + '\n';
25
- }
26
- /**
27
- * Emit a minimal `robots.txt` (allow-all + Sitemap reference if `seo.url` is
28
- * set in `.fimo/config.json`). Serves at `/robots.txt` in dev; emits as a
29
- * static asset at build time.
30
- *
31
- * Opt-in via `fimo({ robots: true })` in your `vite.config.ts`.
32
- */
33
- export default function robotsPlugin() {
34
- return {
35
- name: 'fimo:robots',
36
- configureServer(server) {
37
- server.middlewares.use((req, res, next) => {
38
- if (req.url?.split('?')[0] !== '/robots.txt') {
39
- next();
40
- return;
41
- }
42
- const baseUrl = readSeoUrl();
43
- res.setHeader('Content-Type', 'text/plain; charset=utf-8');
44
- res.end(buildRobotsTxt(baseUrl));
45
- });
46
- },
47
- generateBundle() {
48
- const baseUrl = readSeoUrl();
49
- this.emitFile({
50
- type: 'asset',
51
- fileName: 'robots.txt',
52
- source: buildRobotsTxt(baseUrl),
53
- });
54
- },
55
- };
56
- }
@@ -1,3 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export default function seoPlugin(): Plugin;
3
- //# sourceMappingURL=seo.d.ts.map
@@ -1,112 +0,0 @@
1
- import { normalizePathname, resolveSeoForPath } from '../../../runtime/seo/resolver.js';
2
- import { getConfigServer } from '../../../runtime/shared/fimo-config.server.js';
3
- class HtmlTag {
4
- tags = [];
5
- addMeta(name, content) {
6
- this.tags.push({ tag: 'meta', attrs: { name, content } });
7
- }
8
- addProperty(property, content) {
9
- this.tags.push({ tag: 'meta', attrs: { property, content } });
10
- }
11
- addLink(rel, href) {
12
- this.tags.push({ tag: 'link', attrs: { rel, href } });
13
- }
14
- list() {
15
- return this.tags;
16
- }
17
- }
18
- export default function seoPlugin() {
19
- let rootDir;
20
- return {
21
- name: 'vite-plugin-seo',
22
- configResolved(config) {
23
- rootDir = config.root;
24
- },
25
- transformIndexHtml(html, ctx) {
26
- try {
27
- const config = getConfigServer(rootDir);
28
- const pathname = normalizePathname(ctx?.path ?? '/');
29
- const seo = resolveSeoForPath(pathname, config);
30
- if (!seo) {
31
- return html;
32
- }
33
- let nextHtml = html;
34
- if (seo.title) {
35
- if (/<title>[\s\S]*?<\/title>/.test(nextHtml)) {
36
- nextHtml = nextHtml.replace(/<title>[\s\S]*?<\/title>/, `<title>${seo.title}</title>`);
37
- }
38
- else {
39
- nextHtml = nextHtml.replace('<head>', `<head>\n <title>${seo.title}</title>`);
40
- }
41
- }
42
- // Remove existing meta/link tags that we will re-inject to avoid duplication
43
- // (e.g. when the source index.html already contains og:/twitter: tags from the user's original site)
44
- nextHtml = nextHtml
45
- .replace(/<meta\b[^>]*\bname=["']description["'][^>]*>/gi, '')
46
- .replace(/<meta\b[^>]*\bname=["']robots["'][^>]*>/gi, '')
47
- .replace(/<meta\b[^>]*\bname=["']theme-color["'][^>]*>/gi, '')
48
- .replace(/<meta\b[^>]*\b(?:name|property)=["']og:[^"']*["'][^>]*>/gi, '')
49
- .replace(/<meta\b[^>]*\b(?:name|property)=["']twitter:[^"']*["'][^>]*>/gi, '')
50
- .replace(/<link\b[^>]*\brel=["']canonical["'][^>]*>/gi, '');
51
- if (seo.favicon) {
52
- nextHtml = nextHtml.replace(/<link\b[^>]*\brel=(?:"[^"]*icon[^"]*"|'[^']*icon[^']*'|[^>\s]*icon[^>\s]*)[^>]*>/gi, '');
53
- }
54
- const tags = new HtmlTag();
55
- if (seo.description) {
56
- tags.addMeta('description', seo.description);
57
- }
58
- if (seo.robots) {
59
- tags.addMeta('robots', seo.robots);
60
- }
61
- if (seo.themeColor) {
62
- tags.addMeta('theme-color', seo.themeColor);
63
- }
64
- if (seo.url) {
65
- tags.addLink('canonical', seo.url);
66
- }
67
- if (seo.favicon) {
68
- tags.addLink('icon', seo.favicon);
69
- tags.addLink('apple-touch-icon', seo.favicon);
70
- }
71
- // Open Graph (must use property attribute, not name)
72
- if (seo.title) {
73
- tags.addProperty('og:title', seo.title);
74
- }
75
- if (seo.description) {
76
- tags.addProperty('og:description', seo.description);
77
- }
78
- tags.addProperty('og:type', 'website');
79
- if (seo.url) {
80
- tags.addProperty('og:url', seo.url);
81
- }
82
- if (seo.siteName) {
83
- tags.addProperty('og:site_name', seo.siteName);
84
- }
85
- if (seo.locale) {
86
- tags.addProperty('og:locale', seo.locale);
87
- }
88
- if (seo.image) {
89
- tags.addProperty('og:image', seo.image);
90
- }
91
- // Twitter
92
- tags.addMeta('twitter:card', 'summary_large_image');
93
- if (seo.twitterSite) {
94
- tags.addMeta('twitter:site', seo.twitterSite);
95
- }
96
- if (seo.title) {
97
- tags.addMeta('twitter:title', seo.title);
98
- }
99
- if (seo.description) {
100
- tags.addMeta('twitter:description', seo.description);
101
- }
102
- if (seo.image) {
103
- tags.addMeta('twitter:image', seo.image);
104
- }
105
- return { html: nextHtml, tags: tags.list() };
106
- }
107
- catch {
108
- return html;
109
- }
110
- },
111
- };
112
- }
@@ -1,3 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export default function serverConfigPlugin(): Plugin;
3
- //# sourceMappingURL=server-config.d.ts.map
@@ -1,36 +0,0 @@
1
- const PREVIEW_ORIGINS_ENV = 'FIMO_PREVIEW_ALLOWED_ORIGINS';
2
- function readPreviewHosts() {
3
- return (process.env[PREVIEW_ORIGINS_ENV] ?? '')
4
- .split(',')
5
- .map((origin) => origin.trim())
6
- .filter(Boolean)
7
- .map((origin) => (origin.startsWith('**.') ? `.${origin.slice(3)}` : origin));
8
- }
9
- export default function serverConfigPlugin() {
10
- return {
11
- name: 'fimo:server-config',
12
- config(config) {
13
- const configuredHosts = config.server?.allowedHosts;
14
- const previewHosts = readPreviewHosts();
15
- const allowedHosts = configuredHosts === true
16
- ? true
17
- : [...(configuredHosts ?? []), ...previewHosts].filter((host, index, hosts) => hosts.indexOf(host) === index);
18
- return {
19
- server: {
20
- ...(allowedHosts === true || allowedHosts.length > 0 ? { allowedHosts } : {}),
21
- hmr: {
22
- overlay: false,
23
- },
24
- watch: {
25
- ignored: ['**/.worktrees/**', '**/.fimo/config.json', '**/fimo-config.json'],
26
- },
27
- },
28
- build: {},
29
- optimizeDeps: {
30
- include: [],
31
- exclude: [],
32
- },
33
- };
34
- },
35
- };
36
- }
@@ -1,3 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export default function sitemapPlugin(): Plugin;
3
- //# sourceMappingURL=sitemap.d.ts.map