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.
Files changed (91) hide show
  1. package/dist/cli/cli.js +602 -160
  2. package/dist/cli/worker.js +6 -4
  3. package/dist/declarations/app/adapter.d.ts +12 -0
  4. package/dist/declarations/app/adapters/cloudflare.d.ts +8 -0
  5. package/dist/declarations/app/adapters/lambda.d.ts +13 -0
  6. package/dist/declarations/app/adapters/node.d.ts +12 -0
  7. package/dist/declarations/app/adapters/vercel.d.ts +14 -0
  8. package/dist/declarations/app/entry.client.d.ts +2 -0
  9. package/dist/declarations/app/entry.server.d.ts +13 -0
  10. package/dist/declarations/app/protectChunks.d.ts +17 -0
  11. package/dist/declarations/app/wrapProtectedRoutes.d.ts +4 -0
  12. package/dist/declarations/config/validators/HeaderNavigationSchema.d.ts +216 -80
  13. package/dist/declarations/config/validators/ZudokuConfig.d.ts +81 -30
  14. package/dist/declarations/config/validators/icon-types.d.ts +1 -1
  15. package/dist/declarations/lib/authentication/authentication.d.ts +7 -0
  16. package/dist/declarations/lib/authentication/cookie-sync.d.ts +3 -0
  17. package/dist/declarations/lib/authentication/cookies.d.ts +10 -0
  18. package/dist/declarations/lib/authentication/providers/azureb2c.d.ts +6 -1
  19. package/dist/declarations/lib/authentication/providers/clerk.d.ts +1 -0
  20. package/dist/declarations/lib/authentication/providers/openid.d.ts +2 -1
  21. package/dist/declarations/lib/authentication/providers/supabase.d.ts +2 -0
  22. package/dist/declarations/lib/authentication/session-handler.d.ts +81 -0
  23. package/dist/declarations/lib/authentication/state.d.ts +7 -0
  24. package/dist/declarations/lib/authentication/verify-cache.d.ts +2 -0
  25. package/dist/declarations/lib/components/Bootstrap.d.ts +2 -2
  26. package/dist/declarations/lib/components/Heading.d.ts +1 -1
  27. package/dist/declarations/lib/components/context/RenderContext.d.ts +6 -0
  28. package/dist/declarations/lib/core/RouteGuard.d.ts +11 -0
  29. package/dist/declarations/lib/core/ZudokuContext.d.ts +5 -2
  30. package/dist/declarations/lib/manifest.d.ts +25 -0
  31. package/dist/declarations/lib/util/url.d.ts +2 -0
  32. package/dist/flat-config.d.ts +1 -1
  33. package/docs/configuration/protected-routes.md +21 -4
  34. package/docs/guides/server-side-content-protection.md +207 -0
  35. package/package.json +26 -4
  36. package/src/app/adapter.ts +16 -0
  37. package/src/app/adapters/cloudflare.ts +18 -0
  38. package/src/app/adapters/lambda.ts +36 -0
  39. package/src/app/adapters/node.ts +32 -0
  40. package/src/app/adapters/vercel.ts +39 -0
  41. package/src/app/demo.tsx +2 -2
  42. package/src/app/entry.client.tsx +19 -7
  43. package/src/app/entry.server.tsx +133 -9
  44. package/src/app/main.tsx +21 -3
  45. package/src/app/protectChunks.ts +64 -0
  46. package/src/app/standalone.tsx +2 -2
  47. package/src/app/wrapProtectedRoutes.ts +82 -0
  48. package/src/config/validators/icon-types.ts +17 -0
  49. package/src/lib/authentication/authentication.ts +15 -0
  50. package/src/lib/authentication/cookie-sync.ts +90 -0
  51. package/src/lib/authentication/cookies.ts +54 -0
  52. package/src/lib/authentication/hook.ts +13 -0
  53. package/src/lib/authentication/providers/azureb2c.tsx +70 -2
  54. package/src/lib/authentication/providers/clerk.tsx +49 -0
  55. package/src/lib/authentication/providers/openid.tsx +46 -0
  56. package/src/lib/authentication/providers/supabase.tsx +30 -2
  57. package/src/lib/authentication/session-handler.ts +164 -0
  58. package/src/lib/authentication/state.ts +36 -5
  59. package/src/lib/authentication/verify-cache.ts +32 -0
  60. package/src/lib/components/Bootstrap.tsx +20 -14
  61. package/src/lib/components/Header.tsx +56 -57
  62. package/src/lib/components/MobileTopNavigation.tsx +66 -67
  63. package/src/lib/components/Zudoku.tsx +14 -1
  64. package/src/lib/components/context/RenderContext.ts +8 -0
  65. package/src/lib/components/context/ZudokuContext.ts +2 -1
  66. package/src/lib/core/RouteGuard.tsx +50 -29
  67. package/src/lib/core/ZudokuContext.ts +39 -6
  68. package/src/lib/errors/RouterError.tsx +43 -1
  69. package/src/lib/manifest.ts +62 -0
  70. package/src/lib/oas/parser/dereference/index.ts +2 -1
  71. package/src/lib/oas/parser/dereference/resolveRef.ts +2 -1
  72. package/src/lib/oas/parser/index.ts +1 -1
  73. package/src/lib/plugins/openapi/client/createServer.ts +13 -4
  74. package/src/lib/plugins/search-pagefind/index.tsx +1 -4
  75. package/src/lib/util/os.ts +1 -0
  76. package/src/lib/util/url.ts +13 -0
  77. package/src/vite/build.ts +84 -24
  78. package/src/vite/config.ts +51 -5
  79. package/src/vite/dev-server.ts +61 -8
  80. package/src/vite/manifest.ts +15 -0
  81. package/src/vite/plugin-api.ts +3 -1
  82. package/src/vite/plugin-markdown-export.ts +3 -9
  83. package/src/vite/prerender/worker.ts +2 -4
  84. package/src/vite/protected/annotator.ts +136 -0
  85. package/src/vite/protected/build.ts +151 -0
  86. package/src/vite/protected/registry.ts +82 -0
  87. package/src/vite/ssr-templates/cloudflare.ts +5 -18
  88. package/src/vite/ssr-templates/lambda.ts +4 -0
  89. package/src/vite/ssr-templates/node.ts +7 -22
  90. package/src/vite/ssr-templates/vercel.ts +6 -20
  91. package/src/vite-env.d.ts +1 -0
