fimo 0.7.0-experimental.2 → 0.7.0-experimental.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/content-templates/hooks-template.eta +27 -73
- package/assets/content-templates/types-template.eta +1 -4
- package/assets/skills/fimo/SKILL.md +2 -2
- package/assets/skills/fimo/references/content.md +42 -46
- package/assets/skills/fimo/references/locales.md +0 -8
- package/assets/skills/fimo/references/setup-react-router.md +2 -2
- package/assets/skills/fimo/references/ui.md +1 -1
- package/assets/skills/fimo-cli/references/content.md +14 -17
- package/assets/skills/fimo-cli/references/domains.md +1 -1
- package/assets/skills/fimo-cli/references/locales.md +0 -6
- package/assets/skills/fimo-migration/SKILL.md +22 -2
- package/assets/skills/fimo-migration/references/content.md +8 -0
- package/assets/skills/fimo-migration/references/manifest.md +35 -0
- package/assets/skills/fimo-migration/references/qa.md +24 -2
- package/assets/skills/fimo-migration/references/workflow.md +12 -1
- package/assets/skills/fimo-migration/references/wrap.md +582 -0
- package/assets/skills/fimo-studio/references/custom-domains.md +1 -1
- package/assets/skills/fimo-studio/references/visual-editing.md +5 -3
- package/dist/build/vite/index.d.ts.map +1 -0
- package/dist/build/vite/plugins/content-sync.d.ts.map +1 -0
- package/dist/build/vite/plugins/content-sync.test.d.ts +2 -0
- package/dist/build/vite/plugins/content-sync.test.d.ts.map +1 -0
- package/dist/build/vite/plugins/content-sync.test.js +64 -0
- package/dist/build/vite/plugins/data-id.d.ts.map +1 -0
- package/dist/build/vite/plugins/fimo-config.d.ts.map +1 -0
- package/dist/build/vite/plugins/fimo-config.test.d.ts +2 -0
- package/dist/build/vite/plugins/fimo-config.test.d.ts.map +1 -0
- package/dist/build/vite/plugins/fimo-config.test.js +46 -0
- package/dist/build/vite/plugins/overlay.d.ts.map +1 -0
- package/dist/build/vite/plugins/robots.d.ts.map +1 -0
- package/dist/build/vite/plugins/seo.d.ts.map +1 -0
- package/dist/build/vite/plugins/server-config.d.ts.map +1 -0
- package/dist/build/vite/plugins/sitemap.d.ts.map +1 -0
- package/dist/build/vite/plugins/translations.d.ts +2 -8
- package/dist/build/vite/plugins/translations.d.ts.map +1 -0
- package/dist/build/vite/plugins/translations.js +3 -121
- package/dist/build/vite/plugins/translations.test.d.ts +2 -0
- package/dist/build/vite/plugins/translations.test.d.ts.map +1 -0
- package/dist/build/vite/plugins/translations.test.js +266 -0
- package/dist/cli/bundle.json +2 -3
- package/dist/cli/index.js +117939 -1186
- package/dist/runtime/app/FimoProviders.d.ts +1 -11
- package/dist/runtime/app/FimoProviders.d.ts.map +1 -0
- package/dist/runtime/app/FimoProviders.js +2 -23
- package/dist/runtime/app/FimoScripts.d.ts.map +1 -0
- package/dist/runtime/app/index.d.ts.map +1 -0
- package/dist/runtime/app/prefetch.d.ts.map +1 -0
- package/dist/runtime/astro/index.d.ts +2 -0
- package/dist/runtime/astro/index.d.ts.map +1 -0
- package/dist/runtime/astro/index.js +3 -0
- package/dist/runtime/astro/server.d.ts +3 -0
- package/dist/runtime/astro/server.d.ts.map +1 -0
- package/dist/runtime/astro/server.js +6 -0
- package/dist/runtime/content/DataSourcesProvider.d.ts.map +1 -0
- package/dist/runtime/content/RefreshContentProvider.d.ts.map +1 -0
- package/dist/runtime/content/RefreshContentProvider.test.d.ts +2 -0
- package/dist/runtime/content/RefreshContentProvider.test.d.ts.map +1 -0
- package/dist/runtime/content/RefreshContentProvider.test.js +33 -0
- package/dist/runtime/content/parseCollectionResponse.d.ts.map +1 -0
- package/dist/runtime/content/parseCollectionResponse.test.d.ts +2 -0
- package/dist/runtime/content/parseCollectionResponse.test.d.ts.map +1 -0
- package/dist/runtime/content/parseCollectionResponse.test.js +20 -0
- package/dist/runtime/content/utils/retrieve-data-sources.d.ts +0 -1
- package/dist/runtime/content/utils/retrieve-data-sources.d.ts.map +1 -0
- package/dist/runtime/content/utils/retrieve-data-sources.js +4 -27
- package/dist/runtime/core/AppErrorBoundary.d.ts.map +1 -0
- package/dist/runtime/core/ViteLifecycles.d.ts.map +1 -0
- package/dist/runtime/i18n/FimoLocaleContext.d.ts.map +1 -0
- package/dist/runtime/i18n/FimoLocaleContext.js +1 -0
- package/dist/runtime/i18n/locale.d.ts.map +1 -0
- package/dist/runtime/i18n/locale.test.d.ts +2 -0
- package/dist/runtime/i18n/locale.test.d.ts.map +1 -0
- package/dist/runtime/i18n/locale.test.js +58 -0
- package/dist/runtime/iframe/ConsoleErrorProvider.d.ts.map +1 -0
- package/dist/runtime/iframe/ScreenshotProvider.d.ts.map +1 -0
- package/dist/runtime/iframe/runtime/overlay-hmr.d.ts.map +1 -0
- package/dist/runtime/iframe/runtime/overlay-hmr.js +0 -3
- package/dist/runtime/iframe/runtime/overlay-runtime.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +0 -3
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +0 -2
- package/dist/runtime/next/FimoNextProviders.d.ts +24 -0
- package/dist/runtime/next/FimoNextProviders.d.ts.map +1 -0
- package/dist/runtime/next/FimoNextProviders.js +20 -0
- package/dist/runtime/next/FimoNextScripts.d.ts +10 -0
- package/dist/runtime/next/FimoNextScripts.d.ts.map +1 -0
- package/dist/runtime/next/FimoNextScripts.js +19 -0
- package/dist/runtime/next/index.d.ts +14 -0
- package/dist/runtime/next/index.d.ts.map +1 -0
- package/dist/runtime/next/index.js +14 -0
- package/dist/runtime/next/server.d.ts +2 -0
- package/dist/runtime/next/server.d.ts.map +1 -0
- package/dist/runtime/next/server.js +4 -0
- package/dist/runtime/nuxt/composables.d.ts +9 -0
- package/dist/runtime/nuxt/composables.d.ts.map +1 -0
- package/dist/runtime/nuxt/composables.js +57 -0
- package/dist/runtime/nuxt/index.d.ts +3 -0
- package/dist/runtime/nuxt/index.d.ts.map +1 -0
- package/dist/runtime/nuxt/index.js +6 -0
- package/dist/runtime/nuxt/server.d.ts +3 -0
- package/dist/runtime/nuxt/server.d.ts.map +1 -0
- package/dist/runtime/nuxt/server.js +6 -0
- package/dist/runtime/paths/get-fimo-paths.d.ts.map +1 -0
- package/dist/runtime/paths/get-fimo-paths.js +5 -15
- package/dist/runtime/paths/index.d.ts.map +1 -0
- package/dist/runtime/paths/types.d.ts.map +1 -0
- package/dist/runtime/primitives/components/Boolean.d.ts.map +1 -0
- package/dist/runtime/primitives/components/Date.d.ts.map +1 -0
- package/dist/runtime/primitives/components/Image.d.ts.map +1 -0
- package/dist/runtime/primitives/components/RichText.d.ts.map +1 -0
- package/dist/runtime/primitives/components/StaticImage.d.ts.map +1 -0
- package/dist/runtime/primitives/components/Text.d.ts.map +1 -0
- package/dist/runtime/primitives/components/Video.d.ts.map +1 -0
- package/dist/runtime/primitives/components/index.d.ts.map +1 -0
- package/dist/runtime/primitives/index.d.ts.map +1 -0
- package/dist/runtime/primitives/labels-hook.d.ts +33 -0
- package/dist/runtime/primitives/labels-hook.d.ts.map +1 -0
- package/dist/runtime/primitives/labels-hook.js +41 -0
- package/dist/runtime/primitives/labels-store.d.ts +12 -0
- package/dist/runtime/primitives/labels-store.d.ts.map +1 -0
- package/dist/runtime/primitives/labels-store.js +60 -0
- package/dist/runtime/primitives/labels-store.test.d.ts +2 -0
- package/dist/runtime/primitives/labels-store.test.d.ts.map +1 -0
- package/dist/runtime/primitives/labels-store.test.js +66 -0
- package/dist/runtime/primitives/lib/image-optimization.d.ts.map +1 -0
- package/dist/runtime/primitives/lib/index.d.ts.map +1 -0
- package/dist/runtime/primitives/lib/primitives.d.ts +2 -2
- package/dist/runtime/primitives/lib/primitives.d.ts.map +1 -0
- package/dist/runtime/primitives/lib/query.d.ts +3 -5
- package/dist/runtime/primitives/lib/query.d.ts.map +1 -0
- package/dist/runtime/primitives/lib/template.d.ts.map +1 -0
- package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts +5 -3
- package/dist/runtime/primitives/lib/useFimoLiveValue.d.ts.map +1 -0
- package/dist/runtime/primitives/lib/useFimoLiveValue.js +11 -4
- package/dist/runtime/primitives/public-surface.test.d.ts +2 -0
- package/dist/runtime/primitives/public-surface.test.d.ts.map +1 -0
- package/dist/runtime/primitives/public-surface.test.js +45 -0
- package/dist/runtime/primitives/translations.d.ts +1 -27
- package/dist/runtime/primitives/translations.d.ts.map +1 -0
- package/dist/runtime/primitives/translations.js +7 -85
- package/dist/runtime/react/FimoSpaProviders.d.ts +36 -0
- package/dist/runtime/react/FimoSpaProviders.d.ts.map +1 -0
- package/dist/runtime/react/FimoSpaProviders.js +63 -0
- package/dist/runtime/react/index.d.ts +33 -0
- package/dist/runtime/react/index.d.ts.map +1 -0
- package/dist/runtime/react/index.js +39 -0
- package/dist/runtime/react-router/index.d.ts.map +1 -0
- package/dist/runtime/react-router/navigation-utils.d.ts.map +1 -0
- package/dist/runtime/react-router/navigation.d.ts.map +1 -0
- package/dist/runtime/react-router/navigation.test.d.ts +2 -0
- package/dist/runtime/react-router/navigation.test.d.ts.map +1 -0
- package/dist/runtime/react-router/navigation.test.js +35 -0
- package/dist/runtime/react-router/routes.d.ts.map +1 -0
- package/dist/runtime/react-router/routes.test.d.ts +2 -0
- package/dist/runtime/react-router/routes.test.d.ts.map +1 -0
- package/dist/runtime/react-router/routes.test.js +67 -0
- package/dist/runtime/remix/FimoRemixProviders.d.ts +16 -0
- package/dist/runtime/remix/FimoRemixProviders.d.ts.map +1 -0
- package/dist/runtime/remix/FimoRemixProviders.js +12 -0
- package/dist/runtime/remix/FimoRemixScripts.d.ts +10 -0
- package/dist/runtime/remix/FimoRemixScripts.d.ts.map +1 -0
- package/dist/runtime/remix/FimoRemixScripts.js +19 -0
- package/dist/runtime/remix/index.d.ts +12 -0
- package/dist/runtime/remix/index.d.ts.map +1 -0
- package/dist/runtime/remix/index.js +11 -0
- package/dist/runtime/remix/server.d.ts +2 -0
- package/dist/runtime/remix/server.d.ts.map +1 -0
- package/dist/runtime/remix/server.js +2 -0
- package/dist/runtime/routing/AppResetScrollOnNavigate.d.ts.map +1 -0
- package/dist/runtime/routing/AppRoutesProvider.d.ts.map +1 -0
- package/dist/runtime/seo/buildSeoForPath.d.ts +3 -1
- package/dist/runtime/seo/buildSeoForPath.d.ts.map +1 -0
- package/dist/runtime/seo/buildSeoForPath.js +1 -4
- package/dist/runtime/seo/htmlProps.d.ts.map +1 -0
- package/dist/runtime/seo/index.d.ts.map +1 -0
- package/dist/runtime/seo/resolver.d.ts.map +1 -0
- package/dist/runtime/shared/display-routes.d.ts +14 -0
- package/dist/runtime/shared/display-routes.d.ts.map +1 -0
- package/dist/runtime/shared/display-routes.js +25 -0
- package/dist/runtime/shared/fimo-config.server.d.ts.map +1 -0
- package/dist/runtime/shared/fimo-config.server.js +1 -0
- package/dist/runtime/shared/fimo-config.types.d.ts +2 -0
- package/dist/runtime/shared/fimo-config.types.d.ts.map +1 -0
- package/dist/runtime/shared/i18n-messages.d.ts +29 -0
- package/dist/runtime/shared/i18n-messages.d.ts.map +1 -0
- package/dist/runtime/shared/i18n-messages.js +79 -0
- package/dist/runtime/shared/i18n-messages.test.d.ts +2 -0
- package/dist/runtime/shared/i18n-messages.test.d.ts.map +1 -0
- package/dist/runtime/shared/i18n-messages.test.js +39 -0
- package/dist/runtime/shared/labels-fetch.pure.d.ts +17 -0
- package/dist/runtime/shared/labels-fetch.pure.d.ts.map +1 -0
- package/dist/runtime/shared/labels-fetch.pure.js +71 -0
- package/dist/runtime/shared/labels-fetch.server.d.ts +7 -0
- package/dist/runtime/shared/labels-fetch.server.d.ts.map +1 -0
- package/dist/runtime/shared/labels-fetch.server.js +97 -0
- package/dist/runtime/shared/labels-t.pure.d.ts +2 -0
- package/dist/runtime/shared/labels-t.pure.d.ts.map +1 -0
- package/dist/runtime/shared/labels-t.pure.js +10 -0
- package/dist/runtime/svelte/index.d.ts +3 -0
- package/dist/runtime/svelte/index.d.ts.map +1 -0
- package/dist/runtime/svelte/index.js +7 -0
- package/dist/runtime/svelte/server.d.ts +3 -0
- package/dist/runtime/svelte/server.d.ts.map +1 -0
- package/dist/runtime/svelte/server.js +6 -0
- package/dist/runtime/t/OptionalTracking.d.ts.map +1 -0
- package/dist/runtime/t/OptionalTracking.test.d.ts +2 -0
- package/dist/runtime/t/OptionalTracking.test.d.ts.map +1 -0
- package/dist/runtime/t/OptionalTracking.test.js +11 -0
- package/dist/runtime/t/Pageview.d.ts.map +1 -0
- package/dist/runtime/templates.d.ts.map +1 -0
- package/dist/runtime/vue/index.d.ts +3 -0
- package/dist/runtime/vue/index.d.ts.map +1 -0
- package/dist/runtime/vue/index.js +5 -0
- package/dist/runtime/vue/server.d.ts +3 -0
- package/dist/runtime/vue/server.d.ts.map +1 -0
- package/dist/runtime/vue/server.js +6 -0
- package/dist/runtime/wrapped/FimoFileLink.d.ts +17 -0
- package/dist/runtime/wrapped/FimoFileLink.d.ts.map +1 -0
- package/dist/runtime/wrapped/FimoFileLink.js +19 -0
- package/dist/runtime/wrapped/FimoMediaImage.d.ts +14 -0
- package/dist/runtime/wrapped/FimoMediaImage.d.ts.map +1 -0
- package/dist/runtime/wrapped/FimoMediaImage.js +20 -0
- package/dist/runtime/wrapped/FimoMediaVideo.d.ts +14 -0
- package/dist/runtime/wrapped/FimoMediaVideo.d.ts.map +1 -0
- package/dist/runtime/wrapped/FimoMediaVideo.js +20 -0
- package/dist/runtime/wrapped/FimoRichTextBlock.d.ts +23 -0
- package/dist/runtime/wrapped/FimoRichTextBlock.d.ts.map +1 -0
- package/dist/runtime/wrapped/FimoRichTextBlock.js +22 -0
- package/dist/runtime/wrapped/FimoText.d.ts +22 -0
- package/dist/runtime/wrapped/FimoText.d.ts.map +1 -0
- package/dist/runtime/wrapped/FimoText.js +20 -0
- package/dist/runtime/wrapped/WrappedContentContext.d.ts +28 -0
- package/dist/runtime/wrapped/WrappedContentContext.d.ts.map +1 -0
- package/dist/runtime/wrapped/WrappedContentContext.js +30 -0
- package/dist/runtime/wrapped/WrappedProviders.d.ts +33 -0
- package/dist/runtime/wrapped/WrappedProviders.d.ts.map +1 -0
- package/dist/runtime/wrapped/WrappedProviders.js +101 -0
- package/dist/runtime/wrapped/dom.d.ts +4 -0
- package/dist/runtime/wrapped/dom.d.ts.map +1 -0
- package/dist/runtime/wrapped/dom.js +23 -0
- package/dist/runtime/wrapped/dom.test.d.ts +2 -0
- package/dist/runtime/wrapped/dom.test.d.ts.map +1 -0
- package/dist/runtime/wrapped/dom.test.js +16 -0
- package/dist/runtime/wrapped/server.d.ts +77 -0
- package/dist/runtime/wrapped/server.d.ts.map +1 -0
- package/dist/runtime/wrapped/server.js +237 -0
- package/dist/runtime/wrapped/server.test.d.ts +2 -0
- package/dist/runtime/wrapped/server.test.d.ts.map +1 -0
- package/dist/runtime/wrapped/server.test.js +91 -0
- package/dist/scripts/apply-wrap-templates.d.ts +61 -0
- package/dist/scripts/apply-wrap-templates.js +132 -0
- package/dist/scripts/apply-wrap-templates.test.js +199 -0
- package/dist/scripts/apply-wrap.d.ts +46 -0
- package/dist/scripts/apply-wrap.js +278 -0
- package/dist/scripts/apply-wrap.test.d.ts +1 -0
- package/dist/scripts/apply-wrap.test.js +226 -0
- package/dist/scripts/cms/discover.d.ts +2 -0
- package/dist/scripts/cms/discover.js +17 -0
- package/dist/scripts/cms/example-content.d.ts +32 -0
- package/dist/scripts/cms/example-content.js +87 -0
- package/dist/scripts/cms/example-content.test.d.ts +1 -0
- package/dist/scripts/cms/example-content.test.js +57 -0
- package/dist/scripts/cms/strapi/detect.d.ts +2 -0
- package/dist/scripts/cms/strapi/detect.js +185 -0
- package/dist/scripts/cms/strapi/detect.test.d.ts +1 -0
- package/dist/scripts/cms/strapi/detect.test.js +56 -0
- package/dist/scripts/cms/strapi/index.d.ts +3 -0
- package/dist/scripts/cms/strapi/index.js +15 -0
- package/dist/scripts/cms/strapi/list-source.d.ts +17 -0
- package/dist/scripts/cms/strapi/list-source.js +90 -0
- package/dist/scripts/cms/strapi/list-source.test.d.ts +1 -0
- package/dist/scripts/cms/strapi/list-source.test.js +33 -0
- package/dist/scripts/cms/strapi/schema-map.d.ts +9 -0
- package/dist/scripts/cms/strapi/schema-map.js +138 -0
- package/dist/scripts/cms/strapi/schema-map.test.d.ts +1 -0
- package/dist/scripts/cms/strapi/schema-map.test.js +87 -0
- package/dist/scripts/cms/types.d.ts +76 -0
- package/dist/scripts/cms/types.js +11 -0
- package/dist/scripts/detect-framework.d.ts +39 -0
- package/dist/scripts/detect-framework.js +133 -0
- package/dist/scripts/detect-framework.test.d.ts +1 -0
- package/dist/scripts/detect-framework.test.js +122 -0
- package/dist/scripts/draft-rows.d.ts +19 -0
- package/dist/scripts/draft-rows.js +135 -0
- package/dist/scripts/draft-rows.test.d.ts +1 -0
- package/dist/scripts/draft-rows.test.js +113 -0
- package/dist/scripts/draft-schemas.d.ts +27 -0
- package/dist/scripts/draft-schemas.js +188 -0
- package/dist/scripts/draft-schemas.test.d.ts +1 -0
- package/dist/scripts/draft-schemas.test.js +152 -0
- package/dist/scripts/frameworks/astro/routes.d.ts +3 -0
- package/dist/scripts/frameworks/astro/routes.js +55 -0
- package/dist/scripts/frameworks/astro/template-style.d.ts +7 -0
- package/dist/scripts/frameworks/astro/template-style.js +19 -0
- package/dist/scripts/frameworks/discover.d.ts +70 -0
- package/dist/scripts/frameworks/discover.js +171 -0
- package/dist/scripts/frameworks/next/rewire.d.ts +30 -0
- package/dist/scripts/frameworks/next/rewire.js +258 -0
- package/dist/scripts/frameworks/next/rewire.test.d.ts +1 -0
- package/dist/scripts/frameworks/next/rewire.test.js +134 -0
- package/dist/scripts/frameworks/next/routes.d.ts +17 -0
- package/dist/scripts/frameworks/next/routes.js +134 -0
- package/dist/scripts/frameworks/next/routes.test.d.ts +1 -0
- package/dist/scripts/frameworks/next/routes.test.js +64 -0
- package/dist/scripts/frameworks/next/wiring.d.ts +26 -0
- package/dist/scripts/frameworks/next/wiring.js +163 -0
- package/dist/scripts/frameworks/next/wiring.test.d.ts +1 -0
- package/dist/scripts/frameworks/next/wiring.test.js +146 -0
- package/dist/scripts/frameworks/nuxt/routes.d.ts +3 -0
- package/dist/scripts/frameworks/nuxt/routes.js +54 -0
- package/dist/scripts/frameworks/nuxt/template-style.d.ts +9 -0
- package/dist/scripts/frameworks/nuxt/template-style.js +27 -0
- package/dist/scripts/frameworks/remix/routes.d.ts +3 -0
- package/dist/scripts/frameworks/remix/routes.js +50 -0
- package/dist/scripts/frameworks/sveltekit/routes.d.ts +3 -0
- package/dist/scripts/frameworks/sveltekit/routes.js +50 -0
- package/dist/scripts/frameworks/sveltekit/template-style.d.ts +9 -0
- package/dist/scripts/frameworks/sveltekit/template-style.js +54 -0
- package/dist/scripts/frameworks/vite/routes.d.ts +15 -0
- package/dist/scripts/frameworks/vite/routes.js +93 -0
- package/dist/scripts/frameworks/vite/routes.test.d.ts +1 -0
- package/dist/scripts/frameworks/vite/routes.test.js +73 -0
- package/dist/scripts/frameworks/vite/wiring.d.ts +10 -0
- package/dist/scripts/frameworks/vite/wiring.js +99 -0
- package/dist/scripts/frameworks/vite/wiring.test.d.ts +1 -0
- package/dist/scripts/frameworks/vite/wiring.test.js +88 -0
- package/dist/scripts/generated-types.test.d.ts +1 -0
- package/dist/scripts/generated-types.test.js +212 -0
- package/dist/scripts/lib/validation-report.d.ts +1 -0
- package/dist/scripts/lib/validation-report.js +3 -0
- package/dist/scripts/lint-translation-keys.test.d.ts +1 -0
- package/dist/scripts/lint-translation-keys.test.js +16 -0
- package/dist/scripts/render-parity/capture.d.ts +56 -0
- package/dist/scripts/render-parity/capture.js +366 -0
- package/dist/scripts/render-parity/capture.test.d.ts +1 -0
- package/dist/scripts/render-parity/capture.test.js +306 -0
- package/dist/scripts/render-parity/compare.d.ts +59 -0
- package/dist/scripts/render-parity/compare.js +0 -0
- package/dist/scripts/render-parity/compare.test.d.ts +1 -0
- package/dist/scripts/render-parity/compare.test.js +98 -0
- package/dist/scripts/render-parity/normalize-html.d.ts +13 -0
- package/dist/scripts/render-parity/normalize-html.js +223 -0
- package/dist/scripts/render-parity/normalize-html.test.d.ts +1 -0
- package/dist/scripts/render-parity/normalize-html.test.js +58 -0
- package/dist/scripts/render-parity/types.d.ts +41 -0
- package/dist/scripts/render-parity/types.js +1 -0
- package/dist/scripts/resolve-routes.js +1 -1
- package/dist/scripts/scan-wrappable.d.ts +196 -0
- package/dist/scripts/scan-wrappable.js +1221 -0
- package/dist/scripts/scan-wrappable.test.d.ts +1 -0
- package/dist/scripts/scan-wrappable.test.js +502 -0
- package/dist/scripts/sync-schemas.test.d.ts +1 -0
- package/dist/scripts/sync-schemas.test.js +124 -0
- package/dist/scripts/validate-route-metadata.js +11 -0
- package/dist/scripts/validate-route-metadata.test.d.ts +1 -0
- package/dist/scripts/validate-route-metadata.test.js +116 -0
- package/dist/scripts/validate-schemas.test.d.ts +1 -0
- package/dist/scripts/validate-schemas.test.js +263 -0
- package/package.json +85 -20
- package/scripts/add-ext.mjs +47 -0
- package/scripts/bump-version.mjs +58 -0
- package/scripts/bundle-cli.mjs +123 -0
- package/scripts/install-cli.mjs +36 -0
- package/scripts/lib/channels.mjs +70 -0
- package/scripts/lib/dev-release-state.mjs +44 -0
- package/scripts/lib/dev-release-state.test.ts +36 -0
- package/scripts/lib/postinstall-onboarding.test.ts +82 -0
- package/scripts/lib/release-core.mjs +225 -0
- package/scripts/lib/release-core.test.ts +147 -0
- package/scripts/migration-qa-gate.test.ts +155 -0
- package/scripts/publish-npm.mjs +180 -0
- package/templates/react-router/package.json +7 -10
- package/templates/react-router/src/pages/Index.tsx +1 -1
- package/dist/runtime/content/client/createContentClient.d.ts +0 -5
- package/dist/runtime/content/client/createContentClient.js +0 -300
- package/dist/runtime/content/client/createSingletonClient.d.ts +0 -5
- package/dist/runtime/content/client/createSingletonClient.js +0 -108
- package/dist/runtime/content/client/internal.d.ts +0 -44
- package/dist/runtime/content/client/internal.js +0 -236
- package/dist/runtime/content/client/types.d.ts +0 -136
- package/dist/runtime/content/client/useQueryLocale.d.ts +0 -2
- package/dist/runtime/content/client/useQueryLocale.js +0 -6
- /package/dist/{runtime/content/client/types.js → scripts/apply-wrap-templates.test.d.ts} +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
5
|
+
import { writeSchemaDrafts } from './draft-schemas.js';
|
|
6
|
+
import { scanWrappable } from './scan-wrappable.js';
|
|
7
|
+
let dir;
|
|
8
|
+
const project = (files) => {
|
|
9
|
+
dir = mkdtempSync(join(tmpdir(), 'draft-schemas-'));
|
|
10
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
11
|
+
const full = join(dir, rel);
|
|
12
|
+
mkdirSync(join(full, '..'), { recursive: true });
|
|
13
|
+
writeFileSync(full, content);
|
|
14
|
+
}
|
|
15
|
+
return dir;
|
|
16
|
+
};
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
if (dir) {
|
|
19
|
+
rmSync(dir, { recursive: true, force: true });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
describe('writeSchemaDrafts', () => {
|
|
23
|
+
it('infers deep field types from an in-code candidate and names it singular PascalCase', () => {
|
|
24
|
+
const root = project({
|
|
25
|
+
'src/pages/team.tsx': `const teamMembers = [
|
|
26
|
+
{ name: 'Maë Falk', bio: 'Keeps the berths in order.', headshot: '/images/mae.png', startedAt: '2019-04-02', active: true, boats: 3 },
|
|
27
|
+
{ name: 'Idris Kade', bio: 'Maps every tide table.', headshot: '/images/idris.png', startedAt: '2021-11-20', active: false, boats: 5 },
|
|
28
|
+
];
|
|
29
|
+
export default function Team() {
|
|
30
|
+
return <ul>{teamMembers.map((m) => (<li key={m.name}>{m.name} {m.bio}</li>))}</ul>;
|
|
31
|
+
}
|
|
32
|
+
`,
|
|
33
|
+
});
|
|
34
|
+
const scan = scanWrappable(root, { keepInternal: true });
|
|
35
|
+
const drafts = writeSchemaDrafts(root, scan);
|
|
36
|
+
expect(drafts.map((draft) => draft.uid)).toEqual(['TeamMember']);
|
|
37
|
+
const draft = JSON.parse(readFileSync(join(root, '.fimo/migration/schema-drafts/TeamMember.json'), 'utf8'));
|
|
38
|
+
expect(draft.uid).toBe('TeamMember');
|
|
39
|
+
// Classification context so the agent never reopens the source files.
|
|
40
|
+
expect(draft.source).toContain('src/pages/team.tsx');
|
|
41
|
+
expect(draft.rowCount).toBe(2);
|
|
42
|
+
expect(draft.sample.name).toBe('Maë Falk');
|
|
43
|
+
expect(draft.fields.name).toEqual({ type: 'string' });
|
|
44
|
+
expect(draft.fields.headshot).toEqual({ type: 'media' });
|
|
45
|
+
expect(draft.fields.startedAt).toEqual({ type: 'date' });
|
|
46
|
+
expect(draft.fields.active).toEqual({ type: 'boolean' });
|
|
47
|
+
expect(draft.fields.boats).toEqual({ type: 'number' });
|
|
48
|
+
expect(existsSync(join(root, '.fimo/migration/schema-drafts/README.md'))).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
it('maps detected references to reference fields with provisional target names', () => {
|
|
51
|
+
const root = project({
|
|
52
|
+
'src/pages/board.tsx': `const authors = [
|
|
53
|
+
{ slug: 'author-1', name: 'Maë Falk', role: 'Writer of long tides' },
|
|
54
|
+
{ slug: 'author-2', name: 'Idris Kade', role: 'Editor of every chart' },
|
|
55
|
+
{ slug: 'author-3', name: 'Sol Ferry', role: 'Keeper of the lanterns' },
|
|
56
|
+
];
|
|
57
|
+
const posts = [
|
|
58
|
+
{ slug: 'post-1', title: 'Charting the bay together', author: 'author-1', tags: ['tag-a', 'tag-b'] },
|
|
59
|
+
{ slug: 'post-2', title: 'Berth songs for the crew', author: 'author-2', tags: ['tag-a'] },
|
|
60
|
+
{ slug: 'post-3', title: 'Lanterns over the reef', author: 'author-3', tags: ['tag-b'] },
|
|
61
|
+
];
|
|
62
|
+
export default function Board() {
|
|
63
|
+
return (
|
|
64
|
+
<div>
|
|
65
|
+
<ul>{authors.map((a) => (<li key={a.slug}>{a.name} {a.role}</li>))}</ul>
|
|
66
|
+
<ol>{posts.map((p) => (<li key={p.slug}>{p.title}</li>))}</ol>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
`,
|
|
71
|
+
});
|
|
72
|
+
const scan = scanWrappable(root, { keepInternal: true });
|
|
73
|
+
const drafts = writeSchemaDrafts(root, scan);
|
|
74
|
+
const post = JSON.parse(readFileSync(join(root, '.fimo/migration/schema-drafts/Post.json'), 'utf8'));
|
|
75
|
+
expect(post.fields.author).toEqual({ type: 'reference', target: 'Author' });
|
|
76
|
+
expect(post.fields.slug).toBeUndefined();
|
|
77
|
+
expect(drafts.some((draft) => draft.uid === 'Author')).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
it('drafts data-file collections with prose as richtext', () => {
|
|
80
|
+
const root = project({
|
|
81
|
+
'src/data/caseStudies.json': JSON.stringify([
|
|
82
|
+
{
|
|
83
|
+
slug: 'case-1',
|
|
84
|
+
title: 'Rebuilding the north pier',
|
|
85
|
+
challenge: 'First paragraph of the challenge.\n\nSecond paragraph with detail.',
|
|
86
|
+
publishedAt: '2025-03-14',
|
|
87
|
+
coverImage: '/images/pier.png',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
slug: 'case-2',
|
|
91
|
+
title: 'Charting the shallows',
|
|
92
|
+
challenge: 'Another two-paragraph body.\n\nSecond part here.',
|
|
93
|
+
publishedAt: '2025-06-02',
|
|
94
|
+
coverImage: '/images/shallows.png',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
slug: 'case-3',
|
|
98
|
+
title: 'The lantern census',
|
|
99
|
+
challenge: 'More prose in paragraphs.\n\nStill more prose.',
|
|
100
|
+
publishedAt: '2025-08-19',
|
|
101
|
+
coverImage: '/images/lanterns.png',
|
|
102
|
+
},
|
|
103
|
+
]),
|
|
104
|
+
});
|
|
105
|
+
const scan = scanWrappable(root, { keepInternal: true });
|
|
106
|
+
writeSchemaDrafts(root, scan);
|
|
107
|
+
const draft = JSON.parse(readFileSync(join(root, '.fimo/migration/schema-drafts/CaseStudy.json'), 'utf8'));
|
|
108
|
+
expect(draft.uid).toBe('CaseStudy');
|
|
109
|
+
expect(draft.fields.challenge).toEqual({ type: 'richtext' });
|
|
110
|
+
expect(draft.fields.publishedAt).toEqual({ type: 'date' });
|
|
111
|
+
expect(draft.fields.coverImage).toEqual({ type: 'media' });
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
describe('markdown group staging (Tier 1b)', () => {
|
|
115
|
+
const post = (title, author, date, body) => `---\ntitle: ${title}\nauthor: ${author}\ndate: ${date}\nfeatured: true\n---\n\n${body}\n`;
|
|
116
|
+
it('drafts a markdown blog as a collection: typed frontmatter, verbatim body, reference', () => {
|
|
117
|
+
const root = project({
|
|
118
|
+
'src/authors/authors.json': JSON.stringify([
|
|
119
|
+
{ slug: 'mae-falk', name: 'Maë Falk', bio: 'Keeps the berths in order at dawn each day.' },
|
|
120
|
+
{ slug: 'idris-kade', name: 'Idris Kade', bio: 'Maps every tide table by hand and by heart.' },
|
|
121
|
+
]),
|
|
122
|
+
'src/posts/charting-the-bay.md': post('Charting the bay', 'mae-falk', '2026-01-12', '# Charting the bay\n\nFirst paragraph with **bold** markdown.\n\nSecond paragraph here.'),
|
|
123
|
+
'src/posts/berth-songs.md': post('Berth songs', 'idris-kade', '2026-02-03', '## Berth songs\n\nAnother body with a [link](https://x.test).\n\nAnd its second half.'),
|
|
124
|
+
});
|
|
125
|
+
const scan = scanWrappable(root, { keepInternal: true });
|
|
126
|
+
const drafts = writeSchemaDrafts(root, scan);
|
|
127
|
+
expect(drafts.map((draft) => draft.uid).sort()).toEqual(['Author', 'Post']);
|
|
128
|
+
const post_ = JSON.parse(readFileSync(join(root, '.fimo/migration/schema-drafts/Post.json'), 'utf8'));
|
|
129
|
+
// Body stays a verbatim string (NOT richtext) so the user's md renderer works.
|
|
130
|
+
expect(post_.fields.body).toEqual({ type: 'string' });
|
|
131
|
+
expect(post_.fields.title).toEqual({ type: 'string' });
|
|
132
|
+
expect(post_.fields.date).toEqual({ type: 'date' });
|
|
133
|
+
expect(post_.fields.featured).toEqual({ type: 'boolean' });
|
|
134
|
+
// Frontmatter author matching authors.json → a reference, not a string.
|
|
135
|
+
expect(post_.fields.author).toEqual({ type: 'reference', target: 'Author' });
|
|
136
|
+
expect(post_.fields.slug).toBeUndefined();
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
describe('singularPascal edge cases', () => {
|
|
140
|
+
it('keeps vowel+ses plurals whole (the PressReleas bug)', () => {
|
|
141
|
+
const root = project({
|
|
142
|
+
'src/data/pressReleases.json': JSON.stringify([
|
|
143
|
+
{ slug: 'pr-1', title: 'Harbor opens the north pier to night traffic' },
|
|
144
|
+
{ slug: 'pr-2', title: 'New tide charts published for every berth' },
|
|
145
|
+
{ slug: 'pr-3', title: 'Lantern census completes its tenth year' },
|
|
146
|
+
]),
|
|
147
|
+
});
|
|
148
|
+
const scan = scanWrappable(root, { keepInternal: true });
|
|
149
|
+
const drafts = writeSchemaDrafts(root, scan);
|
|
150
|
+
expect(drafts.map((draft) => draft.uid)).toContain('PressRelease');
|
|
151
|
+
});
|
|
152
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { readdirSync, statSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const titleCase = (seg) => seg
|
|
4
|
+
.replace(/[_\-]+/g, ' ')
|
|
5
|
+
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
6
|
+
.split(/\s+/)
|
|
7
|
+
.filter(Boolean)
|
|
8
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
|
|
9
|
+
.join(' ');
|
|
10
|
+
function pushRoute(routes, parts) {
|
|
11
|
+
const routePath = `/${parts.join('/')}`.replace(/\/+/g, '/');
|
|
12
|
+
const lastStatic = [...parts].reverse().find((part) => !part.startsWith(':'));
|
|
13
|
+
routes.push({
|
|
14
|
+
id: routePath === '/' ? 'home' : parts.map((part) => part.replace(/^:/, '')).join('-'),
|
|
15
|
+
path: routePath,
|
|
16
|
+
label: routePath === '/' ? 'Home' : titleCase(lastStatic ?? parts[parts.length - 1] ?? routePath),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const PAGE_EXT = /\.(astro|md|mdx|html)$/;
|
|
20
|
+
const toSegment = (name) => name.replace(/^\[\.\.\.(.+)\]$/, ':$1').replace(/^\[(.+)\]$/, ':$1');
|
|
21
|
+
/** Astro file-based routes under src/pages (index files map to the dir path). */
|
|
22
|
+
export function discoverAstroRoutes(pagesDir) {
|
|
23
|
+
const routes = [];
|
|
24
|
+
const walk = (dir, segments) => {
|
|
25
|
+
let entries;
|
|
26
|
+
try {
|
|
27
|
+
entries = readdirSync(dir);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
const full = join(dir, entry);
|
|
34
|
+
let isDir = false;
|
|
35
|
+
try {
|
|
36
|
+
isDir = statSync(full).isDirectory();
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (isDir) {
|
|
42
|
+
walk(full, [...segments, toSegment(entry)]);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (!PAGE_EXT.test(entry) || entry.startsWith('_')) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const base = entry.replace(PAGE_EXT, '');
|
|
49
|
+
pushRoute(routes, base === 'index' ? segments : [...segments, toSegment(base)]);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
walk(pagesDir, []);
|
|
53
|
+
routes.sort((a, b) => a.path.localeCompare(b.path));
|
|
54
|
+
return routes;
|
|
55
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TemplateWrapStyle } from '../../apply-wrap-templates.js';
|
|
2
|
+
/**
|
|
3
|
+
* Astro template wraps: t() resolves in the frontmatter (server-only, so the
|
|
4
|
+
* server barrel is safe to import there), values interpolate as {t(...)}.
|
|
5
|
+
* Files without a frontmatter fence get one — Astro allows an empty fence.
|
|
6
|
+
*/
|
|
7
|
+
export declare const astroTemplateWrapStyle: TemplateWrapStyle;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Astro template wraps: t() resolves in the frontmatter (server-only, so the
|
|
3
|
+
* server barrel is safe to import there), values interpolate as {t(...)}.
|
|
4
|
+
* Files without a frontmatter fence get one — Astro allows an empty fence.
|
|
5
|
+
*/
|
|
6
|
+
export const astroTemplateWrapStyle = {
|
|
7
|
+
ext: '.astro',
|
|
8
|
+
head: 'import { loadFimoT } from "fimo/astro/server";\nconst t = await loadFimoT();',
|
|
9
|
+
headMarker: /loadFimoT/,
|
|
10
|
+
open: '{t(',
|
|
11
|
+
close: ')}',
|
|
12
|
+
injectHead: (code, head) => {
|
|
13
|
+
const fence = code.match(/^---\r?\n/);
|
|
14
|
+
if (fence) {
|
|
15
|
+
return `${code.slice(0, fence[0].length)}${head}\n${code.slice(fence[0].length)}`;
|
|
16
|
+
}
|
|
17
|
+
return `---\n${head}\n---\n${code}`;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { TemplateWrapStyle } from '../apply-wrap-templates.js';
|
|
2
|
+
import type { FrameworkDetection } from '../detect-framework.js';
|
|
3
|
+
import { type CollectionRewireResult } from './next/rewire.js';
|
|
4
|
+
import { type DiscoveredRoute } from './next/routes.js';
|
|
5
|
+
import { type RootWiringResult } from './next/wiring.js';
|
|
6
|
+
/**
|
|
7
|
+
* Route discovery for any detected framework — the single registry generic
|
|
8
|
+
* code calls. Frameworks without a file convention (vue SPA, plain vite)
|
|
9
|
+
* return [] and rely on fimo-config routes.
|
|
10
|
+
*/
|
|
11
|
+
export declare function discoverFrameworkRoutes(cwd: string, detection: FrameworkDetection): DiscoveredRoute[];
|
|
12
|
+
/**
|
|
13
|
+
* Extra directories the framework keeps page COPY in, outside any source
|
|
14
|
+
* root (data-file scanning). Part of the framework registry so generic
|
|
15
|
+
* scanners never carry framework names.
|
|
16
|
+
*/
|
|
17
|
+
export declare function frameworkDataDirs(framework: string | null | undefined): string[];
|
|
18
|
+
/**
|
|
19
|
+
* The wrapper-import module for frameworks whose .jsx/.tsx is guaranteed
|
|
20
|
+
* React — the only ones the --apply JSX codemod may touch. Template
|
|
21
|
+
* frameworks return null: a .tsx island there may be Solid or Preact, and
|
|
22
|
+
* injecting a React wrapper import breaks the build (bento dogfood). Bare
|
|
23
|
+
* Vite qualifies only with the detection's `react` flag (a react dependency
|
|
24
|
+
* pins the JSX runtime); the SPA primitives live in fimo/react and are
|
|
25
|
+
* fallback-safe before the providers are wired.
|
|
26
|
+
*/
|
|
27
|
+
export declare function frameworkJsxWrapperModule(detection: Pick<FrameworkDetection, 'framework' | 'react'>): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* The template-wrap style for frameworks whose template files the --apply
|
|
30
|
+
* codemod may touch (plain text nodes only). Vue SPA stays null: without a
|
|
31
|
+
* server data path there is no deterministic t() wiring to inject.
|
|
32
|
+
*/
|
|
33
|
+
export declare function frameworkTemplateWrapStyle(framework: string | null | undefined): TemplateWrapStyle | null;
|
|
34
|
+
/**
|
|
35
|
+
* The one-time root-wiring codemod for frameworks whose providers mount in a
|
|
36
|
+
* single well-known file (Next.js app router: the root layout; Vite React
|
|
37
|
+
* SPA: the entry). Runs during --apply, AFTER the baseline capture — the
|
|
38
|
+
* pre-wrap dev-server boot must not require the fimo package, and providers
|
|
39
|
+
* are render-transparent so the parity check stays clean. Template
|
|
40
|
+
* frameworks wire through their TemplateWrapStyle.ensureWiring hooks instead.
|
|
41
|
+
*/
|
|
42
|
+
export declare function frameworkRootWiring(detection: Pick<FrameworkDetection, 'framework' | 'react' | 'appDir'>): ((cwd: string) => RootWiringResult) | null;
|
|
43
|
+
/**
|
|
44
|
+
* Collection-page rewiring: pages that render a machine-staged collection get
|
|
45
|
+
* their data source switched to `wrapCollection` (Fimo overlay over the
|
|
46
|
+
* retained source rows) mechanically, with per-page bail reasons. Runs during
|
|
47
|
+
* --apply after drafts are staged; adopt-drafts renames the call-site uids.
|
|
48
|
+
* Next.js app router only for now.
|
|
49
|
+
*/
|
|
50
|
+
export declare function frameworkCollectionRewire(detection: Pick<FrameworkDetection, 'framework' | 'appDir'>): ((cwd: string, scan: unknown, drafts: Array<{
|
|
51
|
+
uid: string;
|
|
52
|
+
sourceName: string;
|
|
53
|
+
source: string;
|
|
54
|
+
}>) => CollectionRewireResult) | null;
|
|
55
|
+
export interface WiringMarker {
|
|
56
|
+
/** Candidate files, relative to the project root; ONE must contain the marker. */
|
|
57
|
+
files: string[];
|
|
58
|
+
marker: RegExp;
|
|
59
|
+
/** Human hint rendered when the marker is missing. */
|
|
60
|
+
hint: string;
|
|
61
|
+
/** Missing marker warns instead of failing (no automated recipe yet). */
|
|
62
|
+
warnOnly?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* How `wrap --check` proves the root wiring exists: without providers the
|
|
66
|
+
* wrapped values render fallbacks forever, and neither coverage (counts
|
|
67
|
+
* wraps), parity (fallbacks render identically), nor seeding (DB-side)
|
|
68
|
+
* notices — editability would ship silently broken.
|
|
69
|
+
*/
|
|
70
|
+
export declare function frameworkWiringMarker(detection: Pick<FrameworkDetection, 'framework' | 'react' | 'appDir'>): WiringMarker | null;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { discoverAstroRoutes } from './astro/routes.js';
|
|
3
|
+
import { astroTemplateWrapStyle } from './astro/template-style.js';
|
|
4
|
+
import { rewireNextCollectionPages } from './next/rewire.js';
|
|
5
|
+
import { discoverNextPagesRoutes, discoverNextRoutes } from './next/routes.js';
|
|
6
|
+
import { ensureNextLayoutWiring } from './next/wiring.js';
|
|
7
|
+
import { discoverNuxtRoutes } from './nuxt/routes.js';
|
|
8
|
+
import { nuxtTemplateWrapStyle } from './nuxt/template-style.js';
|
|
9
|
+
import { discoverRemixRoutes } from './remix/routes.js';
|
|
10
|
+
import { discoverSvelteKitRoutes } from './sveltekit/routes.js';
|
|
11
|
+
import { svelteTemplateWrapStyle } from './sveltekit/template-style.js';
|
|
12
|
+
import { discoverReactRouterDomRoutes } from './vite/routes.js';
|
|
13
|
+
import { ensureSpaEntryWiring } from './vite/wiring.js';
|
|
14
|
+
/**
|
|
15
|
+
* Route discovery for any detected framework — the single registry generic
|
|
16
|
+
* code calls. Frameworks without a file convention (vue SPA, plain vite)
|
|
17
|
+
* return [] and rely on fimo-config routes.
|
|
18
|
+
*/
|
|
19
|
+
export function discoverFrameworkRoutes(cwd, detection) {
|
|
20
|
+
if (detection.framework === 'vite' && detection.react) {
|
|
21
|
+
return discoverReactRouterDomRoutes(cwd);
|
|
22
|
+
}
|
|
23
|
+
switch (detection.framework) {
|
|
24
|
+
case 'next':
|
|
25
|
+
return [
|
|
26
|
+
...(detection.appDir ? discoverNextRoutes(join(cwd, detection.appDir)) : []),
|
|
27
|
+
...(detection.pagesDir ? discoverNextPagesRoutes(join(cwd, detection.pagesDir)) : []),
|
|
28
|
+
];
|
|
29
|
+
case 'remix':
|
|
30
|
+
return detection.pagesDir ? discoverRemixRoutes(join(cwd, detection.pagesDir)) : [];
|
|
31
|
+
case 'astro':
|
|
32
|
+
return detection.pagesDir ? discoverAstroRoutes(join(cwd, detection.pagesDir)) : [];
|
|
33
|
+
case 'nuxt':
|
|
34
|
+
return detection.pagesDir ? discoverNuxtRoutes(join(cwd, detection.pagesDir)) : [];
|
|
35
|
+
case 'sveltekit':
|
|
36
|
+
return detection.pagesDir ? discoverSvelteKitRoutes(join(cwd, detection.pagesDir)) : [];
|
|
37
|
+
default:
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extra directories the framework keeps page COPY in, outside any source
|
|
43
|
+
* root (data-file scanning). Part of the framework registry so generic
|
|
44
|
+
* scanners never carry framework names.
|
|
45
|
+
*/
|
|
46
|
+
export function frameworkDataDirs(framework) {
|
|
47
|
+
switch (framework) {
|
|
48
|
+
case 'nuxt':
|
|
49
|
+
return ['content']; // Nuxt Content convention (.yml/.md page documents)
|
|
50
|
+
default:
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The wrapper-import module for frameworks whose .jsx/.tsx is guaranteed
|
|
56
|
+
* React — the only ones the --apply JSX codemod may touch. Template
|
|
57
|
+
* frameworks return null: a .tsx island there may be Solid or Preact, and
|
|
58
|
+
* injecting a React wrapper import breaks the build (bento dogfood). Bare
|
|
59
|
+
* Vite qualifies only with the detection's `react` flag (a react dependency
|
|
60
|
+
* pins the JSX runtime); the SPA primitives live in fimo/react and are
|
|
61
|
+
* fallback-safe before the providers are wired.
|
|
62
|
+
*/
|
|
63
|
+
export function frameworkJsxWrapperModule(detection) {
|
|
64
|
+
switch (detection.framework) {
|
|
65
|
+
case 'next':
|
|
66
|
+
return 'fimo/next';
|
|
67
|
+
case 'remix':
|
|
68
|
+
return 'fimo/remix';
|
|
69
|
+
case 'vite':
|
|
70
|
+
return detection.react ? 'fimo/react' : null;
|
|
71
|
+
default:
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The template-wrap style for frameworks whose template files the --apply
|
|
77
|
+
* codemod may touch (plain text nodes only). Vue SPA stays null: without a
|
|
78
|
+
* server data path there is no deterministic t() wiring to inject.
|
|
79
|
+
*/
|
|
80
|
+
export function frameworkTemplateWrapStyle(framework) {
|
|
81
|
+
switch (framework) {
|
|
82
|
+
case 'astro':
|
|
83
|
+
return astroTemplateWrapStyle;
|
|
84
|
+
case 'nuxt':
|
|
85
|
+
return nuxtTemplateWrapStyle;
|
|
86
|
+
case 'sveltekit':
|
|
87
|
+
return svelteTemplateWrapStyle;
|
|
88
|
+
default:
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The one-time root-wiring codemod for frameworks whose providers mount in a
|
|
94
|
+
* single well-known file (Next.js app router: the root layout; Vite React
|
|
95
|
+
* SPA: the entry). Runs during --apply, AFTER the baseline capture — the
|
|
96
|
+
* pre-wrap dev-server boot must not require the fimo package, and providers
|
|
97
|
+
* are render-transparent so the parity check stays clean. Template
|
|
98
|
+
* frameworks wire through their TemplateWrapStyle.ensureWiring hooks instead.
|
|
99
|
+
*/
|
|
100
|
+
export function frameworkRootWiring(detection) {
|
|
101
|
+
switch (detection.framework) {
|
|
102
|
+
case 'next':
|
|
103
|
+
return (cwd) => ensureNextLayoutWiring(cwd, detection);
|
|
104
|
+
case 'vite':
|
|
105
|
+
return detection.react ? ensureSpaEntryWiring : null;
|
|
106
|
+
default:
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Collection-page rewiring: pages that render a machine-staged collection get
|
|
112
|
+
* their data source switched to `wrapCollection` (Fimo overlay over the
|
|
113
|
+
* retained source rows) mechanically, with per-page bail reasons. Runs during
|
|
114
|
+
* --apply after drafts are staged; adopt-drafts renames the call-site uids.
|
|
115
|
+
* Next.js app router only for now.
|
|
116
|
+
*/
|
|
117
|
+
export function frameworkCollectionRewire(detection) {
|
|
118
|
+
switch (detection.framework) {
|
|
119
|
+
case 'next':
|
|
120
|
+
return (cwd, scan, drafts) => rewireNextCollectionPages(cwd, detection, scan, drafts);
|
|
121
|
+
default:
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* How `wrap --check` proves the root wiring exists: without providers the
|
|
127
|
+
* wrapped values render fallbacks forever, and neither coverage (counts
|
|
128
|
+
* wraps), parity (fallbacks render identically), nor seeding (DB-side)
|
|
129
|
+
* notices — editability would ship silently broken.
|
|
130
|
+
*/
|
|
131
|
+
export function frameworkWiringMarker(detection) {
|
|
132
|
+
switch (detection.framework) {
|
|
133
|
+
case 'next':
|
|
134
|
+
if (!detection.appDir) {
|
|
135
|
+
return {
|
|
136
|
+
files: ['pages/_app.tsx', 'pages/_app.jsx', 'src/pages/_app.tsx', 'src/pages/_app.jsx'],
|
|
137
|
+
marker: /FimoNextProviders/,
|
|
138
|
+
hint: 'mount FimoNextProviders in pages/_app (pages router has no automated recipe yet)',
|
|
139
|
+
warnOnly: true,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
files: [`${detection.appDir}/layout.tsx`, `${detection.appDir}/layout.jsx`, `${detection.appDir}/layout.js`],
|
|
144
|
+
marker: /FimoNextProviders/,
|
|
145
|
+
hint: `mount FimoNextProviders + FimoNextScripts in ${detection.appDir}/layout (agent prompt section 0)`,
|
|
146
|
+
};
|
|
147
|
+
case 'vite':
|
|
148
|
+
if (!detection.react) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
files: ['src/main.tsx', 'src/main.jsx', 'src/index.tsx', 'src/index.jsx'],
|
|
153
|
+
marker: /FimoSpaProviders/,
|
|
154
|
+
hint: 'wrap the root render with FimoSpaProviders from fimo/react (agent prompt section 0)',
|
|
155
|
+
};
|
|
156
|
+
case 'remix':
|
|
157
|
+
return {
|
|
158
|
+
files: ['app/root.tsx', 'app/root.jsx'],
|
|
159
|
+
marker: /FimoRemixProviders/,
|
|
160
|
+
hint: 'mount FimoRemixProviders in app/root (agent prompt section 0)',
|
|
161
|
+
};
|
|
162
|
+
case 'sveltekit':
|
|
163
|
+
return {
|
|
164
|
+
files: ['src/routes/+layout.server.js', 'src/routes/+layout.server.ts'],
|
|
165
|
+
marker: /fimoLabels/,
|
|
166
|
+
hint: 'return fimoLabels from the root +layout.server load (wrap.md SvelteKit notes)',
|
|
167
|
+
};
|
|
168
|
+
default:
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FrameworkDetection } from '../../detect-framework.js';
|
|
2
|
+
import type { WrapScanResult } from '../../scan-wrappable.js';
|
|
3
|
+
/**
|
|
4
|
+
* Page rewiring for wrap-migrated collections: make each page that renders a
|
|
5
|
+
* machine-staged collection read from Fimo through `wrapCollection` while
|
|
6
|
+
* KEEPING its source rows as the render fallback. Two safe shapes:
|
|
7
|
+
*
|
|
8
|
+
* - an in-code array literal (`const clients = [...]`) rendered by the
|
|
9
|
+
* page's default-export function → the literal is extracted byte-faithful
|
|
10
|
+
* to `src/data/<name>.json` (it becomes the fallback file) and the
|
|
11
|
+
* component fetches `wrapCollection('<Uid>', clientsSource)`;
|
|
12
|
+
* - a data-file default import (`import posts from '../src/data/posts.json'`)
|
|
13
|
+
* → the import becomes `postsSource` and the component fetches
|
|
14
|
+
* `wrapCollection('<Uid>', postsSource)`.
|
|
15
|
+
*
|
|
16
|
+
* Everything else bails with a reason that flows into the agent prompt.
|
|
17
|
+
* Uids are the PROVISIONAL draft names; `schemas adopt-drafts` rewrites the
|
|
18
|
+
* call sites through its renames.
|
|
19
|
+
*/
|
|
20
|
+
export interface CollectionRewireResult {
|
|
21
|
+
changes: string[];
|
|
22
|
+
warnings: string[];
|
|
23
|
+
/** Pages successfully rewired. */
|
|
24
|
+
rewired: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function rewireNextCollectionPages(cwd: string, detection: Pick<FrameworkDetection, 'appDir'>, scan: WrapScanResult, drafts: Array<{
|
|
27
|
+
uid: string;
|
|
28
|
+
sourceName: string;
|
|
29
|
+
source: string;
|
|
30
|
+
}>): CollectionRewireResult;
|