Loading examples/sveltekit/package.json +3 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,9 @@ "lint": "eslint ." }, "dependencies": { "@fedify/fedify": "workspace:^", "@fedify/sveltekit": "workspace:^" "@fedify/fedify": "workspace:", "@fedify/sveltekit": "workspace:", "x-forwarded-fetch": "^0.2.0" }, "devDependencies": { "@eslint/compat": "^1.2.5", Loading examples/sveltekit/src/federation/index.ts +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import { Person, Undo, } from "@fedify/fedify"; import { keyPairsStore, relationStore } from "@/data/store"; import { keyPairsStore, relationStore } from "../data/store"; const federation = createFederation({ kv: new MemoryKvStore(), Loading examples/sveltekit/src/hooks.server.ts 0 → 100644 +10 −0 Original line number Diff line number Diff line import { fedifyHook } from "@fedify/sveltekit"; import federation from "./federation"; import { sequence } from "@sveltejs/kit/hooks"; import { replaceHost } from "./lib/handles"; import type { Handle } from "@sveltejs/kit"; export const handle = sequence( replaceHost, fedifyHook(federation, () => {}) as unknown as Handle, ); examples/sveltekit/src/lib/handles.ts 0 → 100644 +14 −0 Original line number Diff line number Diff line import type { Handle } from "@sveltejs/kit"; import { getXForwardedRequest } from "x-forwarded-fetch"; /** * Replaces the host of the request with the value of the * x-forwarded-host header, if present. * If don't use proxy or tunnel, this handle is unnecessary. * @param input * @return A new request handler with the host replaced. */ export const replaceHost: Handle = async ({ event, resolve }) => { event.request = await getXForwardedRequest(event.request); return resolve(event); }; examples/sveltekit/tsconfig.json +1 −9 Original line number Diff line number Diff line Loading @@ -9,14 +9,6 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, "moduleResolution": "bundler", "paths": { "@/*": ["./src/*"] "moduleResolution": "bundler" } } // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files // // To make changes to top-level options such as include and exclude, we recommend extending // the generated config; see https://svelte.dev/docs/kit/configuration#typescript } Loading
examples/sveltekit/package.json +3 −2 Original line number Diff line number Diff line Loading @@ -19,8 +19,9 @@ "lint": "eslint ." }, "dependencies": { "@fedify/fedify": "workspace:^", "@fedify/sveltekit": "workspace:^" "@fedify/fedify": "workspace:", "@fedify/sveltekit": "workspace:", "x-forwarded-fetch": "^0.2.0" }, "devDependencies": { "@eslint/compat": "^1.2.5", Loading
examples/sveltekit/src/federation/index.ts +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import { Person, Undo, } from "@fedify/fedify"; import { keyPairsStore, relationStore } from "@/data/store"; import { keyPairsStore, relationStore } from "../data/store"; const federation = createFederation({ kv: new MemoryKvStore(), Loading
examples/sveltekit/src/hooks.server.ts 0 → 100644 +10 −0 Original line number Diff line number Diff line import { fedifyHook } from "@fedify/sveltekit"; import federation from "./federation"; import { sequence } from "@sveltejs/kit/hooks"; import { replaceHost } from "./lib/handles"; import type { Handle } from "@sveltejs/kit"; export const handle = sequence( replaceHost, fedifyHook(federation, () => {}) as unknown as Handle, );
examples/sveltekit/src/lib/handles.ts 0 → 100644 +14 −0 Original line number Diff line number Diff line import type { Handle } from "@sveltejs/kit"; import { getXForwardedRequest } from "x-forwarded-fetch"; /** * Replaces the host of the request with the value of the * x-forwarded-host header, if present. * If don't use proxy or tunnel, this handle is unnecessary. * @param input * @return A new request handler with the host replaced. */ export const replaceHost: Handle = async ({ event, resolve }) => { event.request = await getXForwardedRequest(event.request); return resolve(event); };
examples/sveltekit/tsconfig.json +1 −9 Original line number Diff line number Diff line Loading @@ -9,14 +9,6 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, "moduleResolution": "bundler", "paths": { "@/*": ["./src/*"] "moduleResolution": "bundler" } } // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files // // To make changes to top-level options such as include and exclude, we recommend extending // the generated config; see https://svelte.dev/docs/kit/configuration#typescript }