@@ -1,19 +1,6 @@
1
- // @ts-nocheck
2
- import { Hono } from "hono";
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
- // Cloudflare Workers with Static Assets feature
7
- // Static files served automatically via wrangler.toml: assets = { directory = "./dist/client" }
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() });
@@ -0,0 +1,4 @@
1
+ import { createServer } from "zudoku/server";
2
+ import { lambda } from "zudoku/server/adapters/lambda";
3
+
4
+ export const handler = createServer({ adapter: lambda() });
@@ -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 { serveStatic } from "@hono/node-server/serve-static";
6
- import { Hono } from "hono";
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 template = "__TEMPLATE__";
11
- const basePath = "__BASE_PATH__";
12
- const routes = getRoutesByConfig(config.default ?? config);
5
+ const app = createServer({ adapter: node() });
13
6
 
14
- const __dirname = dirname(fileURLToPath(import.meta.url));
15
- const staticDir = join(__dirname, "..");
16
-
17
- const app = new Hono();
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
- // @ts-nocheck
2
- import { Hono } from "hono";
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
- // Vercel Edge Functions
7
- // Static files served automatically from dist/client via vercel.json rewrites
4
+ const handler = createServer({ adapter: vercel() });
8
5
 
9
- const template = "__TEMPLATE__";
10
- const basePath = "__BASE_PATH__";
11
- const routes = getRoutesByConfig(zudokuConfig.default ?? zudokuConfig);
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;
package/src/vite-env.d.ts CHANGED
@@ -5,4 +5,5 @@ declare module "vite/modulepreload-polyfill" {}
5
5
  interface ImportMetaEnv {
6
6
  readonly IS_ZUPLO: boolean;
7
7
  readonly ZUPLO_BUILD_ID?: string;
8
+ readonly ZUDOKU_HAS_SERVER: boolean;
8
9
  }