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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type FrameworkBuildPlugin } from "./plugin.js";
|
|
2
|
+
import { type ClientBuildLog } from "./diagnostics.js";
|
|
3
|
+
export type ClientBuildPlugin = FrameworkBuildPlugin;
|
|
4
|
+
export interface ClientBuildBackendOptions {
|
|
5
|
+
entrypoints: string[];
|
|
6
|
+
outdir: string;
|
|
7
|
+
minify: boolean;
|
|
8
|
+
sourcemap: boolean;
|
|
9
|
+
frameworkResolve(specifier: string): string | undefined;
|
|
10
|
+
plugins: ClientBuildPlugin[];
|
|
11
|
+
}
|
|
12
|
+
export interface ClientBuildBackendResult {
|
|
13
|
+
success: boolean;
|
|
14
|
+
logs: ClientBuildLog[];
|
|
15
|
+
}
|
|
16
|
+
export interface ClientBuildBackend {
|
|
17
|
+
name: string;
|
|
18
|
+
build(options: ClientBuildBackendOptions): Promise<ClientBuildBackendResult>;
|
|
19
|
+
}
|
|
20
|
+
export declare const GORSEE_BUILD_BACKEND_ENV = "GORSEE_BUILD_BACKEND";
|
|
21
|
+
export declare function createBunClientBuildBackend(): ClientBuildBackend;
|
|
22
|
+
export declare function getClientBuildBackend(): ClientBuildBackend;
|
|
23
|
+
export declare function setClientBuildBackend(backend: ClientBuildBackend): void;
|
|
24
|
+
export declare function resetClientBuildBackend(): void;
|
|
25
|
+
export declare function registerClientBuildBackend(backend: ClientBuildBackend): void;
|
|
26
|
+
export declare function unregisterClientBuildBackend(name: string): void;
|
|
27
|
+
export declare function listClientBuildBackends(): string[];
|
|
28
|
+
export declare function selectClientBuildBackend(name: string): ClientBuildBackend;
|
|
29
|
+
export declare function resolveClientBuildBackendName(env?: NodeJS.ProcessEnv): string;
|
|
30
|
+
export declare function configureClientBuildBackend(env?: NodeJS.ProcessEnv): ClientBuildBackend;
|
|
31
|
+
export type { ClientBuildLog };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { createRolldownClientBuildBackend } from "./backends/rolldown.js";
|
|
2
|
+
import { resolveBuildPluginsForTarget } from "./plugin.js";
|
|
3
|
+
import { normalizeClientBuildLog } from "./diagnostics.js";
|
|
4
|
+
export const GORSEE_BUILD_BACKEND_ENV = "GORSEE_BUILD_BACKEND";
|
|
5
|
+
const internalBunFallback = createBunClientBuildBackend(), stableRolldownBackend = createRolldownClientBuildBackend({ fallback: internalBunFallback }), clientBuildBackends = new Map([
|
|
6
|
+
[internalBunFallback.name, internalBunFallback],
|
|
7
|
+
[stableRolldownBackend.name, stableRolldownBackend]
|
|
8
|
+
]);
|
|
9
|
+
export function createBunClientBuildBackend() {
|
|
10
|
+
return {
|
|
11
|
+
name: "bun",
|
|
12
|
+
async build(options) {
|
|
13
|
+
const result = await Bun.build({
|
|
14
|
+
entrypoints: options.entrypoints,
|
|
15
|
+
outdir: options.outdir,
|
|
16
|
+
target: "browser",
|
|
17
|
+
format: "esm",
|
|
18
|
+
minify: options.minify,
|
|
19
|
+
sourcemap: options.sourcemap ? "external" : "none",
|
|
20
|
+
splitting: !0,
|
|
21
|
+
jsx: {
|
|
22
|
+
runtime: "automatic",
|
|
23
|
+
importSource: "gorsee",
|
|
24
|
+
development: !0
|
|
25
|
+
},
|
|
26
|
+
plugins: [
|
|
27
|
+
{
|
|
28
|
+
name: "gorsee-client-resolve",
|
|
29
|
+
setup(build) {
|
|
30
|
+
build.onResolve({ filter: /^gorsee:route:/ }, (args) => ({
|
|
31
|
+
path: args.path.slice(13)
|
|
32
|
+
}));
|
|
33
|
+
build.onResolve({ filter: /^gorsee(\/.*)?$/ }, (args) => {
|
|
34
|
+
const mapped = options.frameworkResolve(args.path);
|
|
35
|
+
if (mapped)
|
|
36
|
+
return { path: mapped };
|
|
37
|
+
return;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
...resolveBuildPluginsForTarget(options.plugins, "bun")
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
success: result.success,
|
|
46
|
+
logs: result.logs.map((log) => normalizeClientBuildLog({
|
|
47
|
+
message: log.message
|
|
48
|
+
}, {
|
|
49
|
+
backend: "bun",
|
|
50
|
+
phase: "bundle",
|
|
51
|
+
severity: "error",
|
|
52
|
+
code: "BUN_BUILD_FAILURE"
|
|
53
|
+
}))
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
let defaultClientBuildBackend = stableRolldownBackend;
|
|
59
|
+
export function getClientBuildBackend() {
|
|
60
|
+
return defaultClientBuildBackend;
|
|
61
|
+
}
|
|
62
|
+
export function setClientBuildBackend(backend) {
|
|
63
|
+
clientBuildBackends.set(backend.name, backend);
|
|
64
|
+
defaultClientBuildBackend = backend;
|
|
65
|
+
}
|
|
66
|
+
export function resetClientBuildBackend() {
|
|
67
|
+
clientBuildBackends.clear();
|
|
68
|
+
clientBuildBackends.set(internalBunFallback.name, internalBunFallback);
|
|
69
|
+
clientBuildBackends.set(stableRolldownBackend.name, stableRolldownBackend);
|
|
70
|
+
defaultClientBuildBackend = stableRolldownBackend;
|
|
71
|
+
}
|
|
72
|
+
export function registerClientBuildBackend(backend) {
|
|
73
|
+
clientBuildBackends.set(backend.name, backend);
|
|
74
|
+
}
|
|
75
|
+
export function unregisterClientBuildBackend(name) {
|
|
76
|
+
if (name === stableRolldownBackend.name)
|
|
77
|
+
return;
|
|
78
|
+
clientBuildBackends.delete(name);
|
|
79
|
+
if (defaultClientBuildBackend.name === name)
|
|
80
|
+
defaultClientBuildBackend = stableRolldownBackend;
|
|
81
|
+
}
|
|
82
|
+
export function listClientBuildBackends() {
|
|
83
|
+
return [...clientBuildBackends.keys()].sort();
|
|
84
|
+
}
|
|
85
|
+
export function selectClientBuildBackend(name) {
|
|
86
|
+
const backend = clientBuildBackends.get(name);
|
|
87
|
+
if (!backend)
|
|
88
|
+
throw Error(`Unknown client build backend "${name}". Registered backends: ${listClientBuildBackends().join(", ")}`);
|
|
89
|
+
defaultClientBuildBackend = backend;
|
|
90
|
+
return backend;
|
|
91
|
+
}
|
|
92
|
+
export function resolveClientBuildBackendName(env = process.env) {
|
|
93
|
+
return env[GORSEE_BUILD_BACKEND_ENV]?.trim() || stableRolldownBackend.name;
|
|
94
|
+
}
|
|
95
|
+
export function configureClientBuildBackend(env = process.env) {
|
|
96
|
+
return selectClientBuildBackend(resolveClientBuildBackendName(env));
|
|
97
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ClientBuildBackend } from "./client-backend.js";
|
|
2
|
+
import type { Route } from "../router/scanner.js";
|
|
3
|
+
export interface BuildResult {
|
|
4
|
+
entryMap: Map<string, string>;
|
|
5
|
+
cssModules?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface BuildOptions {
|
|
8
|
+
minify?: boolean;
|
|
9
|
+
sourcemap?: boolean;
|
|
10
|
+
backend?: ClientBuildBackend;
|
|
11
|
+
}
|
|
12
|
+
export declare function buildClientBundles(routes: Route[], cwd: string, options?: BuildOptions): Promise<BuildResult>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { join, relative } from "node:path";
|
|
2
|
+
import { mkdir, rm } from "node:fs/promises";
|
|
3
|
+
import { serverStripPlugin } from "./server-strip.js";
|
|
4
|
+
import { cssModulesPlugin, getCollectedCSS, resetCollectedCSS } from "./css-modules.js";
|
|
5
|
+
import { getClientBuildBackend } from "./client-backend.js";
|
|
6
|
+
import { defineBuildPlugin } from "./plugin.js";
|
|
7
|
+
import { formatClientBuildLog, normalizeClientBuildLog, summarizeClientBuildFailure } from "./diagnostics.js";
|
|
8
|
+
import { resolveClientFrameworkImport } from "./framework-imports.js";
|
|
9
|
+
function routeToEntryName(route, cwd) {
|
|
10
|
+
return relative(join(cwd, "routes"), route.filePath).replace(/\.(tsx?|jsx?)$/, "").replace(/[\[\]]/g, "_");
|
|
11
|
+
}
|
|
12
|
+
function generateEntryCode(route) {
|
|
13
|
+
const layoutImports = route.layoutPaths.map((layoutPath, index) => `import Layout${index} from "gorsee:route:${layoutPath}";`).join(`
|
|
14
|
+
`), composeLayouts = route.layoutPaths.length > 0 ? `
|
|
15
|
+
function composeComponentTree(props) {
|
|
16
|
+
let tree = () => Component(props);
|
|
17
|
+
${route.layoutPaths.map((_, index) => index).reverse().map((index) => `if (typeof Layout${index} === "function") {
|
|
18
|
+
const inner = tree;
|
|
19
|
+
tree = () => Layout${index}({ ...props, data: undefined, children: inner });
|
|
20
|
+
}`).join(`
|
|
21
|
+
`)}
|
|
22
|
+
return tree();
|
|
23
|
+
}
|
|
24
|
+
` : `
|
|
25
|
+
function composeComponentTree(props) {
|
|
26
|
+
return Component(props);
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
return `
|
|
30
|
+
import Component from "gorsee:route:${route.filePath}";
|
|
31
|
+
${layoutImports}
|
|
32
|
+
import { hydrate, initRouter } from "gorsee/runtime";
|
|
33
|
+
${composeLayouts}
|
|
34
|
+
export default composeComponentTree;
|
|
35
|
+
|
|
36
|
+
if (!globalThis.__GORSEE_SUPPRESS_ENTRY_BOOTSTRAP__) {
|
|
37
|
+
globalThis.__GORSEE_ROUTE_SCRIPT__ = new URL(import.meta.url).pathname;
|
|
38
|
+
var container = document.getElementById("app");
|
|
39
|
+
var dataEl = document.getElementById("__GORSEE_DATA__");
|
|
40
|
+
var data = dataEl ? JSON.parse(dataEl.textContent) : {};
|
|
41
|
+
var params = window.__GORSEE_PARAMS__ || {};
|
|
42
|
+
hydrate(function() { return composeComponentTree({ data: data, params: params }); }, container);
|
|
43
|
+
initRouter();
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
export async function buildClientBundles(routes, cwd, options) {
|
|
48
|
+
const outDir = join(cwd, ".gorsee", "client");
|
|
49
|
+
await rm(outDir, { recursive: !0, force: !0 });
|
|
50
|
+
await mkdir(outDir, { recursive: !0 });
|
|
51
|
+
const entryDir = join(cwd, ".gorsee", "entries");
|
|
52
|
+
await rm(entryDir, { recursive: !0, force: !0 });
|
|
53
|
+
await mkdir(entryDir, { recursive: !0 });
|
|
54
|
+
const entryMap = new Map, pageRoutes = routes.filter((r) => !r.filePath.includes("/api/"));
|
|
55
|
+
if (pageRoutes.length === 0)
|
|
56
|
+
return { entryMap };
|
|
57
|
+
resetCollectedCSS();
|
|
58
|
+
const entrypoints = [], backend = options?.backend ?? getClientBuildBackend();
|
|
59
|
+
for (const route of pageRoutes) {
|
|
60
|
+
const name = routeToEntryName(route, cwd), entryPath = join(entryDir, `${name}.ts`), code = generateEntryCode(route);
|
|
61
|
+
await Bun.write(entryPath, code);
|
|
62
|
+
entrypoints.push(entryPath);
|
|
63
|
+
entryMap.set(route.path, `${name}.js`);
|
|
64
|
+
}
|
|
65
|
+
const result = await backend.build({
|
|
66
|
+
entrypoints,
|
|
67
|
+
outdir: outDir,
|
|
68
|
+
minify: options?.minify ?? !1,
|
|
69
|
+
sourcemap: options?.sourcemap ?? !1,
|
|
70
|
+
frameworkResolve: resolveClientFrameworkImport,
|
|
71
|
+
plugins: [
|
|
72
|
+
defineBuildPlugin({ name: serverStripPlugin.name, bun: serverStripPlugin }),
|
|
73
|
+
defineBuildPlugin({ name: cssModulesPlugin.name, bun: cssModulesPlugin })
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
if (!result.success) {
|
|
77
|
+
const diagnostics = (result.logs.length > 0 ? result.logs : [{
|
|
78
|
+
message: "backend reported unsuccessful result without diagnostics"
|
|
79
|
+
}]).map((log) => normalizeClientBuildLog(log, {
|
|
80
|
+
backend: backend.name,
|
|
81
|
+
phase: "bundle",
|
|
82
|
+
severity: "error",
|
|
83
|
+
code: "BUILD_BACKEND_FAILURE"
|
|
84
|
+
}));
|
|
85
|
+
for (const log of diagnostics)
|
|
86
|
+
console.error("[build]", formatClientBuildLog(log));
|
|
87
|
+
throw Error(summarizeClientBuildFailure(backend.name, diagnostics));
|
|
88
|
+
}
|
|
89
|
+
const cssModules = getCollectedCSS();
|
|
90
|
+
if (cssModules)
|
|
91
|
+
await Bun.write(join(outDir, "modules.css"), cssModules);
|
|
92
|
+
return { entryMap, cssModules };
|
|
93
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BunPlugin } from "bun";
|
|
2
|
+
export declare function transformCssModuleSource(filePath: string, source: string): {
|
|
3
|
+
css: string;
|
|
4
|
+
classMap: Record<string, string>;
|
|
5
|
+
};
|
|
6
|
+
export declare function getCollectedCSS(): string;
|
|
7
|
+
export declare function resetCollectedCSS(): void;
|
|
8
|
+
export declare function collectCssModule(css: string): void;
|
|
9
|
+
export declare function renderCssModuleExports(classMap: Record<string, string>): string;
|
|
10
|
+
export declare const cssModulesPlugin: BunPlugin;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { basename, join, dirname } from "node:path";
|
|
4
|
+
function hashClassName(filePath, className) {
|
|
5
|
+
const hash = createHash("md5").update(filePath + className).digest("hex").slice(0, 5);
|
|
6
|
+
return `${basename(filePath, ".module.css")}_${className}_${hash}`;
|
|
7
|
+
}
|
|
8
|
+
export function transformCssModuleSource(filePath, source) {
|
|
9
|
+
const classMap = {};
|
|
10
|
+
return { css: source.replace(/\.([a-zA-Z_][\w-]*)/g, (match, className) => {
|
|
11
|
+
if (match.startsWith("::") || match.startsWith(":."))
|
|
12
|
+
return match;
|
|
13
|
+
const scoped = hashClassName(filePath, className);
|
|
14
|
+
classMap[className] = scoped;
|
|
15
|
+
return `.${scoped}`;
|
|
16
|
+
}), classMap };
|
|
17
|
+
}
|
|
18
|
+
const collectedCSS = [];
|
|
19
|
+
export function getCollectedCSS() {
|
|
20
|
+
return collectedCSS.join(`
|
|
21
|
+
`);
|
|
22
|
+
}
|
|
23
|
+
export function resetCollectedCSS() {
|
|
24
|
+
collectedCSS.length = 0;
|
|
25
|
+
}
|
|
26
|
+
export function collectCssModule(css) {
|
|
27
|
+
collectedCSS.push(css);
|
|
28
|
+
}
|
|
29
|
+
export function renderCssModuleExports(classMap) {
|
|
30
|
+
return `export default {
|
|
31
|
+
${Object.entries(classMap).map(([k, v]) => ` "${k}": "${v}"`).join(`,
|
|
32
|
+
`)}
|
|
33
|
+
};`;
|
|
34
|
+
}
|
|
35
|
+
export const cssModulesPlugin = {
|
|
36
|
+
name: "gorsee-css-modules",
|
|
37
|
+
setup(build) {
|
|
38
|
+
build.onResolve({ filter: /\.module\.css$/ }, (args) => ({
|
|
39
|
+
path: join(dirname(args.importer), args.path),
|
|
40
|
+
namespace: "css-module"
|
|
41
|
+
}));
|
|
42
|
+
build.onLoad({ filter: /.*/, namespace: "css-module" }, async (args) => {
|
|
43
|
+
const source = await readFile(args.path, "utf-8"), { css, classMap } = transformCssModuleSource(args.path, source);
|
|
44
|
+
collectCssModule(css);
|
|
45
|
+
return {
|
|
46
|
+
contents: renderCssModuleExports(classMap),
|
|
47
|
+
loader: "js"
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parse } from "devalue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parse } from "devalue";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ClientBuildDiagnosticSeverity = "info" | "warn" | "error";
|
|
2
|
+
export type ClientBuildDiagnosticPhase = "resolve" | "load" | "transform" | "bundle" | "emit";
|
|
3
|
+
export interface ClientBuildLog {
|
|
4
|
+
message: string;
|
|
5
|
+
backend?: string;
|
|
6
|
+
phase?: ClientBuildDiagnosticPhase;
|
|
7
|
+
severity?: ClientBuildDiagnosticSeverity;
|
|
8
|
+
code?: string;
|
|
9
|
+
file?: string;
|
|
10
|
+
plugin?: string;
|
|
11
|
+
detail?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function normalizeClientBuildLog(log: ClientBuildLog, defaults: {
|
|
14
|
+
backend: string;
|
|
15
|
+
phase?: ClientBuildDiagnosticPhase;
|
|
16
|
+
severity?: ClientBuildDiagnosticSeverity;
|
|
17
|
+
code?: string;
|
|
18
|
+
}): ClientBuildLog;
|
|
19
|
+
export declare function formatClientBuildLog(log: ClientBuildLog): string;
|
|
20
|
+
export declare function summarizeClientBuildFailure(backend: string, logs: ClientBuildLog[]): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function normalizeClientBuildLog(log, defaults) {
|
|
2
|
+
return {
|
|
3
|
+
...log,
|
|
4
|
+
backend: log.backend ?? defaults.backend,
|
|
5
|
+
phase: log.phase ?? defaults.phase ?? "bundle",
|
|
6
|
+
severity: log.severity ?? defaults.severity ?? "error",
|
|
7
|
+
code: log.code ?? defaults.code ?? "BUILD_BACKEND_FAILURE"
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function formatClientBuildLog(log) {
|
|
11
|
+
const parts = [
|
|
12
|
+
`backend=${log.backend ?? "unknown"}`,
|
|
13
|
+
`phase=${log.phase ?? "bundle"}`,
|
|
14
|
+
`severity=${log.severity ?? "error"}`
|
|
15
|
+
];
|
|
16
|
+
if (log.code)
|
|
17
|
+
parts.push(`code=${log.code}`);
|
|
18
|
+
if (log.file)
|
|
19
|
+
parts.push(`file=${log.file}`);
|
|
20
|
+
if (log.plugin)
|
|
21
|
+
parts.push(`plugin=${log.plugin}`);
|
|
22
|
+
let line = `[${parts.join(" ")}] ${log.message}`;
|
|
23
|
+
if (log.detail)
|
|
24
|
+
line += ` | ${log.detail}`;
|
|
25
|
+
return line;
|
|
26
|
+
}
|
|
27
|
+
export function summarizeClientBuildFailure(backend, logs) {
|
|
28
|
+
const primary = logs[0];
|
|
29
|
+
if (!primary)
|
|
30
|
+
return `Client build failed in backend "${backend}" without diagnostics`;
|
|
31
|
+
const formatted = formatClientBuildLog(primary);
|
|
32
|
+
if (logs.length === 1)
|
|
33
|
+
return `Client build failed: ${formatted}`;
|
|
34
|
+
return `Client build failed: ${formatted} (${logs.length - 1} more diagnostic(s))`;
|
|
35
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClientBuildBackendOptions } from "./client-backend.js";
|
|
2
|
+
export interface ClientBuildParityFixture {
|
|
3
|
+
name: string;
|
|
4
|
+
options: ClientBuildBackendOptions;
|
|
5
|
+
}
|
|
6
|
+
export declare function createClientBuildFixtures(rootDir?: string): ClientBuildParityFixture[];
|
|
7
|
+
export declare const CLIENT_BUILD_FIXTURES: ClientBuildParityFixture[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export function createClientBuildFixtures(rootDir = ".tmp-build-backend-parity") {
|
|
2
|
+
return [
|
|
3
|
+
{
|
|
4
|
+
name: "plain-entry",
|
|
5
|
+
options: {
|
|
6
|
+
entrypoints: [`${rootDir}/plain-entry.ts`],
|
|
7
|
+
outdir: `${rootDir}/dist-plain`,
|
|
8
|
+
minify: !1,
|
|
9
|
+
sourcemap: !1,
|
|
10
|
+
frameworkResolve() {
|
|
11
|
+
return;
|
|
12
|
+
},
|
|
13
|
+
plugins: []
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "minified-entry",
|
|
18
|
+
options: {
|
|
19
|
+
entrypoints: [`${rootDir}/minified-entry.ts`],
|
|
20
|
+
outdir: `${rootDir}/dist-minified`,
|
|
21
|
+
minify: !0,
|
|
22
|
+
sourcemap: !1,
|
|
23
|
+
frameworkResolve() {
|
|
24
|
+
return;
|
|
25
|
+
},
|
|
26
|
+
plugins: []
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "multi-entry",
|
|
31
|
+
options: {
|
|
32
|
+
entrypoints: [
|
|
33
|
+
`${rootDir}/multi-a.ts`,
|
|
34
|
+
`${rootDir}/multi-b.ts`
|
|
35
|
+
],
|
|
36
|
+
outdir: `${rootDir}/dist-multi`,
|
|
37
|
+
minify: !1,
|
|
38
|
+
sourcemap: !1,
|
|
39
|
+
frameworkResolve() {
|
|
40
|
+
return;
|
|
41
|
+
},
|
|
42
|
+
plugins: []
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "sourcemap-entry",
|
|
47
|
+
options: {
|
|
48
|
+
entrypoints: [`${rootDir}/sourcemap-entry.ts`],
|
|
49
|
+
outdir: `${rootDir}/dist-sourcemap`,
|
|
50
|
+
minify: !1,
|
|
51
|
+
sourcemap: !0,
|
|
52
|
+
frameworkResolve() {
|
|
53
|
+
return;
|
|
54
|
+
},
|
|
55
|
+
plugins: []
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
export const CLIENT_BUILD_FIXTURES = createClientBuildFixtures();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const FRAMEWORK_IMPORT_MAP: Record<string, string>;
|
|
2
|
+
export declare const CLIENT_FRAMEWORK_IMPORT_MAP: Record<string, string>;
|
|
3
|
+
export declare function resolveFrameworkImport(specifier: string): string | undefined;
|
|
4
|
+
export declare function resolveClientFrameworkImport(specifier: string): string | undefined;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
const FRAMEWORK_ROOT = resolve(import.meta.dir, "..");
|
|
4
|
+
function resolveFrameworkModule(stem) {
|
|
5
|
+
const tsPath = resolve(FRAMEWORK_ROOT, `${stem}.ts`);
|
|
6
|
+
if (existsSync(tsPath))
|
|
7
|
+
return tsPath;
|
|
8
|
+
const jsPath = resolve(FRAMEWORK_ROOT, `${stem}.js`);
|
|
9
|
+
if (existsSync(jsPath))
|
|
10
|
+
return jsPath;
|
|
11
|
+
return tsPath;
|
|
12
|
+
}
|
|
13
|
+
const CLIENT_JSX_RUNTIME = resolveFrameworkModule("jsx-runtime-client"), SERVER_JSX_RUNTIME = resolveFrameworkModule("jsx-runtime");
|
|
14
|
+
export const FRAMEWORK_IMPORT_MAP = {
|
|
15
|
+
gorsee: resolveFrameworkModule("index"),
|
|
16
|
+
"gorsee/compat": resolveFrameworkModule("compat"),
|
|
17
|
+
"gorsee/client": resolveFrameworkModule("client"),
|
|
18
|
+
"gorsee/reactive": resolveFrameworkModule("reactive/index"),
|
|
19
|
+
"gorsee/server": resolveFrameworkModule("server-entry"),
|
|
20
|
+
"gorsee/types": resolveFrameworkModule("types/index"),
|
|
21
|
+
"gorsee/db": resolveFrameworkModule("db/index"),
|
|
22
|
+
"gorsee/router": resolveFrameworkModule("router/index"),
|
|
23
|
+
"gorsee/log": resolveFrameworkModule("log/index"),
|
|
24
|
+
"gorsee/unsafe": resolveFrameworkModule("unsafe/index"),
|
|
25
|
+
"gorsee/runtime": resolveFrameworkModule("runtime/index"),
|
|
26
|
+
"gorsee/security": resolveFrameworkModule("security/index"),
|
|
27
|
+
"gorsee/ai": resolveFrameworkModule("ai/index"),
|
|
28
|
+
"gorsee/jsx-runtime": SERVER_JSX_RUNTIME,
|
|
29
|
+
"gorsee/jsx-dev-runtime": SERVER_JSX_RUNTIME,
|
|
30
|
+
"gorsee/testing": resolveFrameworkModule("testing/index"),
|
|
31
|
+
"gorsee/i18n": resolveFrameworkModule("i18n/index"),
|
|
32
|
+
"gorsee/content": resolveFrameworkModule("content/index"),
|
|
33
|
+
"gorsee/env": resolveFrameworkModule("env/index"),
|
|
34
|
+
"gorsee/auth": resolveFrameworkModule("auth/index"),
|
|
35
|
+
"gorsee/forms": resolveFrameworkModule("forms/index"),
|
|
36
|
+
"gorsee/routes": resolveFrameworkModule("routes/index"),
|
|
37
|
+
"gorsee/cli/cmd-create": resolveFrameworkModule("cli/cmd-create"),
|
|
38
|
+
"gorsee/plugins": resolveFrameworkModule("plugins/index"),
|
|
39
|
+
"gorsee/plugins/drizzle": resolveFrameworkModule("plugins/drizzle"),
|
|
40
|
+
"gorsee/plugins/prisma": resolveFrameworkModule("plugins/prisma"),
|
|
41
|
+
"gorsee/plugins/tailwind": resolveFrameworkModule("plugins/tailwind"),
|
|
42
|
+
"gorsee/plugins/lucia": resolveFrameworkModule("plugins/lucia"),
|
|
43
|
+
"gorsee/plugins/s3": resolveFrameworkModule("plugins/s3"),
|
|
44
|
+
"gorsee/plugins/resend": resolveFrameworkModule("plugins/resend"),
|
|
45
|
+
"gorsee/plugins/stripe": resolveFrameworkModule("plugins/stripe"),
|
|
46
|
+
"gorsee/deploy": resolveFrameworkModule("deploy/index")
|
|
47
|
+
}, CLIENT_FRAMEWORK_IMPORT_MAP = {
|
|
48
|
+
...FRAMEWORK_IMPORT_MAP,
|
|
49
|
+
gorsee: resolveFrameworkModule("index-client"),
|
|
50
|
+
"gorsee/jsx-runtime": CLIENT_JSX_RUNTIME,
|
|
51
|
+
"gorsee/jsx-dev-runtime": CLIENT_JSX_RUNTIME
|
|
52
|
+
};
|
|
53
|
+
export function resolveFrameworkImport(specifier) {
|
|
54
|
+
return FRAMEWORK_IMPORT_MAP[specifier];
|
|
55
|
+
}
|
|
56
|
+
export function resolveClientFrameworkImport(specifier) {
|
|
57
|
+
return CLIENT_FRAMEWORK_IMPORT_MAP[specifier];
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initializeBuildBackends(env?: NodeJS.ProcessEnv): import("./client-backend.js").ClientBuildBackend;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { registerBuiltInBuildBackends } from "./backends/register.js";
|
|
2
|
+
import { configureClientBuildBackend } from "./client-backend.js";
|
|
3
|
+
export function initializeBuildBackends(env = process.env) {
|
|
4
|
+
registerBuiltInBuildBackends({ includeExperimentalRolldown: !0, includeRolldown: !0 });
|
|
5
|
+
return configureClientBuildBackend(env);
|
|
6
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Route } from "../router/scanner.js";
|
|
2
|
+
import { type BuildManifest } from "../server/manifest.js";
|
|
3
|
+
export declare function createBuildManifest(routes: Route[], entryMap: Map<string, string>, hashMap: Map<string, string>, prerenderedPaths?: Iterable<string>): Promise<BuildManifest>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { inspectRouteBuildMetadata } from "./route-metadata.js";
|
|
2
|
+
import { BUILD_MANIFEST_SCHEMA_VERSION } from "../server/manifest.js";
|
|
3
|
+
export async function createBuildManifest(routes, entryMap, hashMap, prerenderedPaths = []) {
|
|
4
|
+
const prerendered = new Set(prerenderedPaths), manifest = {
|
|
5
|
+
schemaVersion: BUILD_MANIFEST_SCHEMA_VERSION,
|
|
6
|
+
routes: {},
|
|
7
|
+
chunks: [],
|
|
8
|
+
prerendered: [...prerendered],
|
|
9
|
+
buildTime: new Date().toISOString()
|
|
10
|
+
};
|
|
11
|
+
for (const route of routes) {
|
|
12
|
+
const metadata = await inspectRouteBuildMetadata(route), jsRel = entryMap.get(route.path);
|
|
13
|
+
manifest.routes[route.path] = {
|
|
14
|
+
js: jsRel ? hashMap.get(jsRel) : void 0,
|
|
15
|
+
hasLoader: metadata.hasLoader,
|
|
16
|
+
prerendered: prerendered.has(route.path) || void 0
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
for (const hashed of hashMap.values())
|
|
20
|
+
if (hashed.includes("chunk-"))
|
|
21
|
+
manifest.chunks.push(hashed);
|
|
22
|
+
return manifest;
|
|
23
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ClientBuildBackend, ClientBuildBackendOptions, ClientBuildBackendResult } from "./client-backend.js";
|
|
2
|
+
export interface ClientBuildOutputSurface {
|
|
3
|
+
files: string[];
|
|
4
|
+
jsFiles: string[];
|
|
5
|
+
sourcemaps: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface ClientBuildBackendParityReport {
|
|
8
|
+
leftBackend: string;
|
|
9
|
+
rightBackend: string;
|
|
10
|
+
matches: boolean;
|
|
11
|
+
outputMatches: boolean;
|
|
12
|
+
left: Pick<ClientBuildBackendResult, "success" | "logs">;
|
|
13
|
+
right: Pick<ClientBuildBackendResult, "success" | "logs">;
|
|
14
|
+
leftOutput: ClientBuildOutputSurface;
|
|
15
|
+
rightOutput: ClientBuildOutputSurface;
|
|
16
|
+
}
|
|
17
|
+
export declare function compareClientBuildBackends(leftBackend: ClientBuildBackend, rightBackend: ClientBuildBackend, options: ClientBuildBackendOptions): Promise<ClientBuildBackendParityReport>;
|
|
18
|
+
export interface BuildArtifactRouteSurface {
|
|
19
|
+
path: string;
|
|
20
|
+
hasLoader: boolean;
|
|
21
|
+
prerendered: boolean;
|
|
22
|
+
hasClientBundle: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface BuildArtifactSurface {
|
|
25
|
+
routes: BuildArtifactRouteSurface[];
|
|
26
|
+
prerendered: string[];
|
|
27
|
+
chunkCount: number;
|
|
28
|
+
cssArtifacts: string[];
|
|
29
|
+
staticPages: string[];
|
|
30
|
+
serverEntries: string[];
|
|
31
|
+
}
|
|
32
|
+
export declare function readBuildArtifactSurface(distDir: string): Promise<BuildArtifactSurface>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { readdir, rm } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, join, relative } from "node:path";
|
|
3
|
+
import { loadBuildManifest } from "../server/manifest.js";
|
|
4
|
+
export async function compareClientBuildBackends(leftBackend, rightBackend, options) {
|
|
5
|
+
const leftOptions = createBackendParityOptions(options, leftBackend.name), rightOptions = createBackendParityOptions(options, rightBackend.name);
|
|
6
|
+
await Promise.all([
|
|
7
|
+
rm(leftOptions.outdir, { recursive: !0, force: !0 }),
|
|
8
|
+
rm(rightOptions.outdir, { recursive: !0, force: !0 })
|
|
9
|
+
]);
|
|
10
|
+
const left = await leftBackend.build(leftOptions), right = await rightBackend.build(rightOptions), leftShape = { success: left.success, logs: left.logs }, rightShape = { success: right.success, logs: right.logs }, leftOutput = await readClientBuildOutputSurface(leftOptions.outdir), rightOutput = await readClientBuildOutputSurface(rightOptions.outdir), outputMatches = JSON.stringify(leftOutput) === JSON.stringify(rightOutput);
|
|
11
|
+
return {
|
|
12
|
+
leftBackend: leftBackend.name,
|
|
13
|
+
rightBackend: rightBackend.name,
|
|
14
|
+
matches: JSON.stringify(leftShape) === JSON.stringify(rightShape) && outputMatches,
|
|
15
|
+
outputMatches,
|
|
16
|
+
left: leftShape,
|
|
17
|
+
right: rightShape,
|
|
18
|
+
leftOutput,
|
|
19
|
+
rightOutput
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export async function readBuildArtifactSurface(distDir) {
|
|
23
|
+
const manifest = await loadBuildManifest(distDir), staticDir = join(distDir, "static"), clientDir = join(distDir, "client"), staticFiles = await listFiles(staticDir, staticDir), clientFiles = await listFiles(clientDir, clientDir), distFiles = await listFiles(distDir, distDir);
|
|
24
|
+
return {
|
|
25
|
+
routes: normalizeManifestRoutes(manifest),
|
|
26
|
+
prerendered: [...manifest.prerendered].sort(),
|
|
27
|
+
chunkCount: manifest.chunks.length,
|
|
28
|
+
cssArtifacts: clientFiles.filter((file) => file.endsWith(".css")).sort(),
|
|
29
|
+
staticPages: staticFiles.filter((file) => file.endsWith(".html")).sort(),
|
|
30
|
+
serverEntries: distFiles.filter((file) => file === "prod.js" || file === "prod-node.js" || file === "server-handler.js" || file === "server-handler-node.js" || file === "worker.js").sort()
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function normalizeManifestRoutes(manifest) {
|
|
34
|
+
return Object.entries(manifest.routes).map(([path, route]) => ({
|
|
35
|
+
path,
|
|
36
|
+
hasLoader: route.hasLoader,
|
|
37
|
+
prerendered: route.prerendered === !0,
|
|
38
|
+
hasClientBundle: typeof route.js === "string" && route.js.length > 0
|
|
39
|
+
})).sort((left, right) => left.path.localeCompare(right.path));
|
|
40
|
+
}
|
|
41
|
+
async function listFiles(root, baseDir) {
|
|
42
|
+
try {
|
|
43
|
+
const entries = await readdir(root, { withFileTypes: !0 }), files = [];
|
|
44
|
+
for (const entry of entries) {
|
|
45
|
+
const full = join(root, entry.name);
|
|
46
|
+
if (entry.isDirectory()) {
|
|
47
|
+
files.push(...await listFiles(full, baseDir));
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
files.push(relative(baseDir, full));
|
|
51
|
+
}
|
|
52
|
+
return files;
|
|
53
|
+
} catch {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function createBackendParityOptions(options, backendName) {
|
|
58
|
+
const outdirBase = basename(options.outdir), outdirParent = dirname(options.outdir);
|
|
59
|
+
return {
|
|
60
|
+
...options,
|
|
61
|
+
outdir: join(outdirParent, `${outdirBase}-${backendName}`)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async function readClientBuildOutputSurface(outdir) {
|
|
65
|
+
const files = (await listFiles(outdir, outdir)).sort();
|
|
66
|
+
return {
|
|
67
|
+
files,
|
|
68
|
+
jsFiles: files.filter((file) => file.endsWith(".js")),
|
|
69
|
+
sourcemaps: files.filter((file) => file.endsWith(".map"))
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BunPlugin } from "bun";
|
|
2
|
+
import type { Plugin as RolldownPlugin } from "rolldown";
|
|
3
|
+
export type BuildRuntimeTarget = "bun" | "rolldown";
|
|
4
|
+
export interface FrameworkBuildPlugin {
|
|
5
|
+
name: string;
|
|
6
|
+
bun?: BunPlugin;
|
|
7
|
+
rolldown?: RolldownPlugin;
|
|
8
|
+
}
|
|
9
|
+
export declare function defineBuildPlugin(plugin: FrameworkBuildPlugin): FrameworkBuildPlugin;
|
|
10
|
+
export declare function resolveBuildPluginsForTarget(plugins: FrameworkBuildPlugin[], target: "bun"): BunPlugin[];
|
|
11
|
+
export declare function resolveBuildPluginsForTarget(plugins: FrameworkBuildPlugin[], target: "rolldown"): RolldownPlugin[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function defineBuildPlugin(plugin) {
|
|
2
|
+
return plugin;
|
|
3
|
+
}
|
|
4
|
+
export function resolveBuildPluginsForTarget(plugins, target) {
|
|
5
|
+
if (target === "bun")
|
|
6
|
+
return plugins.map((plugin) => plugin.bun).filter((plugin) => Boolean(plugin));
|
|
7
|
+
return plugins.map((plugin) => plugin.rolldown).filter((plugin) => Boolean(plugin));
|
|
8
|
+
}
|