fimo 0.20.0 → 0.21.0-experimental.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/agent-templates/_default/GOAL.md +10 -0
- package/assets/agent-templates/_default/capabilities.yaml +10 -0
- package/assets/content-templates/shared/types.eta +1 -1
- package/assets/skills/fimo-cli/SKILL.md +2 -1
- package/assets/skills/fimo-cli/references/agents.md +136 -36
- package/assets/skills/fimo-cli/references/branches.md +8 -5
- package/assets/skills/fimo-cli/references/deploy.md +11 -2
- package/assets/skills/fimo-cli/references/domains.md +12 -0
- package/assets/skills/fimo-cli/references/forms.md +1 -1
- package/assets/skills/fimo-cli/references/init.md +9 -2
- package/assets/skills/fimo-cli/references/locales.md +1 -1
- package/assets/skills/fimo-cli/references/mcp.md +1 -1
- package/assets/skills/fimo-cli/references/media.md +18 -1
- package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +3 -1
- package/assets/skills/fimo-cli/references/projects.md +7 -7
- package/assets/skills/fimo-code/assets/react-router-locales/navigation.tsx +1 -1
- package/assets/skills/fimo-code/references/assets.md +2 -2
- package/assets/skills/fimo-code/references/best-practices/next.md +1 -1
- package/assets/skills/fimo-code/references/content/schema.md +23 -0
- package/assets/skills/fimo-code/references/forms.md +1 -1
- package/assets/skills/fimo-code/references/frameworks/astro.md +8 -2
- package/assets/skills/fimo-code/references/frameworks/compatibility.md +9 -9
- package/assets/skills/fimo-code/references/frameworks/hosting.md +17 -13
- package/assets/skills/fimo-code/references/frameworks/next/app-router.md +8 -9
- package/assets/skills/fimo-code/references/frameworks/next/locales.md +5 -5
- package/assets/skills/fimo-code/references/frameworks/next/pages-router.md +5 -5
- package/assets/skills/fimo-code/references/frameworks/next.md +41 -32
- package/assets/skills/fimo-code/references/frameworks/react-router.md +10 -7
- package/assets/skills/fimo-code/references/frameworks/sveltekit.md +22 -15
- package/assets/skills/fimo-code/references/frameworks/vite-react.md +7 -5
- package/assets/skills/fimo-code/references/labels.md +4 -4
- package/assets/skills/fimo-code/references/locales.md +2 -2
- package/assets/skills/fimo-code/references/ui.md +4 -4
- package/assets/skills/fimo-migration/SKILL.md +51 -30
- package/assets/skills/fimo-migration/references/frameworks/nextjs.md +12 -15
- package/assets/skills/fimo-migration/references/media.md +12 -8
- package/assets/skills/fimo-migration/references/qa.md +12 -11
- package/assets/skills/fimo-migration/references/workers/content-planner.md +33 -4
- package/assets/skills/fimo-migration/references/workers/validator.md +10 -0
- package/assets/skills/fimo-migration/references/workers.md +19 -10
- package/assets/skills/fimo-migration/references/workflow.md +29 -11
- package/assets/skills/fimo-studio/references/ai-chat.md +1 -1
- package/assets/skills/fimo-studio/references/billing-and-credits.md +18 -1
- package/assets/skills/fimo-studio/references/cms.md +2 -0
- package/assets/skills/fimo-studio/references/preview-and-responsive.md +1 -0
- package/assets/starters/fimo-site/template/src/pages/Contact.tsx +1 -1
- package/assets/starters/fimo-site/template/src/pages/SiteContent.tsx +1 -1
- package/assets/starters/fimo-site/template/src/schemas/HomePage.ts +3 -3
- package/assets/starters/fimo-site/template/src/schemas/HomePage.types.ts +1 -1
- package/dist/build/astro/config.d.ts +13 -2
- package/dist/build/astro/config.js +9 -24
- package/dist/build/next/moved.d.ts +2 -0
- package/dist/build/next/moved.js +2 -0
- package/dist/build/react/router-moved.d.ts +2 -0
- package/dist/build/react/router-moved.js +2 -0
- package/dist/build/react/router-preset-moved.d.ts +2 -0
- package/dist/build/react/router-preset-moved.js +2 -0
- package/dist/build/react/router-routes-moved.d.ts +2 -0
- package/dist/build/react/router-routes-moved.js +2 -0
- package/dist/build/react/ui-moved.d.ts +2 -0
- package/dist/build/react/ui-moved.js +2 -0
- package/dist/build/react/vite-moved.d.ts +2 -0
- package/dist/build/react/vite-moved.js +2 -0
- package/dist/build/sveltekit/config.d.ts +5 -4
- package/dist/build/sveltekit/config.js +6 -15
- package/dist/build/sveltekit/moved.d.ts +13 -0
- package/dist/build/sveltekit/moved.js +3 -0
- package/dist/build/vite/data-id.d.ts +11 -0
- package/dist/build/vite/data-id.js +20 -0
- package/dist/build/vite/plugins/runtime-env.d.ts +1 -1
- package/dist/build/vite/plugins/runtime-env.js +6 -2
- package/dist/build/vite/runtime-env.d.ts +2 -0
- package/dist/build/vite/runtime-env.js +1 -0
- package/dist/cli/bundle.json +1 -1
- package/dist/cli/index.js +115 -110
- package/dist/runtime/content/client/internal.js +1 -1
- package/dist/runtime/content/index.d.ts +6 -1
- package/dist/runtime/content/index.js +6 -0
- package/dist/runtime/i18n/index.d.ts +2 -0
- package/dist/runtime/i18n/index.js +1 -0
- package/dist/runtime/labels/index.d.ts +3 -0
- package/dist/runtime/labels/index.js +2 -0
- package/dist/runtime/preview/index.d.ts +5 -0
- package/dist/runtime/preview/index.js +4 -0
- package/dist/runtime/preview/script.d.ts +3 -0
- package/dist/runtime/preview/script.js +14 -0
- package/dist/runtime/primitives/lib/index.d.ts +2 -0
- package/dist/runtime/primitives/lib/index.js +2 -0
- package/dist/runtime/seo/index.d.ts +0 -8
- package/dist/runtime/seo/index.js +0 -8
- package/dist/runtime/shared/config.d.ts +6 -0
- package/dist/runtime/shared/config.js +4 -0
- package/dist/runtime/shared/local-runtime-env.d.ts +2 -2
- package/dist/runtime/shared/local-runtime-env.js +7 -5
- package/dist/runtime/templates.d.ts +20 -4
- package/dist/runtime/templates.js +60 -18
- package/dist/scripts/extract-translations.js +8 -3
- package/dist/scripts/index.d.ts +3 -0
- package/dist/scripts/index.js +2 -0
- package/dist/scripts/sync-forms.js +21 -9
- package/dist/scripts/sync-schemas.js +129 -21
- package/dist/scripts/validate-schemas.js +63 -2
- package/package.json +72 -71
- package/release.json +2 -2
- package/templates/astro/AGENTS.md +1 -1
- package/templates/astro/astro.config.mjs +1 -1
- package/templates/astro/package.json +4 -2
- package/templates/astro/pnpm-workspace.yaml +6 -2
- package/templates/nextjs/.fimo/config.json +1 -2
- package/templates/nextjs/AGENTS.md +6 -16
- package/templates/nextjs/next.config.ts +4 -2
- package/templates/nextjs/package.json +4 -2
- package/templates/nextjs/pnpm-workspace.yaml +6 -2
- package/templates/nextjs/src/app/layout.tsx +16 -0
- package/templates/nextjs/src/locales.ts +3 -6
- package/templates/react-router/AGENTS.md +1 -1
- package/templates/react-router/package.json +5 -2
- package/templates/react-router/pnpm-workspace.yaml +6 -6
- package/templates/react-router/react-router.config.ts +1 -1
- package/templates/react-router/src/pages/legal/LegalPage.tsx +1 -1
- package/templates/react-router/src/root.tsx +1 -1
- package/templates/react-router/src/vite-env.d.ts +0 -1
- package/templates/react-router/vite.config.ts +1 -1
- package/templates/sveltekit/AGENTS.md +1 -1
- package/templates/sveltekit/package.json +4 -2
- package/templates/sveltekit/pnpm-workspace.yaml +6 -2
- package/templates/sveltekit/src/routes/+layout.server.ts +1 -1
- package/templates/sveltekit/src/routes/+layout.svelte +1 -1
- package/templates/sveltekit/svelte.config.js +1 -1
- package/templates/sveltekit/vite.config.ts +1 -1
- package/assets/sveltekit/components/Boolean.svelte +0 -19
- package/assets/sveltekit/components/Date.svelte +0 -33
- package/assets/sveltekit/components/DateTime.svelte +0 -35
- package/assets/sveltekit/components/FimoProvider.svelte +0 -35
- package/assets/sveltekit/components/Image.svelte +0 -80
- package/assets/sveltekit/components/Json.svelte +0 -18
- package/assets/sveltekit/components/Label.svelte +0 -16
- package/assets/sveltekit/components/Number.svelte +0 -21
- package/assets/sveltekit/components/RichText.svelte +0 -19
- package/assets/sveltekit/components/Text.svelte +0 -30
- package/assets/sveltekit/components/Video.svelte +0 -37
- package/assets/sveltekit/components/index.d.ts +0 -11
- package/assets/sveltekit/components/index.js +0 -11
- package/dist/build/next/config.d.ts +0 -17
- package/dist/build/next/config.js +0 -66
- package/dist/build/sveltekit/data-id.d.ts +0 -3
- package/dist/build/sveltekit/data-id.js +0 -171
- package/dist/build/sveltekit/files/edge.js +0 -68
- package/dist/build/sveltekit/files/serverless.js +0 -42
- package/dist/build/sveltekit/vite.d.ts +0 -12
- package/dist/build/sveltekit/vite.js +0 -14
- package/dist/build/vite/index.d.ts +0 -42
- package/dist/build/vite/index.js +0 -160
- package/dist/build/vite/plugins/content-sync.d.ts +0 -11
- package/dist/build/vite/plugins/content-sync.js +0 -41
- package/dist/build/vite/plugins/data-id.d.ts +0 -12
- package/dist/build/vite/plugins/data-id.js +0 -109
- package/dist/build/vite/plugins/fimo-config.d.ts +0 -12
- package/dist/build/vite/plugins/fimo-config.js +0 -68
- package/dist/build/vite/plugins/overlay.d.ts +0 -3
- package/dist/build/vite/plugins/overlay.js +0 -154
- package/dist/build/vite/plugins/robots.d.ts +0 -10
- package/dist/build/vite/plugins/robots.js +0 -56
- package/dist/build/vite/plugins/seo.d.ts +0 -3
- package/dist/build/vite/plugins/seo.js +0 -112
- package/dist/build/vite/plugins/server-config.d.ts +0 -3
- package/dist/build/vite/plugins/server-config.js +0 -36
- package/dist/build/vite/plugins/sitemap.d.ts +0 -3
- package/dist/build/vite/plugins/sitemap.js +0 -73
- package/dist/build/vite/plugins/translations.d.ts +0 -11
- package/dist/build/vite/plugins/translations.js +0 -601
- package/dist/runtime/app/FimoProviders.d.ts +0 -30
- package/dist/runtime/app/FimoProviders.js +0 -186
- package/dist/runtime/app/FimoScripts.d.ts +0 -14
- package/dist/runtime/app/FimoScripts.js +0 -48
- package/dist/runtime/app/index.d.ts +0 -8
- package/dist/runtime/app/index.js +0 -4
- package/dist/runtime/app/prefetch.d.ts +0 -9
- package/dist/runtime/app/prefetch.js +0 -39
- package/dist/runtime/content/DataSourcesProvider.d.ts +0 -4
- package/dist/runtime/content/DataSourcesProvider.js +0 -63
- package/dist/runtime/content/RefreshContentProvider.d.ts +0 -19
- package/dist/runtime/content/RefreshContentProvider.js +0 -71
- package/dist/runtime/content/client/createContentClient.d.ts +0 -7
- package/dist/runtime/content/client/createContentClient.js +0 -7
- package/dist/runtime/content/client/createSingletonClient.d.ts +0 -5
- package/dist/runtime/content/client/createSingletonClient.js +0 -6
- package/dist/runtime/content/client/react-content-client.d.ts +0 -10
- package/dist/runtime/content/client/react-content-client.js +0 -165
- package/dist/runtime/content/client/react-singleton-client.d.ts +0 -7
- package/dist/runtime/content/client/react-singleton-client.js +0 -38
- package/dist/runtime/content/client/types.d.ts +0 -42
- package/dist/runtime/content/client/types.js +0 -1
- package/dist/runtime/content/client/useQueryLocale.d.ts +0 -2
- package/dist/runtime/content/client/useQueryLocale.js +0 -5
- package/dist/runtime/content/client/vite-runtime.d.ts +0 -3
- package/dist/runtime/content/client/vite-runtime.js +0 -23
- package/dist/runtime/content/utils/retrieve-data-sources.d.ts +0 -29
- package/dist/runtime/content/utils/retrieve-data-sources.js +0 -107
- package/dist/runtime/core/AppErrorBoundary.d.ts +0 -10
- package/dist/runtime/core/AppErrorBoundary.js +0 -27
- package/dist/runtime/core/ViteLifecycles.d.ts +0 -5
- package/dist/runtime/core/ViteLifecycles.js +0 -35
- package/dist/runtime/i18n/FimoLocaleContext.d.ts +0 -9
- package/dist/runtime/i18n/FimoLocaleContext.js +0 -17
- package/dist/runtime/iframe/ConsoleErrorProvider.d.ts +0 -3
- package/dist/runtime/iframe/ConsoleErrorProvider.js +0 -103
- package/dist/runtime/iframe/ScreenshotProvider.d.ts +0 -3
- package/dist/runtime/iframe/ScreenshotProvider.js +0 -60
- package/dist/runtime/iframe/runtime/overlay-hmr.d.ts +0 -2
- package/dist/runtime/iframe/runtime/overlay-hmr.js +0 -27
- package/dist/runtime/iframe/runtime/overlay-runtime.d.ts +0 -2
- package/dist/runtime/iframe/runtime/overlay-runtime.js +0 -103
- package/dist/runtime/index.d.ts +0 -22
- package/dist/runtime/index.js +0 -23
- package/dist/runtime/next/client-runtime.d.ts +0 -3
- package/dist/runtime/next/client-runtime.js +0 -24
- package/dist/runtime/next/client.d.ts +0 -28
- package/dist/runtime/next/client.js +0 -25
- package/dist/runtime/next/facade.d.ts +0 -8
- package/dist/runtime/next/facade.js +0 -34
- package/dist/runtime/next/labels.d.ts +0 -7
- package/dist/runtime/next/labels.js +0 -9
- package/dist/runtime/next/preview.d.ts +0 -13
- package/dist/runtime/next/preview.js +0 -34
- package/dist/runtime/next/primitives/Text.d.ts +0 -10
- package/dist/runtime/next/primitives/Text.js +0 -18
- package/dist/runtime/next/primitives/server.d.ts +0 -11
- package/dist/runtime/next/primitives/server.js +0 -54
- package/dist/runtime/next/provider.d.ts +0 -18
- package/dist/runtime/next/provider.js +0 -39
- package/dist/runtime/next/server-runtime.d.ts +0 -3
- package/dist/runtime/next/server-runtime.js +0 -23
- package/dist/runtime/next/server.d.ts +0 -21
- package/dist/runtime/next/server.js +0 -16
- package/dist/runtime/primitives/index.d.ts +0 -16
- package/dist/runtime/primitives/index.js +0 -17
- package/dist/runtime/react/primitives/contracts.d.ts +0 -94
- package/dist/runtime/react/primitives/contracts.js +0 -1
- package/dist/runtime/react/primitives/editable/Boolean.d.ts +0 -5
- package/dist/runtime/react/primitives/editable/Boolean.js +0 -11
- package/dist/runtime/react/primitives/editable/Date.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/Date.js +0 -12
- package/dist/runtime/react/primitives/editable/DateTime.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/DateTime.js +0 -13
- package/dist/runtime/react/primitives/editable/Image.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/Image.js +0 -10
- package/dist/runtime/react/primitives/editable/Json.d.ts +0 -5
- package/dist/runtime/react/primitives/editable/Json.js +0 -11
- package/dist/runtime/react/primitives/editable/RichText.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/RichText.js +0 -11
- package/dist/runtime/react/primitives/editable/Text.d.ts +0 -20
- package/dist/runtime/react/primitives/editable/Text.js +0 -36
- package/dist/runtime/react/primitives/editable/Video.d.ts +0 -4
- package/dist/runtime/react/primitives/editable/Video.js +0 -10
- package/dist/runtime/react/primitives/renderers/DateRenderer.d.ts +0 -17
- package/dist/runtime/react/primitives/renderers/DateRenderer.js +0 -17
- package/dist/runtime/react/primitives/renderers/ImageRenderer.d.ts +0 -8
- package/dist/runtime/react/primitives/renderers/ImageRenderer.js +0 -31
- package/dist/runtime/react/primitives/renderers/RichTextRenderer.d.ts +0 -12
- package/dist/runtime/react/primitives/renderers/RichTextRenderer.js +0 -135
- package/dist/runtime/react/primitives/renderers/StaticImage.d.ts +0 -35
- package/dist/runtime/react/primitives/renderers/StaticImage.js +0 -58
- package/dist/runtime/react/primitives/renderers/VideoRenderer.d.ts +0 -8
- package/dist/runtime/react/primitives/renderers/VideoRenderer.js +0 -10
- package/dist/runtime/react/useFimoLiveValue.d.ts +0 -20
- package/dist/runtime/react/useFimoLiveValue.js +0 -43
- package/dist/runtime/react-router/active-routes.d.ts +0 -12
- package/dist/runtime/react-router/active-routes.js +0 -60
- package/dist/runtime/react-router/index.d.ts +0 -16
- package/dist/runtime/react-router/index.js +0 -20
- package/dist/runtime/react-router/legacy/routes.d.ts +0 -35
- package/dist/runtime/react-router/legacy/routes.js +0 -86
- package/dist/runtime/react-router/navigation-utils.d.ts +0 -8
- package/dist/runtime/react-router/navigation-utils.js +0 -36
- package/dist/runtime/react-router/navigation.d.ts +0 -12
- package/dist/runtime/react-router/navigation.js +0 -28
- package/dist/runtime/react-router/preset.d.ts +0 -30
- package/dist/runtime/react-router/preset.js +0 -33
- package/dist/runtime/routing/AppResetScrollOnNavigate.d.ts +0 -2
- package/dist/runtime/routing/AppResetScrollOnNavigate.js +0 -12
- package/dist/runtime/routing/AppRoutesProvider.d.ts +0 -25
- package/dist/runtime/routing/AppRoutesProvider.js +0 -112
- package/dist/runtime/seo/buildSeoForPath.d.ts +0 -74
- package/dist/runtime/seo/buildSeoForPath.js +0 -55
- package/dist/runtime/seo/htmlProps.d.ts +0 -13
- package/dist/runtime/seo/htmlProps.js +0 -15
- package/dist/runtime/sveltekit/content.d.ts +0 -25
- package/dist/runtime/sveltekit/content.js +0 -33
- package/dist/runtime/sveltekit/context-contract.d.ts +0 -5
- package/dist/runtime/sveltekit/context-contract.js +0 -2
- package/dist/runtime/sveltekit/context.d.ts +0 -8
- package/dist/runtime/sveltekit/context.js +0 -25
- package/dist/runtime/sveltekit/forms.d.ts +0 -15
- package/dist/runtime/sveltekit/forms.js +0 -15
- package/dist/runtime/sveltekit/index.d.ts +0 -9
- package/dist/runtime/sveltekit/index.js +0 -5
- package/dist/runtime/sveltekit/internal.d.ts +0 -6
- package/dist/runtime/sveltekit/internal.js +0 -12
- package/dist/runtime/sveltekit/labels.d.ts +0 -20
- package/dist/runtime/sveltekit/labels.js +0 -13
- package/dist/runtime/sveltekit/preview.d.ts +0 -28
- package/dist/runtime/sveltekit/preview.js +0 -82
- package/dist/runtime/sveltekit/runtime.d.ts +0 -9
- package/dist/runtime/sveltekit/runtime.js +0 -26
- package/dist/runtime/t/OptionalTracking.d.ts +0 -13
- package/dist/runtime/t/OptionalTracking.js +0 -28
- package/dist/runtime/t/Pageview.d.ts +0 -9
- package/dist/runtime/t/Pageview.js +0 -118
- package/dist/runtime/vite/Label.d.ts +0 -13
- package/dist/runtime/vite/Label.js +0 -16
- package/dist/runtime/vite/primitives/Images.d.ts +0 -4
- package/dist/runtime/vite/primitives/Images.js +0 -12
- package/dist/runtime/vite/translations.d.ts +0 -28
- package/dist/runtime/vite/translations.js +0 -103
- package/templates/nextjs/src/app/(default)/layout.tsx +0 -10
- package/templates/nextjs/src/app/[locale]/layout.tsx +0 -22
- package/templates/nextjs/src/app/[locale]/page.tsx +0 -1
- package/templates/nextjs/src/components/Document.tsx +0 -26
- package/templates/nextjs/src/components/FimoPreviewBridge.tsx +0 -13
- /package/templates/nextjs/src/app/{(default)/page.tsx → page.tsx} +0 -0
|
@@ -1,46 +1,31 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';
|
|
2
1
|
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import astroHostingAdapter from '@astrojs/vercel';
|
|
4
2
|
import { getConfigPreviewRoutes } from '../../runtime/preview/routes.js';
|
|
5
3
|
import { getConfigServer } from '../../runtime/shared/fimo-config.server.js';
|
|
6
4
|
import runtimeEnvPlugin from '../vite/plugins/runtime-env.js';
|
|
7
|
-
const require = createRequire(import.meta.url);
|
|
8
|
-
const astroHostingEntrypoint = require.resolve('@astrojs/vercel/entrypoint');
|
|
9
5
|
function serializeForModule(value) {
|
|
10
6
|
return (JSON.stringify(value) ?? 'undefined')
|
|
11
7
|
.replaceAll('<', '\\u003c')
|
|
12
8
|
.replaceAll('\u2028', '\\u2028')
|
|
13
9
|
.replaceAll('\u2029', '\\u2029');
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
configDone({
|
|
21
|
-
...options,
|
|
22
|
-
setAdapter: (resolvedAdapter) => options.setAdapter({
|
|
23
|
-
...resolvedAdapter,
|
|
24
|
-
serverEntrypoint: astroHostingEntrypoint,
|
|
25
|
-
}),
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
return adapter;
|
|
30
|
-
}
|
|
31
|
-
/** Connect an Astro app to Fimo preview and hosted server rendering. */
|
|
32
|
-
export function fimo() {
|
|
11
|
+
/**
|
|
12
|
+
* Connect an Astro app to Fimo preview and the git branch's Fimo env.
|
|
13
|
+
* Server-rendered Fimo hosting needs the adapter from `fimo-astro/config`.
|
|
14
|
+
*/
|
|
15
|
+
export function fimo(options = {}) {
|
|
33
16
|
return {
|
|
34
17
|
name: 'fimo:astro',
|
|
35
18
|
hooks: {
|
|
36
19
|
'astro:config:setup': ({ config, injectScript, updateConfig }) => {
|
|
37
20
|
const hasVercelAdapter = config.integrations?.some((integration) => integration.name === '@astrojs/vercel' || integration.name.startsWith('@astrojs/vercel/'));
|
|
38
21
|
if (config.output === 'server' && !config.adapter && !hasVercelAdapter) {
|
|
22
|
+
if (!options.hostingAdapter) {
|
|
23
|
+
throw new Error("Fimo hosting for Astro moved to the fimo-astro package. Install fimo-astro at the same version as fimo and import { fimo } from 'fimo-astro/config' in astro.config.mjs.");
|
|
24
|
+
}
|
|
39
25
|
// Astro copies config.adapter into its adapter lifecycle before setup
|
|
40
26
|
// hooks run. Registering the same object as an integration ensures
|
|
41
27
|
// its config:done hook calls setAdapter for the server build.
|
|
42
|
-
|
|
43
|
-
updateConfig({ adapter, integrations: [adapter] });
|
|
28
|
+
updateConfig({ adapter: options.hostingAdapter, integrations: [options.hostingAdapter] });
|
|
44
29
|
}
|
|
45
30
|
// Astro is Vite underneath: the same plugin that points a Vite app at
|
|
46
31
|
// the git branch's env does it here, exposing `PUBLIC_FIMO_API_URL`.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { Adapter } from '@sveltejs/kit';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
* provider
|
|
2
|
+
* The SvelteKit hosting adapter moved to `fimo-sveltekit/config` so its
|
|
3
|
+
* provider and SvelteKit peer graph are only installed by SvelteKit projects
|
|
4
|
+
* (FIMO-1635). This subpath stays for one release to turn a stale import into
|
|
5
|
+
* an actionable error instead of a missing-adapter build failure.
|
|
5
6
|
*/
|
|
6
|
-
export declare function fimo():
|
|
7
|
+
export declare function fimo(): never;
|
|
7
8
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import fs from"node:fs";import path from"node:path";import process2 from"node:process";import{fileURLToPath}from"node:url";import{nodeFileTrace}from"@vercel/nft";import esbuild from"esbuild";import process from"node:process";function get_pathname(route){let i=1,pathname=route.segments.map(segment=>{if(!segment.dynamic)return"/"+segment.content;let parts=segment.content.split(/\[(.+?)\](?!\])/);return parts.length===3&&!parts[0]&&!parts[2]&&(parts[1].startsWith("...")||parts[1][0]==="[")?`$${i++}`:"/"+parts.map((content,j)=>j%2?`$${i++}`:content).join("")}).join("");return pathname[0]==="/"?pathname.slice(1):pathname}__name(get_pathname,"get_pathname");function pattern_to_src(pattern){let src=pattern.slice(1,-2).replace(/\\\//g,"/");return src==="^/"&&(src="^/?"),src=src.replace(/\(\?:\/\((.+?)\)\)/g,"(/$1)"),src}__name(pattern_to_src,"pattern_to_src");var integer=/^\d+$/;function parse_isr_expiration(value,route_id){if(value===!1||value==="false")return!1;let err=__name(desc=>{throw new Error(`Invalid isr.expiration value: ${JSON.stringify(value)} (${desc}, in ${route_id})`)},"err"),parsed;return typeof value=="string"?(integer.test(value)||err("value was a string but could not be parsed as an integer"),parsed=Number.parseInt(value,10)):(Number.isInteger(value)||err("should be an integer"),parsed=value),Number.isNaN(parsed)&&err("should be a number"),parsed<0&&err("should be non-negative"),parsed}__name(parse_isr_expiration,"parse_isr_expiration");function resolve_runtime(default_key,override_key){let key=(override_key??default_key??get_default_runtime()).replace("experimental_","");return assert_is_valid_runtime(key),key}__name(resolve_runtime,"resolve_runtime");var valid_node_versions=[20,22,24],formatter=new Intl.ListFormat("en",{type:"disjunction"});function get_default_runtime(){let major=Number(process.version.slice(1).split(".")[0]);if(!valid_node_versions.includes(major))throw new Error(`Unsupported Node.js version: ${process.version}. Please use Node ${formatter.format(valid_node_versions.map(v=>`${v}`))} to build your project, or explicitly specify a runtime in your adapter configuration.`);return`nodejs${major}.x`}__name(get_default_runtime,"get_default_runtime");var valid_runtimes=["nodejs20.x","nodejs22.x","nodejs24.x","bun1.x","edge"];function assert_is_valid_runtime(key){if(!valid_runtimes.includes(key))throw new Error(`Unsupported runtime: ${key}. Supported runtimes are: ${valid_runtimes.join(", ")}. See the Node.js Version section in your Vercel project settings for info on the currently supported versions.`)}__name(assert_is_valid_runtime,"assert_is_valid_runtime");import{VERSION}from"@sveltejs/kit";var name="@sveltejs/adapter-vercel",INTERNAL="![-]",[kit_major,kit_minor]=VERSION.split("."),compatible_node_modules=["async_hooks","events","buffer","assert","util"],plugin=__name(function(defaults={}){if("edge"in defaults)throw new Error("{ edge: true } has been removed in favour of { runtime: 'edge' }");return{name,async adapt(builder){if(!builder.routes)throw new Error("@sveltejs/adapter-vercel >=2.x (possibly installed through @sveltejs/adapter-auto) requires @sveltejs/kit version 1.5 or higher. Either downgrade the adapter or upgrade @sveltejs/kit");let dir=".vercel/output",tmp=builder.getBuildDirectory("vercel-tmp");if(builder.rimraf(dir),builder.rimraf(tmp),fs.existsSync("vercel.json")){let vercel_file=fs.readFileSync("vercel.json","utf-8"),vercel_config=JSON.parse(vercel_file);validate_vercel_json(builder,vercel_config)}let files=fileURLToPath(new URL("./files",import.meta.url).href),dirs={static:`${dir}/static${builder.config.kit.paths.base}`,functions:`${dir}/functions`};builder.log.minor("Copying assets..."),builder.writeClient(dirs.static),builder.writePrerendered(dirs.static);let static_config=static_vercel_config(builder,defaults,dirs.static);builder.log.minor("Generating serverless function...");async function generate_serverless_function(name2,config,routes){let dir2=`${dirs.functions}/${name2}.func`,relativePath=path.posix.relative(tmp,builder.getServerDirectory());builder.copy(`${files}/serverless.js`,`${tmp}/index.js`,{replace:{SERVER:`${relativePath}/index.js`,MANIFEST:"./manifest.js"}}),builder.hasServerInstrumentationFile?.()&&builder.instrument?.({entrypoint:`${tmp}/index.js`,instrumentation:`${builder.getServerDirectory()}/instrumentation.server.js`}),write(`${tmp}/manifest.js`,`export const manifest = ${builder.generateManifest({relativePath,routes})};
|
|
2
|
-
`),await create_function_bundle(builder,`${tmp}/index.js`,dir2,config);for(let asset of builder.findServerAssets(routes))builder.copy(`${builder.getServerDirectory()}/${asset}`,`${dir2}/${asset}`)}__name(generate_serverless_function,"generate_serverless_function");let warned=!1;async function generate_edge_function(name2,config,routes){warned||(warned=!0,builder.log.warn("The `runtime: 'edge'` option is deprecated, and will be removed in a future version of adapter-vercel"));let tmp2=builder.getBuildDirectory(`vercel-tmp/${name2}`),relativePath=path.posix.relative(tmp2,builder.getServerDirectory());builder.copy(`${files}/edge.js`,`${tmp2}/edge.js`,{replace:{SERVER:`${relativePath}/index.js`,MANIFEST:"./manifest.js"}}),write(`${tmp2}/manifest.js`,`export const manifest = ${builder.generateManifest({relativePath,routes})};
|
|
3
|
-
`);try{let outdir=`${dirs.functions}/${name2}.func`,esbuild_config={target:"es2020",bundle:!0,platform:"browser",conditions:["edge-light","module"],format:"esm",external:[...compatible_node_modules,...compatible_node_modules.map(id=>`node:${id}`),...config.external||[]],sourcemap:"linked",banner:{js:"globalThis.global = globalThis;"},loader:{".wasm":"copy",".woff":"copy",".woff2":"copy",".ttf":"copy",".eot":"copy",".otf":"copy"}},result=await esbuild.build({entryPoints:[`${tmp2}/edge.js`],outfile:`${outdir}/index.js`,...esbuild_config}),instrumentation_result;builder.hasServerInstrumentationFile?.()&&(instrumentation_result=await esbuild.build({entryPoints:[`${builder.getServerDirectory()}/instrumentation.server.js`],outfile:`${outdir}/instrumentation.server.js`,...esbuild_config}),builder.instrument?.({entrypoint:`${outdir}/index.js`,instrumentation:`${outdir}/instrumentation.server.js`,module:{generateText:generate_traced_edge_module}}));let warnings=instrumentation_result?[...result.warnings,...instrumentation_result.warnings]:result.warnings;if(warnings.length>0){let formatted=await esbuild.formatMessages(warnings,{kind:"warning",color:!0});console.error(formatted.join(`
|
|
4
|
-
`))}}catch(err){let error=err;for(let e of error.errors)for(let node of e.notes){let match=/The package "(.+)" wasn't found on the file system but is built into node/.exec(node.text);match&&(node.text=`Cannot use "${match[1]}" when deploying to Vercel Edge Functions.`)}let formatted=await esbuild.formatMessages(error.errors,{kind:"error",color:!0});throw console.error(formatted.join(`
|
|
5
|
-
`)),new Error(`Bundling with esbuild failed with ${error.errors.length} ${error.errors.length===1?"error":"errors"}`,{cause:err})}write(`${dirs.functions}/${name2}.func/.vc-config.json`,JSON.stringify({runtime:config.runtime,regions:config.regions,entrypoint:"index.js",framework:{slug:"sveltekit",version:VERSION}},null," "))}__name(generate_edge_function,"generate_edge_function");let groups=new Map,conflicts=new Map,functions=new Map,isr_config=new Map,ignored_isr=new Set;for(let route of builder.routes){let runtime=resolve_runtime(defaults.runtime,route.config.runtime),config={...defaults,...route.config,runtime};if(is_prerendered(route)){config.isr&&ignored_isr.add(route.id);continue}if(config.isr){let directory=path.relative(".",builder.config.kit.files.routes+route.id);if(runtime==="edge")throw new Error(`${directory}: Routes using \`isr\` must use a Node.js or Bun runtime (for example 'nodejs24.x' or 'experimental_bun1.x')`);if(config.isr.allowQuery?.includes("__pathname"))throw new Error(`${directory}: \`__pathname\` is a reserved query parameter for \`isr.allowQuery\``);isr_config.set(route,{expiration:config.isr.expiration,bypassToken:config.isr.bypassToken,allowQuery:["__pathname",...config.isr.allowQuery??[]],group:isr_config.size+1,passQuery:!0})}let hash=hash_config(config),pattern=route.pattern.toString(),existing=conflicts.get(pattern);if(existing){if(existing.hash!==hash)throw new Error(`The ${route.id} and ${existing.route_id} routes must be merged into a single function that matches the ${route.pattern} regex, but they have incompatible configs. You must either rename one of the routes, or make their configs match.`)}else conflicts.set(pattern,{hash,route_id:route.id});let id=config.split?`${hash}-${groups.size}`:hash,group=groups.get(id);group||(group={i:groups.size,config,routes:[]},groups.set(id,group)),group.routes.push(route)}if(ignored_isr.size){builder.log.warn(`
|
|
6
|
-
Warning: The following routes have an ISR config which is ignored because the route is prerendered:`);for(let ignored of ignored_isr)console.log(` - ${ignored}`);console.log(`Either remove the "prerender" option from these routes to use ISR, or remove the ISR config.
|
|
7
|
-
`)}let singular=groups.size===1;for(let group of groups.values()){let generate_function=group.config.runtime==="edge"?generate_edge_function:generate_serverless_function,name2=singular?`${INTERNAL}/catchall`:`${INTERNAL}/${group.i}`;await generate_function(name2,group.config,group.routes);for(let route of group.routes)functions.set(route.pattern.toString(),name2)}if(!singular){let runtime=resolve_runtime(defaults.runtime);await(runtime==="edge"?generate_edge_function:generate_serverless_function)(`${INTERNAL}/catchall`,{...defaults,runtime},[])}if(builder.config.kit.experimental.remoteFunctions){let app_path=builder.getAppPath(),remote_symlink_path=`${path.join(dirs.functions,app_path,"remote")}.func`,target=path.join(dirs.functions,INTERNAL,"catchall.func");builder.mkdirp(path.join(dirs.functions,app_path));let relative=path.relative(path.dirname(remote_symlink_path),target);fs.symlinkSync(relative,remote_symlink_path),static_config.routes.push({src:`/${app_path}/remote/.+`,dest:`/${app_path}/remote`})}for(let route of builder.routes){if(is_prerendered(route))continue;let pattern=route.pattern.toString(),src=pattern_to_src(pattern),name2=functions.get(pattern),isr=isr_config.get(route);if(isr){let isr_name=route.id.slice(1)||"__root__",base=`${dirs.functions}/${isr_name}`;builder.mkdirp(base);let target=`${dirs.functions}/${name2}.func`,relative=path.relative(path.dirname(base),target);fs.symlinkSync(relative,`${base}.func`),fs.symlinkSync(`../${relative}`,`${base}/__data.json.func`);let pathname=get_pathname(route),json=JSON.stringify({...isr,expiration:parse_isr_expiration(isr.expiration,route.id)},null," ");write(`${base}.prerender-config.json`,json),write(`${base}/__data.json.prerender-config.json`,json);let q=`?__pathname=/${pathname}`;static_config.routes.push({src:src+"$",dest:`/${isr_name}${q}`}),static_config.routes.push({src:src+"/__data.json$",dest:`/${isr_name}/__data.json${q}`})}else{let is_root=route.id==="/",route_fs_name=is_root?"index":route.id.slice(1),route_dest_name=is_root?"":route.id.slice(1),base_dir=path.join(dirs.functions,route_fs_name),main_symlink_path=`${base_dir}.func`,data_symlink_path=path.join(base_dir,"__data.json.func"),target=path.join(dirs.functions,`${name2}.func`);builder.mkdirp(base_dir);let relative_for_main=path.relative(path.dirname(main_symlink_path),target),relative_for_data=path.relative(path.dirname(data_symlink_path),target);fs.symlinkSync(relative_for_main,main_symlink_path),fs.symlinkSync(relative_for_data,data_symlink_path),static_config.routes.push({src:src+"(?:/__data.json)?$",dest:`/${route_dest_name}`})}}builder.config.kit.router?.resolution==="server"&&(await generate_edge_function(`${builder.config.kit.appDir}/route`,{external:"external"in defaults?defaults.external:void 0,runtime:"edge"},[]),static_config.routes.push({src:`${builder.config.kit.paths.base}/(|.+/)__route\\.js`,dest:`${builder.config.kit.paths.base}/${builder.config.kit.appDir}/route`})),static_config.routes.push({src:"/.*",dest:`/${INTERNAL}/catchall`}),builder.log.minor("Writing routes..."),write(`${dir}/config.json`,JSON.stringify(static_config,null," "))},supports:{read:__name(({config,route})=>{if((config.runtime??defaults.runtime)==="edge"&&kit_major==="2"&&kit_minor<"25")throw new Error(`${name}: Cannot use \`read\` from \`$app/server\` in route \`${route.id}\` configured with \`runtime: 'edge'\` and SvelteKit < 2.25.0`);return!0},"read"),instrumentation:__name(()=>!0,"instrumentation")}}},"plugin");function hash_config(config){return[config.runtime??"",config.external??"",config.regions??"",config.memory??"",config.maxDuration??"",!!config.isr].join("/")}__name(hash_config,"hash_config");function write(file,data){try{fs.mkdirSync(path.dirname(file),{recursive:!0})}catch{}fs.writeFileSync(file,data)}__name(write,"write");function static_vercel_config(builder,config,dir){let prerendered_redirects=[],overrides={},images=config.images;for(let[src,redirect]of builder.prerendered.redirects)src.replace(/\/$/,"")===redirect.location.replace(/\/$/,"")||(src=src.replace(/\/?$/,"/?")),prerendered_redirects.push({src,headers:{Location:redirect.location},status:redirect.status});for(let[path2,page]of builder.prerendered.pages){let overrides_path=path2.slice(1);if(path2!=="/"){let counterpart_route=path2+"/";path2.endsWith("/")&&(counterpart_route=path2.slice(0,-1),overrides_path=path2.slice(1,-1)),prerendered_redirects.push({src:path2,dest:counterpart_route},{src:counterpart_route,status:308,headers:{Location:path2}})}overrides[page.file]={path:overrides_path}}let routes=[{src:".*",continue:!0,transforms:[{type:"request.query",op:"delete",target:{key:"__pathname"}}]},...prerendered_redirects,{src:`/${builder.getAppPath()}/immutable/.+`,headers:{"cache-control":"public, immutable, max-age=31536000"}}];if(process2.env.VERCEL_SKEW_PROTECTION_ENABLED){routes.push({src:"/.*",has:[{type:"header",key:"Sec-Fetch-Dest",value:"document"}],headers:{"Set-Cookie":`__vdpl=${process2.env.VERCEL_DEPLOYMENT_ID}; Path=${builder.config.kit.paths.base}/; SameSite=Strict; Secure; HttpOnly`},continue:!0});let base=`${dir}/${builder.config.kit.appDir}/immutable/entry`,entry=fs.readdirSync(base).find(file=>file.startsWith("start."));if(!entry)throw new Error("Could not find entry point");routes.splice(-2,0,{src:`/${builder.getAppPath()}/immutable/entry/${entry}`,headers:{"Set-Cookie":`__vdpl=; Path=/${builder.getAppPath()}/version.json; SameSite=Strict; Secure; HttpOnly`},continue:!0})}return routes.push({handle:"filesystem"}),routes.push({src:`/${builder.getAppPath()}/immutable/.+`,status:404,headers:{"cache-control":"no-store"},continue:!1}),{version:3,routes,overrides,images}}__name(static_vercel_config,"static_vercel_config");async function create_function_bundle(builder,entry,dir,config){fs.rmSync(dir,{force:!0,recursive:!0});let base=entry;for(;base!==(base=path.dirname(base)););let traced=await nodeFileTrace([entry],{base}),resolution_failures=new Map;if(traced.warnings.forEach(error=>{if(!error.message.startsWith("Failed to resolve dependency node:")&&!error.message.startsWith("Failed to parse"))if(error.message.startsWith("Failed to resolve dependency")){let match=/Cannot find module '(.+?)' loaded from (.+)/,[,module,importer]=match.exec(error.message)??[,error.message,"(unknown)"];resolution_failures.has(importer)||resolution_failures.set(importer,[]),resolution_failures.get(importer).push(module)}else throw error}),resolution_failures.size>0){let cwd=process2.cwd();builder.log.warn("Warning: The following modules failed to locate dependencies that may (or may not) be required for your app to work:");for(let[importer,modules]of resolution_failures){console.error(` ${path.relative(cwd,importer)}`);for(let module of modules)console.error(` - \x1B[1m\x1B[36m${module}\x1B[39m\x1B[22m`)}}let files=Array.from(traced.fileList),common_parts=files[0]?.split(path.sep)??[];for(let i=1;i<files.length;i+=1){let parts=files[i].split(path.sep);for(let j=0;j<common_parts.length;j+=1)if(parts[j]!==common_parts[j]){common_parts=common_parts.slice(0,j);break}}let ancestor=base+common_parts.join(path.sep);for(let file of traced.fileList){let source=base+file,dest=path.join(dir,path.relative(ancestor,source)),is_dir=fs.statSync(source).isDirectory(),realpath=fs.realpathSync(source);try{fs.mkdirSync(path.dirname(dest),{recursive:!0})}catch{}if(source!==realpath){let realdest=path.join(dir,path.relative(ancestor,realpath));fs.symlinkSync(path.relative(path.dirname(dest),realdest),dest,is_dir?"dir":"file")}else is_dir||fs.copyFileSync(source,dest)}write(`${dir}/.vc-config.json`,JSON.stringify({runtime:config.runtime,regions:config.regions,memory:config.memory,maxDuration:config.maxDuration,handler:path.relative(base+ancestor,entry),launcherType:"Nodejs",experimentalResponseStreaming:!config.isr,framework:{slug:"sveltekit",version:VERSION}},null," ")),write(`${dir}/package.json`,JSON.stringify({type:"module"}))}__name(create_function_bundle,"create_function_bundle");function validate_vercel_json(builder,vercel_config){if(builder.routes.length>0&&!builder.routes[0].api)return;let crons=Array.isArray(vercel_config?.crons)?vercel_config.crons:[],valid_routes=builder.routes.filter(route=>route.api.methods.includes("GET")),unmatched_paths=[];for(let cron of crons){if(typeof cron!="object"||cron===null||!("path"in cron))continue;let{path:path2}=cron;typeof path2=="string"&&(valid_routes.some(route=>route.pattern.test(path2))||unmatched_paths.push(path2))}if(unmatched_paths.length){builder.log.warn("\nWarning: vercel.json defines cron tasks that use paths that do not correspond to an API route with a GET handler (ignore this if the request is handled in your `handle` hook):");for(let path2 of unmatched_paths)console.log(` - ${path2}`);console.log("")}}__name(validate_vercel_json,"validate_vercel_json");function is_prerendered(route){return route.prerender===!0||route.prerender==="auto"&&route.segments.every(segment=>!segment.dynamic)}__name(is_prerendered,"is_prerendered");function generate_traced_edge_module({instrumentation,start}){return`import './${instrumentation}';
|
|
8
|
-
const promise = import('./${start}');
|
|
9
|
-
|
|
10
1
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
2
|
+
* The SvelteKit hosting adapter moved to `fimo-sveltekit/config` so its
|
|
3
|
+
* provider and SvelteKit peer graph are only installed by SvelteKit projects
|
|
4
|
+
* (FIMO-1635). This subpath stays for one release to turn a stale import into
|
|
5
|
+
* an actionable error instead of a missing-adapter build failure.
|
|
13
6
|
*/
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
return handler(req, res);
|
|
7
|
+
export function fimo() {
|
|
8
|
+
throw new Error("Fimo hosting for SvelteKit moved to the fimo-sveltekit package. Install fimo-sveltekit at the same version as fimo and import { fimo } from 'fimo-sveltekit/config' in svelte.config.js.");
|
|
17
9
|
}
|
|
18
|
-
`}__name(generate_traced_edge_module,"generate_traced_edge_module");var adapter_vercel_default=plugin;function fimo(){return adapter_vercel_default({runtime:"nodejs24.x"})}__name(fimo,"fimo");export{fimo};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backs `fimo/sveltekit`, `fimo/sveltekit/components`, `fimo/sveltekit/internal`
|
|
3
|
+
* and `fimo/sveltekit/vite`, whose implementations moved to the `fimo-sveltekit`
|
|
4
|
+
* package so a project on another framework never resolves a SvelteKit peer
|
|
5
|
+
* graph (FIMO-1635). These subpaths stay for one release to turn a stale import
|
|
6
|
+
* into an actionable error instead of a missing-export failure.
|
|
7
|
+
*
|
|
8
|
+
* The throw is at module scope on purpose: it reports the same migration step
|
|
9
|
+
* whichever name the stale import asked for, across all four subpaths. `export
|
|
10
|
+
* {}` keeps this a module rather than a global script.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=moved.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
throw new Error('The Fimo SvelteKit runtime moved to the fimo-sveltekit package. Install fimo-sveltekit at the same version as fimo, then import from ' +
|
|
2
|
+
"'fimo-sveltekit' (content, labels, forms), 'fimo-sveltekit/components', 'fimo-sveltekit/internal', or 'fimo-sveltekit/vite'.");
|
|
3
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1-based line and 0-based column of `offset` in `code`.
|
|
3
|
+
*
|
|
4
|
+
* Framework packages share the source-id convention, but the pure coordinate
|
|
5
|
+
* helper stays in neutral `fimo` so they do not import the React JSX plugin.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getLineColumn(code: string, offset: number): {
|
|
8
|
+
line: number;
|
|
9
|
+
column: number;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=data-id.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1-based line and 0-based column of `offset` in `code`.
|
|
3
|
+
*
|
|
4
|
+
* Framework packages share the source-id convention, but the pure coordinate
|
|
5
|
+
* helper stays in neutral `fimo` so they do not import the React JSX plugin.
|
|
6
|
+
*/
|
|
7
|
+
export function getLineColumn(code, offset) {
|
|
8
|
+
let line = 1;
|
|
9
|
+
let column = 0;
|
|
10
|
+
for (let index = 0; index < offset && index < code.length; index++) {
|
|
11
|
+
if (code[index] === '\n') {
|
|
12
|
+
line++;
|
|
13
|
+
column = 0;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
column++;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return { line, column };
|
|
20
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { loadEnv } from 'vite';
|
|
2
1
|
import { findStaleFimoOverride, resolveLocalRuntimeEnv, staleOverrideMessage, } from '../../../runtime/shared/local-runtime-env.js';
|
|
3
2
|
/**
|
|
4
3
|
* Point the app at the Fimo env of the current git branch.
|
|
@@ -33,12 +32,17 @@ export default function runtimeEnvPlugin() {
|
|
|
33
32
|
// comes back empty. Astro hides the same bug because it reads
|
|
34
33
|
// `import.meta.env`, which `define` patches at transform time.
|
|
35
34
|
order: 'pre',
|
|
36
|
-
handler(config, { command, mode }) {
|
|
35
|
+
async handler(config, { command, mode }) {
|
|
37
36
|
const cwd = config.root ?? process.cwd();
|
|
38
37
|
const derived = resolveLocalRuntimeEnv({ cwd });
|
|
39
38
|
if (!derived) {
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
41
|
+
// Keep the public neutral entry importable without installing Vite.
|
|
42
|
+
// The consuming framework always provides Vite when it invokes the
|
|
43
|
+
// plugin, but `import('fimo/vite/runtime-env')` is also a valid package
|
|
44
|
+
// boundary probe for projects that only install the core runtime.
|
|
45
|
+
const { loadEnv } = await import('vite');
|
|
42
46
|
const explicit = { ...loadEnv(mode, config.envDir ?? cwd, ''), ...process.env };
|
|
43
47
|
if (command === 'serve') {
|
|
44
48
|
const stale = findStaleFimoOverride(explicit, derived);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './plugins/runtime-env.js';
|