fimo 0.15.0-staging.2 → 0.15.0-staging.3
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 -0
- package/assets/content-templates/forms/framework.eta +90 -0
- package/assets/content-templates/forms/react.eta +42 -21
- package/assets/skills/fimo-cli/references/forms.md +2 -2
- package/assets/skills/fimo-cli/references/init.md +10 -8
- package/assets/skills/fimo-cli/references/projects.md +1 -1
- package/assets/skills/fimo-code/references/forms.md +24 -10
- package/assets/skills/fimo-code/references/frameworks/astro.md +9 -0
- package/assets/skills/fimo-code/references/frameworks/next.md +25 -0
- package/assets/skills/fimo-code/references/frameworks/sveltekit.md +33 -5
- package/assets/skills/fimo-code/references/labels.md +1 -1
- package/dist/build/sveltekit/config.d.ts +2 -1
- package/dist/build/sveltekit/config.js +15 -5
- package/dist/build/sveltekit/files/edge.js +68 -0
- package/dist/build/sveltekit/files/serverless.js +42 -0
- package/dist/cli/bundle.json +1 -1
- package/dist/cli/index.js +12 -12
- package/dist/runtime/astro/server.d.ts +2 -0
- package/dist/runtime/astro/server.js +2 -0
- package/dist/runtime/forms/client.d.ts +13 -0
- package/dist/runtime/forms/client.js +83 -0
- package/dist/runtime/forms/index.d.ts +2 -0
- package/dist/runtime/forms/index.js +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/next/client.d.ts +2 -0
- package/dist/runtime/next/client.js +2 -0
- package/dist/runtime/next/server.d.ts +2 -0
- package/dist/runtime/next/server.js +2 -0
- package/dist/runtime/react-router/index.d.ts +1 -0
- package/dist/runtime/react-router/index.js +1 -0
- package/dist/runtime/sveltekit/forms.d.ts +15 -0
- package/dist/runtime/sveltekit/forms.js +15 -0
- package/dist/runtime/sveltekit/index.d.ts +2 -0
- package/dist/runtime/sveltekit/index.js +1 -0
- package/dist/runtime/sveltekit/labels.d.ts +7 -3
- package/dist/runtime/sveltekit/labels.js +1 -1
- package/dist/runtime/sveltekit/runtime.d.ts +2 -1
- package/dist/runtime/sveltekit/runtime.js +8 -2
- package/dist/runtime/templates.d.ts +1 -1
- package/dist/runtime/templates.js +1 -1
- package/dist/scripts/sync-forms.d.ts +1 -0
- package/dist/scripts/sync-forms.js +78 -26
- package/package.json +9 -4
- package/templates/astro/.fimo/config.json +21 -0
- package/templates/astro/AGENTS.md +37 -0
- package/templates/astro/CLAUDE.md +5 -0
- package/templates/astro/_gitignore +15 -0
- package/templates/astro/astro.config.mjs +7 -0
- package/templates/astro/package.json +22 -0
- package/templates/astro/pnpm-workspace.yaml +7 -0
- package/templates/astro/src/components/ProjectOverview.astro +42 -0
- package/templates/astro/src/env.d.ts +1 -0
- package/templates/astro/src/layouts/Base.astro +81 -0
- package/templates/astro/src/pages/index.astro +10 -0
- package/templates/astro/src/pages/projects/[slug].astro +26 -0
- package/templates/astro/src/pages/projects/index.astro +10 -0
- package/templates/astro/src/schemas/Project.json +9 -0
- package/templates/astro/src/schemas/Project.ts +29 -0
- package/templates/astro/src/schemas/Project.types.ts +70 -0
- package/templates/astro/src/schemas/SiteSettings.json +10 -0
- package/templates/astro/src/schemas/SiteSettings.ts +31 -0
- package/templates/astro/src/schemas/SiteSettings.types.ts +69 -0
- package/templates/astro/tsconfig.json +5 -0
- package/templates/react-router/package.json +1 -1
- package/templates/sveltekit/src/routes/+layout.server.ts +1 -2
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* eslint-disable n/prefer-global/process --
|
|
2
|
+
Vercel Edge Runtime does not support node:process */
|
|
3
|
+
import { Server } from 'SERVER';
|
|
4
|
+
import { manifest } from 'MANIFEST';
|
|
5
|
+
|
|
6
|
+
const server = new Server(manifest);
|
|
7
|
+
|
|
8
|
+
/** @type {HeadersInit | undefined} */
|
|
9
|
+
let read_headers;
|
|
10
|
+
if (process.env.VERCEL_AUTOMATION_BYPASS_SECRET) {
|
|
11
|
+
read_headers = {
|
|
12
|
+
'x-vercel-protection-bypass': process.env.VERCEL_AUTOMATION_BYPASS_SECRET
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* We don't know the origin until we receive a request, but
|
|
18
|
+
* that's guaranteed to happen before we call `read`
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
let origin;
|
|
22
|
+
|
|
23
|
+
const initialized = server.init({
|
|
24
|
+
env: /** @type {Record<string, string>} */ (process.env),
|
|
25
|
+
read: async (file) => {
|
|
26
|
+
const url = `${origin}/${file}`;
|
|
27
|
+
const response = await fetch(url, {
|
|
28
|
+
// we need to add a bypass header if the user has deployment protection enabled
|
|
29
|
+
// see https://vercel.com/docs/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation
|
|
30
|
+
headers: read_headers
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
if (response.status === 401) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Please enable Protection Bypass for Automation: https://svelte.dev/docs/kit/adapter-vercel#Troubleshooting-Deployment-protection`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// belt and braces — not sure how we could end up here
|
|
41
|
+
throw new Error(
|
|
42
|
+
`read(...) failed: could not fetch ${url} (${response.status} ${response.statusText})`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return response.body;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {Request} request
|
|
52
|
+
* @param {import('../index.js').RequestContext} context
|
|
53
|
+
*/
|
|
54
|
+
export default async (request, context) => {
|
|
55
|
+
if (!origin) {
|
|
56
|
+
origin = new URL(request.url).origin;
|
|
57
|
+
await initialized;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return server.respond(request, {
|
|
61
|
+
getClientAddress() {
|
|
62
|
+
return /** @type {string} */ (request.headers.get('x-forwarded-for'));
|
|
63
|
+
},
|
|
64
|
+
platform: {
|
|
65
|
+
context
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createReadableStream } from '@sveltejs/kit/node';
|
|
2
|
+
import { Server } from 'SERVER';
|
|
3
|
+
import { manifest } from 'MANIFEST';
|
|
4
|
+
import process from 'node:process';
|
|
5
|
+
|
|
6
|
+
const server = new Server(manifest);
|
|
7
|
+
|
|
8
|
+
await server.init({
|
|
9
|
+
env: /** @type {Record<string, string>} */ (process.env),
|
|
10
|
+
read: createReadableStream
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const DATA_SUFFIX = '/__data.json';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
/**
|
|
17
|
+
* @param {Request} request
|
|
18
|
+
* @returns {Promise<Response>}
|
|
19
|
+
*/
|
|
20
|
+
fetch(request) {
|
|
21
|
+
// If this is an ISR request, the requested pathname is encoded
|
|
22
|
+
// as a search parameter, so we need to extract it
|
|
23
|
+
const url = new URL(request.url);
|
|
24
|
+
let pathname = url.searchParams.get('__pathname');
|
|
25
|
+
|
|
26
|
+
if (pathname) {
|
|
27
|
+
// Optional routes' pathname replacements look like `/foo/$1/bar` which means we could end up with an url like /foo//bar
|
|
28
|
+
pathname = pathname.replace(/\/+/g, '/');
|
|
29
|
+
|
|
30
|
+
url.pathname = pathname + (url.pathname.endsWith(DATA_SUFFIX) ? DATA_SUFFIX : '');
|
|
31
|
+
url.searchParams.delete('__pathname');
|
|
32
|
+
|
|
33
|
+
request = new Request(url, request);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return server.respond(request, {
|
|
37
|
+
getClientAddress() {
|
|
38
|
+
return /** @type {string} */ (request.headers.get('x-forwarded-for'));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|