gorsee 0.2.3 → 0.2.5
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 +261 -213
- package/dist-pkg/ai/artifact-lifecycle.d.ts +25 -0
- package/dist-pkg/ai/artifact-lifecycle.js +98 -0
- package/dist-pkg/ai/bridge.d.ts +26 -0
- package/dist-pkg/ai/bridge.js +82 -0
- package/dist-pkg/ai/bundle.d.ts +46 -0
- package/dist-pkg/ai/bundle.js +247 -0
- package/dist-pkg/ai/contracts.d.ts +1 -0
- package/dist-pkg/ai/contracts.js +1 -0
- package/dist-pkg/ai/ide.d.ts +37 -0
- package/dist-pkg/ai/ide.js +56 -0
- package/dist-pkg/ai/index.d.ts +85 -0
- package/dist-pkg/ai/index.js +267 -0
- package/dist-pkg/ai/json.d.ts +6 -0
- package/dist-pkg/ai/json.js +14 -0
- package/dist-pkg/ai/mcp.d.ts +28 -0
- package/dist-pkg/ai/mcp.js +152 -0
- package/dist-pkg/ai/session-pack.d.ts +28 -0
- package/dist-pkg/ai/session-pack.js +57 -0
- package/dist-pkg/ai/store.d.ts +67 -0
- package/dist-pkg/ai/store.js +174 -0
- package/dist-pkg/ai/summary.d.ts +57 -0
- package/dist-pkg/ai/summary.js +148 -0
- package/dist-pkg/ai/watch.d.ts +15 -0
- package/dist-pkg/ai/watch.js +66 -0
- package/dist-pkg/auth/action-tokens.d.ts +50 -0
- package/dist-pkg/auth/action-tokens.js +79 -0
- package/dist-pkg/auth/index.d.ts +70 -0
- package/dist-pkg/auth/index.js +199 -0
- package/dist-pkg/auth/redis-session-store.d.ts +7 -0
- package/dist-pkg/auth/redis-session-store.js +42 -0
- package/dist-pkg/auth/signing.d.ts +4 -0
- package/dist-pkg/auth/signing.js +33 -0
- package/dist-pkg/auth/sqlite-session-store.d.ts +12 -0
- package/dist-pkg/auth/sqlite-session-store.js +83 -0
- package/dist-pkg/auth/store-utils.d.ts +2 -0
- package/dist-pkg/auth/store-utils.js +20 -0
- package/dist-pkg/bin/gorsee.js +2 -0
- package/dist-pkg/build/backends/experimental-rolldown.d.ts +6 -0
- package/dist-pkg/build/backends/experimental-rolldown.js +9 -0
- package/dist-pkg/build/backends/register.d.ts +7 -0
- package/dist-pkg/build/backends/register.js +24 -0
- package/dist-pkg/build/backends/rolldown.d.ts +16 -0
- package/dist-pkg/build/backends/rolldown.js +176 -0
- package/dist-pkg/build/client-backend.d.ts +31 -0
- package/dist-pkg/build/client-backend.js +97 -0
- package/dist-pkg/build/client.d.ts +12 -0
- package/dist-pkg/build/client.js +93 -0
- package/dist-pkg/build/css-modules.d.ts +10 -0
- package/dist-pkg/build/css-modules.js +51 -0
- package/dist-pkg/build/devalue-parse.d.ts +1 -0
- package/dist-pkg/build/devalue-parse.js +1 -0
- package/dist-pkg/build/diagnostics.d.ts +20 -0
- package/dist-pkg/build/diagnostics.js +35 -0
- package/dist-pkg/build/fixtures.d.ts +7 -0
- package/dist-pkg/build/fixtures.js +60 -0
- package/dist-pkg/build/framework-imports.d.ts +4 -0
- package/dist-pkg/build/framework-imports.js +58 -0
- package/dist-pkg/build/init.d.ts +1 -0
- package/dist-pkg/build/init.js +6 -0
- package/dist-pkg/build/manifest.d.ts +3 -0
- package/dist-pkg/build/manifest.js +23 -0
- package/dist-pkg/build/parity.d.ts +32 -0
- package/dist-pkg/build/parity.js +71 -0
- package/dist-pkg/build/plugin.d.ts +11 -0
- package/dist-pkg/build/plugin.js +8 -0
- package/dist-pkg/build/readiness.d.ts +11 -0
- package/dist-pkg/build/readiness.js +18 -0
- package/dist-pkg/build/route-client-transform.d.ts +17 -0
- package/dist-pkg/build/route-client-transform.js +48 -0
- package/dist-pkg/build/route-metadata.d.ts +6 -0
- package/dist-pkg/build/route-metadata.js +8 -0
- package/dist-pkg/build/rpc-transform.d.ts +1 -0
- package/dist-pkg/build/rpc-transform.js +44 -0
- package/dist-pkg/build/server-bundle.d.ts +4 -0
- package/dist-pkg/build/server-bundle.js +261 -0
- package/dist-pkg/build/server-strip.d.ts +2 -0
- package/dist-pkg/build/server-strip.js +32 -0
- package/dist-pkg/build/ssg.d.ts +12 -0
- package/dist-pkg/build/ssg.js +36 -0
- package/dist-pkg/cli/bun-plugin.d.ts +2 -0
- package/dist-pkg/cli/bun-plugin.js +14 -0
- package/dist-pkg/cli/canonical-import-rewrite.d.ts +18 -0
- package/dist-pkg/cli/canonical-import-rewrite.js +94 -0
- package/dist-pkg/cli/canonical-imports.d.ts +8 -0
- package/dist-pkg/cli/canonical-imports.js +131 -0
- package/dist-pkg/cli/check-ast.d.ts +20 -0
- package/dist-pkg/cli/check-ast.js +126 -0
- package/dist-pkg/cli/cmd-ai.d.ts +4 -0
- package/dist-pkg/cli/cmd-ai.js +290 -0
- package/dist-pkg/cli/cmd-build.d.ts +12 -0
- package/dist-pkg/cli/cmd-build.js +198 -0
- package/dist-pkg/cli/cmd-check.d.ts +25 -0
- package/dist-pkg/cli/cmd-check.js +573 -0
- package/dist-pkg/cli/cmd-create.d.ts +6 -0
- package/dist-pkg/cli/cmd-create.js +600 -0
- package/dist-pkg/cli/cmd-deploy.d.ts +6 -0
- package/dist-pkg/cli/cmd-deploy.js +381 -0
- package/dist-pkg/cli/cmd-dev.d.ts +5 -0
- package/dist-pkg/cli/cmd-dev.js +5 -0
- package/dist-pkg/cli/cmd-docs.d.ts +50 -0
- package/dist-pkg/cli/cmd-docs.js +122 -0
- package/dist-pkg/cli/cmd-generate.d.ts +12 -0
- package/dist-pkg/cli/cmd-generate.js +320 -0
- package/dist-pkg/cli/cmd-migrate.d.ts +7 -0
- package/dist-pkg/cli/cmd-migrate.js +42 -0
- package/dist-pkg/cli/cmd-routes.d.ts +6 -0
- package/dist-pkg/cli/cmd-routes.js +24 -0
- package/dist-pkg/cli/cmd-start.d.ts +13 -0
- package/dist-pkg/cli/cmd-start.js +32 -0
- package/dist-pkg/cli/cmd-test.d.ts +20 -0
- package/dist-pkg/cli/cmd-test.js +103 -0
- package/dist-pkg/cli/cmd-typegen.d.ts +7 -0
- package/dist-pkg/cli/cmd-typegen.js +66 -0
- package/dist-pkg/cli/cmd-upgrade.d.ts +38 -0
- package/dist-pkg/cli/cmd-upgrade.js +232 -0
- package/dist-pkg/cli/context.d.ts +4 -0
- package/dist-pkg/cli/context.js +4 -0
- package/dist-pkg/cli/framework-md.d.ts +1 -0
- package/dist-pkg/cli/framework-md.js +391 -0
- package/dist-pkg/cli/index.d.ts +6 -0
- package/dist-pkg/cli/index.js +106 -0
- package/dist-pkg/cli/release-version.d.ts +2 -0
- package/dist-pkg/cli/release-version.js +33 -0
- package/dist-pkg/client.d.ts +16 -0
- package/dist-pkg/client.js +71 -0
- package/dist-pkg/compat.d.ts +1 -0
- package/dist-pkg/compat.js +1 -0
- package/dist-pkg/compiler/analysis-backend.d.ts +20 -0
- package/dist-pkg/compiler/analysis-backend.js +164 -0
- package/dist-pkg/compiler/backends/experimental-oxc.d.ts +6 -0
- package/dist-pkg/compiler/backends/experimental-oxc.js +9 -0
- package/dist-pkg/compiler/backends/oxc.d.ts +16 -0
- package/dist-pkg/compiler/backends/oxc.js +198 -0
- package/dist-pkg/compiler/backends/register.d.ts +7 -0
- package/dist-pkg/compiler/backends/register.js +22 -0
- package/dist-pkg/compiler/fixtures.d.ts +2 -0
- package/dist-pkg/compiler/fixtures.js +118 -0
- package/dist-pkg/compiler/init.d.ts +1 -0
- package/dist-pkg/compiler/init.js +6 -0
- package/dist-pkg/compiler/module-analysis.d.ts +13 -0
- package/dist-pkg/compiler/module-analysis.js +50 -0
- package/dist-pkg/compiler/parity.d.ts +35 -0
- package/dist-pkg/compiler/parity.js +89 -0
- package/dist-pkg/compiler/readiness.d.ts +11 -0
- package/dist-pkg/compiler/readiness.js +18 -0
- package/dist-pkg/compiler/route-facts.d.ts +34 -0
- package/dist-pkg/compiler/route-facts.js +75 -0
- package/dist-pkg/content/index.d.ts +27 -0
- package/dist-pkg/content/index.js +287 -0
- package/dist-pkg/db/index.d.ts +3 -0
- package/dist-pkg/db/index.js +6 -0
- package/dist-pkg/db/migrate.d.ts +7 -0
- package/dist-pkg/db/migrate.js +53 -0
- package/dist-pkg/db/postgres.d.ts +29 -0
- package/dist-pkg/db/postgres.js +59 -0
- package/dist-pkg/db/sqlite.d.ts +10 -0
- package/dist-pkg/db/sqlite.js +22 -0
- package/dist-pkg/deploy/cloudflare.d.ts +8 -0
- package/{src/deploy/cloudflare.ts → dist-pkg/deploy/cloudflare.js} +24 -26
- package/dist-pkg/deploy/conformance.d.ts +21 -0
- package/dist-pkg/deploy/conformance.js +98 -0
- package/dist-pkg/deploy/dockerfile.d.ts +3 -0
- package/{src/deploy/dockerfile.ts → dist-pkg/deploy/dockerfile.js} +8 -10
- package/dist-pkg/deploy/fly.d.ts +3 -0
- package/{src/deploy/fly.ts → dist-pkg/deploy/fly.js} +11 -12
- package/dist-pkg/deploy/index.d.ts +6 -0
- package/dist-pkg/deploy/index.js +26 -0
- package/dist-pkg/deploy/netlify.d.ts +2 -0
- package/{src/deploy/netlify.ts → dist-pkg/deploy/netlify.js} +17 -11
- package/dist-pkg/deploy/runtime.d.ts +2 -0
- package/dist-pkg/deploy/runtime.js +3 -0
- package/dist-pkg/deploy/vercel.d.ts +22 -0
- package/dist-pkg/deploy/vercel.js +53 -0
- package/dist-pkg/dev/error-overlay.d.ts +1 -0
- package/{src/dev/error-overlay.ts → dist-pkg/dev/error-overlay.js} +13 -23
- package/dist-pkg/dev/hmr.d.ts +30 -0
- package/dist-pkg/dev/hmr.js +86 -0
- package/dist-pkg/dev/partial-handler.d.ts +9 -0
- package/dist-pkg/dev/partial-handler.js +24 -0
- package/dist-pkg/dev/request-handler.d.ts +30 -0
- package/dist-pkg/dev/request-handler.js +67 -0
- package/dist-pkg/dev/watcher.d.ts +6 -0
- package/dist-pkg/dev/watcher.js +34 -0
- package/dist-pkg/dev.d.ts +11 -0
- package/dist-pkg/dev.js +268 -0
- package/dist-pkg/env/index.d.ts +3 -0
- package/dist-pkg/env/index.js +57 -0
- package/dist-pkg/errors/catalog.d.ts +9 -0
- package/{src/errors/catalog.ts → dist-pkg/errors/catalog.js} +8 -24
- package/dist-pkg/errors/formatter.d.ts +22 -0
- package/dist-pkg/errors/formatter.js +43 -0
- package/dist-pkg/errors/index.d.ts +2 -0
- package/dist-pkg/errors/index.js +2 -0
- package/dist-pkg/forms/action.d.ts +15 -0
- package/dist-pkg/forms/action.js +20 -0
- package/dist-pkg/forms/index.d.ts +4 -0
- package/dist-pkg/forms/index.js +12 -0
- package/dist-pkg/i18n/index.d.ts +61 -0
- package/dist-pkg/i18n/index.js +147 -0
- package/dist-pkg/index-client.d.ts +1 -0
- package/dist-pkg/index-client.js +1 -0
- package/dist-pkg/index.d.ts +32 -0
- package/dist-pkg/index.js +79 -0
- package/dist-pkg/jsx-runtime-client.d.ts +8 -0
- package/dist-pkg/jsx-runtime-client.js +1 -0
- package/dist-pkg/jsx-runtime.d.ts +13 -0
- package/dist-pkg/jsx-runtime.js +5 -0
- package/dist-pkg/jsx-types-html.d.ts +221 -0
- package/dist-pkg/jsx-types-html.js +0 -0
- package/dist-pkg/log/index.d.ts +8 -0
- package/dist-pkg/log/index.js +55 -0
- package/dist-pkg/plugins/drizzle.d.ts +16 -0
- package/dist-pkg/plugins/drizzle.js +50 -0
- package/dist-pkg/plugins/index.d.ts +62 -0
- package/dist-pkg/plugins/index.js +147 -0
- package/dist-pkg/plugins/lucia.d.ts +26 -0
- package/dist-pkg/plugins/lucia.js +63 -0
- package/dist-pkg/plugins/prisma.d.ts +14 -0
- package/dist-pkg/plugins/prisma.js +57 -0
- package/dist-pkg/plugins/resend.d.ts +21 -0
- package/dist-pkg/plugins/resend.js +45 -0
- package/dist-pkg/plugins/s3.d.ts +18 -0
- package/dist-pkg/plugins/s3.js +63 -0
- package/dist-pkg/plugins/stripe.d.ts +32 -0
- package/dist-pkg/plugins/stripe.js +69 -0
- package/dist-pkg/plugins/tailwind.d.ts +15 -0
- package/dist-pkg/plugins/tailwind.js +58 -0
- package/dist-pkg/prod.d.ts +21 -0
- package/dist-pkg/prod.js +347 -0
- package/dist-pkg/reactive/computed.d.ts +3 -0
- package/dist-pkg/reactive/computed.js +15 -0
- package/dist-pkg/reactive/data.d.ts +25 -0
- package/dist-pkg/reactive/data.js +56 -0
- package/dist-pkg/reactive/diagnostics.d.ts +100 -0
- package/dist-pkg/reactive/diagnostics.js +363 -0
- package/dist-pkg/reactive/effect.d.ts +3 -0
- package/dist-pkg/reactive/effect.js +6 -0
- package/dist-pkg/reactive/index.d.ts +9 -0
- package/dist-pkg/reactive/index.js +18 -0
- package/dist-pkg/reactive/live.d.ts +15 -0
- package/dist-pkg/reactive/live.js +58 -0
- package/dist-pkg/reactive/optimistic.d.ts +20 -0
- package/dist-pkg/reactive/optimistic.js +54 -0
- package/dist-pkg/reactive/resource.d.ts +25 -0
- package/dist-pkg/reactive/resource.js +97 -0
- package/dist-pkg/reactive/signal.d.ts +4 -0
- package/dist-pkg/reactive/signal.js +17 -0
- package/dist-pkg/reactive/store.d.ts +6 -0
- package/dist-pkg/reactive/store.js +19 -0
- package/dist-pkg/router/index.d.ts +2 -0
- package/dist-pkg/router/index.js +2 -0
- package/dist-pkg/router/matcher.d.ts +7 -0
- package/dist-pkg/router/matcher.js +40 -0
- package/dist-pkg/router/scanner.d.ts +14 -0
- package/dist-pkg/router/scanner.js +141 -0
- package/dist-pkg/routes/index.d.ts +1 -0
- package/dist-pkg/routes/index.js +10 -0
- package/dist-pkg/runtime/app-config.d.ts +26 -0
- package/dist-pkg/runtime/app-config.js +69 -0
- package/dist-pkg/runtime/client.d.ts +3 -0
- package/dist-pkg/runtime/client.js +31 -0
- package/dist-pkg/runtime/devtools.d.ts +64 -0
- package/dist-pkg/runtime/devtools.js +132 -0
- package/dist-pkg/runtime/error-boundary.d.ts +6 -0
- package/dist-pkg/runtime/error-boundary.js +17 -0
- package/dist-pkg/runtime/event-replay.d.ts +3 -0
- package/{src/runtime/event-replay.ts → dist-pkg/runtime/event-replay.js} +7 -22
- package/dist-pkg/runtime/event-source.d.ts +7 -0
- package/dist-pkg/runtime/event-source.js +24 -0
- package/dist-pkg/runtime/form.d.ts +24 -0
- package/dist-pkg/runtime/form.js +59 -0
- package/dist-pkg/runtime/head.d.ts +7 -0
- package/dist-pkg/runtime/head.js +90 -0
- package/dist-pkg/runtime/html-escape.d.ts +7 -0
- package/dist-pkg/runtime/html-escape.js +39 -0
- package/dist-pkg/runtime/hydration.d.ts +15 -0
- package/dist-pkg/runtime/hydration.js +103 -0
- package/dist-pkg/runtime/image.d.ts +49 -0
- package/dist-pkg/runtime/image.js +144 -0
- package/dist-pkg/runtime/index.d.ts +17 -0
- package/dist-pkg/runtime/index.js +59 -0
- package/dist-pkg/runtime/island-hydrator.d.ts +12 -0
- package/dist-pkg/runtime/island-hydrator.js +49 -0
- package/dist-pkg/runtime/island.d.ts +19 -0
- package/dist-pkg/runtime/island.js +36 -0
- package/dist-pkg/runtime/jsx-runtime.d.ts +12 -0
- package/dist-pkg/runtime/jsx-runtime.js +173 -0
- package/dist-pkg/runtime/link.d.ts +16 -0
- package/dist-pkg/runtime/link.js +47 -0
- package/dist-pkg/runtime/project.d.ts +37 -0
- package/dist-pkg/runtime/project.js +36 -0
- package/dist-pkg/runtime/renderable.d.ts +6 -0
- package/dist-pkg/runtime/renderable.js +0 -0
- package/dist-pkg/runtime/router.d.ts +47 -0
- package/dist-pkg/runtime/router.js +476 -0
- package/dist-pkg/runtime/server.d.ts +8 -0
- package/dist-pkg/runtime/server.js +71 -0
- package/dist-pkg/runtime/stream.d.ts +29 -0
- package/dist-pkg/runtime/stream.js +106 -0
- package/dist-pkg/runtime/suspense.d.ts +6 -0
- package/dist-pkg/runtime/suspense.js +16 -0
- package/dist-pkg/runtime/typed-routes.d.ts +24 -0
- package/dist-pkg/runtime/typed-routes.js +77 -0
- package/dist-pkg/runtime/validated-form.d.ts +40 -0
- package/dist-pkg/runtime/validated-form.js +120 -0
- package/dist-pkg/security/cors.d.ts +10 -0
- package/dist-pkg/security/cors.js +56 -0
- package/dist-pkg/security/csrf.d.ts +9 -0
- package/dist-pkg/security/csrf.js +53 -0
- package/dist-pkg/security/headers.d.ts +11 -0
- package/dist-pkg/security/headers.js +31 -0
- package/dist-pkg/security/index.d.ts +5 -0
- package/dist-pkg/security/index.js +5 -0
- package/dist-pkg/security/rate-limit.d.ts +10 -0
- package/dist-pkg/security/rate-limit.js +49 -0
- package/dist-pkg/security/redis-rate-limit.d.ts +14 -0
- package/dist-pkg/security/redis-rate-limit.js +23 -0
- package/dist-pkg/server/action.d.ts +21 -0
- package/dist-pkg/server/action.js +64 -0
- package/dist-pkg/server/cache-utils.d.ts +2 -0
- package/dist-pkg/server/cache-utils.js +26 -0
- package/dist-pkg/server/cache.d.ts +33 -0
- package/dist-pkg/server/cache.js +236 -0
- package/dist-pkg/server/compress.d.ts +2 -0
- package/dist-pkg/server/compress.js +49 -0
- package/dist-pkg/server/endpoint-execution.d.ts +28 -0
- package/dist-pkg/server/endpoint-execution.js +37 -0
- package/dist-pkg/server/etag.d.ts +3 -0
- package/dist-pkg/server/etag.js +18 -0
- package/dist-pkg/server/guard.d.ts +16 -0
- package/dist-pkg/server/guard.js +45 -0
- package/dist-pkg/server/html-shell.d.ts +12 -0
- package/dist-pkg/server/html-shell.js +52 -0
- package/dist-pkg/server/index.d.ts +36 -0
- package/dist-pkg/server/index.js +170 -0
- package/dist-pkg/server/jobs.d.ts +41 -0
- package/dist-pkg/server/jobs.js +81 -0
- package/dist-pkg/server/manifest.d.ts +19 -0
- package/dist-pkg/server/manifest.js +36 -0
- package/dist-pkg/server/middleware.d.ts +39 -0
- package/dist-pkg/server/middleware.js +122 -0
- package/dist-pkg/server/mime.d.ts +1 -0
- package/{src/server/mime.ts → dist-pkg/server/mime.js} +6 -17
- package/dist-pkg/server/not-found.d.ts +6 -0
- package/dist-pkg/server/not-found.js +24 -0
- package/dist-pkg/server/page-render.d.ts +29 -0
- package/dist-pkg/server/page-render.js +67 -0
- package/dist-pkg/server/partial-navigation.d.ts +4 -0
- package/dist-pkg/server/partial-navigation.js +16 -0
- package/dist-pkg/server/pipe.d.ts +9 -0
- package/dist-pkg/server/pipe.js +32 -0
- package/dist-pkg/server/redis-cache-store.d.ts +10 -0
- package/dist-pkg/server/redis-cache-store.js +73 -0
- package/dist-pkg/server/redis-client.d.ts +37 -0
- package/dist-pkg/server/redis-client.js +37 -0
- package/dist-pkg/server/request-policy.d.ts +55 -0
- package/dist-pkg/server/request-policy.js +216 -0
- package/dist-pkg/server/request-preflight.d.ts +23 -0
- package/dist-pkg/server/request-preflight.js +45 -0
- package/dist-pkg/server/request-security-policy.d.ts +17 -0
- package/dist-pkg/server/request-security-policy.js +34 -0
- package/dist-pkg/server/request-surface.d.ts +8 -0
- package/dist-pkg/server/request-surface.js +19 -0
- package/dist-pkg/server/route-request.d.ts +31 -0
- package/dist-pkg/server/route-request.js +112 -0
- package/dist-pkg/server/route-response.d.ts +22 -0
- package/dist-pkg/server/route-response.js +58 -0
- package/dist-pkg/server/rpc-hash.d.ts +2 -0
- package/dist-pkg/server/rpc-hash.js +7 -0
- package/dist-pkg/server/rpc-protocol.d.ts +22 -0
- package/dist-pkg/server/rpc-protocol.js +28 -0
- package/dist-pkg/server/rpc-utils.d.ts +2 -0
- package/dist-pkg/server/rpc-utils.js +26 -0
- package/dist-pkg/server/rpc.d.ts +20 -0
- package/dist-pkg/server/rpc.js +147 -0
- package/dist-pkg/server/runtime-dispatch.d.ts +19 -0
- package/dist-pkg/server/runtime-dispatch.js +67 -0
- package/dist-pkg/server/server-execution.d.ts +22 -0
- package/dist-pkg/server/server-execution.js +53 -0
- package/dist-pkg/server/sqlite-cache-store.d.ts +13 -0
- package/dist-pkg/server/sqlite-cache-store.js +88 -0
- package/dist-pkg/server/sse.d.ts +9 -0
- package/dist-pkg/server/sse.js +34 -0
- package/dist-pkg/server/static-file.d.ts +9 -0
- package/dist-pkg/server/static-file.js +43 -0
- package/dist-pkg/server/ws.d.ts +18 -0
- package/dist-pkg/server/ws.js +40 -0
- package/dist-pkg/server-entry.d.ts +19 -0
- package/dist-pkg/server-entry.js +93 -0
- package/dist-pkg/testing/index.d.ts +98 -0
- package/dist-pkg/testing/index.js +254 -0
- package/dist-pkg/types/index.d.ts +4 -0
- package/dist-pkg/types/index.js +4 -0
- package/dist-pkg/types/safe-html.d.ts +7 -0
- package/dist-pkg/types/safe-html.js +19 -0
- package/dist-pkg/types/safe-sql.d.ts +8 -0
- package/dist-pkg/types/safe-sql.js +14 -0
- package/dist-pkg/types/safe-url.d.ts +7 -0
- package/dist-pkg/types/safe-url.js +20 -0
- package/dist-pkg/types/user-input.d.ts +9 -0
- package/dist-pkg/types/user-input.js +3 -0
- package/dist-pkg/unsafe/index.d.ts +12 -0
- package/dist-pkg/unsafe/index.js +6 -0
- package/package.json +102 -44
- package/bin/gorsee.js +0 -14
- package/src/auth/index.ts +0 -178
- package/src/auth/redis-session-store.ts +0 -46
- package/src/auth/sqlite-session-store.ts +0 -98
- package/src/auth/store-utils.ts +0 -21
- package/src/build/client.ts +0 -139
- package/src/build/css-modules.ts +0 -69
- package/src/build/devalue-parse.ts +0 -2
- package/src/build/manifest.ts +0 -34
- package/src/build/route-metadata.ts +0 -12
- package/src/build/rpc-transform.ts +0 -62
- package/src/build/server-strip.ts +0 -87
- package/src/build/ssg.ts +0 -70
- package/src/cli/bun-plugin.ts +0 -58
- package/src/cli/cmd-build.ts +0 -153
- package/src/cli/cmd-check.ts +0 -239
- package/src/cli/cmd-create.ts +0 -328
- package/src/cli/cmd-deploy.ts +0 -149
- package/src/cli/cmd-dev.ts +0 -13
- package/src/cli/cmd-docs.ts +0 -152
- package/src/cli/cmd-generate.ts +0 -155
- package/src/cli/cmd-migrate.ts +0 -53
- package/src/cli/cmd-routes.ts +0 -36
- package/src/cli/cmd-start.ts +0 -30
- package/src/cli/cmd-test.ts +0 -129
- package/src/cli/cmd-typegen.ts +0 -93
- package/src/cli/cmd-upgrade.ts +0 -143
- package/src/cli/context.ts +0 -12
- package/src/cli/framework-md.ts +0 -223
- package/src/cli/index.ts +0 -107
- package/src/client.ts +0 -26
- package/src/db/index.ts +0 -2
- package/src/db/migrate.ts +0 -89
- package/src/db/sqlite.ts +0 -40
- package/src/deploy/index.ts +0 -31
- package/src/deploy/vercel.ts +0 -94
- package/src/dev/hmr.ts +0 -31
- package/src/dev/partial-handler.ts +0 -52
- package/src/dev/request-handler.ts +0 -127
- package/src/dev/watcher.ts +0 -48
- package/src/dev.ts +0 -208
- package/src/env/index.ts +0 -74
- package/src/errors/formatter.ts +0 -63
- package/src/errors/index.ts +0 -2
- package/src/i18n/index.ts +0 -72
- package/src/index-client.ts +0 -4
- package/src/index.ts +0 -43
- package/src/jsx-runtime-client.ts +0 -13
- package/src/jsx-runtime.ts +0 -20
- package/src/jsx-types-html.ts +0 -242
- package/src/log/index.ts +0 -44
- package/src/plugins/drizzle.ts +0 -84
- package/src/plugins/index.ts +0 -86
- package/src/plugins/lucia.ts +0 -111
- package/src/plugins/prisma.ts +0 -85
- package/src/plugins/resend.ts +0 -78
- package/src/plugins/s3.ts +0 -102
- package/src/plugins/stripe.ts +0 -133
- package/src/plugins/tailwind.ts +0 -92
- package/src/prod.ts +0 -252
- package/src/reactive/computed.ts +0 -7
- package/src/reactive/effect.ts +0 -7
- package/src/reactive/index.ts +0 -7
- package/src/reactive/live.ts +0 -97
- package/src/reactive/optimistic.ts +0 -83
- package/src/reactive/resource.ts +0 -138
- package/src/reactive/signal.ts +0 -20
- package/src/reactive/store.ts +0 -36
- package/src/router/index.ts +0 -2
- package/src/router/matcher.ts +0 -53
- package/src/router/scanner.ts +0 -206
- package/src/runtime/client.ts +0 -28
- package/src/runtime/error-boundary.ts +0 -35
- package/src/runtime/form.ts +0 -49
- package/src/runtime/head.ts +0 -113
- package/src/runtime/html-escape.ts +0 -30
- package/src/runtime/hydration.ts +0 -95
- package/src/runtime/image.ts +0 -48
- package/src/runtime/index.ts +0 -12
- package/src/runtime/island-hydrator.ts +0 -84
- package/src/runtime/island.ts +0 -88
- package/src/runtime/jsx-runtime.ts +0 -167
- package/src/runtime/link.ts +0 -45
- package/src/runtime/project.ts +0 -73
- package/src/runtime/router.ts +0 -224
- package/src/runtime/server.ts +0 -102
- package/src/runtime/stream.ts +0 -182
- package/src/runtime/suspense.ts +0 -37
- package/src/runtime/typed-routes.ts +0 -26
- package/src/runtime/validated-form.ts +0 -106
- package/src/security/cors.ts +0 -80
- package/src/security/csrf.ts +0 -85
- package/src/security/headers.ts +0 -50
- package/src/security/index.ts +0 -4
- package/src/security/rate-limit.ts +0 -80
- package/src/server/action.ts +0 -48
- package/src/server/cache-utils.ts +0 -23
- package/src/server/cache.ts +0 -125
- package/src/server/compress.ts +0 -60
- package/src/server/etag.ts +0 -23
- package/src/server/guard.ts +0 -69
- package/src/server/html-shell.ts +0 -69
- package/src/server/index.ts +0 -57
- package/src/server/manifest.ts +0 -36
- package/src/server/middleware.ts +0 -159
- package/src/server/not-found.ts +0 -35
- package/src/server/page-render.ts +0 -123
- package/src/server/pipe.ts +0 -46
- package/src/server/redis-cache-store.ts +0 -87
- package/src/server/redis-client.ts +0 -71
- package/src/server/request-preflight.ts +0 -45
- package/src/server/route-request.ts +0 -72
- package/src/server/rpc-hash.ts +0 -17
- package/src/server/rpc-utils.ts +0 -27
- package/src/server/rpc.ts +0 -177
- package/src/server/sqlite-cache-store.ts +0 -109
- package/src/server/sse.ts +0 -96
- package/src/server/static-file.ts +0 -63
- package/src/server/ws.ts +0 -56
- package/src/server-entry.ts +0 -36
- package/src/testing/index.ts +0 -74
- package/src/types/index.ts +0 -4
- package/src/types/safe-html.ts +0 -32
- package/src/types/safe-sql.ts +0 -28
- package/src/types/safe-url.ts +0 -40
- package/src/types/user-input.ts +0 -12
- package/src/unsafe/index.ts +0 -18
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
export {
|
|
2
|
+
server,
|
|
3
|
+
handleRPCRequest,
|
|
4
|
+
__registerRPC,
|
|
5
|
+
getRPCHandler,
|
|
6
|
+
createMemoryRPCRegistry,
|
|
7
|
+
handleRPCRequestWithRegistry,
|
|
8
|
+
createMemoryRPCRegistry as createRPCRegistry
|
|
9
|
+
} from "./rpc.js";
|
|
10
|
+
export {
|
|
11
|
+
RPC_PROTOCOL_VERSION,
|
|
12
|
+
RPC_CONTENT_TYPE,
|
|
13
|
+
RPC_ACCEPTED_CONTENT_TYPES
|
|
14
|
+
} from "./rpc-protocol.js";
|
|
15
|
+
export { handleRPCRequestWithPolicy, handleRPCWithHeaders } from "./request-preflight.js";
|
|
16
|
+
export {
|
|
17
|
+
middleware,
|
|
18
|
+
createContext,
|
|
19
|
+
runMiddlewareChain
|
|
20
|
+
} from "./middleware.js";
|
|
21
|
+
export {
|
|
22
|
+
defineAction,
|
|
23
|
+
handleAction,
|
|
24
|
+
parseFormData,
|
|
25
|
+
actionSuccess,
|
|
26
|
+
actionFailure
|
|
27
|
+
} from "./action.js";
|
|
28
|
+
export { joinRoom, leaveRoom, broadcastToRoom, getRoomSize, createWSContext } from "./ws.js";
|
|
29
|
+
export { compress } from "./compress.js";
|
|
30
|
+
export { getMimeType } from "./mime.js";
|
|
31
|
+
export { fileETag, generateETag, isNotModified } from "./etag.js";
|
|
32
|
+
export { redirect, RedirectError } from "./middleware.js";
|
|
33
|
+
export { createSSEStream } from "./sse.js";
|
|
34
|
+
export { createEventSource } from "../runtime/event-source.js";
|
|
35
|
+
export {
|
|
36
|
+
routeCache,
|
|
37
|
+
invalidateCache,
|
|
38
|
+
clearCache,
|
|
39
|
+
createMemoryCacheStore
|
|
40
|
+
} from "./cache.js";
|
|
41
|
+
export { createGuard, requireAuth, requireRole, allGuards, anyGuard } from "./guard.js";
|
|
42
|
+
export { pipe, when, forMethods, forPaths } from "./pipe.js";
|
|
43
|
+
export { createNamespacedCacheStore } from "./cache-utils.js";
|
|
44
|
+
export { createRedisCacheStore } from "./redis-cache-store.js";
|
|
45
|
+
export { createScopedRPCRegistry } from "./rpc-utils.js";
|
|
46
|
+
export { createSQLiteCacheStore } from "./sqlite-cache-store.js";
|
|
47
|
+
export { createMemoryJobQueue, defineJob } from "./jobs.js";
|
|
48
|
+
export {
|
|
49
|
+
setupI18n,
|
|
50
|
+
loadLocale,
|
|
51
|
+
getLocale,
|
|
52
|
+
getLocales,
|
|
53
|
+
getDefaultLocale,
|
|
54
|
+
getFallbackLocales,
|
|
55
|
+
setLocale,
|
|
56
|
+
t,
|
|
57
|
+
plural,
|
|
58
|
+
negotiateLocale,
|
|
59
|
+
resolveLocaleFromPath,
|
|
60
|
+
stripLocalePrefix,
|
|
61
|
+
withLocalePath,
|
|
62
|
+
buildHreflangLinks,
|
|
63
|
+
formatNumber,
|
|
64
|
+
formatDate,
|
|
65
|
+
formatRelativeTime
|
|
66
|
+
} from "../i18n/index.js";
|
|
67
|
+
export {
|
|
68
|
+
loadContentCollection,
|
|
69
|
+
parseFrontmatter,
|
|
70
|
+
extractExcerpt,
|
|
71
|
+
queryContent,
|
|
72
|
+
getContentEntryBySlug
|
|
73
|
+
} from "../content/index.js";
|
|
74
|
+
export {
|
|
75
|
+
createNodeRedisLikeClient,
|
|
76
|
+
createIORedisLikeClient,
|
|
77
|
+
deleteExpiredRedisKeys
|
|
78
|
+
} from "./redis-client.js";
|
|
79
|
+
export {
|
|
80
|
+
createAuth,
|
|
81
|
+
createMemorySessionStore,
|
|
82
|
+
createNamespacedSessionStore,
|
|
83
|
+
createRedisSessionStore,
|
|
84
|
+
createSQLiteSessionStore,
|
|
85
|
+
createAuthActionTokenManager,
|
|
86
|
+
createMemoryAuthActionTokenStore,
|
|
87
|
+
sessionHasRole,
|
|
88
|
+
sessionHasPermission
|
|
89
|
+
} from "../auth/index.js";
|
|
90
|
+
export {
|
|
91
|
+
createDB,
|
|
92
|
+
createPostgresDB,
|
|
93
|
+
toPostgresSQL,
|
|
94
|
+
runMigrations,
|
|
95
|
+
createMigration
|
|
96
|
+
} from "../db/index.js";
|
|
97
|
+
export {
|
|
98
|
+
securityHeaders,
|
|
99
|
+
csrfProtection,
|
|
100
|
+
createCSRFMiddleware,
|
|
101
|
+
generateCSRFToken,
|
|
102
|
+
validateCSRFToken,
|
|
103
|
+
createRateLimiter,
|
|
104
|
+
createRedisRateLimiter,
|
|
105
|
+
parseRateLimitWindow,
|
|
106
|
+
cors
|
|
107
|
+
} from "../security/index.js";
|
|
108
|
+
export { env, getPublicEnv, loadEnv } from "../env/index.js";
|
|
109
|
+
export { log, setLogLevel } from "../log/index.js";
|
|
110
|
+
export {
|
|
111
|
+
GORSEE_AI_CONTEXT_SCHEMA_VERSION,
|
|
112
|
+
buildAIHealthReport,
|
|
113
|
+
buildAIContextBundle,
|
|
114
|
+
buildIDEProjection,
|
|
115
|
+
configureAIObservability,
|
|
116
|
+
createAIMCPServer,
|
|
117
|
+
createAIContextPacket,
|
|
118
|
+
createAIBridgeHandler,
|
|
119
|
+
createAIBridgeServer,
|
|
120
|
+
createIDEProjectionWatcher,
|
|
121
|
+
createLineReader,
|
|
122
|
+
emitAIDiagnostic,
|
|
123
|
+
emitAIEvent,
|
|
124
|
+
createTraceIds,
|
|
125
|
+
readAIDiagnosticsSnapshot,
|
|
126
|
+
readAIEvents,
|
|
127
|
+
renderAIContextBundleMarkdown,
|
|
128
|
+
renderAIContextMarkdown,
|
|
129
|
+
resolveAISessionPackPaths,
|
|
130
|
+
resolveIDEProjectionPaths,
|
|
131
|
+
resolveAIStorePaths,
|
|
132
|
+
resolveAIObservabilityConfig,
|
|
133
|
+
runWithAITrace,
|
|
134
|
+
writeAISessionPack,
|
|
135
|
+
writeIDEProjection
|
|
136
|
+
} from "../ai/index.js";
|
|
137
|
+
export {
|
|
138
|
+
BUILD_MANIFEST_SCHEMA_VERSION,
|
|
139
|
+
loadBuildManifest,
|
|
140
|
+
parseBuildManifest,
|
|
141
|
+
getRouteBuildEntry,
|
|
142
|
+
getClientBundleForRoute,
|
|
143
|
+
isPrerenderedRoute,
|
|
144
|
+
getPrerenderedHtmlPath
|
|
145
|
+
} from "./manifest.js";
|
|
146
|
+
export {
|
|
147
|
+
attachRequestMetadata,
|
|
148
|
+
classifyRouteRequest,
|
|
149
|
+
resolveRequestExecutionPolicy,
|
|
150
|
+
resolveRequestMetadata,
|
|
151
|
+
validateRequestPolicy
|
|
152
|
+
} from "./request-policy.js";
|
|
153
|
+
export {
|
|
154
|
+
createRuntimeRequestPlan
|
|
155
|
+
} from "./request-surface.js";
|
|
156
|
+
export {
|
|
157
|
+
dispatchRuntimeRequestPlan
|
|
158
|
+
} from "./runtime-dispatch.js";
|
|
159
|
+
export {
|
|
160
|
+
renderRouteErrorBoundaryResponse,
|
|
161
|
+
renderRoutePageResponse,
|
|
162
|
+
renderRoutePartialResponse
|
|
163
|
+
} from "./route-response.js";
|
|
164
|
+
export {
|
|
165
|
+
createRequestSecurityPolicy,
|
|
166
|
+
validateRequestSecurityPolicy
|
|
167
|
+
} from "./request-security-policy.js";
|
|
168
|
+
export {
|
|
169
|
+
executeServerExecution
|
|
170
|
+
} from "./server-execution.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
type Awaitable<T> = T | Promise<T>;
|
|
2
|
+
export interface JobContext {
|
|
3
|
+
attempt: number;
|
|
4
|
+
maxAttempts: number;
|
|
5
|
+
}
|
|
6
|
+
export interface JobDefinition<Payload> {
|
|
7
|
+
name: string;
|
|
8
|
+
handler(payload: Payload, context: JobContext): Awaitable<void>;
|
|
9
|
+
}
|
|
10
|
+
export interface JobEnqueueOptions {
|
|
11
|
+
runAt?: number;
|
|
12
|
+
maxAttempts?: number;
|
|
13
|
+
backoffMs?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface EnqueuedJob<Payload = unknown> {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
payload: Payload;
|
|
19
|
+
runAt: number;
|
|
20
|
+
attempts: number;
|
|
21
|
+
maxAttempts: number;
|
|
22
|
+
backoffMs: number;
|
|
23
|
+
lastError?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface JobRunResult {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
status: "completed" | "retrying" | "failed";
|
|
29
|
+
attempts: number;
|
|
30
|
+
nextRunAt?: number;
|
|
31
|
+
error?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface JobQueue {
|
|
34
|
+
enqueue<Payload>(job: JobDefinition<Payload>, payload: Payload, options?: JobEnqueueOptions): Promise<EnqueuedJob<Payload>>;
|
|
35
|
+
runNext(now?: number): Promise<JobRunResult | null>;
|
|
36
|
+
drain(now?: number): Promise<JobRunResult[]>;
|
|
37
|
+
size(): Promise<number>;
|
|
38
|
+
}
|
|
39
|
+
export declare function defineJob<Payload>(name: string, handler: (payload: Payload, context: JobContext) => Awaitable<void>): JobDefinition<Payload>;
|
|
40
|
+
export declare function createMemoryJobQueue(): JobQueue;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export function defineJob(name, handler) {
|
|
2
|
+
return { name, handler };
|
|
3
|
+
}
|
|
4
|
+
export function createMemoryJobQueue() {
|
|
5
|
+
const jobs = [];
|
|
6
|
+
function sortJobs() {
|
|
7
|
+
jobs.sort((a, b) => a.runAt - b.runAt);
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
async enqueue(job, payload, options = {}) {
|
|
11
|
+
const enqueued = {
|
|
12
|
+
id: crypto.randomUUID(),
|
|
13
|
+
name: job.name,
|
|
14
|
+
payload,
|
|
15
|
+
runAt: options.runAt ?? Date.now(),
|
|
16
|
+
attempts: 0,
|
|
17
|
+
maxAttempts: options.maxAttempts ?? 3,
|
|
18
|
+
backoffMs: options.backoffMs ?? 1000,
|
|
19
|
+
job
|
|
20
|
+
};
|
|
21
|
+
jobs.push(enqueued);
|
|
22
|
+
sortJobs();
|
|
23
|
+
return enqueued;
|
|
24
|
+
},
|
|
25
|
+
async runNext(now = Date.now()) {
|
|
26
|
+
sortJobs();
|
|
27
|
+
const nextIndex = jobs.findIndex((entry) => entry.runAt <= now);
|
|
28
|
+
if (nextIndex === -1)
|
|
29
|
+
return null;
|
|
30
|
+
const entry = jobs.splice(nextIndex, 1)[0];
|
|
31
|
+
entry.attempts += 1;
|
|
32
|
+
try {
|
|
33
|
+
await entry.job.handler(entry.payload, {
|
|
34
|
+
attempt: entry.attempts,
|
|
35
|
+
maxAttempts: entry.maxAttempts
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
id: entry.id,
|
|
39
|
+
name: entry.name,
|
|
40
|
+
status: "completed",
|
|
41
|
+
attempts: entry.attempts
|
|
42
|
+
};
|
|
43
|
+
} catch (error) {
|
|
44
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
45
|
+
entry.lastError = message;
|
|
46
|
+
if (entry.attempts < entry.maxAttempts) {
|
|
47
|
+
entry.runAt = now + entry.backoffMs * entry.attempts;
|
|
48
|
+
jobs.push(entry);
|
|
49
|
+
sortJobs();
|
|
50
|
+
return {
|
|
51
|
+
id: entry.id,
|
|
52
|
+
name: entry.name,
|
|
53
|
+
status: "retrying",
|
|
54
|
+
attempts: entry.attempts,
|
|
55
|
+
nextRunAt: entry.runAt,
|
|
56
|
+
error: message
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
id: entry.id,
|
|
61
|
+
name: entry.name,
|
|
62
|
+
status: "failed",
|
|
63
|
+
attempts: entry.attempts,
|
|
64
|
+
error: message
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
async drain(now = Date.now()) {
|
|
69
|
+
const results = [];
|
|
70
|
+
for (;; ) {
|
|
71
|
+
const result = await this.runNext(now);
|
|
72
|
+
if (!result)
|
|
73
|
+
return results;
|
|
74
|
+
results.push(result);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
async size() {
|
|
78
|
+
return jobs.length;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const BUILD_MANIFEST_SCHEMA_VERSION: 1;
|
|
2
|
+
export interface BuildManifestRoute {
|
|
3
|
+
js?: string;
|
|
4
|
+
hasLoader: boolean;
|
|
5
|
+
prerendered?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface BuildManifest {
|
|
8
|
+
schemaVersion: number;
|
|
9
|
+
routes: Record<string, BuildManifestRoute>;
|
|
10
|
+
chunks: string[];
|
|
11
|
+
prerendered: string[];
|
|
12
|
+
buildTime: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function loadBuildManifest(distDir: string): Promise<BuildManifest>;
|
|
15
|
+
export declare function parseBuildManifest(raw: string): BuildManifest;
|
|
16
|
+
export declare function getRouteBuildEntry(manifest: BuildManifest, pathname: string): BuildManifestRoute | undefined;
|
|
17
|
+
export declare function getClientBundleForRoute(manifest: BuildManifest, pathname: string): string | undefined;
|
|
18
|
+
export declare function isPrerenderedRoute(manifest: BuildManifest, pathname: string): boolean;
|
|
19
|
+
export declare function getPrerenderedHtmlPath(pathname: string): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
export const BUILD_MANIFEST_SCHEMA_VERSION = 1;
|
|
4
|
+
export async function loadBuildManifest(distDir) {
|
|
5
|
+
const raw = await readFile(join(distDir, "manifest.json"), "utf-8");
|
|
6
|
+
return parseBuildManifest(raw);
|
|
7
|
+
}
|
|
8
|
+
export function parseBuildManifest(raw) {
|
|
9
|
+
const manifest = JSON.parse(raw);
|
|
10
|
+
validateBuildManifest(manifest);
|
|
11
|
+
return manifest;
|
|
12
|
+
}
|
|
13
|
+
function validateBuildManifest(manifest) {
|
|
14
|
+
if (manifest.schemaVersion !== BUILD_MANIFEST_SCHEMA_VERSION)
|
|
15
|
+
throw Error(`Unsupported build manifest schema version: expected ${BUILD_MANIFEST_SCHEMA_VERSION}, received ${String(manifest.schemaVersion)}`);
|
|
16
|
+
if (!manifest.routes || typeof manifest.routes !== "object" || Array.isArray(manifest.routes))
|
|
17
|
+
throw Error("Invalid build manifest: routes must be an object");
|
|
18
|
+
if (!Array.isArray(manifest.chunks))
|
|
19
|
+
throw Error("Invalid build manifest: chunks must be an array");
|
|
20
|
+
if (!Array.isArray(manifest.prerendered))
|
|
21
|
+
throw Error("Invalid build manifest: prerendered must be an array");
|
|
22
|
+
if (typeof manifest.buildTime !== "string" || manifest.buildTime.length === 0)
|
|
23
|
+
throw Error("Invalid build manifest: buildTime must be a non-empty string");
|
|
24
|
+
}
|
|
25
|
+
export function getRouteBuildEntry(manifest, pathname) {
|
|
26
|
+
return manifest.routes[pathname];
|
|
27
|
+
}
|
|
28
|
+
export function getClientBundleForRoute(manifest, pathname) {
|
|
29
|
+
return getRouteBuildEntry(manifest, pathname)?.js;
|
|
30
|
+
}
|
|
31
|
+
export function isPrerenderedRoute(manifest, pathname) {
|
|
32
|
+
return getRouteBuildEntry(manifest, pathname)?.prerendered === !0;
|
|
33
|
+
}
|
|
34
|
+
export function getPrerenderedHtmlPath(pathname) {
|
|
35
|
+
return pathname === "/" ? "index.html" : join(pathname.slice(1), "index.html");
|
|
36
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface CookieOptions {
|
|
2
|
+
maxAge?: number;
|
|
3
|
+
expires?: Date;
|
|
4
|
+
path?: string;
|
|
5
|
+
domain?: string;
|
|
6
|
+
secure?: boolean;
|
|
7
|
+
httpOnly?: boolean;
|
|
8
|
+
sameSite?: "Strict" | "Lax" | "None";
|
|
9
|
+
}
|
|
10
|
+
export interface Context {
|
|
11
|
+
request: Request;
|
|
12
|
+
url: URL;
|
|
13
|
+
params: Record<string, string>;
|
|
14
|
+
cookies: Map<string, string>;
|
|
15
|
+
locals: Record<string, unknown>;
|
|
16
|
+
/** Response headers to be merged into the final response */
|
|
17
|
+
responseHeaders: Headers;
|
|
18
|
+
redirect(url: string, status?: number): Response;
|
|
19
|
+
setCookie(name: string, value: string, options?: CookieOptions): void;
|
|
20
|
+
deleteCookie(name: string, options?: Pick<CookieOptions, "path" | "domain">): void;
|
|
21
|
+
setHeader(name: string, value: string): void;
|
|
22
|
+
}
|
|
23
|
+
export interface ContextOptions {
|
|
24
|
+
trustedOrigin?: string;
|
|
25
|
+
}
|
|
26
|
+
export type NextFn = () => Promise<Response>;
|
|
27
|
+
export type MiddlewareFn = (ctx: Context, next: NextFn) => Promise<Response>;
|
|
28
|
+
/** Throwable redirect — use in loaders to interrupt and redirect */
|
|
29
|
+
export declare class RedirectError {
|
|
30
|
+
url: string;
|
|
31
|
+
status: number;
|
|
32
|
+
constructor(url: string, status?: number);
|
|
33
|
+
}
|
|
34
|
+
export declare function redirect(url: string, status?: number): never;
|
|
35
|
+
export declare function sanitizeRedirectTarget(target: string, currentUrlOrOrigin: URL | string): string;
|
|
36
|
+
export declare function isAllowedRequestOrigin(request: Request, trustedOrigin?: string): boolean;
|
|
37
|
+
export declare function middleware(fn: MiddlewareFn): MiddlewareFn;
|
|
38
|
+
export declare function createContext(request: Request, params?: Record<string, string>, options?: ContextOptions): Context;
|
|
39
|
+
export declare function runMiddlewareChain(middlewares: MiddlewareFn[], ctx: Context, handler: () => Promise<Response>): Promise<Response>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export class RedirectError {
|
|
2
|
+
url;
|
|
3
|
+
status;
|
|
4
|
+
constructor(url, status = 302) {
|
|
5
|
+
this.url = url;
|
|
6
|
+
this.status = status;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function redirect(url, status = 302) {
|
|
10
|
+
throw new RedirectError(url, status);
|
|
11
|
+
}
|
|
12
|
+
export function sanitizeRedirectTarget(target, currentUrlOrOrigin) {
|
|
13
|
+
const currentUrl = typeof currentUrlOrOrigin === "string" ? new URL(currentUrlOrOrigin) : currentUrlOrOrigin;
|
|
14
|
+
if (target.startsWith("//"))
|
|
15
|
+
return "/";
|
|
16
|
+
if (!/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(target))
|
|
17
|
+
return target;
|
|
18
|
+
try {
|
|
19
|
+
return new URL(target).origin === currentUrl.origin ? target : "/";
|
|
20
|
+
} catch {
|
|
21
|
+
return "/";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function isAllowedRequestOrigin(request, trustedOrigin) {
|
|
25
|
+
const origin = request.headers.get("Origin");
|
|
26
|
+
if (!origin)
|
|
27
|
+
return !0;
|
|
28
|
+
try {
|
|
29
|
+
const requestOrigin = new URL(origin), expectedOrigin = new URL(trustedOrigin ?? new URL(request.url).origin);
|
|
30
|
+
return requestOrigin.origin === expectedOrigin.origin;
|
|
31
|
+
} catch {
|
|
32
|
+
return !1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function middleware(fn) {
|
|
36
|
+
return fn;
|
|
37
|
+
}
|
|
38
|
+
function sanitizeCookiePart(str) {
|
|
39
|
+
return str.replace(/[\r\n;,]/g, "");
|
|
40
|
+
}
|
|
41
|
+
function serializeCookie(name, value, options = {}) {
|
|
42
|
+
let cookie = `${sanitizeCookiePart(name)}=${sanitizeCookiePart(value)}`;
|
|
43
|
+
if (options.maxAge !== void 0)
|
|
44
|
+
cookie += `; Max-Age=${options.maxAge}`;
|
|
45
|
+
if (options.expires)
|
|
46
|
+
cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
47
|
+
cookie += `; Path=${options.path ?? "/"}`;
|
|
48
|
+
if (options.domain)
|
|
49
|
+
cookie += `; Domain=${options.domain}`;
|
|
50
|
+
if (options.secure)
|
|
51
|
+
cookie += "; Secure";
|
|
52
|
+
if (options.httpOnly)
|
|
53
|
+
cookie += "; HttpOnly";
|
|
54
|
+
if (options.sameSite)
|
|
55
|
+
cookie += `; SameSite=${options.sameSite}`;
|
|
56
|
+
return cookie;
|
|
57
|
+
}
|
|
58
|
+
function parseCookies(request) {
|
|
59
|
+
const cookieHeader = request.headers.get("cookie") ?? "", cookies = new Map;
|
|
60
|
+
for (const pair of cookieHeader.split(";")) {
|
|
61
|
+
const [key, ...rest] = pair.trim().split("=");
|
|
62
|
+
if (key)
|
|
63
|
+
cookies.set(key, rest.join("="));
|
|
64
|
+
}
|
|
65
|
+
return cookies;
|
|
66
|
+
}
|
|
67
|
+
export function createContext(request, params = {}, options = {}) {
|
|
68
|
+
const url = new URL(request.url), trustedOrigin = options.trustedOrigin, cookies = parseCookies(request), responseHeaders = new Headers, pendingCookies = [];
|
|
69
|
+
return {
|
|
70
|
+
request,
|
|
71
|
+
url,
|
|
72
|
+
params,
|
|
73
|
+
cookies,
|
|
74
|
+
locals: {},
|
|
75
|
+
responseHeaders,
|
|
76
|
+
redirect(target, status = 302) {
|
|
77
|
+
const safeTarget = sanitizeRedirectTarget(target, trustedOrigin ?? url), res = new Response(null, {
|
|
78
|
+
status,
|
|
79
|
+
headers: { Location: safeTarget }
|
|
80
|
+
});
|
|
81
|
+
for (const cookie of pendingCookies)
|
|
82
|
+
res.headers.append("Set-Cookie", cookie);
|
|
83
|
+
return res;
|
|
84
|
+
},
|
|
85
|
+
setCookie(name, value, options) {
|
|
86
|
+
const cookie = serializeCookie(name, value, options);
|
|
87
|
+
pendingCookies.push(cookie);
|
|
88
|
+
responseHeaders.append("Set-Cookie", cookie);
|
|
89
|
+
cookies.set(name, value);
|
|
90
|
+
},
|
|
91
|
+
deleteCookie(name, options) {
|
|
92
|
+
const cookie = serializeCookie(name, "", {
|
|
93
|
+
...options,
|
|
94
|
+
maxAge: 0,
|
|
95
|
+
expires: new Date(0)
|
|
96
|
+
});
|
|
97
|
+
pendingCookies.push(cookie);
|
|
98
|
+
responseHeaders.append("Set-Cookie", cookie);
|
|
99
|
+
cookies.delete(name);
|
|
100
|
+
},
|
|
101
|
+
setHeader(name, value) {
|
|
102
|
+
responseHeaders.set(name, value);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export async function runMiddlewareChain(middlewares, ctx, handler) {
|
|
107
|
+
let index = 0;
|
|
108
|
+
const next = async () => {
|
|
109
|
+
if (index < middlewares.length) {
|
|
110
|
+
const mw = middlewares[index];
|
|
111
|
+
index++;
|
|
112
|
+
return mw(ctx, next);
|
|
113
|
+
}
|
|
114
|
+
return handler();
|
|
115
|
+
}, response = await next();
|
|
116
|
+
for (const [key, value] of ctx.responseHeaders.entries())
|
|
117
|
+
if (key.toLowerCase() === "set-cookie")
|
|
118
|
+
response.headers.append(key, value);
|
|
119
|
+
else
|
|
120
|
+
response.headers.set(key, value);
|
|
121
|
+
return response;
|
|
122
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getMimeType(path: string): string;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const MIME_TYPES: Record<string, string> = {
|
|
1
|
+
const MIME_TYPES = {
|
|
4
2
|
".html": "text/html; charset=utf-8",
|
|
5
3
|
".css": "text/css; charset=utf-8",
|
|
6
4
|
".js": "application/javascript; charset=utf-8",
|
|
@@ -10,8 +8,6 @@ const MIME_TYPES: Record<string, string> = {
|
|
|
10
8
|
".txt": "text/plain; charset=utf-8",
|
|
11
9
|
".md": "text/markdown; charset=utf-8",
|
|
12
10
|
".csv": "text/csv; charset=utf-8",
|
|
13
|
-
|
|
14
|
-
// Images
|
|
15
11
|
".png": "image/png",
|
|
16
12
|
".jpg": "image/jpeg",
|
|
17
13
|
".jpeg": "image/jpeg",
|
|
@@ -20,29 +16,22 @@ const MIME_TYPES: Record<string, string> = {
|
|
|
20
16
|
".avif": "image/avif",
|
|
21
17
|
".svg": "image/svg+xml",
|
|
22
18
|
".ico": "image/x-icon",
|
|
23
|
-
|
|
24
|
-
// Fonts
|
|
25
19
|
".woff": "font/woff",
|
|
26
20
|
".woff2": "font/woff2",
|
|
27
21
|
".ttf": "font/ttf",
|
|
28
22
|
".otf": "font/otf",
|
|
29
23
|
".eot": "application/vnd.ms-fontobject",
|
|
30
|
-
|
|
31
|
-
// Media
|
|
32
24
|
".mp4": "video/mp4",
|
|
33
25
|
".webm": "video/webm",
|
|
34
26
|
".mp3": "audio/mpeg",
|
|
35
27
|
".ogg": "audio/ogg",
|
|
36
28
|
".wav": "audio/wav",
|
|
37
|
-
|
|
38
|
-
// Other
|
|
39
29
|
".pdf": "application/pdf",
|
|
40
30
|
".zip": "application/zip",
|
|
41
31
|
".wasm": "application/wasm",
|
|
42
|
-
".map": "application/json"
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return MIME_TYPES[ext] ?? "application/octet-stream"
|
|
32
|
+
".map": "application/json"
|
|
33
|
+
};
|
|
34
|
+
export function getMimeType(path) {
|
|
35
|
+
const ext = path.slice(path.lastIndexOf(".")).toLowerCase();
|
|
36
|
+
return MIME_TYPES[ext] ?? "application/octet-stream";
|
|
48
37
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type HTMLWrapOptions } from "./html-shell.js";
|
|
2
|
+
interface NotFoundOptions extends Pick<HTMLWrapOptions, "bodyPrefix" | "bodySuffix" | "headElements"> {
|
|
3
|
+
title?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function renderNotFoundPage(routesDir: string, nonce: string, options?: NotFoundOptions): Promise<string>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { stat } from "node:fs/promises";
|
|
3
|
+
import { wrapHTML } from "./html-shell.js";
|
|
4
|
+
export async function renderNotFoundPage(routesDir, nonce, options = {}) {
|
|
5
|
+
const { title = "404 - Not Found", bodyPrefix, bodySuffix, headElements } = options;
|
|
6
|
+
try {
|
|
7
|
+
for (const candidate of ["404.tsx", "404.ts", "404.jsx", "404.js", "404.mjs"]) {
|
|
8
|
+
const notFoundPath = join(routesDir, candidate);
|
|
9
|
+
if (!(await stat(notFoundPath).catch(() => null))?.isFile())
|
|
10
|
+
continue;
|
|
11
|
+
const mod = await import(notFoundPath);
|
|
12
|
+
if (typeof mod.default === "function") {
|
|
13
|
+
const { ssrJsx, renderToString } = await import("../runtime/server.js"), vnode = ssrJsx(mod.default, {}), body = renderToString(vnode);
|
|
14
|
+
return wrapHTML(body, nonce, { title, bodyPrefix, bodySuffix, headElements });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
} catch {}
|
|
18
|
+
return wrapHTML("<h1>404</h1><p>Page not found</p>", nonce, {
|
|
19
|
+
title,
|
|
20
|
+
bodyPrefix,
|
|
21
|
+
bodySuffix,
|
|
22
|
+
headElements
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Context } from "./middleware.js";
|
|
2
|
+
import type { MatchResult } from "../router/matcher.js";
|
|
3
|
+
type PageModule = Record<string, unknown>;
|
|
4
|
+
export interface ResolvedPageRoute {
|
|
5
|
+
component: Function;
|
|
6
|
+
pageComponent: Function;
|
|
7
|
+
loaderData: unknown;
|
|
8
|
+
cssFiles: string[];
|
|
9
|
+
renderMode: string;
|
|
10
|
+
}
|
|
11
|
+
export interface RenderedPage {
|
|
12
|
+
html: string;
|
|
13
|
+
headElements: string[];
|
|
14
|
+
title?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PartialResponsePayload {
|
|
17
|
+
html: string;
|
|
18
|
+
data?: unknown;
|
|
19
|
+
params?: Record<string, string>;
|
|
20
|
+
title?: string;
|
|
21
|
+
css?: string[];
|
|
22
|
+
script?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function resolvePageRoute(mod: PageModule, match: MatchResult, ctx: Context): Promise<ResolvedPageRoute | null>;
|
|
25
|
+
export declare function createClientScriptPath(entryFile?: string): string | undefined;
|
|
26
|
+
export declare function renderPageDocument(pageComponent: Function, ctx: Context, params: Record<string, string>, loaderData: unknown): RenderedPage;
|
|
27
|
+
export declare function buildPartialResponsePayload(rendered: RenderedPage, loaderData: unknown, params: Record<string, string>, cssFiles: string[], clientScript?: string): PartialResponsePayload;
|
|
28
|
+
export declare function extractTitle(headElements: string[]): string | undefined;
|
|
29
|
+
export {};
|