gorsee 0.2.4 → 0.2.6
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 +283 -212
- 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 +173 -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} +44 -28
- 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 +53 -0
- package/dist-pkg/plugins/index.d.ts +62 -0
- package/dist-pkg/plugins/index.js +159 -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 +60 -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 +70 -0
- package/dist-pkg/reactive/optimistic.d.ts +20 -0
- package/dist-pkg/reactive/optimistic.js +67 -0
- package/dist-pkg/reactive/resource.d.ts +25 -0
- package/dist-pkg/reactive/resource.js +153 -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 +42 -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} +20 -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 +65 -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 +74 -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 +176 -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 +487 -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 +77 -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 +83 -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 +127 -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 +27 -0
- package/dist-pkg/server/page-render.d.ts +29 -0
- package/dist-pkg/server/page-render.js +70 -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 +46 -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 +61 -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 +257 -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 +110 -45
- package/bin/gorsee.js +0 -2
- 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
package/src/cli/cmd-create.ts
DELETED
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
// gorsee create <name> -- scaffold a new project
|
|
2
|
-
|
|
3
|
-
import { mkdir, writeFile } from "node:fs/promises"
|
|
4
|
-
import { join } from "node:path"
|
|
5
|
-
import { generateFrameworkMD } from "./framework-md.ts"
|
|
6
|
-
import { createProjectContext, type RuntimeOptions } from "../runtime/project.ts"
|
|
7
|
-
|
|
8
|
-
const DIRS = [
|
|
9
|
-
"routes",
|
|
10
|
-
"routes/api",
|
|
11
|
-
"shared",
|
|
12
|
-
"middleware",
|
|
13
|
-
"migrations",
|
|
14
|
-
"public",
|
|
15
|
-
]
|
|
16
|
-
|
|
17
|
-
const INDEX_ROUTE = `import { createSignal, Head, Link } from "gorsee/client"
|
|
18
|
-
|
|
19
|
-
export default function HomePage() {
|
|
20
|
-
const [count, setCount] = createSignal(0)
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div>
|
|
24
|
-
<Head>
|
|
25
|
-
<title>My Gorsee App</title>
|
|
26
|
-
<meta name="description" content="Built with Gorsee.js" />
|
|
27
|
-
</Head>
|
|
28
|
-
<h1>My Gorsee App</h1>
|
|
29
|
-
<p>Edit routes/index.tsx to get started.</p>
|
|
30
|
-
<nav>
|
|
31
|
-
<Link href="/">Home</Link> | <Link href="/about">About</Link>
|
|
32
|
-
</nav>
|
|
33
|
-
<div>
|
|
34
|
-
<button on:click={() => setCount((c: number) => c + 1)}>Count: {count}</button>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
const ABOUT_ROUTE = `import { Head, Link } from "gorsee/client"
|
|
42
|
-
|
|
43
|
-
export default function AboutPage() {
|
|
44
|
-
return (
|
|
45
|
-
<div>
|
|
46
|
-
<Head>
|
|
47
|
-
<title>About - My Gorsee App</title>
|
|
48
|
-
</Head>
|
|
49
|
-
<h1>About</h1>
|
|
50
|
-
<p>This app is built with <strong>Gorsee.js</strong> — a full-stack TypeScript framework.</p>
|
|
51
|
-
<Link href="/">Back to Home</Link>
|
|
52
|
-
</div>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
`
|
|
56
|
-
|
|
57
|
-
const LAYOUT = `export default function RootLayout(props: { children: unknown }) {
|
|
58
|
-
return (
|
|
59
|
-
<div class="layout">
|
|
60
|
-
<header>
|
|
61
|
-
<nav class="main-nav">
|
|
62
|
-
<strong>Gorsee App</strong>
|
|
63
|
-
</nav>
|
|
64
|
-
</header>
|
|
65
|
-
<main>{props.children}</main>
|
|
66
|
-
<footer>
|
|
67
|
-
<p>Built with Gorsee.js</p>
|
|
68
|
-
</footer>
|
|
69
|
-
</div>
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
`
|
|
73
|
-
|
|
74
|
-
const ERROR_PAGE = `export default function ErrorPage(props: { error: Error }) {
|
|
75
|
-
return (
|
|
76
|
-
<div class="error-page">
|
|
77
|
-
<h1>Something went wrong</h1>
|
|
78
|
-
<p>{props.error.message}</p>
|
|
79
|
-
<a href="/">Go back home</a>
|
|
80
|
-
</div>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
`
|
|
84
|
-
|
|
85
|
-
const NOT_FOUND_PAGE = `import { Head, Link } from "gorsee/client"
|
|
86
|
-
|
|
87
|
-
export default function NotFoundPage() {
|
|
88
|
-
return (
|
|
89
|
-
<div>
|
|
90
|
-
<Head><title>404 - Not Found</title></Head>
|
|
91
|
-
<h1>404</h1>
|
|
92
|
-
<p>The page you're looking for doesn't exist.</p>
|
|
93
|
-
<Link href="/">Go back home</Link>
|
|
94
|
-
</div>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
`
|
|
98
|
-
|
|
99
|
-
const HEALTH_API = `import type { Context } from "gorsee/server"
|
|
100
|
-
|
|
101
|
-
export function GET(_ctx: Context): Response {
|
|
102
|
-
return Response.json({
|
|
103
|
-
status: "ok",
|
|
104
|
-
timestamp: new Date().toISOString(),
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
`
|
|
108
|
-
|
|
109
|
-
const DEFAULT_CSS = `*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
|
110
|
-
body{font-family:system-ui,-apple-system,sans-serif;line-height:1.6;color:#1a1a1a;max-width:800px;margin:0 auto;padding:2rem 1rem}
|
|
111
|
-
h1{margin-bottom:.5rem}p{margin-bottom:.5rem}
|
|
112
|
-
a{color:#2563eb;text-decoration:none}a:hover{text-decoration:underline}
|
|
113
|
-
button{background:#2563eb;color:#fff;border:none;padding:.4rem 1rem;border-radius:4px;cursor:pointer;font-size:.9rem}
|
|
114
|
-
button:hover{background:#1d4ed8}
|
|
115
|
-
.layout{min-height:100vh;display:flex;flex-direction:column}
|
|
116
|
-
.layout main{flex:1}
|
|
117
|
-
.layout footer{margin-top:2rem;padding-top:1rem;border-top:1px solid #e5e7eb;color:#6b7280;font-size:.85rem}
|
|
118
|
-
`
|
|
119
|
-
|
|
120
|
-
const ENV_EXAMPLE = `# App
|
|
121
|
-
PORT=3000
|
|
122
|
-
NODE_ENV=development
|
|
123
|
-
|
|
124
|
-
# Auth (generate with: openssl rand -hex 32)
|
|
125
|
-
SESSION_SECRET=change-me-in-production
|
|
126
|
-
|
|
127
|
-
# Database
|
|
128
|
-
DATABASE_URL=./data.sqlite
|
|
129
|
-
|
|
130
|
-
# Public vars (exposed to client)
|
|
131
|
-
PUBLIC_APP_NAME=My Gorsee App
|
|
132
|
-
`
|
|
133
|
-
|
|
134
|
-
const APP_CONFIG = `export default {
|
|
135
|
-
port: 3000,
|
|
136
|
-
|
|
137
|
-
db: {
|
|
138
|
-
driver: "sqlite" as const,
|
|
139
|
-
url: "./data.sqlite",
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
log: "info" as const,
|
|
143
|
-
|
|
144
|
-
security: {
|
|
145
|
-
csp: true,
|
|
146
|
-
hsts: true,
|
|
147
|
-
csrf: true,
|
|
148
|
-
rateLimit: {
|
|
149
|
-
requests: 100,
|
|
150
|
-
window: "1m",
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
deploy: {
|
|
155
|
-
target: "bun" as const,
|
|
156
|
-
},
|
|
157
|
-
}
|
|
158
|
-
`
|
|
159
|
-
|
|
160
|
-
const TSCONFIG = `{
|
|
161
|
-
"compilerOptions": {
|
|
162
|
-
"target": "ESNext",
|
|
163
|
-
"module": "ESNext",
|
|
164
|
-
"moduleResolution": "bundler",
|
|
165
|
-
"jsx": "preserve",
|
|
166
|
-
"jsxImportSource": "gorsee",
|
|
167
|
-
"strict": true,
|
|
168
|
-
"noUncheckedIndexedAccess": true,
|
|
169
|
-
"allowImportingTsExtensions": true,
|
|
170
|
-
"noEmit": true,
|
|
171
|
-
"types": ["bun"]
|
|
172
|
-
},
|
|
173
|
-
"include": ["routes/**/*.ts", "routes/**/*.tsx", "shared/**/*.ts", "middleware/**/*.ts"]
|
|
174
|
-
}
|
|
175
|
-
`
|
|
176
|
-
|
|
177
|
-
const GITIGNORE = `node_modules/
|
|
178
|
-
dist/
|
|
179
|
-
.gorsee/
|
|
180
|
-
.env
|
|
181
|
-
.env.local
|
|
182
|
-
*.sqlite
|
|
183
|
-
*.db
|
|
184
|
-
.DS_Store
|
|
185
|
-
bun.lock
|
|
186
|
-
`
|
|
187
|
-
|
|
188
|
-
function generateReadme(name: string): string {
|
|
189
|
-
return `# ${name}
|
|
190
|
-
|
|
191
|
-
Built with [Gorsee.js](https://github.com/AYKGorsee/gorsee-js) — full-stack TypeScript framework.
|
|
192
|
-
|
|
193
|
-
## Getting Started
|
|
194
|
-
|
|
195
|
-
\`\`\`bash
|
|
196
|
-
bun install
|
|
197
|
-
bun run dev
|
|
198
|
-
\`\`\`
|
|
199
|
-
|
|
200
|
-
Open [http://localhost:3000](http://localhost:3000).
|
|
201
|
-
|
|
202
|
-
## Commands
|
|
203
|
-
|
|
204
|
-
| Command | Description |
|
|
205
|
-
|---------|-------------|
|
|
206
|
-
| \`bun run dev\` | Start dev server with HMR |
|
|
207
|
-
| \`bun run build\` | Production build |
|
|
208
|
-
| \`bun run start\` | Start production server |
|
|
209
|
-
| \`bun run check\` | Type check + safety audit |
|
|
210
|
-
| \`bunx gorsee routes\` | Show route table |
|
|
211
|
-
| \`bunx gorsee generate <entity>\` | CRUD scaffold |
|
|
212
|
-
| \`bunx gorsee typegen\` | Generate typed routes |
|
|
213
|
-
| \`bunx gorsee migrate\` | Run DB migrations |
|
|
214
|
-
|
|
215
|
-
## Import Boundaries
|
|
216
|
-
|
|
217
|
-
- Use \`gorsee/client\` for route components, islands, links, forms, and reactive primitives.
|
|
218
|
-
- Use \`gorsee/server\` for loaders, middleware, auth, db, cache, RPC, security, env, and logging.
|
|
219
|
-
- Do not use root \`gorsee\` in new code. It exists only as a compatibility entrypoint.
|
|
220
|
-
|
|
221
|
-
## Project Structure
|
|
222
|
-
|
|
223
|
-
\`\`\`
|
|
224
|
-
routes/ → pages and API routes (file-based routing)
|
|
225
|
-
index.tsx → /
|
|
226
|
-
about.tsx → /about
|
|
227
|
-
api/health.ts → /api/health (JSON API)
|
|
228
|
-
_layout.tsx → wraps all pages
|
|
229
|
-
_error.tsx → error boundary
|
|
230
|
-
404.tsx → custom 404
|
|
231
|
-
shared/ → shared modules (imported by routes)
|
|
232
|
-
middleware/ → global middleware
|
|
233
|
-
migrations/ → SQL migration files
|
|
234
|
-
public/ → static assets (served as-is)
|
|
235
|
-
\`\`\`
|
|
236
|
-
|
|
237
|
-
## Learn More
|
|
238
|
-
|
|
239
|
-
See \`FRAMEWORK.md\` for the full API reference (AI-friendly).
|
|
240
|
-
`
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export interface CreateCommandOptions extends RuntimeOptions {}
|
|
244
|
-
|
|
245
|
-
export async function createProject(args: string[], options: CreateCommandOptions = {}) {
|
|
246
|
-
const name = args[0]
|
|
247
|
-
if (!name) {
|
|
248
|
-
console.error("Usage: gorsee create <project-name>")
|
|
249
|
-
process.exit(1)
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
const { cwd } = createProjectContext(options)
|
|
253
|
-
const dir = join(cwd, name)
|
|
254
|
-
console.log(`\n Creating ${name}...\n`)
|
|
255
|
-
|
|
256
|
-
await mkdir(dir, { recursive: true })
|
|
257
|
-
for (const d of DIRS) {
|
|
258
|
-
await mkdir(join(dir, d), { recursive: true })
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
await writeFile(join(dir, "routes/index.tsx"), INDEX_ROUTE)
|
|
262
|
-
await writeFile(join(dir, "routes/about.tsx"), ABOUT_ROUTE)
|
|
263
|
-
await writeFile(join(dir, "routes/_layout.tsx"), LAYOUT)
|
|
264
|
-
await writeFile(join(dir, "routes/_error.tsx"), ERROR_PAGE)
|
|
265
|
-
await writeFile(join(dir, "routes/404.tsx"), NOT_FOUND_PAGE)
|
|
266
|
-
await writeFile(join(dir, "routes/api/health.ts"), HEALTH_API)
|
|
267
|
-
await writeFile(join(dir, "public/styles.css"), DEFAULT_CSS)
|
|
268
|
-
await writeFile(join(dir, "app.config.ts"), APP_CONFIG)
|
|
269
|
-
await writeFile(join(dir, "tsconfig.json"), TSCONFIG)
|
|
270
|
-
await writeFile(join(dir, ".gitignore"), GITIGNORE)
|
|
271
|
-
await writeFile(join(dir, ".env.example"), ENV_EXAMPLE)
|
|
272
|
-
await writeFile(join(dir, ".env"), ENV_EXAMPLE)
|
|
273
|
-
await writeFile(join(dir, "README.md"), generateReadme(name))
|
|
274
|
-
|
|
275
|
-
await writeFile(
|
|
276
|
-
join(dir, "package.json"),
|
|
277
|
-
JSON.stringify(
|
|
278
|
-
{
|
|
279
|
-
name,
|
|
280
|
-
version: "0.1.0",
|
|
281
|
-
type: "module",
|
|
282
|
-
scripts: {
|
|
283
|
-
dev: "gorsee dev",
|
|
284
|
-
build: "gorsee build",
|
|
285
|
-
start: "gorsee start",
|
|
286
|
-
check: "gorsee check",
|
|
287
|
-
},
|
|
288
|
-
dependencies: {
|
|
289
|
-
gorsee: "latest",
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
null,
|
|
293
|
-
2
|
|
294
|
-
) + "\n"
|
|
295
|
-
)
|
|
296
|
-
|
|
297
|
-
const frameworkMD = generateFrameworkMD(name)
|
|
298
|
-
await writeFile(join(dir, "FRAMEWORK.md"), frameworkMD)
|
|
299
|
-
|
|
300
|
-
console.log(" Created:")
|
|
301
|
-
console.log(" routes/index.tsx home page with counter")
|
|
302
|
-
console.log(" routes/about.tsx about page")
|
|
303
|
-
console.log(" routes/_layout.tsx root layout (header + footer)")
|
|
304
|
-
console.log(" routes/_error.tsx error boundary")
|
|
305
|
-
console.log(" routes/404.tsx custom 404")
|
|
306
|
-
console.log(" routes/api/health.ts health check API")
|
|
307
|
-
console.log(" public/styles.css default styles")
|
|
308
|
-
console.log(" app.config.ts configuration")
|
|
309
|
-
console.log(" .env / .env.example environment variables")
|
|
310
|
-
console.log(" README.md project readme")
|
|
311
|
-
console.log(" FRAMEWORK.md AI context file")
|
|
312
|
-
console.log(" tsconfig.json")
|
|
313
|
-
console.log(" package.json")
|
|
314
|
-
console.log()
|
|
315
|
-
console.log(" Next steps:")
|
|
316
|
-
console.log()
|
|
317
|
-
console.log(` cd ${name}`)
|
|
318
|
-
console.log(" bun install")
|
|
319
|
-
console.log(" bun run dev")
|
|
320
|
-
console.log()
|
|
321
|
-
console.log(" Then open http://localhost:3000")
|
|
322
|
-
console.log()
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/** @deprecated Use createProject() for programmatic access. */
|
|
326
|
-
export async function runCreate(args: string[], options: CreateCommandOptions = {}) {
|
|
327
|
-
return createProject(args, options)
|
|
328
|
-
}
|
package/src/cli/cmd-deploy.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
// Gorsee.js — CLI deploy command
|
|
2
|
-
|
|
3
|
-
import { writeFile, access, mkdir } from "node:fs/promises"
|
|
4
|
-
import { join } from "node:path"
|
|
5
|
-
import { createProjectContext, type RuntimeOptions } from "../runtime/project.ts"
|
|
6
|
-
|
|
7
|
-
type Target = "vercel" | "fly" | "cloudflare" | "netlify" | "docker"
|
|
8
|
-
|
|
9
|
-
const TARGETS: Target[] = ["vercel", "fly", "cloudflare", "netlify", "docker"]
|
|
10
|
-
|
|
11
|
-
const DETECT_FILES: Record<string, Target> = {
|
|
12
|
-
"vercel.json": "vercel",
|
|
13
|
-
"fly.toml": "fly",
|
|
14
|
-
"wrangler.toml": "cloudflare",
|
|
15
|
-
"netlify.toml": "netlify",
|
|
16
|
-
"Dockerfile": "docker",
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function fileExists(path: string): Promise<boolean> {
|
|
20
|
-
try {
|
|
21
|
-
await access(path)
|
|
22
|
-
return true
|
|
23
|
-
} catch {
|
|
24
|
-
return false
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async function detectTarget(cwd: string): Promise<Target | null> {
|
|
29
|
-
for (const [file, target] of Object.entries(DETECT_FILES)) {
|
|
30
|
-
if (await fileExists(join(cwd, file))) return target
|
|
31
|
-
}
|
|
32
|
-
return null
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function writeAndLog(filePath: string, content: string): Promise<void> {
|
|
36
|
-
await writeFile(filePath, content, "utf-8")
|
|
37
|
-
console.log(` created ${filePath}`)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function deployVercel(cwd: string): Promise<void> {
|
|
41
|
-
const { generateVercelConfig, generateVercelServerlessEntry } = await import("../deploy/vercel.ts")
|
|
42
|
-
await writeAndLog(join(cwd, "vercel.json"), JSON.stringify(generateVercelConfig(), null, 2))
|
|
43
|
-
await mkdir(join(cwd, "api"), { recursive: true })
|
|
44
|
-
await writeAndLog(join(cwd, "api/index.ts"), generateVercelServerlessEntry())
|
|
45
|
-
console.log("\n Next steps:")
|
|
46
|
-
console.log(" 1. Install Vercel CLI: npm i -g vercel")
|
|
47
|
-
console.log(" 2. Run: vercel")
|
|
48
|
-
console.log(" 3. Follow prompts to link your project")
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async function deployFly(cwd: string, appName: string): Promise<void> {
|
|
52
|
-
const { generateFlyConfig, generateFlyDockerfile } = await import("../deploy/fly.ts")
|
|
53
|
-
await writeAndLog(join(cwd, "fly.toml"), generateFlyConfig(appName))
|
|
54
|
-
await writeAndLog(join(cwd, "Dockerfile"), generateFlyDockerfile())
|
|
55
|
-
console.log("\n Next steps:")
|
|
56
|
-
console.log(" 1. Install Fly CLI: curl -L https://fly.io/install.sh | sh")
|
|
57
|
-
console.log(` 2. Run: fly launch --name ${appName}`)
|
|
58
|
-
console.log(" 3. Deploy: fly deploy")
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function deployCloudflare(cwd: string, name: string): Promise<void> {
|
|
62
|
-
const { generateWranglerConfig, generateCloudflareEntry, generateCloudflareStaticAssets } =
|
|
63
|
-
await import("../deploy/cloudflare.ts")
|
|
64
|
-
await writeAndLog(join(cwd, "wrangler.toml"), generateWranglerConfig(name))
|
|
65
|
-
await writeAndLog(join(cwd, "worker.ts"), generateCloudflareEntry())
|
|
66
|
-
await writeAndLog(join(cwd, "_routes.json"), JSON.stringify(generateCloudflareStaticAssets(), null, 2))
|
|
67
|
-
console.log("\n Next steps:")
|
|
68
|
-
console.log(" 1. Install Wrangler: npm i -g wrangler")
|
|
69
|
-
console.log(" 2. Authenticate: wrangler login")
|
|
70
|
-
console.log(" 3. Deploy: wrangler deploy")
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async function deployNetlify(cwd: string): Promise<void> {
|
|
74
|
-
const { generateNetlifyConfig, generateNetlifyFunction } = await import("../deploy/netlify.ts")
|
|
75
|
-
await writeAndLog(join(cwd, "netlify.toml"), generateNetlifyConfig())
|
|
76
|
-
const edgeFnDir = join(cwd, "netlify/edge-functions")
|
|
77
|
-
await mkdir(edgeFnDir, { recursive: true })
|
|
78
|
-
await writeAndLog(join(edgeFnDir, "gorsee-handler.ts"), generateNetlifyFunction())
|
|
79
|
-
console.log("\n Next steps:")
|
|
80
|
-
console.log(" 1. Install Netlify CLI: npm i -g netlify-cli")
|
|
81
|
-
console.log(" 2. Run: netlify init")
|
|
82
|
-
console.log(" 3. Deploy: netlify deploy --prod")
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async function deployDocker(cwd: string): Promise<void> {
|
|
86
|
-
const { generateDockerfile, generateDockerignore } = await import("../deploy/dockerfile.ts")
|
|
87
|
-
await writeAndLog(join(cwd, "Dockerfile"), generateDockerfile())
|
|
88
|
-
await writeAndLog(join(cwd, ".dockerignore"), generateDockerignore())
|
|
89
|
-
console.log("\n Next steps:")
|
|
90
|
-
console.log(" 1. Build image: docker build -t gorsee-app .")
|
|
91
|
-
console.log(" 2. Run: docker run -p 3000:3000 gorsee-app")
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface DeployCommandOptions extends RuntimeOptions {}
|
|
95
|
-
|
|
96
|
-
export async function generateDeployConfig(args: string[], options: DeployCommandOptions = {}): Promise<void> {
|
|
97
|
-
const { cwd } = createProjectContext(options)
|
|
98
|
-
const initOnly = args.includes("--init")
|
|
99
|
-
const targetArg = args.find((a) => !a.startsWith("-")) as Target | undefined
|
|
100
|
-
|
|
101
|
-
let target = targetArg ?? null
|
|
102
|
-
if (!target) {
|
|
103
|
-
target = await detectTarget(cwd)
|
|
104
|
-
if (!target) {
|
|
105
|
-
console.error(" No deploy target specified and none detected.")
|
|
106
|
-
console.error(` Usage: gorsee deploy <${TARGETS.join("|")}> [--init]`)
|
|
107
|
-
process.exit(1)
|
|
108
|
-
}
|
|
109
|
-
console.log(` Auto-detected target: ${target}`)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (!TARGETS.includes(target)) {
|
|
113
|
-
console.error(` Unknown target: ${target}`)
|
|
114
|
-
console.error(` Available: ${TARGETS.join(", ")}`)
|
|
115
|
-
process.exit(1)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const projectName = cwd.split("/").pop() ?? "gorsee-app"
|
|
119
|
-
console.log(`\n Generating ${target} deploy config...\n`)
|
|
120
|
-
|
|
121
|
-
switch (target) {
|
|
122
|
-
case "vercel":
|
|
123
|
-
await deployVercel(cwd)
|
|
124
|
-
break
|
|
125
|
-
case "fly":
|
|
126
|
-
await deployFly(cwd, projectName)
|
|
127
|
-
break
|
|
128
|
-
case "cloudflare":
|
|
129
|
-
await deployCloudflare(cwd, projectName)
|
|
130
|
-
break
|
|
131
|
-
case "netlify":
|
|
132
|
-
await deployNetlify(cwd)
|
|
133
|
-
break
|
|
134
|
-
case "docker":
|
|
135
|
-
await deployDocker(cwd)
|
|
136
|
-
break
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (initOnly) {
|
|
140
|
-
console.log("\n Config generated (--init mode). Deploy manually when ready.")
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
console.log()
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** @deprecated Use generateDeployConfig() for programmatic access. */
|
|
147
|
-
export async function runDeploy(args: string[], options: DeployCommandOptions = {}): Promise<void> {
|
|
148
|
-
return generateDeployConfig(args, options)
|
|
149
|
-
}
|
package/src/cli/cmd-dev.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// gorsee dev -- start dev server
|
|
2
|
-
|
|
3
|
-
import { createProjectContext, type RuntimeOptions } from "../runtime/project.ts"
|
|
4
|
-
|
|
5
|
-
export interface DevCommandOptions extends RuntimeOptions {
|
|
6
|
-
port?: number
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export async function runDev(_args: string[], options: DevCommandOptions = {}) {
|
|
10
|
-
const { cwd } = createProjectContext(options)
|
|
11
|
-
const { startDevServer } = await import("../dev.ts")
|
|
12
|
-
await startDevServer({ cwd, port: options.port })
|
|
13
|
-
}
|
package/src/cli/cmd-docs.ts
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
// gorsee docs -- generate API documentation from route files
|
|
2
|
-
|
|
3
|
-
import { join } from "node:path"
|
|
4
|
-
import { readFile, mkdir, writeFile } from "node:fs/promises"
|
|
5
|
-
import { createRouter, type Route } from "../router/scanner.ts"
|
|
6
|
-
import { createProjectContext, type RuntimeOptions } from "../runtime/project.ts"
|
|
7
|
-
|
|
8
|
-
const HTTP_METHODS = ["GET", "POST", "PUT", "DELETE", "PATCH"] as const
|
|
9
|
-
|
|
10
|
-
interface DocFlags {
|
|
11
|
-
output: string
|
|
12
|
-
format: "md" | "json" | "html"
|
|
13
|
-
routesOnly: boolean
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface RouteDoc {
|
|
17
|
-
path: string
|
|
18
|
-
methods: string[]
|
|
19
|
-
hasLoader: boolean
|
|
20
|
-
isApi: boolean
|
|
21
|
-
hasMiddleware: boolean
|
|
22
|
-
title: string
|
|
23
|
-
meta: Record<string, unknown> | null
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function parseDocsFlags(args: string[]): DocFlags {
|
|
27
|
-
const flags: DocFlags = { output: "docs/api.md", format: "md", routesOnly: false }
|
|
28
|
-
|
|
29
|
-
for (let i = 0; i < args.length; i++) {
|
|
30
|
-
const arg = args[i]!
|
|
31
|
-
if (arg === "--output" && args[i + 1]) flags.output = args[++i]!
|
|
32
|
-
else if (arg === "--format" && args[i + 1]) {
|
|
33
|
-
const fmt = args[++i]!
|
|
34
|
-
if (fmt === "md" || fmt === "json" || fmt === "html") flags.format = fmt
|
|
35
|
-
} else if (arg === "--routes-only") flags.routesOnly = true
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return flags
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async function extractRouteInfo(route: Route): Promise<RouteDoc> {
|
|
42
|
-
const content = await readFile(route.filePath, "utf-8")
|
|
43
|
-
const methods: string[] = []
|
|
44
|
-
|
|
45
|
-
for (const method of HTTP_METHODS) {
|
|
46
|
-
if (new RegExp(`export\\s+(async\\s+)?function\\s+${method}\\b`, "i").test(content)) {
|
|
47
|
-
methods.push(method)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const hasDefault = /export\s+default\s+/.test(content)
|
|
52
|
-
const hasLoader = /export\s+(async\s+)?function\s+loader\b/.test(content)
|
|
53
|
-
const isApi = !hasDefault || methods.length > 0
|
|
54
|
-
|
|
55
|
-
if (methods.length === 0 && hasDefault) methods.push("GET")
|
|
56
|
-
if (methods.length === 0 && hasLoader) methods.push("GET")
|
|
57
|
-
|
|
58
|
-
// Extract title from JSDoc or component name
|
|
59
|
-
let title = ""
|
|
60
|
-
const jsdocMatch = content.match(/\/\*\*\s*\n?\s*\*\s*(.+?)(?:\n|\*\/)/s)
|
|
61
|
-
if (jsdocMatch) title = jsdocMatch[1]!.trim()
|
|
62
|
-
|
|
63
|
-
// Extract meta export
|
|
64
|
-
let meta: Record<string, unknown> | null = null
|
|
65
|
-
const metaMatch = content.match(/export\s+const\s+meta\s*=\s*(\{[^}]+\})/)
|
|
66
|
-
if (metaMatch) {
|
|
67
|
-
try { meta = JSON.parse(metaMatch[1]!.replace(/'/g, '"')) } catch { /* skip */ }
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
path: route.path,
|
|
72
|
-
methods,
|
|
73
|
-
hasLoader,
|
|
74
|
-
isApi,
|
|
75
|
-
hasMiddleware: route.middlewarePaths.length > 0,
|
|
76
|
-
title,
|
|
77
|
-
meta,
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function generateMarkdown(docs: RouteDoc[]): string {
|
|
82
|
-
const lines = ["# API Documentation", "", "| Path | Methods | Type | Loader | Middleware |", "| --- | --- | --- | --- | --- |"]
|
|
83
|
-
for (const doc of docs) {
|
|
84
|
-
const type = doc.isApi ? "API" : "Page"
|
|
85
|
-
const mw = doc.hasMiddleware ? "Yes" : "-"
|
|
86
|
-
lines.push(`| ${doc.path} | ${doc.methods.join(", ")} | ${type} | ${doc.hasLoader ? "Yes" : "-"} | ${mw} |`)
|
|
87
|
-
}
|
|
88
|
-
return lines.join("\n") + "\n"
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function generateJson(docs: RouteDoc[]): string {
|
|
92
|
-
return JSON.stringify(docs, null, 2) + "\n"
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function generateHtml(docs: RouteDoc[]): string {
|
|
96
|
-
const rows = docs.map((d) => {
|
|
97
|
-
const type = d.isApi ? "API" : "Page"
|
|
98
|
-
const mw = d.hasMiddleware ? "Yes" : "-"
|
|
99
|
-
return `<tr><td>${d.path}</td><td>${d.methods.join(", ")}</td><td>${type}</td><td>${d.hasLoader ? "Yes" : "-"}</td><td>${mw}</td></tr>`
|
|
100
|
-
}).join("\n ")
|
|
101
|
-
|
|
102
|
-
return `<!DOCTYPE html>
|
|
103
|
-
<html><head><meta charset="utf-8"><title>API Docs</title>
|
|
104
|
-
<style>body{font-family:sans-serif;margin:2rem}table{border-collapse:collapse;width:100%}
|
|
105
|
-
th,td{border:1px solid #ddd;padding:8px;text-align:left}th{background:#f5f5f5}</style>
|
|
106
|
-
</head><body><h1>API Documentation</h1>
|
|
107
|
-
<table><thead><tr><th>Path</th><th>Methods</th><th>Type</th><th>Loader</th><th>Middleware</th></tr></thead>
|
|
108
|
-
<tbody>${rows}</tbody></table></body></html>\n`
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const GENERATORS: Record<string, (docs: RouteDoc[]) => string> = {
|
|
112
|
-
md: generateMarkdown,
|
|
113
|
-
json: generateJson,
|
|
114
|
-
html: generateHtml,
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface DocsCommandOptions extends RuntimeOptions {}
|
|
118
|
-
|
|
119
|
-
export async function generateDocs(args: string[], options: DocsCommandOptions = {}) {
|
|
120
|
-
const { cwd, paths } = createProjectContext(options)
|
|
121
|
-
const flags = parseDocsFlags(args)
|
|
122
|
-
|
|
123
|
-
const routes = await createRouter(paths.routesDir)
|
|
124
|
-
if (routes.length === 0) {
|
|
125
|
-
console.log("\n No routes found in routes/\n")
|
|
126
|
-
return
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const docs: RouteDoc[] = []
|
|
130
|
-
for (const route of routes) {
|
|
131
|
-
const info = await extractRouteInfo(route)
|
|
132
|
-
if (flags.routesOnly && info.isApi) continue
|
|
133
|
-
docs.push(info)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const generate = GENERATORS[flags.format]!
|
|
137
|
-
const content = generate(docs)
|
|
138
|
-
|
|
139
|
-
const outputPath = join(cwd, flags.output)
|
|
140
|
-
await mkdir(join(outputPath, ".."), { recursive: true })
|
|
141
|
-
await writeFile(outputPath, content, "utf-8")
|
|
142
|
-
|
|
143
|
-
console.log(`\n Generated docs for ${docs.length} routes -> ${flags.output}\n`)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/** @deprecated Use generateDocs() for programmatic access. */
|
|
147
|
-
export async function runDocs(args: string[], options: DocsCommandOptions = {}) {
|
|
148
|
-
return generateDocs(args, options)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export { extractRouteInfo, generateMarkdown, generateJson, generateHtml }
|
|
152
|
-
export type { RouteDoc, DocFlags }
|