zudoku 0.78.0 → 0.78.2
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/dist/cli/cli.js +602 -160
- package/dist/cli/worker.js +6 -4
- package/dist/declarations/app/adapter.d.ts +12 -0
- package/dist/declarations/app/adapters/cloudflare.d.ts +8 -0
- package/dist/declarations/app/adapters/lambda.d.ts +13 -0
- package/dist/declarations/app/adapters/node.d.ts +12 -0
- package/dist/declarations/app/adapters/vercel.d.ts +14 -0
- package/dist/declarations/app/entry.client.d.ts +2 -0
- package/dist/declarations/app/entry.server.d.ts +13 -0
- package/dist/declarations/app/protectChunks.d.ts +17 -0
- package/dist/declarations/app/wrapProtectedRoutes.d.ts +4 -0
- package/dist/declarations/config/validators/HeaderNavigationSchema.d.ts +216 -80
- package/dist/declarations/config/validators/ZudokuConfig.d.ts +81 -30
- package/dist/declarations/config/validators/icon-types.d.ts +1 -1
- package/dist/declarations/lib/authentication/authentication.d.ts +7 -0
- package/dist/declarations/lib/authentication/cookie-sync.d.ts +3 -0
- package/dist/declarations/lib/authentication/cookies.d.ts +10 -0
- package/dist/declarations/lib/authentication/providers/azureb2c.d.ts +6 -1
- package/dist/declarations/lib/authentication/providers/clerk.d.ts +1 -0
- package/dist/declarations/lib/authentication/providers/openid.d.ts +2 -1
- package/dist/declarations/lib/authentication/providers/supabase.d.ts +2 -0
- package/dist/declarations/lib/authentication/session-handler.d.ts +81 -0
- package/dist/declarations/lib/authentication/state.d.ts +7 -0
- package/dist/declarations/lib/authentication/verify-cache.d.ts +2 -0
- package/dist/declarations/lib/components/Bootstrap.d.ts +2 -2
- package/dist/declarations/lib/components/Heading.d.ts +1 -1
- package/dist/declarations/lib/components/context/RenderContext.d.ts +6 -0
- package/dist/declarations/lib/core/RouteGuard.d.ts +11 -0
- package/dist/declarations/lib/core/ZudokuContext.d.ts +5 -2
- package/dist/declarations/lib/manifest.d.ts +25 -0
- package/dist/declarations/lib/util/url.d.ts +2 -0
- package/dist/flat-config.d.ts +1 -1
- package/docs/configuration/protected-routes.md +21 -4
- package/docs/guides/server-side-content-protection.md +207 -0
- package/package.json +26 -4
- package/src/app/adapter.ts +16 -0
- package/src/app/adapters/cloudflare.ts +18 -0
- package/src/app/adapters/lambda.ts +36 -0
- package/src/app/adapters/node.ts +32 -0
- package/src/app/adapters/vercel.ts +39 -0
- package/src/app/demo.tsx +2 -2
- package/src/app/entry.client.tsx +19 -7
- package/src/app/entry.server.tsx +133 -9
- package/src/app/main.tsx +21 -3
- package/src/app/protectChunks.ts +64 -0
- package/src/app/standalone.tsx +2 -2
- package/src/app/wrapProtectedRoutes.ts +82 -0
- package/src/config/validators/icon-types.ts +17 -0
- package/src/lib/authentication/authentication.ts +15 -0
- package/src/lib/authentication/cookie-sync.ts +90 -0
- package/src/lib/authentication/cookies.ts +54 -0
- package/src/lib/authentication/hook.ts +13 -0
- package/src/lib/authentication/providers/azureb2c.tsx +70 -2
- package/src/lib/authentication/providers/clerk.tsx +49 -0
- package/src/lib/authentication/providers/openid.tsx +46 -0
- package/src/lib/authentication/providers/supabase.tsx +30 -2
- package/src/lib/authentication/session-handler.ts +164 -0
- package/src/lib/authentication/state.ts +36 -5
- package/src/lib/authentication/verify-cache.ts +32 -0
- package/src/lib/components/Bootstrap.tsx +20 -14
- package/src/lib/components/Header.tsx +56 -57
- package/src/lib/components/MobileTopNavigation.tsx +66 -67
- package/src/lib/components/Zudoku.tsx +14 -1
- package/src/lib/components/context/RenderContext.ts +8 -0
- package/src/lib/components/context/ZudokuContext.ts +2 -1
- package/src/lib/core/RouteGuard.tsx +50 -29
- package/src/lib/core/ZudokuContext.ts +39 -6
- package/src/lib/errors/RouterError.tsx +43 -1
- package/src/lib/manifest.ts +62 -0
- package/src/lib/oas/parser/dereference/index.ts +2 -1
- package/src/lib/oas/parser/dereference/resolveRef.ts +2 -1
- package/src/lib/oas/parser/index.ts +1 -1
- package/src/lib/plugins/openapi/client/createServer.ts +13 -4
- package/src/lib/plugins/search-pagefind/index.tsx +1 -4
- package/src/lib/util/os.ts +1 -0
- package/src/lib/util/url.ts +13 -0
- package/src/vite/build.ts +84 -24
- package/src/vite/config.ts +51 -5
- package/src/vite/dev-server.ts +61 -8
- package/src/vite/manifest.ts +15 -0
- package/src/vite/plugin-api.ts +3 -1
- package/src/vite/plugin-markdown-export.ts +3 -9
- package/src/vite/prerender/worker.ts +2 -4
- package/src/vite/protected/annotator.ts +136 -0
- package/src/vite/protected/build.ts +151 -0
- package/src/vite/protected/registry.ts +82 -0
- package/src/vite/ssr-templates/cloudflare.ts +5 -18
- package/src/vite/ssr-templates/lambda.ts +4 -0
- package/src/vite/ssr-templates/node.ts +7 -22
- package/src/vite/ssr-templates/vercel.ts +6 -20
- package/src/vite-env.d.ts +1 -0
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { getRoutesByConfig, handleRequest } from "./entry.server.js";
|
|
4
|
-
import config from "./zudoku.config.js";
|
|
1
|
+
import { createServer } from "zudoku/server";
|
|
2
|
+
import { cloudflare } from "zudoku/server/adapters/cloudflare";
|
|
5
3
|
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
const template = "__TEMPLATE__";
|
|
10
|
-
const basePath = "__BASE_PATH__";
|
|
11
|
-
const routes = getRoutesByConfig(config.default ?? config);
|
|
12
|
-
|
|
13
|
-
const app = new Hono();
|
|
14
|
-
|
|
15
|
-
app.all("*", (c) =>
|
|
16
|
-
handleRequest({ template, request: c.req.raw, routes, basePath }),
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
export default app;
|
|
4
|
+
// Requires `run_worker_first = ["/_protected/*"]` in wrangler.toml. Without
|
|
5
|
+
// it, the assets binding serves the chunks directly and skips the gate.
|
|
6
|
+
export default createServer({ adapter: cloudflare() });
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
1
|
import { serve } from "@hono/node-server";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { getRoutesByConfig, handleRequest } from "./entry.server.js";
|
|
8
|
-
import config from "./zudoku.config.js";
|
|
2
|
+
import { createServer } from "zudoku/server";
|
|
3
|
+
import { node } from "zudoku/server/adapters/node";
|
|
9
4
|
|
|
10
|
-
const
|
|
11
|
-
const basePath = "__BASE_PATH__";
|
|
12
|
-
const routes = getRoutesByConfig(config.default ?? config);
|
|
5
|
+
const app = createServer({ adapter: node() });
|
|
13
6
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
app.use("/server/*", (c) => c.notFound());
|
|
20
|
-
app.use("*", serveStatic({ root: staticDir }));
|
|
21
|
-
app.get("*", (c) =>
|
|
22
|
-
handleRequest({ template, request: c.req.raw, routes, basePath }),
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
serve({ fetch: app.fetch, port: Number(process.env.PORT || 3000) });
|
|
7
|
+
serve({ fetch: app.fetch, port: Number(process.env.PORT || 3000) }, (info) => {
|
|
8
|
+
// biome-ignore lint/suspicious/noConsole: Log server info
|
|
9
|
+
console.info(`Server is running on ${info.address}:${info.port}`);
|
|
10
|
+
});
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { getRoutesByConfig, handleRequest } from "./entry.server.js";
|
|
4
|
-
import zudokuConfig from "./zudoku.config.js";
|
|
1
|
+
import { createServer } from "zudoku/server";
|
|
2
|
+
import { vercel } from "zudoku/server/adapters/vercel";
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
// Static files served automatically from dist/client via vercel.json rewrites
|
|
4
|
+
const handler = createServer({ adapter: vercel() });
|
|
8
5
|
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const app = new Hono();
|
|
14
|
-
|
|
15
|
-
app.all("*", (c) =>
|
|
16
|
-
handleRequest({ template, request: c.req.raw, routes, basePath }),
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
export const GET = (req: Request) => app.fetch(req);
|
|
20
|
-
export const POST = (req: Request) => app.fetch(req);
|
|
21
|
-
|
|
22
|
-
export const config = { runtime: "edge" };
|
|
6
|
+
export const GET = handler;
|
|
7
|
+
export const POST = handler;
|
|
8
|
+
export const DELETE = handler;
|