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
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
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
|
-
}
|
|
2
|
+
export type { DisplayRoute, ParamInfo } from '../shared/display-routes.js';
|
|
13
3
|
export interface FimoProvidersProps {
|
|
14
4
|
children?: React.ReactNode;
|
|
15
5
|
locale?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FimoProviders.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/FimoProviders.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAgBzE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AA+D3E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,kBAAkB,2CAwCrE"}
|
|
@@ -11,31 +11,10 @@ import { ViteLifecycles } from '../core/ViteLifecycles.js';
|
|
|
11
11
|
import { FimoLocaleProvider } from '../i18n/FimoLocaleContext.js';
|
|
12
12
|
import { getFimoTextDirection, resolveFimoLocale, toHtmlLang } from '../i18n/locale.js';
|
|
13
13
|
import { ScreenshotProvider } from '../iframe/ScreenshotProvider.js';
|
|
14
|
+
import { getDisplayRoutes as getDisplayRoutesFromConfig } from '../shared/display-routes.js';
|
|
14
15
|
import { OptionalTracking } from '../t/OptionalTracking.js';
|
|
15
|
-
const titleCase = (seg) => seg
|
|
16
|
-
.replace(/[_\-]+/g, ' ')
|
|
17
|
-
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
|
18
|
-
.split(/\s+/)
|
|
19
|
-
.filter(Boolean)
|
|
20
|
-
.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
|
|
21
|
-
.join(' ');
|
|
22
|
-
const generateRouteName = (path) => {
|
|
23
|
-
if (path === '/') {
|
|
24
|
-
return 'Home';
|
|
25
|
-
}
|
|
26
|
-
const firstSegment = path.replace(/^\//, '').split('/')[0];
|
|
27
|
-
return titleCase(firstSegment);
|
|
28
|
-
};
|
|
29
16
|
function getDisplayRoutes() {
|
|
30
|
-
|
|
31
|
-
return Object.entries(configRoutes)
|
|
32
|
-
.filter(([, route]) => route.path)
|
|
33
|
-
.map(([id, route]) => ({
|
|
34
|
-
id,
|
|
35
|
-
path: route.path,
|
|
36
|
-
name: route.name || generateRouteName(route.path),
|
|
37
|
-
params: route.params,
|
|
38
|
-
}));
|
|
17
|
+
return getDisplayRoutesFromConfig(fimoConfig);
|
|
39
18
|
}
|
|
40
19
|
function PreviewBridge() {
|
|
41
20
|
const navigate = useNavigate();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FimoScripts.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/FimoScripts.tsx"],"names":[],"mappings":"AAKA,OAAO,0BAA0B,CAAC;AA6BlC;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,4CAc1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtF,YAAY,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefetch.d.ts","sourceRoot":"","sources":["../../../src/runtime/app/prefetch.ts"],"names":[],"mappings":"AAkFA,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,6CAElD;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAqClG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/astro/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/runtime/astro/server.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// fimo/astro/server — Astro adapter, server surface. The loaders are
|
|
2
|
+
// framework-neutral (Astro needs no React): call them in server-side code
|
|
3
|
+
// (frontmatter / load functions / useAsyncData) and render values with the
|
|
4
|
+
// DOM attribute helpers so edit mode can select the elements.
|
|
5
|
+
export * from '../wrapped/server.js';
|
|
6
|
+
export { fimoLabelAttrs, fimoMediaAttrs } from '../wrapped/dom.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataSourcesProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/DataSourcesProvider.tsx"],"names":[],"mappings":"AA6CA,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CA8B9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshContentProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/RefreshContentProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGnD,UAAU,qBAAqB;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAYD,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAMrE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,qBAAqB,GAAG,IAAI,CAWpF;AAmBD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,OAAO,EAAE,qBAAqB,GAAG,IAAI,GACpC,OAAO,CAUT;AAED,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CAiCxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshContentProvider.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/RefreshContentProvider.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { getContentRefreshPayload, normalizeContentQueryRoot, shouldInvalidateContentQuery, } from './RefreshContentProvider.js';
|
|
3
|
+
describe('RefreshContentProvider content invalidation', () => {
|
|
4
|
+
it('keeps broad invalidation when no content type is provided', () => {
|
|
5
|
+
expect(shouldInvalidateContentQuery(['BlogPost'], null)).toBe(true);
|
|
6
|
+
expect(shouldInvalidateContentQuery(['Author'], {})).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
it('invalidates only matching generated content query roots', () => {
|
|
9
|
+
const payload = { contentType: 'BlogPost', locale: 'en' };
|
|
10
|
+
expect(shouldInvalidateContentQuery(['BlogPost', 'entry-1', 'en'], payload)).toBe(true);
|
|
11
|
+
expect(shouldInvalidateContentQuery(['Author', 'entry-1', 'en'], payload)).toBe(false);
|
|
12
|
+
});
|
|
13
|
+
it('normalizes schema-style content type names to generated query roots', () => {
|
|
14
|
+
expect(normalizeContentQueryRoot('blog-post')).toBe('BlogPost');
|
|
15
|
+
expect(shouldInvalidateContentQuery(['BlogPost'], { contentType: 'blog-post' })).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
it('supports events with multiple changed content types', () => {
|
|
18
|
+
const payload = {
|
|
19
|
+
changes: [
|
|
20
|
+
{ contentType: 'BlogPost', id: 'post-1' },
|
|
21
|
+
{ contentType: 'author-profile', id: 'author-1' },
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
expect(shouldInvalidateContentQuery(['BlogPost'], payload)).toBe(true);
|
|
25
|
+
expect(shouldInvalidateContentQuery(['AuthorProfile'], payload)).toBe(true);
|
|
26
|
+
expect(shouldInvalidateContentQuery(['Product'], payload)).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
it('reads payloads from window messages and direct HMR payloads', () => {
|
|
29
|
+
const payload = { contentType: 'BlogPost', locale: 'en' };
|
|
30
|
+
expect(getContentRefreshPayload({ type: 'content/refresh', payload })).toEqual(payload);
|
|
31
|
+
expect(getContentRefreshPayload(payload)).toEqual(payload);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseCollectionResponse.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/parseCollectionResponse.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;KAC3B,CAAC;CACH;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAE1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseCollectionResponse.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/content/parseCollectionResponse.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { parseCollectionResponse } from './parseCollectionResponse.js';
|
|
3
|
+
describe('parseCollectionResponse', () => {
|
|
4
|
+
it('accepts the collection envelope used by generated clients', () => {
|
|
5
|
+
const response = parseCollectionResponse({
|
|
6
|
+
data: [{ id: 'post-1', title: 'Hello' }],
|
|
7
|
+
meta: { limit: 12, offset: 24, total: 40, hasMore: true },
|
|
8
|
+
});
|
|
9
|
+
expect(response).toEqual({
|
|
10
|
+
data: [{ id: 'post-1', title: 'Hello' }],
|
|
11
|
+
meta: { limit: 12, offset: 24, total: 40, hasMore: true },
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
it('rejects invalid pagination metadata', () => {
|
|
15
|
+
expect(() => parseCollectionResponse({
|
|
16
|
+
data: [],
|
|
17
|
+
meta: { limit: 0, offset: -1, total: '40', hasMore: 'yes' },
|
|
18
|
+
})).toThrow();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieve-data-sources.d.ts","sourceRoot":"","sources":["../../../../src/runtime/content/utils/retrieve-data-sources.ts"],"names":[],"mappings":"AACA,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAExC,UAAU,UAAU;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AA8B9D;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,kBAAkB,CAiD/D"}
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
function parseRecordIdentity(token) {
|
|
2
|
-
if (!token.startsWith('id:')) {
|
|
3
|
-
return token.includes(':') ? null : { id: token };
|
|
4
|
-
}
|
|
5
|
-
const [format, id, encodedLocale, ...rest] = token.split(':');
|
|
6
|
-
if (format !== 'id' || !id || !encodedLocale || rest.length > 0) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
const locale = decodeURIComponent(encodedLocale);
|
|
11
|
-
return locale ? { id, locale } : null;
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
1
|
/**
|
|
18
2
|
* Checks if an element is genuinely visible to the user within the viewport.
|
|
19
3
|
* @param el The element to check.
|
|
@@ -54,13 +38,7 @@ export function retrieveVisibleDataSources() {
|
|
|
54
38
|
const parts = source.split('.');
|
|
55
39
|
// Expects the format "SchemaName.id.fieldName"
|
|
56
40
|
if (parts.length === 3) {
|
|
57
|
-
const [schemaName,
|
|
58
|
-
const identity = parseRecordIdentity(identityToken);
|
|
59
|
-
if (!identity) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const { id, locale } = identity;
|
|
63
|
-
const recordKey = JSON.stringify([id, locale ?? null]);
|
|
41
|
+
const [schemaName, id, fieldName] = parts;
|
|
64
42
|
// Skip __translations
|
|
65
43
|
if (schemaName === '__translations') {
|
|
66
44
|
return;
|
|
@@ -70,17 +48,16 @@ export function retrieveVisibleDataSources() {
|
|
|
70
48
|
tempGroupedData[schemaName] = {};
|
|
71
49
|
}
|
|
72
50
|
// Ensure the record (by ID) exists for this schema
|
|
73
|
-
if (!tempGroupedData[schemaName][
|
|
74
|
-
tempGroupedData[schemaName][
|
|
51
|
+
if (!tempGroupedData[schemaName][id]) {
|
|
52
|
+
tempGroupedData[schemaName][id] = {
|
|
75
53
|
id: id,
|
|
76
|
-
...(locale ? { locale } : {}),
|
|
77
54
|
data: {},
|
|
78
55
|
visible: isElementVisible(el),
|
|
79
56
|
};
|
|
80
57
|
}
|
|
81
58
|
// Add the field and its text content to the record
|
|
82
59
|
if (el.textContent) {
|
|
83
|
-
tempGroupedData[schemaName][
|
|
60
|
+
tempGroupedData[schemaName][id].data[fieldName] = el.textContent.trim();
|
|
84
61
|
}
|
|
85
62
|
}
|
|
86
63
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/AppErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,QAmBrC;AAGD,wBAAgB,gBAAgB,4CAM/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViteLifecycles.d.ts","sourceRoot":"","sources":["../../../src/runtime/core/ViteLifecycles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAGzC,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAkCzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FimoLocaleContext.d.ts","sourceRoot":"","sources":["../../../src/runtime/i18n/FimoLocaleContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,oBAAoB,EACpB,QAAQ,GAAG,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,KAAK,CAC1E,CAAC;AAaF,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,sBAAsB,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAEpH;AAED,wBAAgB,SAAS,IAAI,sBAAsB,CAElD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../../../src/runtime/i18n/locale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,GAAG,EAAE,KAAK,GAAG,KAAK,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAEzF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAUrF;AAED,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,GAAG,GAAG,GAAG,qBAAqB,EACjD,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,SAAS,GAC3C,oBAAoB,CA8CtB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAgBnH;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAGlE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAYpF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/i18n/locale.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { localizeFimoPath, resolveFimoLocale } from './locale';
|
|
3
|
+
describe('Fimo locale routing', () => {
|
|
4
|
+
const config = {
|
|
5
|
+
i18n: {
|
|
6
|
+
defaultLocale: 'en',
|
|
7
|
+
locales: ['en', 'es'],
|
|
8
|
+
routing: {
|
|
9
|
+
strategy: 'path-prefix',
|
|
10
|
+
prefixDefaultLocale: false,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
it('uses the unprefixed URL for the default locale', () => {
|
|
15
|
+
expect(resolveFimoLocale('/pricing', config)).toMatchObject({
|
|
16
|
+
locale: 'en',
|
|
17
|
+
routePath: '/pricing',
|
|
18
|
+
prefix: null,
|
|
19
|
+
isDefaultLocale: true,
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
it('strips non-default locale prefixes before route matching', () => {
|
|
23
|
+
expect(resolveFimoLocale('/es/blog/hola-mundo', config)).toMatchObject({
|
|
24
|
+
locale: 'es',
|
|
25
|
+
routePath: '/blog/hola-mundo',
|
|
26
|
+
prefix: 'es',
|
|
27
|
+
isDefaultLocale: false,
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
it('builds localized paths for enabled locales', () => {
|
|
31
|
+
expect(localizeFimoPath('/pricing', 'en', config)).toBe('/pricing');
|
|
32
|
+
expect(localizeFimoPath('/pricing', 'es', config)).toBe('/es/pricing');
|
|
33
|
+
expect(localizeFimoPath('/', 'es', config)).toBe('/es');
|
|
34
|
+
});
|
|
35
|
+
it('can prefix the default locale when configured', () => {
|
|
36
|
+
const prefixed = {
|
|
37
|
+
i18n: {
|
|
38
|
+
...config.i18n,
|
|
39
|
+
routing: {
|
|
40
|
+
strategy: 'path-prefix',
|
|
41
|
+
prefixDefaultLocale: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
expect(localizeFimoPath('/pricing', 'en', prefixed)).toBe('/en/pricing');
|
|
46
|
+
});
|
|
47
|
+
it('canonicalizes structurally valid locale tags', () => {
|
|
48
|
+
expect(resolveFimoLocale('/es-419/pricing', {
|
|
49
|
+
i18n: {
|
|
50
|
+
defaultLocale: 'en_us',
|
|
51
|
+
locales: ['en_us', 'es-419'],
|
|
52
|
+
},
|
|
53
|
+
})).toMatchObject({
|
|
54
|
+
locale: 'es-419',
|
|
55
|
+
defaultLocale: 'en-US',
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleErrorProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/iframe/ConsoleErrorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAkEnD,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,iBAAiB,CA0CtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenshotProvider.d.ts","sourceRoot":"","sources":["../../../src/runtime/iframe/ScreenshotProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAkEnD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,iBAAiB,CAOpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-hmr.d.ts","sourceRoot":"","sources":["../../../../src/runtime/iframe/runtime/overlay-hmr.ts"],"names":[],"mappings":""}
|
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
// stays `undefined`. The inline overlay runtime (overlay-runtime.ts) exposes
|
|
7
7
|
// its helpers on `window.__fimoOverlay`, which we call here.
|
|
8
8
|
function api() {
|
|
9
|
-
if (typeof window === 'undefined') {
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
9
|
return window.__fimoOverlay;
|
|
13
10
|
}
|
|
14
11
|
if (import.meta && import.meta.hot) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-runtime.d.ts","sourceRoot":"","sources":["../../../../src/runtime/iframe/runtime/overlay-runtime.ts"],"names":[],"mappings":""}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -8,9 +8,6 @@ export { DataSourcesProvider } from './content/DataSourcesProvider.js';
|
|
|
8
8
|
export { RefreshContentProvider } from './content/RefreshContentProvider.js';
|
|
9
9
|
export { parseCollectionResponse } from './content/parseCollectionResponse.js';
|
|
10
10
|
export type { CollectionResponse } from './content/parseCollectionResponse.js';
|
|
11
|
-
export { createContentClient } from './content/client/createContentClient.js';
|
|
12
|
-
export { createSingletonClient } from './content/client/createSingletonClient.js';
|
|
13
|
-
export type { CollectionContentClient, CollectionPage, CollectionPageInfo, ContentClientConfig, ContentClientHandle, ContentModuleMeta, ContentModuleRef, ContentReadOptions, ContentResult, ContentSchema, ContentSchemaField, InfiniteListResult, SingletonContentClient, } from './content/client/types.js';
|
|
14
11
|
export { AppErrorBoundary } from './core/AppErrorBoundary.js';
|
|
15
12
|
export { ViteLifecycles } from './core/ViteLifecycles.js';
|
|
16
13
|
export { Pageview } from './t/Pageview.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACvE,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,YAAY,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,cAAc,uBAAuB,CAAC"}
|
package/dist/runtime/index.js
CHANGED
|
@@ -6,8 +6,6 @@ export { localizeFimoPath, resolveFimoLocale } from './i18n/locale.js';
|
|
|
6
6
|
export { DataSourcesProvider } from './content/DataSourcesProvider.js';
|
|
7
7
|
export { RefreshContentProvider } from './content/RefreshContentProvider.js';
|
|
8
8
|
export { parseCollectionResponse } from './content/parseCollectionResponse.js';
|
|
9
|
-
export { createContentClient } from './content/client/createContentClient.js';
|
|
10
|
-
export { createSingletonClient } from './content/client/createSingletonClient.js';
|
|
11
9
|
// Core
|
|
12
10
|
export { AppErrorBoundary } from './core/AppErrorBoundary.js';
|
|
13
11
|
export { ViteLifecycles } from './core/ViteLifecycles.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FimoConfig } from '../shared/fimo-config.types.js';
|
|
3
|
+
import type { WrappedMediaEntry, WrappedRichTextEntry } from '../wrapped/WrappedContentContext.js';
|
|
4
|
+
import { type WrappedLabels } from '../wrapped/WrappedProviders.js';
|
|
5
|
+
export type FimoNextLabels = WrappedLabels;
|
|
6
|
+
export interface FimoNextProvidersProps {
|
|
7
|
+
config: FimoConfig;
|
|
8
|
+
labels?: FimoNextLabels;
|
|
9
|
+
media?: Record<string, WrappedMediaEntry>;
|
|
10
|
+
richText?: Record<string, WrappedRichTextEntry>;
|
|
11
|
+
locale?: string;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Fimo providers for wrapped Next.js apps — the Next adapter supplies only
|
|
16
|
+
* the navigation hooks; everything else lives in the framework-neutral
|
|
17
|
+
* WrappedProviders. Mount once in the root layout:
|
|
18
|
+
*
|
|
19
|
+
* const config = loadFimoConfig();
|
|
20
|
+
* const labels = await loadFimoLabels();
|
|
21
|
+
* <FimoNextProviders config={config} labels={labels}>{children}</FimoNextProviders>
|
|
22
|
+
*/
|
|
23
|
+
export declare function FimoNextProviders(props: FimoNextProvidersProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=FimoNextProviders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FimoNextProviders.d.ts","sourceRoot":"","sources":["../../../src/runtime/next/FimoNextProviders.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AACnG,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEtF,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAK9D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { usePathname, useRouter } from 'next/navigation';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { WrappedProviders } from '../wrapped/WrappedProviders.js';
|
|
6
|
+
/**
|
|
7
|
+
* Fimo providers for wrapped Next.js apps — the Next adapter supplies only
|
|
8
|
+
* the navigation hooks; everything else lives in the framework-neutral
|
|
9
|
+
* WrappedProviders. Mount once in the root layout:
|
|
10
|
+
*
|
|
11
|
+
* const config = loadFimoConfig();
|
|
12
|
+
* const labels = await loadFimoLabels();
|
|
13
|
+
* <FimoNextProviders config={config} labels={labels}>{children}</FimoNextProviders>
|
|
14
|
+
*/
|
|
15
|
+
export function FimoNextProviders(props) {
|
|
16
|
+
const router = useRouter();
|
|
17
|
+
const pathname = usePathname();
|
|
18
|
+
const navigation = useMemo(() => ({ pathname, navigate: (to) => router.push(to) }), [pathname, router]);
|
|
19
|
+
return _jsx(WrappedProviders, { ...props, navigation: navigation });
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders the Fimo preview client script in development so the Fimo Studio
|
|
3
|
+
* preview can select/edit elements. Mount inside <head> in the root layout.
|
|
4
|
+
*
|
|
5
|
+
* The script URL comes from NEXT_PUBLIC_FIMO_PREVIEW_SCRIPT_URL (written by
|
|
6
|
+
* `fimo init` for wrapped projects, pointing at `<apiUrl>/preview.js`).
|
|
7
|
+
* Renders nothing in production builds.
|
|
8
|
+
*/
|
|
9
|
+
export declare function FimoNextScripts(): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
//# sourceMappingURL=FimoNextScripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FimoNextScripts.d.ts","sourceRoot":"","sources":["../../../src/runtime/next/FimoNextScripts.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,eAAe,mDAW9B"}
|
|
@@ -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 NEXT_PUBLIC_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 FimoNextScripts() {
|
|
11
|
+
if (process.env.NODE_ENV !== 'development') {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const previewScriptUrl = process.env.NEXT_PUBLIC_FIMO_PREVIEW_SCRIPT_URL;
|
|
15
|
+
if (!previewScriptUrl) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return _jsx("script", { type: "module", src: previewScriptUrl });
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { FimoNextProviders } from './FimoNextProviders.js';
|
|
2
|
+
export type { FimoNextLabels, FimoNextProvidersProps } from './FimoNextProviders.js';
|
|
3
|
+
export { FimoNextScripts } from './FimoNextScripts.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, useTranslations } from '../primitives/labels-hook.js';
|
|
12
|
+
export { Text, Image, Video, RichText } from '../react/index.js';
|
|
13
|
+
export type { FimoConfig } from '../shared/fimo-config.types.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/next/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,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;AAInG,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// fimo/next — the Next.js adapter for wrapped (migrated) sites.
|
|
2
|
+
// Client components; server loaders live in fimo/next/server.
|
|
3
|
+
export { FimoNextProviders } from './FimoNextProviders.js';
|
|
4
|
+
export { FimoNextScripts } from './FimoNextScripts.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
|
+
// Framework-neutral React surface, re-exported for convenience so wrapped
|
|
12
|
+
// apps import everything from fimo/next.
|
|
13
|
+
export { useLabels, useTranslations } from '../primitives/labels-hook.js';
|
|
14
|
+
export { Text, Image, Video, RichText } from '../react/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/runtime/next/server.ts"],"names":[],"mappings":"AAGA,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function useFimoLabels(locale?: string): Promise<Record<string, string>>;
|
|
2
|
+
/**
|
|
3
|
+
* Server-loaded, hydration-safe label accessor for `<script setup>`:
|
|
4
|
+
*
|
|
5
|
+
* const t = await useFimoT();
|
|
6
|
+
* <h1 v-bind="fimoLabelAttrs('hero.title')">{{ t('hero.title', 'Fallback') }}</h1>
|
|
7
|
+
*/
|
|
8
|
+
export declare function useFimoT(locale?: string): Promise<(key: string, fallback?: string) => string>;
|
|
9
|
+
//# sourceMappingURL=composables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composables.d.ts","sourceRoot":"","sources":["../../../src/runtime/nuxt/composables.ts"],"names":[],"mappings":"AA8BA,wBAAsB,aAAa,CAAC,MAAM,SAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAyBlF;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,MAAM,SAAO,GAAG,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,CAGjG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Nuxt composables over the PURE label-fetch core. Constraints proven by the
|
|
2
|
+
// nuxtship dogfood, in order:
|
|
3
|
+
// - no node builtins anywhere in this module graph (`<script setup>` imports
|
|
4
|
+
// land in the client bundle; named imports from externalized builtins hard-
|
|
5
|
+
// fail `nuxt build`);
|
|
6
|
+
// - no `#app` import (Vite's dep optimizer prebundles node_modules with no
|
|
7
|
+
// knowledge of Nuxt aliases);
|
|
8
|
+
// - no `nuxt/app` import either (server-side the package is a nitro external
|
|
9
|
+
// resolved by raw node, where nuxt/app's internal `#build/*` imports do not
|
|
10
|
+
// exist).
|
|
11
|
+
// So: import only from 'vue', reach the Nuxt app via the current component
|
|
12
|
+
// instance, and hand labels to the client through `nuxtApp.payload.data` —
|
|
13
|
+
// the exact bucket useAsyncData serializes into the page payload.
|
|
14
|
+
import { getCurrentInstance } from 'vue';
|
|
15
|
+
import { fetchLabelDictionary, resolveTenantApiUrl } from '../shared/labels-fetch.pure.js';
|
|
16
|
+
function currentNuxtApp() {
|
|
17
|
+
const instance = getCurrentInstance();
|
|
18
|
+
const vueApp = instance?.appContext?.app;
|
|
19
|
+
return vueApp?.$nuxt ?? vueApp?.config?.globalProperties?.$nuxt ?? instance?.proxy?.$nuxt;
|
|
20
|
+
}
|
|
21
|
+
export async function useFimoLabels(locale = 'en') {
|
|
22
|
+
const key = `__fimo_labels_${locale}`;
|
|
23
|
+
const payloadData = currentNuxtApp()?.payload?.data;
|
|
24
|
+
const cached = payloadData?.[key];
|
|
25
|
+
if (cached) {
|
|
26
|
+
return cached;
|
|
27
|
+
}
|
|
28
|
+
// `typeof window` (not import.meta.server): as a nitro external this module
|
|
29
|
+
// runs as plain node ESM where Nuxt's import.meta flags do not exist.
|
|
30
|
+
if (typeof window !== 'undefined') {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
const apiUrl = resolveTenantApiUrl(process.env);
|
|
34
|
+
if (!apiUrl) {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const { labels } = await fetchLabelDictionary(apiUrl, locale);
|
|
39
|
+
if (payloadData) {
|
|
40
|
+
payloadData[key] = labels;
|
|
41
|
+
}
|
|
42
|
+
return labels;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Server-loaded, hydration-safe label accessor for `<script setup>`:
|
|
50
|
+
*
|
|
51
|
+
* const t = await useFimoT();
|
|
52
|
+
* <h1 v-bind="fimoLabelAttrs('hero.title')">{{ t('hero.title', 'Fallback') }}</h1>
|
|
53
|
+
*/
|
|
54
|
+
export async function useFimoT(locale = 'en') {
|
|
55
|
+
const labels = await useFimoLabels(locale);
|
|
56
|
+
return (key, fallback = '') => labels[key] ?? fallback;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/nuxt/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
|