@kayjs/kay 1.104.3 → 1.106.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eslint.js +6409 -3392
- package/editors/vscode/syntaxes/kay.tmLanguage.json +1 -1
- package/editors/zed/extension.toml +2 -2
- package/llms/action-protection.md +11 -11
- package/llms/actions-from-islands.md +28 -31
- package/llms/actions-refused-fields.md +18 -4
- package/llms/actions.md +57 -45
- package/llms/analytics.md +2 -2
- package/llms/api-from-islands.md +15 -16
- package/llms/api-routes.md +16 -14
- package/llms/browser-only.md +12 -10
- package/llms/cdn-caching.md +7 -6
- package/llms/check-and-tools.md +6 -6
- package/llms/checks.md +1 -1
- package/llms/code-lints.md +8 -8
- package/llms/commands.md +42 -0
- package/llms/compiler-api.md +1 -1
- package/llms/component-libraries.md +2 -1
- package/llms/component-library-conventions.md +11 -5
- package/llms/components.md +14 -14
- package/llms/content-cms.md +1 -1
- package/llms/content-markdown-to-caching.md +3 -3
- package/llms/content-preview.md +2 -2
- package/llms/content.md +21 -21
- package/llms/deprecated-lints-1-105-libraries.md +32 -0
- package/llms/deprecated-lints-1-105.md +58 -0
- package/llms/deprecated-lints.md +8 -5
- package/llms/dev-tool.md +3 -3
- package/llms/eco-design.md +3 -3
- package/llms/editor-and-agent-commands.md +1 -1
- package/llms/effects.md +7 -7
- package/llms/environment.md +27 -26
- package/llms/errors-runtime.md +4 -4
- package/llms/errors.md +12 -8
- package/llms/events.md +15 -12
- package/llms/files.md +11 -9
- package/llms/guards.md +18 -15
- package/llms/head.md +38 -6
- package/llms/hooks.md +27 -25
- package/llms/images-runtime-and-remote.md +12 -12
- package/llms/images.md +29 -29
- package/llms/island-and-form-lints.md +8 -8
- package/llms/island-sources.md +31 -24
- package/llms/islands-state-to-ids.md +10 -11
- package/llms/islands.md +16 -14
- package/llms/lints.md +1 -1
- package/llms/live-values.md +12 -9
- package/llms/local-collections.md +13 -13
- package/llms/locales-texts.md +1 -1
- package/llms/locales.md +12 -11
- package/llms/mcp.md +10 -9
- package/llms/metrics.md +24 -0
- package/llms/navigation-from-code.md +16 -15
- package/llms/navigation.md +5 -3
- package/llms/notifications.md +4 -2
- package/llms/prerendering.md +4 -4
- package/llms/privacy.md +4 -4
- package/llms/production.md +28 -38
- package/llms/project-new-and-add.md +2 -2
- package/llms/project.md +17 -40
- package/llms/proxy-and-security.md +5 -5
- package/llms/queues.md +19 -24
- package/llms/rate-limits.md +22 -11
- package/llms/recipes.md +23 -22
- package/llms/rendering.md +8 -7
- package/llms/request-values.md +2 -2
- package/llms/rooms.md +13 -13
- package/llms/routing-endpoints-and-base.md +4 -4
- package/llms/routing-special-pages.md +4 -4
- package/llms/routing.md +21 -23
- package/llms/schemas.md +10 -5
- package/llms/security-and-i18n-lints.md +1 -1
- package/llms/seo-lints.md +1 -1
- package/llms/server-islands.md +12 -7
- package/llms/server.md +40 -25
- package/llms/site.md +21 -19
- package/llms/sitemap-search-fonts.md +52 -44
- package/llms/stores.md +7 -5
- package/llms/styles-and-assets.md +10 -9
- package/llms/templates-elements-slots-snippets.md +6 -10
- package/llms/templates.md +4 -4
- package/llms/testing-browser.md +21 -0
- package/llms/testing-requests-jobs-sockets.md +27 -4
- package/llms/testing.md +8 -8
- package/llms/tracing.md +9 -7
- package/llms/upgrading-1-105-config.md +71 -0
- package/llms/upgrading-archive.md +74 -114
- package/llms/upgrading.md +49 -124
- package/llms/whats-new-archive.md +37 -66
- package/llms/whats-new.md +38 -54
- package/llms/workers.md +2 -2
- package/llms.txt +18 -13
- package/package.json +18 -14
- package/src/add.ts +2 -2
- package/src/build/await-alert.ts +34 -0
- package/src/build/class-table.ts +2 -2
- package/src/build/client.ts +20 -17
- package/src/build/compile.ts +9 -6
- package/src/build/pipeline.ts +19 -16
- package/src/build/plugin.ts +14 -11
- package/src/build/server-record.ts +2 -1
- package/src/build/sourcemap.ts +1 -1
- package/src/build/static.ts +10 -8
- package/src/build/styles.ts +10 -4
- package/src/build/transform.ts +5 -2
- package/src/build/ui-layers.ts +30 -0
- package/src/build/ui.ts +108 -11
- package/src/build/variants.ts +119 -43
- package/src/build/verify.ts +8 -5
- package/src/build/worker-bundle.ts +6 -0
- package/src/check/action-readers.ts +115 -0
- package/src/check/action-type.ts +44 -0
- package/src/check/ai-language.ts +56 -0
- package/src/check/app-hooks.ts +90 -0
- package/src/check/auth-methods.ts +85 -0
- package/src/check/auth-rate-limits.ts +99 -0
- package/src/check/boot.ts +31 -9
- package/src/check/browser-global-reads.ts +4 -4
- package/src/check/call-result.ts +242 -0
- package/src/check/client-keys.ts +10 -0
- package/src/check/cms-options.ts +81 -0
- package/src/check/config-groups.ts +22 -0
- package/src/check/config-objects.ts +98 -0
- package/src/check/config-switches.ts +38 -0
- package/src/check/context-import.ts +51 -0
- package/src/check/diagnose.ts +38 -6
- package/src/check/env-files.ts +31 -0
- package/src/check/env-types.ts +10 -8
- package/src/check/format-duration.ts +75 -0
- package/src/check/generated.ts +23 -4
- package/src/check/guard-options.ts +58 -0
- package/src/check/guards.ts +4 -4
- package/src/check/handler-events.ts +149 -0
- package/src/check/hook-context.ts +94 -0
- package/src/check/hook-names.ts +104 -0
- package/src/check/i18n-keys.ts +50 -0
- package/src/check/images-keys.ts +54 -0
- package/src/check/index.ts +43 -23
- package/src/check/job-shapes.ts +273 -0
- package/src/check/layout-facts.ts +1 -1
- package/src/check/link-flag-tests.ts +130 -0
- package/src/check/live-api.ts +137 -0
- package/src/check/mail-api.ts +67 -0
- package/src/check/messages.ts +7 -7
- package/src/check/moved-keys.ts +49 -0
- package/src/check/one-state-api.ts +357 -0
- package/src/check/open-settings.ts +1 -1
- package/src/check/output-schema.ts +3 -1
- package/src/check/page-heads.ts +31 -5
- package/src/check/pages-options.ts +35 -0
- package/src/check/project.ts +9 -4
- package/src/check/rate-enforce.ts +53 -0
- package/src/check/refusal-calls.ts +185 -0
- package/src/check/regroup.ts +94 -0
- package/src/check/renamed-packages.ts +82 -6
- package/src/check/retired-lints.ts +49 -0
- package/src/check/route-keys.ts +166 -0
- package/src/check/route-shadow.ts +174 -0
- package/src/check/schema-builders.ts +256 -0
- package/src/check/secret-keys.ts +83 -0
- package/src/check/seo.ts +3 -3
- package/src/check/shadow-types.ts +112 -4
- package/src/check/shadow.ts +4 -1
- package/src/check/socket-frames.ts +102 -0
- package/src/check/source-readers.ts +257 -0
- package/src/check/store-ms.ts +72 -0
- package/src/check/store-names.ts +88 -0
- package/src/check/template-hints.ts +71 -7
- package/src/check/test-helpers.ts +98 -0
- package/src/check/tool-labels.ts +11 -9
- package/src/check/ttl-names.ts +142 -0
- package/src/check/ui-types.ts +4 -3
- package/src/check/ui.ts +14 -11
- package/src/check/unmounted-jobs.ts +2 -2
- package/src/commands/a11y.ts +1 -1
- package/src/commands/check.ts +4 -2
- package/src/commands/env-compare.ts +2 -2
- package/src/commands/env-declare.ts +18 -6
- package/src/commands/env.ts +19 -16
- package/src/commands/explain-island.ts +27 -1
- package/src/commands/i18n.ts +2 -2
- package/src/commands/routes.ts +24 -18
- package/src/compiler/a11y.ts +64 -42
- package/src/compiler/aria.ts +1 -1
- package/src/compiler/ast.ts +55 -137
- package/src/compiler/bound-props.ts +75 -0
- package/src/compiler/browser.ts +12 -11
- package/src/compiler/button-forms.ts +33 -0
- package/src/compiler/codegen.ts +55 -141
- package/src/compiler/deprecated-ai-labels.ts +97 -0
- package/src/compiler/deprecated-ai-links.ts +63 -0
- package/src/compiler/deprecated-allow.ts +50 -0
- package/src/compiler/deprecated-auth-lints.ts +14 -0
- package/src/compiler/deprecated-auth-signed.ts +29 -0
- package/src/compiler/deprecated-children.ts +66 -0
- package/src/compiler/deprecated-image.ts +116 -0
- package/src/compiler/deprecated-island.ts +155 -0
- package/src/compiler/deprecated-library.ts +20 -0
- package/src/compiler/deprecated-lints-1-106.ts +14 -0
- package/src/compiler/deprecated-lints.ts +528 -22
- package/src/compiler/deprecated-page.ts +125 -0
- package/src/compiler/deprecated-parts.ts +22 -0
- package/src/compiler/deprecated-typed-lints.ts +23 -0
- package/src/compiler/deprecated-ui-callbacks.ts +66 -0
- package/src/compiler/deprecated-ui-input.ts +97 -0
- package/src/compiler/deprecated-ui-items.ts +47 -0
- package/src/compiler/deprecated-ui-props.ts +3 -3
- package/src/compiler/dom-fields.ts +67 -0
- package/src/compiler/dom-here.ts +72 -0
- package/src/compiler/dom.ts +43 -41
- package/src/compiler/errors.ts +37 -27
- package/src/compiler/event-modifiers.ts +2 -2
- package/src/compiler/fence-checks.ts +41 -80
- package/src/compiler/field-described.ts +2 -2
- package/src/compiler/form-action.ts +18 -0
- package/src/compiler/form-info.ts +154 -0
- package/src/compiler/head-shorthand.ts +118 -0
- package/src/compiler/head-tags.ts +64 -0
- package/src/compiler/helper-imports.ts +33 -0
- package/src/compiler/html-fields.ts +92 -0
- package/src/compiler/html-initial.ts +70 -0
- package/src/compiler/html-parts.ts +40 -0
- package/src/compiler/html.ts +53 -120
- package/src/compiler/if-alias.ts +2 -47
- package/src/compiler/image-attributes.ts +69 -0
- package/src/compiler/index.ts +35 -9
- package/src/compiler/island-arguments.ts +38 -10
- package/src/compiler/island-cause.ts +5 -5
- package/src/compiler/island-declaration.ts +181 -0
- package/src/compiler/island-marker.ts +10 -15
- package/src/compiler/items.ts +7 -2
- package/src/compiler/jsx-class.ts +25 -1
- package/src/compiler/jsx-field.ts +58 -0
- package/src/compiler/jsx.ts +24 -29
- package/src/compiler/kay-exports.ts +2 -0
- package/src/compiler/link-flags.ts +107 -0
- package/src/compiler/lints.ts +39 -72
- package/src/compiler/live-reads.ts +160 -0
- package/src/compiler/loop-lints.ts +6 -5
- package/src/compiler/markup-fields.ts +34 -0
- package/src/compiler/markup.ts +75 -77
- package/src/compiler/module-signals.ts +1 -1
- package/src/compiler/names.ts +7 -1
- package/src/compiler/nesting.ts +7 -0
- package/src/compiler/old-parts.ts +84 -0
- package/src/compiler/page-settings.ts +2 -0
- package/src/compiler/parser.ts +7 -8
- package/src/compiler/plan.ts +13 -1
- package/src/compiler/rest-omits.ts +15 -0
- package/src/compiler/rewrite-reads.ts +29 -0
- package/src/compiler/rewrite-types.ts +2 -0
- package/src/compiler/rewrite.ts +35 -33
- package/src/compiler/route-lints.ts +4 -2
- package/src/compiler/script-props.ts +34 -5
- package/src/compiler/script-server.ts +26 -3
- package/src/compiler/script-shared.ts +7 -0
- package/src/compiler/script.ts +7 -0
- package/src/compiler/server-imports.ts +52 -0
- package/src/compiler/slot-types.ts +46 -0
- package/src/compiler/style-arguments.ts +20 -0
- package/src/compiler/template-walk.ts +72 -0
- package/src/compiler/type-parameters.ts +45 -0
- package/src/compiler/validate-fields.ts +68 -0
- package/src/compiler/validate.ts +51 -45
- package/src/config-extensions.ts +53 -6
- package/src/config-loader.ts +40 -17
- package/src/config-resolve.ts +196 -0
- package/src/config-shape.ts +82 -39
- package/src/config-switch.ts +14 -0
- package/src/config.ts +305 -104
- package/src/content/markdown.ts +2 -3
- package/src/content/problems.ts +1 -1
- package/src/generate-resource.ts +14 -13
- package/src/generate.ts +3 -3
- package/src/lsp/code-actions.ts +1 -1
- package/src/lsp/completions.ts +2 -2
- package/src/lsp/diagnostics.ts +4 -2
- package/src/lsp/document-links.ts +1 -1
- package/src/lsp/navigation.ts +1 -1
- package/src/lsp/route-documents.ts +21 -0
- package/src/lsp/server.ts +60 -8
- package/src/lsp/template-completion.ts +4 -4
- package/src/lsp/ui-completion.ts +1 -1
- package/src/mcp/guards.ts +1 -1
- package/src/mcp/tools.ts +1 -1
- package/src/migrate/astro.ts +1 -1
- package/src/migrate/content.ts +61 -55
- package/src/migrate/project.ts +1 -1
- package/src/project.ts +20 -11
- package/src/runtime/action-call.ts +179 -41
- package/src/runtime/action-encode.ts +2 -1
- package/src/runtime/action-error.ts +2 -1
- package/src/runtime/action-form.ts +159 -17
- package/src/runtime/action-navigate.ts +19 -0
- package/src/runtime/action-owner.ts +2 -0
- package/src/runtime/action-post.ts +22 -4
- package/src/runtime/action-protection.ts +4 -3
- package/src/runtime/action-shared.ts +86 -28
- package/src/runtime/action-stream.ts +43 -9
- package/src/runtime/action.ts +14 -9
- package/src/runtime/api-error-class.ts +1 -1
- package/src/runtime/api-url.ts +5 -4
- package/src/runtime/await-failed.ts +9 -0
- package/src/runtime/await.server.ts +14 -4
- package/src/runtime/await.ts +3 -3
- package/src/runtime/button-form.ts +5 -0
- package/src/runtime/cache-hooks.ts +54 -0
- package/src/runtime/cache-live-id.ts +3 -0
- package/src/runtime/cache.ts +12 -36
- package/src/runtime/call-result.ts +86 -21
- package/src/runtime/checks.ts +27 -17
- package/src/runtime/consent.ts +3 -2
- package/src/runtime/core.ts +99 -27
- package/src/runtime/dispatch.ts +11 -0
- package/src/runtime/dom-await.ts +39 -9
- package/src/runtime/dom-image.ts +2 -2
- package/src/runtime/duration-words.ts +2 -1
- package/src/runtime/duration.ts +5 -3
- package/src/runtime/edit.ts +3 -2
- package/src/runtime/env.ts +2 -1
- package/src/runtime/form-types.ts +99 -0
- package/src/runtime/form.ts +22 -7
- package/src/runtime/forms.ts +15 -5
- package/src/runtime/head.ts +3 -1
- package/src/runtime/html.ts +46 -11
- package/src/runtime/i18n.client.ts +12 -6
- package/src/runtime/i18n.server.ts +12 -6
- package/src/runtime/i18n.ts +28 -8
- package/src/runtime/image.ts +16 -18
- package/src/runtime/index.ts +9 -8
- package/src/runtime/internal.ts +2 -1
- package/src/runtime/invalidated-keys.ts +11 -0
- package/src/runtime/island.server.ts +18 -10
- package/src/runtime/jsx.ts +6 -1
- package/src/runtime/kay-error.ts +29 -0
- package/src/runtime/leave.ts +1 -0
- package/src/runtime/live-cache.ts +8 -1
- package/src/runtime/live-resource.server.ts +1 -0
- package/src/runtime/live-revalidate.ts +53 -0
- package/src/runtime/live-value.client.ts +36 -3
- package/src/runtime/live-value.server.ts +10 -6
- package/src/runtime/live-value.shared.ts +50 -10
- package/src/runtime/live-value.ts +16 -4
- package/src/runtime/live.ts +92 -137
- package/src/runtime/local-types.ts +106 -0
- package/src/runtime/local.ts +31 -109
- package/src/runtime/log.ts +3 -1
- package/src/runtime/markdown-autolink.ts +69 -0
- package/src/runtime/markdown-render.client.ts +39 -3
- package/src/runtime/markdown.client.ts +6 -3
- package/src/runtime/markdown.server.ts +6 -3
- package/src/runtime/markdown.ts +125 -1
- package/src/runtime/mount.compat.ts +8 -0
- package/src/runtime/navigate-api.ts +27 -13
- package/src/runtime/navigation-state.ts +50 -13
- package/src/runtime/navigation.ts +3 -3
- package/src/runtime/optimistic.ts +1 -1
- package/src/runtime/page-swap.ts +11 -6
- package/src/runtime/persist.ts +9 -8
- package/src/runtime/persisted.ts +43 -38
- package/src/runtime/presence.ts +15 -9
- package/src/runtime/query-param.ts +1 -1
- package/src/runtime/queue-jobs.ts +2 -1
- package/src/runtime/reactive.ts +18 -5
- package/src/runtime/refuse.ts +23 -6
- package/src/runtime/resource-tags.ts +35 -0
- package/src/runtime/route.ts +3 -2
- package/src/runtime/sanitize.ts +7 -4
- package/src/runtime/schema-record.ts +31 -0
- package/src/runtime/schema.client.ts +3 -5
- package/src/runtime/schema.ts +322 -26
- package/src/runtime/send.ts +2 -1
- package/src/runtime/shortcut.ts +10 -3
- package/src/runtime/socket-message.ts +26 -0
- package/src/runtime/store-base.ts +22 -0
- package/src/runtime/swap-fetch.ts +2 -1
- package/src/runtime/swap-focus.ts +59 -11
- package/src/runtime/swap.ts +4 -0
- package/src/runtime/template-context.ts +4 -2
- package/src/runtime/values.ts +28 -10
- package/src/runtime/wire.ts +13 -3
- package/src/runtime/with-query.ts +3 -2
- package/src/runtime/work.ts +4 -2
- package/src/server/action-hooks.ts +15 -8
- package/src/server/action-iterable.ts +18 -3
- package/src/server/action-module.ts +16 -0
- package/src/server/actions.ts +37 -32
- package/src/server/address.ts +1 -1
- package/src/server/analytics-server.ts +2 -1
- package/src/server/api-modules.ts +38 -26
- package/src/server/api.ts +30 -97
- package/src/server/app-database.ts +11 -0
- package/src/server/app-hooks.ts +25 -6
- package/src/server/app-stages.ts +103 -67
- package/src/server/app.ts +25 -13
- package/src/server/auth-mails.ts +2 -0
- package/src/server/basic-auth.ts +27 -7
- package/src/server/bundle.ts +2 -0
- package/src/server/button-form-rule.ts +20 -0
- package/src/server/card.ts +2 -2
- package/src/server/ceiling.ts +1 -1
- package/src/server/client.ts +2 -2
- package/src/server/config-error.ts +2 -2
- package/src/server/config-limits.ts +37 -17
- package/src/server/context-values.ts +4 -3
- package/src/server/cookies.ts +4 -2
- package/src/server/dev-ui.ts +2 -2
- package/src/server/endpoints.ts +5 -2
- package/src/server/entry-drafts.ts +1 -1
- package/src/server/env-state.ts +1 -1
- package/src/server/env.ts +11 -3
- package/src/server/errors.ts +4 -3
- package/src/server/event-stream.ts +7 -4
- package/src/server/favicon.ts +106 -11
- package/src/server/fetch-public.ts +4 -3
- package/src/server/file-answer.ts +89 -0
- package/src/server/forms.ts +1 -1
- package/src/server/guard-requirement.ts +7 -0
- package/src/server/guards.ts +74 -2
- package/src/server/hooks.ts +10 -10
- package/src/server/i18n.ts +8 -9
- package/src/server/image-limits.ts +4 -3
- package/src/server/image-metadata-bmff.ts +1 -1
- package/src/server/image.ts +17 -15
- package/src/server/index.ts +15 -9
- package/src/server/job-context.ts +35 -0
- package/src/server/jobs-page.ts +14 -8
- package/src/server/jobs.ts +48 -13
- package/src/server/kept-exports.ts +3 -1
- package/src/server/kept-pages.ts +3 -3
- package/src/server/kv.ts +34 -18
- package/src/server/lazy-guard.ts +4 -1
- package/src/server/library.ts +7 -2
- package/src/server/lifecycle.ts +5 -5
- package/src/server/link-schemes.ts +5 -5
- package/src/server/live.ts +79 -7
- package/src/server/load-budget.ts +2 -2
- package/src/server/loader.ts +4 -2
- package/src/server/log.ts +18 -3
- package/src/server/maintenance.ts +1 -1
- package/src/server/mcp-key.ts +27 -24
- package/src/server/mcp.ts +24 -10
- package/src/server/message-drafts.ts +2 -2
- package/src/server/metrics.ts +42 -14
- package/src/server/moved-exports.ts +17 -0
- package/src/server/not-found-config.ts +4 -3
- package/src/server/notifications.ts +6 -4
- package/src/server/offline.ts +24 -7
- package/src/server/openapi.ts +9 -13
- package/src/server/over-limit.ts +29 -0
- package/src/server/page-limits.ts +1 -1
- package/src/server/page-routes.ts +2 -2
- package/src/server/page-seo.ts +29 -0
- package/src/server/page-settings.ts +69 -8
- package/src/server/pg-data.ts +3 -2
- package/src/server/pg-jobs.ts +3 -2
- package/src/server/pg-limit.ts +4 -3
- package/src/server/pg-live.ts +3 -1
- package/src/server/pg-not-found.ts +2 -1
- package/src/server/pg-poll.ts +3 -3
- package/src/server/pg-redirects.ts +3 -2
- package/src/server/pg-stores.ts +9 -7
- package/src/server/prerender.ts +21 -10
- package/src/server/preview.ts +3 -1
- package/src/server/protection.ts +20 -44
- package/src/server/proxy-key.ts +17 -39
- package/src/server/pure-page.ts +2 -29
- package/src/server/push-crypto.ts +3 -2
- package/src/server/push-server.ts +2 -1
- package/src/server/push-settings.ts +16 -2
- package/src/server/push.ts +18 -10
- package/src/server/query.ts +13 -6
- package/src/server/queue-scheduler.ts +5 -0
- package/src/server/queue.ts +21 -29
- package/src/server/rate-limit.ts +21 -13
- package/src/server/rate-windows.ts +14 -0
- package/src/server/redirects.ts +29 -2
- package/src/server/remote.ts +5 -4
- package/src/server/render-document.ts +32 -11
- package/src/server/render.ts +7 -7
- package/src/server/report.ts +5 -5
- package/src/server/request-record.ts +2 -0
- package/src/server/resources.ts +2 -1
- package/src/server/rooms.ts +177 -23
- package/src/server/route-settings.ts +236 -0
- package/src/server/routes.ts +25 -195
- package/src/server/save-data.ts +1 -1
- package/src/server/scope.ts +21 -14
- package/src/server/secret.ts +76 -0
- package/src/server/security.ts +15 -10
- package/src/server/seo.ts +19 -7
- package/src/server/served-paths.ts +2 -1
- package/src/server/session.ts +39 -18
- package/src/server/setup.ts +17 -10
- package/src/server/signals.ts +23 -3
- package/src/server/signed.ts +7 -4
- package/src/server/sitemap.ts +6 -4
- package/src/server/socket.ts +371 -0
- package/src/server/source.ts +13 -7
- package/src/server/sqlite-live.ts +3 -1
- package/src/server/storage.ts +21 -48
- package/src/server/stream.ts +23 -14
- package/src/server/translations.ts +2 -2
- package/src/server/uncaught.ts +2 -2
- package/src/server/violations.ts +4 -3
- package/src/server/vitals-routes/_guard.ts +1 -1
- package/src/server/vitals-server.ts +2 -1
- package/src/server/vitals.ts +5 -2
- package/src/server/words.ts +4 -0
- package/src/server/work-scope.ts +4 -2
- package/src/server/work.ts +4 -3
- package/src/server/workers.ts +2 -1
- package/src/server/workflow.ts +19 -11
- package/src/server/ws-limits.ts +51 -69
- package/src/template-config.ts +1 -1
- package/src/template-docker.ts +1 -1
- package/src/template-starter.ts +2 -2
- package/src/template-styles.ts +1 -1
- package/src/template-ws.ts +2 -2
- package/src/test/a11y-dom.ts +70 -0
- package/src/test/a11y.ts +55 -0
- package/src/test/browser.ts +5 -48
- package/src/test/html-snapshot.ts +103 -0
- package/src/test/index.ts +33 -40
- package/src/test/mount.ts +13 -5
- package/src/test/outgoing.ts +138 -0
- package/src/test/page-checks.ts +12 -0
- package/src/test/page-types.ts +3 -0
- package/src/test/screenshot-match.ts +69 -0
- package/src/test/service.ts +11 -5
- package/src/test/shared-modules.ts +27 -5
- package/src/test/site-actions.ts +22 -19
- package/src/test/site-keys.ts +49 -0
- package/src/test/site-socket.ts +42 -38
- package/src/test/site-types.ts +46 -13
- package/src/test/site-world.ts +86 -0
- package/types/build/await-alert.d.ts +4 -0
- package/types/build/await-alert.d.ts.map +1 -0
- package/types/build/class-table.d.ts +1 -1
- package/types/build/class-table.d.ts.map +1 -1
- package/types/build/client.d.ts.map +1 -1
- package/types/build/compile.d.ts +1 -0
- package/types/build/compile.d.ts.map +1 -1
- package/types/build/plugin.d.ts.map +1 -1
- package/types/build/server-record.d.ts.map +1 -1
- package/types/build/static.d.ts.map +1 -1
- package/types/build/styles.d.ts.map +1 -1
- package/types/build/transform.d.ts +1 -0
- package/types/build/transform.d.ts.map +1 -1
- package/types/build/ui-layers.d.ts +5 -0
- package/types/build/ui-layers.d.ts.map +1 -0
- package/types/build/ui.d.ts +7 -0
- package/types/build/ui.d.ts.map +1 -1
- package/types/build/variants.d.ts +1 -1
- package/types/build/variants.d.ts.map +1 -1
- package/types/build/verify.d.ts +3 -2
- package/types/build/verify.d.ts.map +1 -1
- package/types/build/worker-bundle.d.ts +1 -0
- package/types/build/worker-bundle.d.ts.map +1 -1
- package/types/check/action-readers.d.ts +3 -0
- package/types/check/action-readers.d.ts.map +1 -0
- package/types/check/action-type.d.ts +3 -0
- package/types/check/action-type.d.ts.map +1 -0
- package/types/check/ai-language.d.ts +3 -0
- package/types/check/ai-language.d.ts.map +1 -0
- package/types/check/app-hooks.d.ts +3 -0
- package/types/check/app-hooks.d.ts.map +1 -0
- package/types/check/auth-methods.d.ts +3 -0
- package/types/check/auth-methods.d.ts.map +1 -0
- package/types/check/auth-rate-limits.d.ts +3 -0
- package/types/check/auth-rate-limits.d.ts.map +1 -0
- package/types/check/boot.d.ts.map +1 -1
- package/types/check/call-result.d.ts +7 -0
- package/types/check/call-result.d.ts.map +1 -0
- package/types/check/client-keys.d.ts +3 -0
- package/types/check/client-keys.d.ts.map +1 -0
- package/types/check/cms-options.d.ts +3 -0
- package/types/check/cms-options.d.ts.map +1 -0
- package/types/check/config-groups.d.ts +3 -0
- package/types/check/config-groups.d.ts.map +1 -0
- package/types/check/config-objects.d.ts +16 -0
- package/types/check/config-objects.d.ts.map +1 -0
- package/types/check/config-switches.d.ts +3 -0
- package/types/check/config-switches.d.ts.map +1 -0
- package/types/check/context-import.d.ts +3 -0
- package/types/check/context-import.d.ts.map +1 -0
- package/types/check/diagnose.d.ts +1 -1
- package/types/check/diagnose.d.ts.map +1 -1
- package/types/check/env-files.d.ts +3 -0
- package/types/check/env-files.d.ts.map +1 -0
- package/types/check/env-types.d.ts.map +1 -1
- package/types/check/format-duration.d.ts +5 -0
- package/types/check/format-duration.d.ts.map +1 -0
- package/types/check/generated.d.ts +2 -0
- package/types/check/generated.d.ts.map +1 -1
- package/types/check/guard-options.d.ts +3 -0
- package/types/check/guard-options.d.ts.map +1 -0
- package/types/check/handler-events.d.ts +9 -0
- package/types/check/handler-events.d.ts.map +1 -0
- package/types/check/hook-context.d.ts +3 -0
- package/types/check/hook-context.d.ts.map +1 -0
- package/types/check/hook-names.d.ts +3 -0
- package/types/check/hook-names.d.ts.map +1 -0
- package/types/check/i18n-keys.d.ts +3 -0
- package/types/check/i18n-keys.d.ts.map +1 -0
- package/types/check/images-keys.d.ts +3 -0
- package/types/check/images-keys.d.ts.map +1 -0
- package/types/check/index.d.ts +8 -4
- package/types/check/index.d.ts.map +1 -1
- package/types/check/job-shapes.d.ts +6 -0
- package/types/check/job-shapes.d.ts.map +1 -0
- package/types/check/link-flag-tests.d.ts +4 -0
- package/types/check/link-flag-tests.d.ts.map +1 -0
- package/types/check/live-api.d.ts +3 -0
- package/types/check/live-api.d.ts.map +1 -0
- package/types/check/mail-api.d.ts +3 -0
- package/types/check/mail-api.d.ts.map +1 -0
- package/types/check/moved-keys.d.ts +10 -0
- package/types/check/moved-keys.d.ts.map +1 -0
- package/types/check/one-state-api.d.ts +9 -0
- package/types/check/one-state-api.d.ts.map +1 -0
- package/types/check/output-schema.d.ts +1 -1
- package/types/check/output-schema.d.ts.map +1 -1
- package/types/check/page-heads.d.ts.map +1 -1
- package/types/check/pages-options.d.ts +3 -0
- package/types/check/pages-options.d.ts.map +1 -0
- package/types/check/project.d.ts.map +1 -1
- package/types/check/rate-enforce.d.ts +3 -0
- package/types/check/rate-enforce.d.ts.map +1 -0
- package/types/check/refusal-calls.d.ts +3 -0
- package/types/check/refusal-calls.d.ts.map +1 -0
- package/types/check/regroup.d.ts +8 -0
- package/types/check/regroup.d.ts.map +1 -0
- package/types/check/renamed-packages.d.ts +1 -0
- package/types/check/renamed-packages.d.ts.map +1 -1
- package/types/check/retired-lints.d.ts +3 -0
- package/types/check/retired-lints.d.ts.map +1 -0
- package/types/check/route-keys.d.ts +3 -0
- package/types/check/route-keys.d.ts.map +1 -0
- package/types/check/route-shadow.d.ts +12 -0
- package/types/check/route-shadow.d.ts.map +1 -0
- package/types/check/schema-builders.d.ts +3 -0
- package/types/check/schema-builders.d.ts.map +1 -0
- package/types/check/secret-keys.d.ts +3 -0
- package/types/check/secret-keys.d.ts.map +1 -0
- package/types/check/seo.d.ts +3 -1
- package/types/check/seo.d.ts.map +1 -1
- package/types/check/shadow-types.d.ts +1 -0
- package/types/check/shadow-types.d.ts.map +1 -1
- package/types/check/shadow.d.ts +1 -0
- package/types/check/shadow.d.ts.map +1 -1
- package/types/check/socket-frames.d.ts +3 -0
- package/types/check/socket-frames.d.ts.map +1 -0
- package/types/check/source-readers.d.ts +3 -0
- package/types/check/source-readers.d.ts.map +1 -0
- package/types/check/store-ms.d.ts +3 -0
- package/types/check/store-ms.d.ts.map +1 -0
- package/types/check/store-names.d.ts +3 -0
- package/types/check/store-names.d.ts.map +1 -0
- package/types/check/template-hints.d.ts +3 -0
- package/types/check/template-hints.d.ts.map +1 -1
- package/types/check/test-helpers.d.ts +3 -0
- package/types/check/test-helpers.d.ts.map +1 -0
- package/types/check/tool-labels.d.ts.map +1 -1
- package/types/check/ttl-names.d.ts +3 -0
- package/types/check/ttl-names.d.ts.map +1 -0
- package/types/check/ui-types.d.ts.map +1 -1
- package/types/check/ui.d.ts.map +1 -1
- package/types/commands/check.d.ts.map +1 -1
- package/types/commands/env-declare.d.ts.map +1 -1
- package/types/commands/env.d.ts.map +1 -1
- package/types/commands/explain-island.d.ts.map +1 -1
- package/types/commands/routes.d.ts.map +1 -1
- package/types/compiler/a11y.d.ts.map +1 -1
- package/types/compiler/aria.d.ts +1 -0
- package/types/compiler/aria.d.ts.map +1 -1
- package/types/compiler/ast.d.ts +13 -16
- package/types/compiler/ast.d.ts.map +1 -1
- package/types/compiler/bound-props.d.ts +17 -0
- package/types/compiler/bound-props.d.ts.map +1 -0
- package/types/compiler/browser.d.ts.map +1 -1
- package/types/compiler/button-forms.d.ts +3 -0
- package/types/compiler/button-forms.d.ts.map +1 -0
- package/types/compiler/codegen.d.ts +3 -1
- package/types/compiler/codegen.d.ts.map +1 -1
- package/types/compiler/deprecated-ai-labels.d.ts +5 -0
- package/types/compiler/deprecated-ai-labels.d.ts.map +1 -0
- package/types/compiler/deprecated-ai-links.d.ts +5 -0
- package/types/compiler/deprecated-ai-links.d.ts.map +1 -0
- package/types/compiler/deprecated-allow.d.ts +5 -0
- package/types/compiler/deprecated-allow.d.ts.map +1 -0
- package/types/compiler/deprecated-auth-lints.d.ts +12 -0
- package/types/compiler/deprecated-auth-lints.d.ts.map +1 -0
- package/types/compiler/deprecated-auth-signed.d.ts +5 -0
- package/types/compiler/deprecated-auth-signed.d.ts.map +1 -0
- package/types/compiler/deprecated-children.d.ts +4 -0
- package/types/compiler/deprecated-children.d.ts.map +1 -0
- package/types/compiler/deprecated-image.d.ts +5 -0
- package/types/compiler/deprecated-image.d.ts.map +1 -0
- package/types/compiler/deprecated-island.d.ts +9 -0
- package/types/compiler/deprecated-island.d.ts.map +1 -0
- package/types/compiler/deprecated-library.d.ts +4 -0
- package/types/compiler/deprecated-library.d.ts.map +1 -0
- package/types/compiler/deprecated-lints-1-106.d.ts +12 -0
- package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -0
- package/types/compiler/deprecated-lints.d.ts +554 -20
- package/types/compiler/deprecated-lints.d.ts.map +1 -1
- package/types/compiler/deprecated-page.d.ts +4 -0
- package/types/compiler/deprecated-page.d.ts.map +1 -0
- package/types/compiler/deprecated-parts.d.ts +3 -0
- package/types/compiler/deprecated-parts.d.ts.map +1 -0
- package/types/compiler/deprecated-typed-lints.d.ts +21 -0
- package/types/compiler/deprecated-typed-lints.d.ts.map +1 -0
- package/types/compiler/deprecated-ui-callbacks.d.ts +5 -0
- package/types/compiler/deprecated-ui-callbacks.d.ts.map +1 -0
- package/types/compiler/deprecated-ui-input.d.ts +5 -0
- package/types/compiler/deprecated-ui-input.d.ts.map +1 -0
- package/types/compiler/deprecated-ui-items.d.ts +5 -0
- package/types/compiler/deprecated-ui-items.d.ts.map +1 -0
- package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
- package/types/compiler/dom-fields.d.ts +7 -0
- package/types/compiler/dom-fields.d.ts.map +1 -0
- package/types/compiler/dom-here.d.ts +14 -0
- package/types/compiler/dom-here.d.ts.map +1 -0
- package/types/compiler/dom.d.ts +5 -2
- package/types/compiler/dom.d.ts.map +1 -1
- package/types/compiler/errors.d.ts +43 -18
- package/types/compiler/errors.d.ts.map +1 -1
- package/types/compiler/fence-checks.d.ts.map +1 -1
- package/types/compiler/field-described.d.ts +1 -1
- package/types/compiler/field-described.d.ts.map +1 -1
- package/types/compiler/form-action.d.ts +8 -0
- package/types/compiler/form-action.d.ts.map +1 -0
- package/types/compiler/form-info.d.ts +29 -0
- package/types/compiler/form-info.d.ts.map +1 -0
- package/types/compiler/head-shorthand.d.ts +16 -0
- package/types/compiler/head-shorthand.d.ts.map +1 -0
- package/types/compiler/head-tags.d.ts +7 -0
- package/types/compiler/head-tags.d.ts.map +1 -0
- package/types/compiler/helper-imports.d.ts +5 -0
- package/types/compiler/helper-imports.d.ts.map +1 -0
- package/types/compiler/html-fields.d.ts +19 -0
- package/types/compiler/html-fields.d.ts.map +1 -0
- package/types/compiler/html-initial.d.ts +17 -0
- package/types/compiler/html-initial.d.ts.map +1 -0
- package/types/compiler/html-parts.d.ts +13 -0
- package/types/compiler/html-parts.d.ts.map +1 -0
- package/types/compiler/html.d.ts +3 -2
- package/types/compiler/html.d.ts.map +1 -1
- package/types/compiler/if-alias.d.ts.map +1 -1
- package/types/compiler/image-attributes.d.ts +22 -0
- package/types/compiler/image-attributes.d.ts.map +1 -0
- package/types/compiler/index.d.ts +3 -0
- package/types/compiler/index.d.ts.map +1 -1
- package/types/compiler/island-arguments.d.ts +6 -1
- package/types/compiler/island-arguments.d.ts.map +1 -1
- package/types/compiler/island-cause.d.ts +1 -1
- package/types/compiler/island-cause.d.ts.map +1 -1
- package/types/compiler/island-declaration.d.ts +30 -0
- package/types/compiler/island-declaration.d.ts.map +1 -0
- package/types/compiler/island-marker.d.ts.map +1 -1
- package/types/compiler/items.d.ts +6 -0
- package/types/compiler/items.d.ts.map +1 -1
- package/types/compiler/jsx-class.d.ts +2 -1
- package/types/compiler/jsx-class.d.ts.map +1 -1
- package/types/compiler/jsx-field.d.ts +13 -0
- package/types/compiler/jsx-field.d.ts.map +1 -0
- package/types/compiler/jsx.d.ts +1 -0
- package/types/compiler/jsx.d.ts.map +1 -1
- package/types/compiler/kay-exports.d.ts.map +1 -1
- package/types/compiler/link-flags.d.ts +18 -0
- package/types/compiler/link-flags.d.ts.map +1 -0
- package/types/compiler/lints.d.ts +601 -66
- package/types/compiler/lints.d.ts.map +1 -1
- package/types/compiler/live-reads.d.ts +13 -0
- package/types/compiler/live-reads.d.ts.map +1 -0
- package/types/compiler/loop-lints.d.ts +4 -4
- package/types/compiler/loop-lints.d.ts.map +1 -1
- package/types/compiler/markup-fields.d.ts +8 -0
- package/types/compiler/markup-fields.d.ts.map +1 -0
- package/types/compiler/markup.d.ts +9 -5
- package/types/compiler/markup.d.ts.map +1 -1
- package/types/compiler/module-signals.d.ts.map +1 -1
- package/types/compiler/names.d.ts +4 -0
- package/types/compiler/names.d.ts.map +1 -1
- package/types/compiler/old-parts.d.ts +9 -0
- package/types/compiler/old-parts.d.ts.map +1 -0
- package/types/compiler/page-settings.d.ts +1 -0
- package/types/compiler/page-settings.d.ts.map +1 -1
- package/types/compiler/parser.d.ts.map +1 -1
- package/types/compiler/plan.d.ts +1 -0
- package/types/compiler/plan.d.ts.map +1 -1
- package/types/compiler/rest-omits.d.ts +4 -0
- package/types/compiler/rest-omits.d.ts.map +1 -0
- package/types/compiler/rewrite-reads.d.ts +8 -0
- package/types/compiler/rewrite-reads.d.ts.map +1 -1
- package/types/compiler/rewrite-types.d.ts +1 -0
- package/types/compiler/rewrite-types.d.ts.map +1 -1
- package/types/compiler/rewrite.d.ts.map +1 -1
- package/types/compiler/route-lints.d.ts +13 -6
- package/types/compiler/route-lints.d.ts.map +1 -1
- package/types/compiler/script-props.d.ts.map +1 -1
- package/types/compiler/script-server.d.ts.map +1 -1
- package/types/compiler/script-shared.d.ts +8 -0
- package/types/compiler/script-shared.d.ts.map +1 -1
- package/types/compiler/script.d.ts.map +1 -1
- package/types/compiler/server-imports.d.ts +4 -0
- package/types/compiler/server-imports.d.ts.map +1 -0
- package/types/compiler/slot-types.d.ts +13 -0
- package/types/compiler/slot-types.d.ts.map +1 -0
- package/types/compiler/style-arguments.d.ts +6 -0
- package/types/compiler/style-arguments.d.ts.map +1 -0
- package/types/compiler/template-walk.d.ts +7 -0
- package/types/compiler/template-walk.d.ts.map +1 -0
- package/types/compiler/type-parameters.d.ts +3 -0
- package/types/compiler/type-parameters.d.ts.map +1 -0
- package/types/compiler/validate-fields.d.ts +10 -0
- package/types/compiler/validate-fields.d.ts.map +1 -0
- package/types/compiler/validate.d.ts.map +1 -1
- package/types/config-extensions.d.ts +3 -1
- package/types/config-extensions.d.ts.map +1 -1
- package/types/config-loader.d.ts +2 -2
- package/types/config-loader.d.ts.map +1 -1
- package/types/config-resolve.d.ts +3 -0
- package/types/config-resolve.d.ts.map +1 -0
- package/types/config-shape.d.ts +2 -1
- package/types/config-shape.d.ts.map +1 -1
- package/types/config-switch.d.ts +10 -0
- package/types/config-switch.d.ts.map +1 -0
- package/types/config.d.ts +242 -68
- package/types/config.d.ts.map +1 -1
- package/types/content/markdown.d.ts.map +1 -1
- package/types/generate-resource.d.ts.map +1 -1
- package/types/lsp/diagnostics.d.ts.map +1 -1
- package/types/lsp/route-documents.d.ts +4 -0
- package/types/lsp/route-documents.d.ts.map +1 -0
- package/types/lsp/server.d.ts +3 -0
- package/types/lsp/server.d.ts.map +1 -1
- package/types/migrate/content.d.ts.map +1 -1
- package/types/project.d.ts +7 -4
- package/types/project.d.ts.map +1 -1
- package/types/runtime/action-call.d.ts +11 -3
- package/types/runtime/action-call.d.ts.map +1 -1
- package/types/runtime/action-encode.d.ts.map +1 -1
- package/types/runtime/action-error.d.ts.map +1 -1
- package/types/runtime/action-form.d.ts +10 -3
- package/types/runtime/action-form.d.ts.map +1 -1
- package/types/runtime/action-navigate.d.ts +1 -0
- package/types/runtime/action-navigate.d.ts.map +1 -1
- package/types/runtime/action-owner.d.ts +1 -0
- package/types/runtime/action-owner.d.ts.map +1 -1
- package/types/runtime/action-post.d.ts.map +1 -1
- package/types/runtime/action-protection.d.ts.map +1 -1
- package/types/runtime/action-shared.d.ts +76 -15
- package/types/runtime/action-shared.d.ts.map +1 -1
- package/types/runtime/action-stream.d.ts +1 -1
- package/types/runtime/action-stream.d.ts.map +1 -1
- package/types/runtime/action.d.ts +8 -5
- package/types/runtime/action.d.ts.map +1 -1
- package/types/runtime/api-url.d.ts.map +1 -1
- package/types/runtime/await-failed.d.ts +8 -0
- package/types/runtime/await-failed.d.ts.map +1 -0
- package/types/runtime/await.d.ts +2 -2
- package/types/runtime/await.d.ts.map +1 -1
- package/types/runtime/await.server.d.ts +6 -3
- package/types/runtime/await.server.d.ts.map +1 -1
- package/types/runtime/button-form.d.ts +3 -0
- package/types/runtime/button-form.d.ts.map +1 -0
- package/types/runtime/cache-hooks.d.ts +10 -0
- package/types/runtime/cache-hooks.d.ts.map +1 -0
- package/types/runtime/cache-live-id.d.ts +3 -0
- package/types/runtime/cache-live-id.d.ts.map +1 -1
- package/types/runtime/cache.d.ts +1 -5
- package/types/runtime/cache.d.ts.map +1 -1
- package/types/runtime/call-result.d.ts +18 -9
- package/types/runtime/call-result.d.ts.map +1 -1
- package/types/runtime/checks.d.ts +13 -10
- package/types/runtime/checks.d.ts.map +1 -1
- package/types/runtime/consent.d.ts.map +1 -1
- package/types/runtime/core.d.ts +48 -9
- package/types/runtime/core.d.ts.map +1 -1
- package/types/runtime/dispatch.d.ts +8 -0
- package/types/runtime/dispatch.d.ts.map +1 -0
- package/types/runtime/dom-await.d.ts +1 -1
- package/types/runtime/dom-await.d.ts.map +1 -1
- package/types/runtime/dom-image.d.ts +1 -1
- package/types/runtime/dom-image.d.ts.map +1 -1
- package/types/runtime/duration-words.d.ts.map +1 -1
- package/types/runtime/duration.d.ts.map +1 -1
- package/types/runtime/edit.d.ts.map +1 -1
- package/types/runtime/env.d.ts.map +1 -1
- package/types/runtime/form-types.d.ts +6 -0
- package/types/runtime/form-types.d.ts.map +1 -0
- package/types/runtime/form.d.ts +3 -1
- package/types/runtime/form.d.ts.map +1 -1
- package/types/runtime/forms.d.ts.map +1 -1
- package/types/runtime/head.d.ts.map +1 -1
- package/types/runtime/html.d.ts +6 -2
- package/types/runtime/html.d.ts.map +1 -1
- package/types/runtime/i18n.client.d.ts +4 -1
- package/types/runtime/i18n.client.d.ts.map +1 -1
- package/types/runtime/i18n.d.ts +22 -7
- package/types/runtime/i18n.d.ts.map +1 -1
- package/types/runtime/i18n.server.d.ts +4 -1
- package/types/runtime/i18n.server.d.ts.map +1 -1
- package/types/runtime/image.d.ts +1 -1
- package/types/runtime/image.d.ts.map +1 -1
- package/types/runtime/index.d.ts +9 -8
- package/types/runtime/index.d.ts.map +1 -1
- package/types/runtime/internal.d.ts +2 -1
- package/types/runtime/internal.d.ts.map +1 -1
- package/types/runtime/invalidated-keys.d.ts +2 -0
- package/types/runtime/invalidated-keys.d.ts.map +1 -0
- package/types/runtime/island.server.d.ts.map +1 -1
- package/types/runtime/jsx.d.ts +7 -0
- package/types/runtime/jsx.d.ts.map +1 -1
- package/types/runtime/kay-error.d.ts +14 -0
- package/types/runtime/kay-error.d.ts.map +1 -0
- package/types/runtime/leave.d.ts.map +1 -1
- package/types/runtime/live-cache.d.ts +1 -0
- package/types/runtime/live-cache.d.ts.map +1 -1
- package/types/runtime/live-resource.server.d.ts.map +1 -1
- package/types/runtime/live-revalidate.d.ts +9 -0
- package/types/runtime/live-revalidate.d.ts.map +1 -0
- package/types/runtime/live-value.client.d.ts.map +1 -1
- package/types/runtime/live-value.d.ts +3 -0
- package/types/runtime/live-value.d.ts.map +1 -1
- package/types/runtime/live-value.server.d.ts.map +1 -1
- package/types/runtime/live-value.shared.d.ts +38 -6
- package/types/runtime/live-value.shared.d.ts.map +1 -1
- package/types/runtime/live.d.ts +41 -42
- package/types/runtime/live.d.ts.map +1 -1
- package/types/runtime/local-types.d.ts +86 -0
- package/types/runtime/local-types.d.ts.map +1 -0
- package/types/runtime/local.d.ts +1 -70
- package/types/runtime/local.d.ts.map +1 -1
- package/types/runtime/log.d.ts.map +1 -1
- package/types/runtime/markdown-autolink.d.ts +11 -0
- package/types/runtime/markdown-autolink.d.ts.map +1 -0
- package/types/runtime/markdown-render.client.d.ts +2 -1
- package/types/runtime/markdown-render.client.d.ts.map +1 -1
- package/types/runtime/markdown.client.d.ts +3 -1
- package/types/runtime/markdown.client.d.ts.map +1 -1
- package/types/runtime/markdown.d.ts +11 -0
- package/types/runtime/markdown.d.ts.map +1 -1
- package/types/runtime/markdown.server.d.ts +3 -1
- package/types/runtime/markdown.server.d.ts.map +1 -1
- package/types/runtime/mount.compat.d.ts +7 -0
- package/types/runtime/mount.compat.d.ts.map +1 -0
- package/types/runtime/navigate-api.d.ts +11 -5
- package/types/runtime/navigate-api.d.ts.map +1 -1
- package/types/runtime/navigation-state.d.ts +19 -0
- package/types/runtime/navigation-state.d.ts.map +1 -1
- package/types/runtime/page-swap.d.ts.map +1 -1
- package/types/runtime/persist.d.ts +2 -2
- package/types/runtime/persist.d.ts.map +1 -1
- package/types/runtime/persisted.d.ts +25 -29
- package/types/runtime/persisted.d.ts.map +1 -1
- package/types/runtime/presence.d.ts +6 -3
- package/types/runtime/presence.d.ts.map +1 -1
- package/types/runtime/queue-jobs.d.ts.map +1 -1
- package/types/runtime/reactive.d.ts +3 -0
- package/types/runtime/reactive.d.ts.map +1 -1
- package/types/runtime/refuse.d.ts +8 -1
- package/types/runtime/refuse.d.ts.map +1 -1
- package/types/runtime/resource-tags.d.ts +4 -0
- package/types/runtime/resource-tags.d.ts.map +1 -0
- package/types/runtime/route.d.ts.map +1 -1
- package/types/runtime/sanitize.d.ts.map +1 -1
- package/types/runtime/schema-record.d.ts +9 -0
- package/types/runtime/schema-record.d.ts.map +1 -0
- package/types/runtime/schema.client.d.ts.map +1 -1
- package/types/runtime/schema.d.ts +94 -10
- package/types/runtime/schema.d.ts.map +1 -1
- package/types/runtime/send.d.ts.map +1 -1
- package/types/runtime/shortcut.d.ts +1 -0
- package/types/runtime/shortcut.d.ts.map +1 -1
- package/types/runtime/socket-message.d.ts +7 -0
- package/types/runtime/socket-message.d.ts.map +1 -0
- package/types/runtime/store-base.d.ts +4 -0
- package/types/runtime/store-base.d.ts.map +1 -1
- package/types/runtime/swap-fetch.d.ts.map +1 -1
- package/types/runtime/swap-focus.d.ts.map +1 -1
- package/types/runtime/swap.d.ts +2 -0
- package/types/runtime/swap.d.ts.map +1 -1
- package/types/runtime/template-context.d.ts.map +1 -1
- package/types/runtime/values.d.ts.map +1 -1
- package/types/runtime/wire.d.ts +1 -0
- package/types/runtime/wire.d.ts.map +1 -1
- package/types/runtime/with-query.d.ts.map +1 -1
- package/types/runtime/work.d.ts.map +1 -1
- package/types/server/action-hooks.d.ts +4 -4
- package/types/server/action-hooks.d.ts.map +1 -1
- package/types/server/action-iterable.d.ts +2 -1
- package/types/server/action-iterable.d.ts.map +1 -1
- package/types/server/action-module.d.ts +2 -0
- package/types/server/action-module.d.ts.map +1 -0
- package/types/server/actions.d.ts +4 -2
- package/types/server/actions.d.ts.map +1 -1
- package/types/server/analytics-server.d.ts.map +1 -1
- package/types/server/api-modules.d.ts +16 -13
- package/types/server/api-modules.d.ts.map +1 -1
- package/types/server/api.d.ts +6 -3
- package/types/server/api.d.ts.map +1 -1
- package/types/server/app-database.d.ts +2 -0
- package/types/server/app-database.d.ts.map +1 -1
- package/types/server/app-hooks.d.ts +10 -2
- package/types/server/app-hooks.d.ts.map +1 -1
- package/types/server/app-stages.d.ts +24 -28
- package/types/server/app-stages.d.ts.map +1 -1
- package/types/server/app.d.ts +21 -24
- package/types/server/app.d.ts.map +1 -1
- package/types/server/auth-mails.d.ts +5 -0
- package/types/server/auth-mails.d.ts.map +1 -1
- package/types/server/basic-auth.d.ts +2 -5
- package/types/server/basic-auth.d.ts.map +1 -1
- package/types/server/bundle.d.ts +1 -0
- package/types/server/bundle.d.ts.map +1 -1
- package/types/server/button-form-rule.d.ts +4 -0
- package/types/server/button-form-rule.d.ts.map +1 -0
- package/types/server/card.d.ts +1 -1
- package/types/server/card.d.ts.map +1 -1
- package/types/server/config-limits.d.ts +5 -5
- package/types/server/config-limits.d.ts.map +1 -1
- package/types/server/context-values.d.ts.map +1 -1
- package/types/server/cookies.d.ts +2 -2
- package/types/server/cookies.d.ts.map +1 -1
- package/types/server/endpoints.d.ts.map +1 -1
- package/types/server/env-state.d.ts.map +1 -1
- package/types/server/env.d.ts +5 -1
- package/types/server/env.d.ts.map +1 -1
- package/types/server/errors.d.ts +2 -2
- package/types/server/errors.d.ts.map +1 -1
- package/types/server/event-stream.d.ts +1 -1
- package/types/server/event-stream.d.ts.map +1 -1
- package/types/server/favicon.d.ts +10 -4
- package/types/server/favicon.d.ts.map +1 -1
- package/types/server/fetch-public.d.ts.map +1 -1
- package/types/server/file-answer.d.ts +17 -0
- package/types/server/file-answer.d.ts.map +1 -0
- package/types/server/forms.d.ts +1 -1
- package/types/server/forms.d.ts.map +1 -1
- package/types/server/guard-requirement.d.ts +6 -0
- package/types/server/guard-requirement.d.ts.map +1 -1
- package/types/server/guards.d.ts +11 -0
- package/types/server/guards.d.ts.map +1 -1
- package/types/server/hooks.d.ts +8 -8
- package/types/server/hooks.d.ts.map +1 -1
- package/types/server/i18n.d.ts.map +1 -1
- package/types/server/image-limits.d.ts.map +1 -1
- package/types/server/image.d.ts +8 -13
- package/types/server/image.d.ts.map +1 -1
- package/types/server/index.d.ts +12 -8
- package/types/server/index.d.ts.map +1 -1
- package/types/server/job-context.d.ts +16 -0
- package/types/server/job-context.d.ts.map +1 -0
- package/types/server/jobs-page.d.ts +1 -1
- package/types/server/jobs-page.d.ts.map +1 -1
- package/types/server/jobs.d.ts +22 -4
- package/types/server/jobs.d.ts.map +1 -1
- package/types/server/kept-exports.d.ts.map +1 -1
- package/types/server/kept-pages.d.ts +1 -1
- package/types/server/kept-pages.d.ts.map +1 -1
- package/types/server/kv.d.ts +5 -4
- package/types/server/kv.d.ts.map +1 -1
- package/types/server/lazy-guard.d.ts +2 -1
- package/types/server/lazy-guard.d.ts.map +1 -1
- package/types/server/library.d.ts +7 -2
- package/types/server/library.d.ts.map +1 -1
- package/types/server/lifecycle.d.ts +2 -2
- package/types/server/lifecycle.d.ts.map +1 -1
- package/types/server/link-schemes.d.ts +1 -1
- package/types/server/link-schemes.d.ts.map +1 -1
- package/types/server/live.d.ts +5 -0
- package/types/server/live.d.ts.map +1 -1
- package/types/server/loader.d.ts.map +1 -1
- package/types/server/log.d.ts +7 -1
- package/types/server/log.d.ts.map +1 -1
- package/types/server/mcp-key.d.ts +2 -3
- package/types/server/mcp-key.d.ts.map +1 -1
- package/types/server/mcp.d.ts +1 -0
- package/types/server/mcp.d.ts.map +1 -1
- package/types/server/metrics.d.ts +9 -2
- package/types/server/metrics.d.ts.map +1 -1
- package/types/server/moved-exports.d.ts +12 -0
- package/types/server/moved-exports.d.ts.map +1 -0
- package/types/server/not-found-config.d.ts.map +1 -1
- package/types/server/notifications.d.ts +2 -1
- package/types/server/notifications.d.ts.map +1 -1
- package/types/server/offline.d.ts.map +1 -1
- package/types/server/openapi.d.ts +5 -5
- package/types/server/openapi.d.ts.map +1 -1
- package/types/server/over-limit.d.ts +9 -0
- package/types/server/over-limit.d.ts.map +1 -0
- package/types/server/page-seo.d.ts +3 -0
- package/types/server/page-seo.d.ts.map +1 -0
- package/types/server/page-settings.d.ts +5 -1
- package/types/server/page-settings.d.ts.map +1 -1
- package/types/server/pg-data.d.ts.map +1 -1
- package/types/server/pg-jobs.d.ts.map +1 -1
- package/types/server/pg-limit.d.ts.map +1 -1
- package/types/server/pg-live.d.ts.map +1 -1
- package/types/server/pg-not-found.d.ts.map +1 -1
- package/types/server/pg-poll.d.ts +2 -2
- package/types/server/pg-poll.d.ts.map +1 -1
- package/types/server/pg-redirects.d.ts.map +1 -1
- package/types/server/pg-stores.d.ts.map +1 -1
- package/types/server/prerender.d.ts.map +1 -1
- package/types/server/preview.d.ts +1 -1
- package/types/server/preview.d.ts.map +1 -1
- package/types/server/protection.d.ts +1 -2
- package/types/server/protection.d.ts.map +1 -1
- package/types/server/proxy-key.d.ts +3 -3
- package/types/server/proxy-key.d.ts.map +1 -1
- package/types/server/pure-page.d.ts.map +1 -1
- package/types/server/push-crypto.d.ts.map +1 -1
- package/types/server/push-server.d.ts.map +1 -1
- package/types/server/push-settings.d.ts +1 -1
- package/types/server/push-settings.d.ts.map +1 -1
- package/types/server/push.d.ts +1 -0
- package/types/server/push.d.ts.map +1 -1
- package/types/server/query.d.ts.map +1 -1
- package/types/server/queue-scheduler.d.ts +1 -0
- package/types/server/queue-scheduler.d.ts.map +1 -1
- package/types/server/queue.d.ts +6 -7
- package/types/server/queue.d.ts.map +1 -1
- package/types/server/rate-limit.d.ts +6 -1
- package/types/server/rate-limit.d.ts.map +1 -1
- package/types/server/rate-windows.d.ts +3 -0
- package/types/server/rate-windows.d.ts.map +1 -0
- package/types/server/redirects.d.ts.map +1 -1
- package/types/server/remote.d.ts.map +1 -1
- package/types/server/render-document.d.ts +1 -0
- package/types/server/render-document.d.ts.map +1 -1
- package/types/server/report.d.ts +3 -3
- package/types/server/report.d.ts.map +1 -1
- package/types/server/request-record.d.ts +1 -0
- package/types/server/request-record.d.ts.map +1 -1
- package/types/server/resources.d.ts.map +1 -1
- package/types/server/rooms.d.ts +34 -4
- package/types/server/rooms.d.ts.map +1 -1
- package/types/server/route-settings.d.ts +9 -0
- package/types/server/route-settings.d.ts.map +1 -0
- package/types/server/routes.d.ts +1 -6
- package/types/server/routes.d.ts.map +1 -1
- package/types/server/scope.d.ts +1 -1
- package/types/server/scope.d.ts.map +1 -1
- package/types/server/secret.d.ts +12 -0
- package/types/server/secret.d.ts.map +1 -0
- package/types/server/security.d.ts +4 -5
- package/types/server/security.d.ts.map +1 -1
- package/types/server/seo.d.ts.map +1 -1
- package/types/server/served-paths.d.ts.map +1 -1
- package/types/server/session.d.ts +8 -2
- package/types/server/session.d.ts.map +1 -1
- package/types/server/setup.d.ts.map +1 -1
- package/types/server/signals.d.ts +3 -1
- package/types/server/signals.d.ts.map +1 -1
- package/types/server/signed.d.ts +2 -0
- package/types/server/signed.d.ts.map +1 -1
- package/types/server/sitemap.d.ts +4 -3
- package/types/server/sitemap.d.ts.map +1 -1
- package/types/server/socket.d.ts +51 -0
- package/types/server/socket.d.ts.map +1 -0
- package/types/server/source.d.ts +4 -3
- package/types/server/source.d.ts.map +1 -1
- package/types/server/sqlite-live.d.ts.map +1 -1
- package/types/server/storage.d.ts +10 -2
- package/types/server/storage.d.ts.map +1 -1
- package/types/server/stream.d.ts +3 -3
- package/types/server/stream.d.ts.map +1 -1
- package/types/server/uncaught.d.ts +2 -2
- package/types/server/uncaught.d.ts.map +1 -1
- package/types/server/violations.d.ts +2 -2
- package/types/server/violations.d.ts.map +1 -1
- package/types/server/vitals-server.d.ts.map +1 -1
- package/types/server/vitals.d.ts +1 -0
- package/types/server/vitals.d.ts.map +1 -1
- package/types/server/words.d.ts +3 -0
- package/types/server/words.d.ts.map +1 -1
- package/types/server/work-scope.d.ts +2 -0
- package/types/server/work-scope.d.ts.map +1 -1
- package/types/server/work.d.ts +2 -2
- package/types/server/work.d.ts.map +1 -1
- package/types/server/workers.d.ts.map +1 -1
- package/types/server/workflow.d.ts +4 -5
- package/types/server/workflow.d.ts.map +1 -1
- package/types/server/ws-limits.d.ts +15 -6
- package/types/server/ws-limits.d.ts.map +1 -1
- package/types/test/a11y-dom.d.ts +20 -0
- package/types/test/a11y-dom.d.ts.map +1 -0
- package/types/test/a11y.d.ts +3 -0
- package/types/test/a11y.d.ts.map +1 -0
- package/types/test/browser.d.ts.map +1 -1
- package/types/test/html-snapshot.d.ts +4 -0
- package/types/test/html-snapshot.d.ts.map +1 -0
- package/types/test/index.d.ts +8 -2
- package/types/test/index.d.ts.map +1 -1
- package/types/test/mount.d.ts +3 -0
- package/types/test/mount.d.ts.map +1 -1
- package/types/test/outgoing.d.ts +12 -0
- package/types/test/outgoing.d.ts.map +1 -0
- package/types/test/page-checks.d.ts +6 -0
- package/types/test/page-checks.d.ts.map +1 -0
- package/types/test/page-types.d.ts +2 -0
- package/types/test/page-types.d.ts.map +1 -1
- package/types/test/screenshot-match.d.ts +7 -0
- package/types/test/screenshot-match.d.ts.map +1 -0
- package/types/test/service.d.ts +2 -0
- package/types/test/service.d.ts.map +1 -1
- package/types/test/shared-modules.d.ts.map +1 -1
- package/types/test/site-actions.d.ts +2 -2
- package/types/test/site-actions.d.ts.map +1 -1
- package/types/test/site-keys.d.ts +10 -0
- package/types/test/site-keys.d.ts.map +1 -0
- package/types/test/site-socket.d.ts.map +1 -1
- package/types/test/site-types.d.ts +35 -10
- package/types/test/site-types.d.ts.map +1 -1
- package/types/test/site-world.d.ts +11 -0
- package/types/test/site-world.d.ts.map +1 -0
- package/src/check/local-state.ts +0 -132
- package/src/check/persisted-storage.ts +0 -87
- package/types/check/local-state.d.ts +0 -3
- package/types/check/local-state.d.ts.map +0 -1
- package/types/check/persisted-storage.d.ts +0 -3
- package/types/check/persisted-storage.d.ts.map +0 -1
package/llms/prerendering.md
CHANGED
|
@@ -25,7 +25,7 @@ h1 {post.title}
|
|
|
25
25
|
|
|
26
26
|
```kay
|
|
27
27
|
--- server
|
|
28
|
-
export const page = { prerender: true,
|
|
28
|
+
export const page = { prerender: true, cache: '1h' }
|
|
29
29
|
---
|
|
30
30
|
h1 Blog
|
|
31
31
|
```
|
|
@@ -86,7 +86,7 @@ h1 {post.title}
|
|
|
86
86
|
|
|
87
87
|
#### Revalidating
|
|
88
88
|
|
|
89
|
-
- `
|
|
89
|
+
- `cache: '1h'` beside `prerender` in `page` (`ttl` before 1.105) keeps a prerendered page fresh: once it is older than that, a string such as `'1h'`, the next request still gets it as it is, and starts rendering it again in the background, the way `kay build` does.
|
|
90
90
|
- It also tells a CDN in front how long to keep the page: [a CDN in front](cdn-caching.md).
|
|
91
91
|
- Every request after that render lands gets the new page, with a new ETag and compressed copies.
|
|
92
92
|
- One render runs at a time per path.
|
|
@@ -153,8 +153,8 @@ export const pageWeight: KayExtension = {
|
|
|
153
153
|
- Every compressible file has its `.br` and `.gz` copy beside it, for a server sending them as they are (nginx's `gzip_static`), and asset names carry their hash, so the files of `_kay/` can be cached forever, except `search.json` and `THIRD-PARTY-LICENSES.txt`, which keep their name between builds and must revalidate. A server without brotli (the scaffold's `nginxinc/nginx-unprivileged`) drops the `.br` copies.
|
|
154
154
|
- `_headers` (read by Netlify and Cloudflare Pages) and `headers.nginx.conf` (`add_header` lines for an nginx `include`, without HSTS) hold the security headers a server would send every response, the app's `security` settings applied, `_headers` also the `cache-control` of a page with a `ttl` ([a CDN in front](cdn-caching.md)). A page's own `security` setting is not carried (the build warns naming those routes), nor is the CSP report endpoint of `reports: true`, and a `public/_headers` keeps its rules, kay's block following them without a header the file names. The scaffold's Dockerfile moves the include to `/etc/nginx/kay-headers.conf`, and its `nginx.conf` includes it at server level and in every `location` with an `add_header` of its own, as nginx drops the inherited ones there.
|
|
155
155
|
- Imported images link the variants the build writes, `/_kay/images/hero-640.webp`, `hero-640-16x9.webp` cut, `hero-96.webp` for a width under 320 a page asks for and `hero-card.jpg` for the share card, since no image route answers.
|
|
156
|
-
- An image from `images.dirs` is not exported, and one from `images.remote` is downloaded by the build, its variants written as `/_kay/images/remote-<hash of its URL>-640.webp`, the build failing if the host does not answer.
|
|
156
|
+
- An image from `assets.images.dirs` is not exported, and one from `assets.images.remote` is downloaded by the build, its variants written as `/_kay/images/remote-<hash of its URL>-640.webp`, the build failing if the host does not answer.
|
|
157
157
|
- A redirect without params becomes a page sending the browser on with `<meta http-equiv="refresh">`; every redirect also goes to `_redirects`, read by hosts such as Netlify and Cloudflare Pages.
|
|
158
|
-
- With `i18n.
|
|
158
|
+
- With `i18n.mode: 'always'`, each unprefixed path sends the browser to the default locale's copy.
|
|
159
159
|
- Locales by domain need a server.
|
|
160
160
|
- The directory is cleared first, only when the last export wrote it: kay refuses one holding other files, and the project itself.
|
package/llms/privacy.md
CHANGED
|
@@ -41,7 +41,7 @@ For a script that needs the visitor's browser, such as a tracker that sets cooki
|
|
|
41
41
|
---
|
|
42
42
|
import { persisted, effect } from 'kay'
|
|
43
43
|
|
|
44
|
-
const consent = persisted('consent', '')
|
|
44
|
+
const consent = persisted.cookie('consent', '')
|
|
45
45
|
|
|
46
46
|
effect(() => {
|
|
47
47
|
if (consent() === 'yes')
|
|
@@ -112,7 +112,7 @@ export async function archive(scan: File) {
|
|
|
112
112
|
- `theme` (kayjs-ui `ThemeToggle`, `themeMode`, `scheme`, or the name given to their `cookie`): `system`, `light` or `dark`, readable by scripts so the server renders the scheme the visitor picked; a preference, so necessary, a year.
|
|
113
113
|
- `kay_push_device` (`push()`): a hash naming the push subscription this browser made, `httpOnly`, set when it subscribes, so sign-out drops that device alone; necessary, a year.
|
|
114
114
|
- `kay_local_clear` (`local()`): a random value at sign-out, or at sign-in a hash of the person's id (kayjs-auth, or `forgetLocalMirrors(request, person)`), readable by scripts, derived from the app's secret; the next page using a collection empties the browser's mirror and queue when it changed, which another person's sign-in does and a sign-in again by the same person does not, so after a session expires the mirror stays readable on that browser until the next sign-in; necessary, a year, names no one.
|
|
115
|
-
- Each `persisted(name, ...)` signal keeps its value in a cookie of that name for a year, or its `maxAge`, or in `localStorage` (`persisted.local()`) or `sessionStorage` (`persisted.session()`, dropped when the tab closes); what it holds is the app's choice, so a preference is necessary and anything else waits for consent.
|
|
115
|
+
- Each `persisted.cookie(name, ...)` signal keeps its value in a cookie of that name for a year, or its `maxAge`, or in `localStorage` (`persisted.local()`) or `sessionStorage` (`persisted.session()`, dropped when the tab closes); what it holds is the app's choice, so a preference is necessary and anything else waits for consent.
|
|
116
116
|
|
|
117
117
|
### Browser storage
|
|
118
118
|
|
|
@@ -129,7 +129,7 @@ export async function archive(scan: File) {
|
|
|
129
129
|
- `sessionStorage` under the `remember` key of kayjs-ai's `Chat` and `ChatLauncher` (none unless named): the conversation's text, up to 200,000 characters, what the visitor wrote included; the tab's life, nothing without `remember`.
|
|
130
130
|
- `localStorage` `kai:chat-conversation:<action URL>` (kayjs-ai's `ChatLauncher` with `keepOnServer` or `conversations`, or a `Chat` with `conversationIn="browser"`): the id of the conversation shown, which reads nothing without the visitor's session; necessary, until a new conversation.
|
|
131
131
|
- `localStorage` under the `listWidthKey` of kayjs-ui's `SplitLayout` (none unless named): the list's width, a preference.
|
|
132
|
-
- With `offline`, the service worker and its Cache Storage `kay-w<version>`: the pages `offline.pages` names (the public prerendered ones by default) and the files, and the public pages and files it fetched later that answered 200 without `private` or `no-store`; each copy changes with the build and the cache stays until `offline` is turned off or the worker's version changes. A page of `offline.pages` that holds a visitor's render is kept as it was served, so list only public ones.
|
|
132
|
+
- With `offline`, the service worker and its Cache Storage `kay-w<version>`: the pages `client.offline.pages` names (the public prerendered ones by default) and the files, and the public pages and files it fetched later that answered 200 without `private` or `no-store`; each copy changes with the build and the cache stays until `offline` is turned off or the worker's version changes. A page of `offline.pages` that holds a visitor's render is kept as it was served, so list only public ones.
|
|
133
133
|
|
|
134
134
|
### What the server keeps
|
|
135
135
|
|
|
@@ -143,7 +143,7 @@ export async function archive(scan: File) {
|
|
|
143
143
|
- A queue keeps a waiting job's payload until it runs and a failed one's for `failedTtl`, 30 days by default from when its last attempt was due, or for good with `false`.
|
|
144
144
|
- `queue.remove(id)` removes one job, and `queue.remove(match)` every waiting or failed job whose payload `match` returns true for, resolving with how many went; an app's own `JobStore` takes a function only when it has `jobs(queue)`.
|
|
145
145
|
- kayjs-mail keeps an address that bounced or complained, with the reason, where it was reported and when, in `kay_mail_suppressions` until `mail.unsuppress(address)` or `mail.erase(address)`, so a person's address is not mailed again; it is the record of that refusal, kept as long as the address could be mailed.
|
|
146
|
-
- kayjs-mail's mailing lists keep each subscriber's address, language, confirmation date and the proof of consent (the page of the form and the id of the notice it showed) in `data/
|
|
146
|
+
- kayjs-mail's mailing lists keep each subscriber's address, language, confirmation date and the proof of consent (the page of the form and the id of the notice it showed) in the app's database (else `data/app.sqlite`) until they unsubscribe or `mail.erase(address)` (which also removes the mails queued for it); an address nobody confirmed is dropped after 7 days, a broadcast and its deliveries (random ids, no address) 30 days after it finished.
|
|
147
147
|
- Notifications (`notify()`, [Notifications](notifications.md)) live 90 days, or the `ttl` given, in `store.notifications` (memory without a store), the newest 200 per user; `notifications.erase(userId)` deletes a person's, and the devices they subscribed to push in `store.push` (`push()`, [Notifications](notifications.md#push-to-a-persons-devices)), kept until no push reaches one for 180 days (`push({ keep })`); kayjs-auth's account export lists them.
|
|
148
148
|
- The paths a production server counted 404s at (in the app's `store` database, SQLite or Postgres, else `data/not-found.sqlite`) are forgotten 90 days after the last visit, with their referrers, checked on opening, with the writes and every hour by a timer, so a log nobody adds to is swept too; the redirects stored beside them stay.
|
|
149
149
|
- `sqliteRooms` from `kay/server` keeps a room's messages 30 seconds, for the processes sharing it to read.
|
package/llms/production.md
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
### Log requests as JSON for a log collector
|
|
6
6
|
|
|
7
|
-
`observe: { log: 'json' }` in kay.config.ts writes one JSON object per line, requests included, on stdout for info and on stderr for warnings and errors:
|
|
7
|
+
`ops: { observe: { log: { format: 'json' } } }` in kay.config.ts writes one JSON object per line, requests included, on stdout for info and on stderr for warnings and errors; `log: { sink }` hands each entry to a function instead, and `requests: false` keeps kay's messages and logs no request line (`log: 'json'` and a bare function work until 1.108, `deprecated-app-hooks` rewrites them):
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
10
|
import { defineConfig } from 'kay/server'
|
|
11
11
|
|
|
12
12
|
export default defineConfig({
|
|
13
|
-
observe: { log: 'json' },
|
|
13
|
+
ops: { observe: { log: { format: 'json' } } },
|
|
14
14
|
})
|
|
15
15
|
```
|
|
16
16
|
|
|
@@ -30,13 +30,14 @@ log.error('failed', new Error('refused'))
|
|
|
30
30
|
|
|
31
31
|
### Check the database in the health route
|
|
32
32
|
|
|
33
|
-
`health` moves the route and adds a check, which answers 503 when it returns `false`, throws or takes over 5 s, or when the `ping` of a store ([Stores](stores.md)) rejects, and runs at most once every 3 s, probes between sharing its answer, which `timeout` changes (`health: { timeout: '10s' }`, a duration such as `'250ms'`, which `./server --health` and the build's check of the executable wait for too, though the Dockerfile `kay new` writes cuts a probe off at 6 s: raise its `--timeout` with it):
|
|
33
|
+
`ops.health` moves the route and adds a check, which answers 503 when it returns `false`, throws or takes over 5 s, or when the `ping` of a store ([Stores](stores.md)) rejects, and runs at most once every 3 s, probes between sharing its answer, which `timeout` changes (`ops: { health: { timeout: '10s' } }`, a duration such as `'250ms'`, which `./server --health` and the build's check of the executable wait for too, though the Dockerfile `kay new` writes cuts a probe off at 6 s: raise its `--timeout` with it):
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
36
|
import { defineConfig } from 'kay/server'
|
|
37
37
|
|
|
38
38
|
export default defineConfig({
|
|
39
|
-
|
|
39
|
+
endpoints: { health: '/up' },
|
|
40
|
+
ops: { health: { check: async () => await db.ping() } },
|
|
40
41
|
})
|
|
41
42
|
```
|
|
42
43
|
|
|
@@ -65,24 +66,24 @@ kay build --compile server --verify
|
|
|
65
66
|
- A failed verify writes no record of the executable, so `kay start` runs the entry instead.
|
|
66
67
|
- The server runs in a process group of its own and everything it started is stopped with it. On Linux an answer only counts when the listening socket belongs to the server or a process it started, so another process holding the port cannot pass the verify; where /proc cannot be read, the check is left out. An interrupted build stops the server too.
|
|
67
68
|
- It costs the server's startup plus 250 ms, usually well under a second, and `--format json` carries it as `compiled.verifiedMs`.
|
|
68
|
-
- `health: false` leaves no route to ask, so any answer on the port counts and `--health` is not run.
|
|
69
|
+
- `ops: { health: false }` leaves no route to ask, so any answer on the port counts and `--health` is not run.
|
|
69
70
|
|
|
70
71
|
### Set a library's secrets
|
|
71
72
|
|
|
72
73
|
- A provider key, kayjs-ai's `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`, or the password in kayjs-mail's `MAIL_URL`, is a production secret: an environment variable of the container or a `.env` beside the executable, never in the image or the repository.
|
|
73
|
-
- `kay env` lists what each library in `extensions` reads and which of it production requires, such as `AI_MODEL`; `
|
|
74
|
+
- `kay env` lists what each library in `extensions` reads and which of it production requires, such as `AI_MODEL`; `envFiles: { compose, example }` in kay.config.ts has `kay check` compare it with the compose file and `.env.example` ([Server](server.md)).
|
|
74
75
|
|
|
75
76
|
### Run a job on a schedule
|
|
76
77
|
|
|
77
|
-
`schedule` from `kay/server` is an Elysia plugin taking
|
|
78
|
+
`schedule` from `kay/server` is an Elysia plugin taking `{ cron }` or `{ every }` and the job, and runs in the server's process:
|
|
78
79
|
|
|
79
80
|
```ts
|
|
80
81
|
import { Elysia } from 'elysia'
|
|
81
82
|
import { pages, schedule } from 'kay/server'
|
|
82
83
|
|
|
83
84
|
new Elysia()
|
|
84
|
-
.use(schedule('30 2 * * MON',
|
|
85
|
-
.use(schedule('30s', collectMetrics))
|
|
85
|
+
.use(schedule({ cron: '30 2 * * MON', timeZone: 'Europe/Paris' }, sendWeeklyReport))
|
|
86
|
+
.use(schedule({ every: '30s' }, collectMetrics))
|
|
86
87
|
.use(await pages())
|
|
87
88
|
```
|
|
88
89
|
|
|
@@ -91,7 +92,7 @@ new Elysia()
|
|
|
91
92
|
A `queue` runs its jobs in the background, after a restart or a deploy if need be, and an action enqueues one and goes on:
|
|
92
93
|
|
|
93
94
|
```ts
|
|
94
|
-
// src/
|
|
95
|
+
// src/jobs/mail.ts: every queue, workflow and schedule a file of src/jobs exports is mounted
|
|
95
96
|
import { queue } from 'kay/server'
|
|
96
97
|
|
|
97
98
|
export const welcomeMails = queue(
|
|
@@ -99,8 +100,6 @@ export const welcomeMails = queue(
|
|
|
99
100
|
async ({ to }: { to: string }) => sendWelcome(to),
|
|
100
101
|
{ attempts: 5, backoff: '30s' },
|
|
101
102
|
)
|
|
102
|
-
|
|
103
|
-
export default welcomeMails
|
|
104
103
|
```
|
|
105
104
|
|
|
106
105
|
Then `await welcomeMails.enqueue({ to: email })` in an action, or `enqueue(payload, { delay: '1h' })` to run it later., and more in [Queues](queues.md).
|
|
@@ -113,8 +112,8 @@ Then `await welcomeMails.enqueue({ to: email })` in an action, or `enqueue(paylo
|
|
|
113
112
|
- A server started with no NODE_ENV warns as it boots, as it then bundles its browser code at boot and Elysia answers a request refused before kay's own check, such as a response failing its schema, with the schema it failed: set NODE_ENV=production where the app is deployed.
|
|
114
113
|
- With NODE_ENV=production, a server's first line, once it listens, says where it listens and what runs: `kay: listening on http://localhost:3000, kay 1.30.0 in production, 12 pages prerendered`.
|
|
115
114
|
- Then every request kay or the app's routes registered after `.use(await pages())` answer is logged to stdout as one line: `GET /blog/hello 200 12ms AZnLe0vUe9qD0uXq9vLwZw`, the method, the path without its query string, which may carry tokens, the status, the milliseconds until the response was made, a streamed one's headers, and the request's id.
|
|
116
|
-
- kay's own `/_kay/` routes, assets included (an extension's API modules served there, kayjs-cms's `/_kay/cms`, are logged), and the health route, wherever `health
|
|
117
|
-
- `true` in kay.config.ts's `observe.log` logs them outside production too, `false` never.
|
|
115
|
+
- kay's own `/_kay/` routes, assets included (an extension's API modules served there, kayjs-cms's `/_kay/cms`, are logged, and so is the MCP endpoint), and the health route, wherever `endpoints.health` puts it, are left out.
|
|
116
|
+
- `true` in kay.config.ts's `ops.observe.log` logs them outside production too, `false` never.
|
|
118
117
|
- kay's own messages, an error it caught, a warning about the app, a shutdown notice, go out in any mode, as `kay: ` and the message, an error's source-mapped stack on the lines below.
|
|
119
118
|
- `log` sets the format of both: `'json'` writes one JSON object per line for a log collector, on stdout for info and on stderr for warnings and errors, and a function receives each entry instead, typed `LogEntry` from `kay/server`:
|
|
120
119
|
- a request, `{ type: 'request', time, level: 'info', method, path, status, duration, id }`;
|
|
@@ -126,20 +125,11 @@ Then `await welcomeMails.enqueue({ to: email })` in an action, or `enqueue(paylo
|
|
|
126
125
|
- An error logged while answering a request is headed by the request, `kay: GET /blog/hello, request AZnLe0vUe9qD0uXq9vLwZw`, then its stack, so a line from a user or a log search finds both.
|
|
127
126
|
- `requestId(request)` from `kay/server` gives it, in `onError` or a route, and a server span carries it as `kay.request.id` ([Tracing](tracing.md)).
|
|
128
127
|
|
|
129
|
-
### Metrics for a collector
|
|
130
|
-
|
|
131
|
-
- `metrics: true` in kay.config.ts serves `/metrics` in the Prometheus text format, for Prometheus or any compatible collector (Grafana Alloy, the OpenTelemetry collector's Prometheus receiver): `metrics: { path: '/_internal/metrics' }` moves it. It is off by default, and a server run by `kay dev` or a static export serves none.
|
|
132
|
-
- It holds `kay_http_requests_total{method,route,status}` and the histogram `kay_http_request_duration_seconds{method,route}`, `kay_queue_runs_total{queue,result}` (`ok`, `retried`, `failed`; a workflow is `workflow:<name>`), `kay_job_runs_total{schedule,result}` (`ok`, `failed`, `skipped` when another process held the lock), `kay_session_events_total{event}` (`created`, `destroyed`), `kay_file_events_total{event}` (`written`, `deleted`), `kay_cache_reads_total{result}` (`hit` or `miss` of `cached` and `cache`), `kay_live_connections`, `kay_process_resident_memory_bytes` and `kay_process_uptime_seconds`.
|
|
133
|
-
- A page counts under its pattern, `/shop/:item`, an API route under its route, and a path nothing serves under `unmatched`, so a scan adds no series; at most 500 routes are kept, the rest read `other`. The scrape itself and the health route are not counted, nor a request an earlier hook answers (a redirect, a refusal by `proxy.key`), and a method no server knows reads `OTHER`.
|
|
134
|
-
- It is never public by default: only a request that reached the socket from this machine or a private network (a collector in the same compose network, a sidecar) and carries no `X-Forwarded-*`, `X-Real-IP`, `Forwarded`, `Via` or `CF-Connecting-IP` header, nor the headers `proxy.header` and `proxy.key` name, is answered; every other gets 403, a trailing slash, a query or the `base` in the path included. Do not forward the path from the reverse proxy: one that adds none of those headers cannot be told from a collector.
|
|
135
|
-
- With `KAY_METRICS_TOKEN` set, only a request with `Authorization: Bearer <token>` is answered, from any address, for a collector reaching the server across networks. With no token the boot always logs a warning, as any peer on a private network reads the metrics, and a proxy on this host that forwards the path unmarked reads as a collector. `kay routes` lists the route and `kay env` the variable.
|
|
136
|
-
- `proxy.key` lets a request on this path past the key, as it does the health route, since the collector does not go through the proxy; the rules above still apply. An app file or page at `/metrics` keeps the path, and kay serves none there.
|
|
137
|
-
|
|
138
128
|
### Health and shutdown
|
|
139
129
|
|
|
140
130
|
- `/_kay/health` answers `200 ok` while the server takes requests, for a load balancer or a container's health check.
|
|
141
|
-
- `
|
|
142
|
-
- `health: false` leaves the route out.
|
|
131
|
+
- `endpoints: { health: '/up' }` in kay.config.ts moves it, and `ops: { health: { check: async () => await db.ping() } }` adds a check: one returning `false`, throwing, or taking over 5 s answers 503, the error logged.
|
|
132
|
+
- `ops: { health: false }` leaves the route out.
|
|
143
133
|
- An executable `kay build --compile` made checks a server it started, rather than starting one, when run as `./server --health`: it exits with 0 when the health route on `PORT`, 3000 by default, at `HOST` when it names an address and on loopback otherwise, answers 200, else 1, for a container image with no curl: `HEALTHCHECK CMD ["./server", "--health"]`.
|
|
144
134
|
- On SIGTERM, SIGINT or SIGHUP, a server that listens stops taking connections, lets open requests finish, ends every open event stream (live values, presence, `stream()`) and, once no request is left, every websocket (close code 1001), so browsers reconnect to the next instance, then runs the app's `onStop` hooks, each given `serve.shutdownTimeout` at most, and exits with 0. A queue handler or schedule ignoring its signal is given 3 seconds (at most 40% of `serve.shutdownTimeout`), all of them together, then its job is handed back untouched, and the `store` config's `rooms` store is closed so a stopped replica leaves no member behind (a store given only to `rooms({ store })` is not).
|
|
145
135
|
- New connections are refused from the signal on, so a load balancer stops sending any; a client on a connection kept alive gets 503 from the health route meanwhile.
|
|
@@ -149,11 +139,11 @@ Then `await welcomeMails.enqueue({ to: email })` in an action, or `enqueue(paylo
|
|
|
149
139
|
### Request timeouts
|
|
150
140
|
|
|
151
141
|
- `serve: { timeout: '15s' }` in kay.config.ts holds every page, action, `api()` route and endpoint to that time; none by default. A hung database call otherwise keeps its request, and the connection, until the client leaves.
|
|
152
|
-
- Past it a page answers 504 through the nearest `_error.kay` (`ctx.error.status` is 504), an action call fails with 504 and the message `kay.action.timeout`, an API route or endpoint answers `504 Gateway Timeout` as text. It is logged and handed to `
|
|
142
|
+
- Past it a page answers 504 through the nearest `_error.kay` (`ctx.error.status` is 504), an action call fails with 504 and the message `kay.action.timeout`, an API route or endpoint answers `504 Gateway Timeout` as text. It is logged and handed to `onError` as a `RequestTimeoutError` from `kay/server`.
|
|
153
143
|
- `ctx.signal` is on the page, guard, endpoint and action contexts, and aborts at the timeout and when the client leaves; pass it to `fetch`, a database call or anything that takes a signal, so the work stops with the request. An `api()` route reads it as `request.signal`, which aborts at the timeout too (only under a timeout).
|
|
154
144
|
- A page sets its own in `export const page = { timeout: '30s' }` (the innermost layout or page wins), an `api({ timeout })` module and an action's options likewise, one route of an API module as `detail: { timeout }`; `false` is none.
|
|
155
145
|
- The clock counts from the request's arrival. Work that cannot be stopped, a handler ignoring the signal, goes on after the 504. A streamed page whose headers went out is cut at the time: the body ends with an error, the status stays 200, and the timeout is reported. An API route that returns a stream or a generator is not cut, nor an event stream.
|
|
156
|
-
- A job has no request, so no `ctx.signal`: a `
|
|
146
|
+
- A job has no request, so no `ctx.signal`: a job's `ctx.signal` aborts at its `timeout` and as the server stops (see [Queues](queues.md)).
|
|
157
147
|
|
|
158
148
|
### A deploy under open tabs
|
|
159
149
|
|
|
@@ -170,17 +160,17 @@ Then `await welcomeMails.enqueue({ to: email })` in an action, or `enqueue(paylo
|
|
|
170
160
|
|
|
171
161
|
### Background jobs
|
|
172
162
|
|
|
173
|
-
- `schedule(cron, job)` and `background(work)` from `kay/server` are Elysia plugins, so a job runs in the server's process, from the server listening to its stopping, once across the processes sharing the job store in production, else once per process:
|
|
163
|
+
- `schedule({ cron }, job)` and `background(work)` from `kay/server` are Elysia plugins, so a job runs in the server's process, from the server listening to its stopping, once across the processes sharing the job store in production, else once per process:
|
|
174
164
|
|
|
175
165
|
```ts
|
|
176
166
|
import { Elysia } from 'elysia'
|
|
177
167
|
import { background, pages, schedule } from 'kay/server'
|
|
178
168
|
|
|
179
169
|
new Elysia()
|
|
180
|
-
.use(schedule('@hourly', async () => purgeExpiredCarts()))
|
|
181
|
-
.use(schedule('30 2 * * MON',
|
|
182
|
-
.use(schedule('30s', collectMetrics))
|
|
183
|
-
.use(background(async (signal) => {
|
|
170
|
+
.use(schedule({ cron: '@hourly' }, async () => purgeExpiredCarts()))
|
|
171
|
+
.use(schedule({ cron: '30 2 * * MON', timeZone: 'Europe/Paris' }, sendWeeklyReport))
|
|
172
|
+
.use(schedule({ every: '30s' }, collectMetrics))
|
|
173
|
+
.use(background(async (_, { signal }) => {
|
|
184
174
|
while (!signal.aborted)
|
|
185
175
|
await handleNextEmail(signal)
|
|
186
176
|
}))
|
|
@@ -191,7 +181,7 @@ new Elysia()
|
|
|
191
181
|
- A literal one with another number of fields, an unknown nickname or a day its month never has, `0 0 30 2 *`, is a type error; a computed one it cannot read, or that never comes, fails the boot.
|
|
192
182
|
- Runs never overlap: the next is planned once the last settles.
|
|
193
183
|
- A run that throws is logged and the next one comes as planned.
|
|
194
|
-
- `schedule('30s', job)` runs every so long in place of a cron, at the multiples of that length since the epoch, `'1h'` on the hour and `'1d'` at UTC midnight, so it takes no `timeZone`; a run outlasting its length skips the runs it overlaps.
|
|
184
|
+
- `schedule({ every: '30s' }, job)` runs every so long in place of a cron, at the multiples of that length since the epoch, `'1h'` on the hour and `'1d'` at UTC midnight, so it takes no `timeZone`; a run outlasting its length skips the runs it overlaps.
|
|
195
185
|
- A length that is not positive is a type error, or fails the boot when computed.
|
|
196
186
|
- `lock`, `store`, the overlap and the shutdown work as for a cron. `lock` is not a `key` of `enqueue()` or `start()`: it is taken afresh for each time the schedule falls due, one process runs it, and it takes `false`, where a `key` makes a repeated start a no-op while it lives.
|
|
197
187
|
- `background` starts `work` with the server, for a queue consumer or anything else that runs the whole time.
|
|
@@ -200,11 +190,11 @@ new Elysia()
|
|
|
200
190
|
- Stopping on a signal waits for a scheduled run in progress, and for every `onStop` hook the app registers, async ones included, in turn, the `onStop` key of `kay.config.ts` after the plugins' own.
|
|
201
191
|
- `shutdown(app)` from `kay/server` stops a server the same way, as a test does; Elysia's own `app.stop()` does not wait for the hooks.
|
|
202
192
|
- A production server (`NODE_ENV=production`) locks every schedule by default, named `auto:<schedule>:<hash of the job's source>` (a twin with the same schedule and source takes `#2` by start order, which every process of one app shares), so each run happens once across processes sharing the store; a dev or test server runs each schedule in every process. `lock: false` opts out. If the store cannot give that default lock, one warning is logged and the run goes on unlocked, once per process; a `lock` the app named skips the run instead.
|
|
203
|
-
- A run still going after `timeout` (`'10m'` by default, `false` for none) is logged as failed and left, so it no longer blocks the next run; a stop aborts the signal and waits at most 3 s (less with a short `serve.shutdownTimeout`) for a run ignoring it, without reporting it.
|
|
204
|
-
- `schedule(cron, [jobA, jobB])` gives each job of the list that schedule, and `schedule({ '* * * * *': [jobA, jobB], '@hourly': jobC, '30s': jobD }, options)` several schedules at once, each key checked as a literal schedule is and `timeZone` read by the crons alone, all in one plugin: with several jobs, `lock` names each `<lock>:<its schedule>:<its place in that schedule's list>`, `report:@hourly:0`.
|
|
205
|
-
- `schedule(cron,
|
|
206
|
-
- `schedule(cron,
|
|
193
|
+
- A run still going after `timeout` (`'10m'` by default, `false` for none) is logged as failed and left, so it no longer blocks the next run; a stop aborts the signal and waits at most 3 s (less with a short `serve.shutdownTimeout`) for a run ignoring it, without reporting it. A job is `(run, ctx)`, as every job is `(input, ctx)`: `run` is `{ schedule, boot }`, and `ctx.signal` aborts at the timeout and as the server stops, beside `ctx.job`, `ctx.log` and `ctx.locale`; `background(work)` gets `(undefined, ctx)`. The lock name hashes the job's source, so during a rolling deploy old and new builds with changed jobs both run.
|
|
194
|
+
- `schedule({ cron }, [jobA, jobB])` gives each job of the list that schedule, and `schedule({ '* * * * *': [jobA, jobB], '@hourly': jobC, '30s': jobD }, options)` several schedules at once, each key checked as a literal schedule is and `timeZone` read by the crons alone, all in one plugin: with several jobs, `lock` names each `<lock>:<its schedule>:<its place in that schedule's list>`, `report:@hourly:0`.
|
|
195
|
+
- `schedule({ cron, boot: true }, job)` runs the jobs once as the server starts too, the first scheduled run waiting for it and a stop too, so a job needing a first run does not start itself by hand; processes starting within the same minute (the schedule's length if shorter) run it once, two either side of the boundary possibly twice (it takes the lock `<lock>:boot` for a slot of a minute at most, a skipped one is logged), while a restart minutes later runs it again, each restart of `kay dev`, `kay render` and `--verify` included.
|
|
196
|
+
- `schedule({ cron, lock: 'weekly-report' }, job)` runs each time once across every process sharing the job store ([Queues](queues.md)), the first to reach it taking it; `store` names another store than the default one.
|
|
207
197
|
- The upkeep kay and its libraries run on a timer (expired sessions and notifications on Postgres, kayjs-auth's prune, kayjs-mail's list sweep, kayjs-cms's history sweep) goes through the same lock, signal and stop handling as a schedule, so with several processes behind one database each pass runs once; it counts in `kay_job_runs_total` as `maintenance:<name>`, shows under Maintenance in the dev tool's Jobs tab, ends with the server, and a test's `runJobs()` waits for a pass going. `KAY_LOCK_SCHEDULES=false` turns its lock off as it does a schedule's. Upkeep of a file on one host (the sqlite session and notification stores) and the caches each process keeps (image variants, loader watchers) stay per process.
|
|
208
|
-
- `KAY_LOCK_SCHEDULES=false` makes `lock: false` the default of every schedule, for an app running one process; a `lock` it names still locks. `
|
|
198
|
+
- `KAY_LOCK_SCHEDULES=false` makes `lock: false` the default of every schedule, for an app running one process; a `lock` it names still locks. `enabled: false` in the options of a schedule, `background`, `queue` or `workflow` starts nothing, so `enabled: env.ZIGBEE_URL !== undefined` switches a job on its setting with no conditional plugin.
|
|
209
199
|
|
|
210
200
|
The queue, its stores and its retries are in [Queues](queues.md).
|
|
@@ -46,7 +46,7 @@ kay generate resource post title:string body:text published:boolean
|
|
|
46
46
|
- `server`, the default, is an Elysia server, with a `Dockerfile` and `compose.prod.yaml` running the executable `bun run compile` makes; the compose requires `SITE_URL`, which `.env.example` lists.
|
|
47
47
|
- `site` is a static site whose `bun run build` runs `kay build --static`, with a Forgejo Pages workflow publishing `dist` to the `gitea-pages` branch under `/<owner>/<repo>`, its `SITE_URL` the forge's own address until a repository variable named `SITE_URL` gives the host the Forgejo instance publishes Pages on (`--forge github`: a workflow deploying `dist` with GitHub Pages, `SITE_URL` and `SITE_BASE` read from the repository), and a `Dockerfile` serving it with `nginxinc/nginx-unprivileged` on port 8080 instead.
|
|
48
48
|
- `app` is the server with kayjs-auth as `kay add auth` writes it (`auth({ name })` and `ui()` in `kay.config.ts`, a root `src/routes/_guard.ts` exporting kayjs-auth's `authGuard()` to put every page behind sign-in, and no `src/auth.ts`), an API module and an island over its websocket, its session secret written to a `.env` git ignores, `.env.test` holding a test-only secret, and `.env.example` naming what production sets (`SESSION_SECRET`, `SITE_URL`);
|
|
49
|
-
- The default `app` needs Bun alone: kayjs-auth keeps its users in `data/
|
|
49
|
+
- The default `app` needs Bun alone: kayjs-auth keeps its users in `data/app.sqlite` and creates its tables when the app starts, `data` is ignored by git and docker, and `compose.prod.yaml` bind-mounts `data-prod`, a git- and docker-ignored folder to create owned by `nobody` (uid 65534), the user the image runs as, at `/app/data`, with no database service and no migration;
|
|
50
50
|
- `--with postgres` (with `auth`, as in `--template app --with postgres`) swaps SQLite for Postgres: `src/db/tables.ts` lists `...authTables` among the tables, which `src/db/index.ts` builds `db` over and `pg-orm.config.ts` imports on their own, so the test preload points `DATABASE_URL` at its copy before anything builds `db`, `docker compose up -d --wait` starts the database `compose.dev.yaml` describes (on a port of its own per app name, its data in the git-ignored `data/postgres`), `bun run db:generate` writes the first migration for kayjs-auth's tables as the installed version declares them (and the next ones for yours), `bun run db:migrate` applies `migrations/`, its `bun run test` gives each test file a copy of the migrated database (see [Testing](testing.md)), its workflow runs Postgres as a service, and `compose.prod.yaml` runs the database (its data in `data-prod/postgres`, to create owned by the image's postgres uid 70) and a one-shot service applying the migrations before the app. Two Postgres roles split the work: the owner (`POSTGRES_USER`, connected by `MIGRATE_DATABASE_URL`, which `pg-orm.config.ts` reads before `DATABASE_URL`) changes the schema, and `app_rw` (the app's `DATABASE_URL`, password `APP_DB_PASSWORD`) reads and writes rows and cannot drop, alter or create anything. The database image creates `app_rw` from `db/roles.sh` when it first creates the database, with default privileges on tables, sequences and schemas, so a table a later migration creates needs no `GRANT`. An existing database runs `db/roles.sh` once, see [Upgrading](upgrading.md);
|
|
51
51
|
- Every server preset's compose publishes the app on 127.0.0.1 alone, for a reverse proxy serving it over HTTPS, and its `kay.config.ts` sets `proxy: true` so rate limits count the visitor and not the proxy, its images and workflow use the Bun `kay new` ran under, and `.env` is ignored by git and docker and written readable by its owner alone;
|
|
52
52
|
- `--kay` sets the `kay` dependency, by default `npm:@kayjs/kay@~<its version>`, or a packed copy when run from a checkout of kay.
|
|
@@ -62,6 +62,6 @@ kay generate resource post title:string body:text published:boolean
|
|
|
62
62
|
- What it writes passes `kay check` and the lint. `--dry-run` lists the files and writes none, and `--format json` prints `{ kind, name, written, dryRun }`.
|
|
63
63
|
- `kay add <features> [dir] [--no-install] [--dry-run] [--format text|json] [--quiet]`:
|
|
64
64
|
- Applies `kay new` features, comma-separated, to the project in `dir` (the current directory by default): the files and edits `kay new --with` would have made, then `bun install`.
|
|
65
|
-
- The features the project holds are read off its files. A feature missing what it needs is refused naming the command that adds them together (`kay add server,ws`); `kay add postgres` on a project without kayjs-auth plans it too, `kay add auth,postgres` writes both in one run, and `postgres` over an app whose `data/auth.db` exists stops there, as that file holds the users.
|
|
65
|
+
- The features the project holds are read off its files. A feature missing what it needs is refused naming the command that adds them together (`kay add server,ws`); `kay add postgres` on a project without kayjs-auth plans it too, `kay add auth,postgres` writes both in one run, and `postgres` over an app whose `data/app.sqlite`, `data/auth.sqlite` or `data/auth.db` exists stops there, as that file holds the users.
|
|
66
66
|
- It writes only when every file has the shape `kay new` writes: a file both feature sets write differently (`_layout.kay`, `bunfig.toml`, `kay.config.ts`) is replaced while it is still what `kay new` wrote, `package.json` gets the scripts and dependencies it lacks (a script is replaced only while it is still the generated one), `.gitignore`, `.dockerignore` and `.env` get the lines or keys they lack, and `AGENTS.md` is left once edited; a deleted file is not written back and is named in the output. The CI workflow follows the `origin` remote (`.github` for GitHub, `.forgejo` otherwise), else the folder the project has, and the runner label is the one its workflow already runs on. Any other file, or a file that exists with other content, stops it with `kay add: nothing was written` and the lines to remove (`-`) and add (`+`) by hand.
|
|
67
67
|
- `ai`, `mail`, `cms`, `ui` and `auth` are features of kay's libraries (`auth` is kayjs-auth, which `kay new --with auth` writes the same files for; `kay new --with ai,mail,cms` runs this same step after scaffolding): it adds `@kayjs/ai`, `@kayjs/mail`, `@kayjs/cms`, `@kayjs/ui` or `@kayjs/auth` (the last two with `@iconify-json/tabler`, kayjs-auth with `@kaynooo/pg-orm` and kayjs-ui) at kay's own minor, then writes what the package's `add` export says (`{ description, files?, edits?, env?, example?, ignore?, extension?: { import, expression }, notes? }`, or a function of the project returning it) and adds the extension to `extensions` in `kay.config.ts`, which needs a plain `defineConfig({ ... })`. `ui` needs `tailwind` and `auth` needs `server` and `tailwind`, refused like a core feature; `kay add ui` writes only `ui()`, or in a static site the `@kayjs/ui/theme.css` import in `src/app.css` (see [Extensions](component-libraries.md#extensions)), and `kay add auth` writes `auth({ name })` in `kay.config.ts` (no `src/auth.ts`: the mailer of `src/mail.ts`, themed when `mail()` is registered, is found by `auth()`; over the app's pg-orm `Database` it adds `store: async () => pgAuth(...)` and `...authTables` to its `tables`, else users live in SQLite, `AUTH_DATABASE_URL` in `.env.example`; `.gitignore` is created when absent and `data` is added unless `/data` or `data/` is there), `src/routes/_guard.ts` exporting `authGuard()` from kayjs-auth to guard every page, `ui()`, and `KAY_SECRET` and `SITE_URL` in `.env.example`. The import goes where the app's `perfectionist/sort-imports` puts it (groups, then natural order), so a config with sorted imports passes `kay lint` with no fixer run.
|
package/llms/project.md
CHANGED
|
@@ -52,7 +52,7 @@ kay migrate astro ../my-astro-site --outdir ../my-kay-site
|
|
|
52
52
|
### Project setup
|
|
53
53
|
|
|
54
54
|
- kay is published as `@kayjs/kay` to npm, and as a mirror to the Forgejo registry at `https://git.kaynooo.fr/api/packages/kaynooo/npm/`, its libraries as `@kayjs/ui`, `@kayjs/auth`, `@kayjs/mail`, `@kayjs/cms` and `@kayjs/ai` (`@kaynooo/kayjs*` up to 1.103, which `kay upgrade` moves an app off), and installed under the name its imports use: `"kay": "npm:@kayjs/kay@~<version>"` in `package.json`, a tilde since a minor release may break what the one before it took, each break listed in [Upgrading](upgrading.md) and every one `kay check` can recognise a `deprecated` lint with a fix, which `kay upgrade` applies as it moves the app, and a major is a rewrite. Every package a project installs, pg-orm and eslint included, is on npm, so a project carries no `.npmrc` and Bun needs no registry setup.
|
|
55
|
-
- `bunx -p @kayjs/kay kay new my-app` writes a project that, after `cd my-app && bun install`, checks, builds and runs (`bun run dev`), both of those included: this setup, a layout, a page, a `_404.kay` and islands, or only what is picked of them (see [Commands](#commands) for the presets and features).
|
|
55
|
+
- `bunx -p @kayjs/kay kay new my-app` writes a project that, after `cd my-app && bun install`, checks, builds and runs (`bun run dev`), both of those included: this setup, a layout, a page, a `_404.kay` and islands, or only what is picked of them (see [Commands](commands.md#commands) for the presets and features).
|
|
56
56
|
|
|
57
57
|
- kay runs on Bun 1.4.4 or later, as its `engines` says: the CLI and `pages()` refuse an older one, naming its version, its path and the fix, `bun update bun` when it is the project's npm `bun` package, which a plugin's peer dependency installs and package scripts run ahead of the system Bun.
|
|
58
58
|
|
|
@@ -75,10 +75,10 @@ export const app = new Elysia()
|
|
|
75
75
|
- An entry other than `src/server.ts` is named once, as `entry: 'src/main.ts'` in `kay.config.ts`, which `kay dev`, `start`, `render`, `check`, `build` and `build --compile` all read; `--entry` on a command wins over it, `kay build --entry` also pointing its check step at that entry.
|
|
76
76
|
- An entry `kay check` does not read registers it instead: `declare module 'kay' { interface Register { app: typeof app } }`.
|
|
77
77
|
|
|
78
|
-
- A key kay does not know in `kay.config.ts`, at its top or in any option bag (`security`, `i18n`, `
|
|
79
|
-
- A value that is not the kind its key takes (`trailingSlash: 'sometimes'`, `compress: 7`, `lang: 5`, a `
|
|
78
|
+
- A key kay does not know in `kay.config.ts`, at its top or in any option bag (`security`, `i18n`, `assets`, `markdown`, `ops`, `cors`, `client` and the rest), stops every command with the nearest known name (`` `trailingslash`, did you mean `trailingSlash`? ``), and `defineConfig` types it as an error, since a mistyped key would otherwise leave kay's default in place with nothing said.
|
|
79
|
+
- A value that is not the kind its key takes (`trailingSlash: 'sometimes'`, `compress: 7`, `lang: 5`, a `default` locale outside the `locales`) stops them the same way, once, as the config loads: `` `trailingSlash` is "sometimes", expected one of "never", "always" or "ignore" ``, the path through bags and lists, with the nearest allowed value for a mistyped text. The options of `pages()` and `testSite()` are checked as they merge, and an extension's `config` as it loads.
|
|
80
80
|
- `auth()`, `cms()`, `mail()` and `ai()` refuse an option they do not take with the nearest one, as `kay.config.ts` does; a library adds the same to its own factory with `checkOptionKeys` from `kay/library`, over a `Record<keyof ItsOptions, true>`.
|
|
81
|
-
- Project settings live in an optional `kay.config.ts` at the root, read by `pages()` and every command;
|
|
81
|
+
- Project settings live in an optional `kay.config.ts` at the root, read by `pages()` and every command; the `config` passed to `pages({ config })` or `testSite({ config })` wins over it key by key, an `undefined` key leaving the file's value (the config's keys written beside `root` work until 1.108, `deprecated-pages-options` rewrites them), and in an executable `kay build --compile` wrote, the root, routes and public directory it was built with win over both.
|
|
82
82
|
- It must `export default` its config, or the command fails with a message saying so.
|
|
83
83
|
|
|
84
84
|
```ts
|
|
@@ -95,17 +95,23 @@ export default defineConfig({
|
|
|
95
95
|
|
|
96
96
|
- A directory inside the project holding a `kay.config.ts` of its own, such as an example app or a documentation site, is another project: its components are never the outer one's islands, and it checks and builds from its own root.
|
|
97
97
|
|
|
98
|
-
- `
|
|
98
|
+
- A feature key is `false` for off, `true` for its defaults or an object of options: `robots`, `sitemap`, `assets.favicon`, `security`, `ops.health`, `preview`, `client.offline`, `ops.metrics`, `openapi`, `mcp`, `proxy`, `assets.images.formats.avif` and the rate limits. `defineConfig` refuses a key it does not know in any option bag, as a type error.
|
|
99
|
+
- A list that may come from a CMS or a database is the list, or a function returning it (or a promise of it): `cors.origins`, `security.hosts`, `assets.images.remote.hosts`, `proxy.trusted`, `redirects`, `robots.disallow`, `robots.allow` and `i18n.paths`. Kay calls it once as the config loads, `kay dev` again after a change to the file.
|
|
100
|
+
- Keys are grouped by concern: `client` (what the browser is given: `links`, `offline`, `search`, ...), `assets` (`images`, `fonts`, `favicon`, `manifest`, `publicCache`), `ops` (`observe`, `health`, `metrics`, `jobs`), `endpoints` (where the app's API and each feature are served) and `i18n: { locales, default, mode }`, where `mode` is `'prefix'` (the default locale unprefixed), `'always'` or `{ domains }`. The old top-level keys work until 1.108 (`deprecated-client-keys`, `deprecated-config-groups`, `deprecated-i18n-keys` rewrite them).
|
|
101
|
+
- `endpoints` holds every route the config moves, in one place: `{ api: '/api', openapi: '/api/openapi.json', mcp: '/_kay/mcp', health: '/_kay/health', metrics: '/_kay/metrics', jobs: '/_kay/jobs' }`, each an absolute path of plain segments with no trailing slash, and `api`, `openapi` and `mcp` none under `/_kay` when you set them. Every default is under `/_kay` but the app's API (and its OpenAPI document and reference page, which follow it). The reference page is `openapi: { reference: true }` or `{ reference: { path } }`. `serve.apiPrefix` and the `path` of `openapi`, `mcp`, `health`, `metrics` and `jobs`, and `openapi.referencePath`, work until 1.108 (`deprecated-route-keys` rewrites them). An app that did not move `mcp` or `metrics` keeps `/metrics` answering as well until 1.108, and `/mcp` answers the MCP endpoint in place (not redirected) until 2.0.
|
|
102
|
+
- `assets.images` is `{ remote: { hosts, maxSize, timeout }, formats: { quality, webp, avif }, limits: { variants, queue }, rateLimit, ttl, widths, ... }`; `remote: [...]` is hosts alone.
|
|
103
|
+
- A duration key is `ttl` for how long data lives, `timeout` for how long to wait and `maxAge` only for the HTTP or cookie attribute of that name.
|
|
104
|
+
- `proxy: false` is none, `proxy: true` is one proxy in front, `proxy: { hops: 2 }` two, `{ header }` a header the proxy sets, `{ key: { header: 'x-upstream-key' }, open }` refuses requests without the shared key ([Production](proxy-and-security.md#behind-a-proxy)).
|
|
99
105
|
- `extensions` lists what libraries add to the app, one value each, such as `extensions: [auth()]`: pages laid over `src/routes` and API modules over `src/api` under a prefix, message catalogs under `src/messages`, an app file at the same path or an app key winning, config laid under the app's, such as Bun plugins or head tags (see [Extensions](component-libraries.md#extensions)), and a hook rewriting each prerendered page (see [Page hooks](prerendering.md#page-hooks)).
|
|
100
106
|
|
|
101
107
|
- `minify` is on for `kay build` unless set to `false`, and off for `kay dev` and a server bundling at boot unless set to `true`.
|
|
102
108
|
- `lang`, the `<html lang>` of every page when `i18n` is not set, defaults to `en`.
|
|
103
109
|
- `timeZone: 'Europe/Paris'` is the zone `formatDate` and message dates write in, on the server and in islands alike, instead of the server's and the visitor's ([Locales](locales.md)).
|
|
104
110
|
- `typography: false` leaves a French page's spaces before `: ; ! ?` and inside `« »` as typed instead of making them non-breaking ([Locales](locales.md#french-typography)).
|
|
105
|
-
- `links: { outside: 'same-tab' }` keeps a link to another origin in the same tab, where it opens in a new one by default ([Navigation](navigation.md#navigation)); `links: { schemes: ['webcal'] }` lets a bound URL keep a scheme beyond the web's, mail, phone and sms ([Security](proxy-and-security.md)).
|
|
111
|
+
- `client.links: { outside: 'same-tab' }` keeps a link to another origin in the same tab, where it opens in a new one by default ([Navigation](navigation.md#navigation)); `client.links: { schemes: ['webcal'] }` lets a bound URL keep a scheme beyond the web's, mail, phone and sms ([Security](proxy-and-security.md)).
|
|
106
112
|
|
|
107
113
|
- A page without kay's script carries speculation rules, and one shipping it a `kay-prefetch` meta naming the setting alone, as the swap prefetches its links itself (see [Navigation](navigation.md#navigation)): Chromium, or the swap, prefetches the page a link points at once it is hovered (`prefetch: 'moderate'`), on press with `'conservative'`, as soon as it can with `'eager'` (every link on a page without the script, the links scrolled into view, three at a time, on one with it), never with `false`; `data-prefetch="eager|moderate|conservative"` on a link or a container sets its own level where the script runs, `data-prefetch="false"` opts out everywhere; a page with no `data-prefetch` in it carries the shorter rules without the selector that follows the nearest one.
|
|
108
|
-
- Links under `/_kay/` or `/api/`, with `download` or with `rel="nofollow"` are never prefetched; any other link that changes something on GET, such as a logout, takes `data-
|
|
114
|
+
- Links under `/_kay/` or `/api/`, with `download` or with `rel="nofollow"` are never prefetched; any other link that changes something on GET, such as a logout, takes `data-prefetch="false"`.
|
|
109
115
|
- A stylesheet holding `@view-transition { navigation: auto; }` animates from page to page where the browser supports it, swaps included; `kay new` writes one inside `@media (prefers-reduced-motion: no-preference)`.
|
|
110
116
|
|
|
111
117
|
- `pages()` also takes `root`, `dev` (default: `NODE_ENV` is `development`) and `prebuilt` (default: `NODE_ENV` is `production`), which serves what `kay build` wrote instead of bundling at boot.
|
|
@@ -124,41 +130,12 @@ export default defineConfig({
|
|
|
124
130
|
|
|
125
131
|
- `kay/html`, `kay/dom`, `kay/dom-loop`, `kay/dom-await`, `kay/dom-try`, `kay/dom-spread`, `kay/dom-image`, `kay/pending`, `kay/i18n-links`, `kay/island`, `kay/await`, `kay/client`, `kay/arrival`, `kay/internal`, `kay/internal/title` and `kay/internal/server` are what compiled `.kay` files and kay's generated entries import, and `kay/jsx-runtime` is where TypeScript finds the JSX types of `jsxImportSource: "kay"`: the compiler's output contract rather than API, free to change in any release, never imported by an app. The root `kay` export also holds the compile-time types behind the generated shadow types, none of them for an app to name: `BindableMark`, `IslandBrand`, `HandedPart`, `HandsPart`, `HandedSignal`, `UnresolvedParameter`, `WidenedProps`, `CheckedHref`, `CheckedHtml`, `CheckedComputedHtml`, `BoundProp`, `BoundValue`, `PlainIslandProp`, `FunctionProp`, `Inferred`, `TemplateHelpers`, `TemplateValues` and `Truthy`, free to change in any release too.
|
|
126
132
|
- A few entries also hold plumbing no page tells an app to call, free to change in any release: the paths, providers and tracker tags of `kay/analytics` (`ANALYTICS_PATH`, `ANALYTICS_SCRIPT_PATH`, `ANALYTICS_PROVIDERS`, `CUSTOM_COLLECT_PATH`, `CUSTOM_SCRIPT_PATH`, `NOTICE_SCRIPT_PATH`, `INTEGRITY`, `TRACKER_TAGS`, `isGated`, `LazyGuard`), the collection marker, publish times and cache key of `kay/content`, and the preview session reader of `kay/server`.
|
|
127
|
-
- A name has one home: an entry beside a package's root exists for browser safety (`@kayjs/auth/rules`, `@kayjs/cms/form`, which an island imports without the server) and the root does not repeat its names
|
|
133
|
+
- A name has one home: an entry beside a package's root exists for browser safety (`@kayjs/auth/rules`, `@kayjs/cms/form`, which an island imports without the server) and the root does not repeat its names. The copies in `kay/mount` and `kay/server` that 1.105 moved (`mount`, `s`, `RateLimit`, `sqliteCache`) stay as deprecated shims until 1.108.
|
|
128
134
|
- `kay/library` is what kay's own libraries (kayjs-auth, kayjs-ui, kayjs-mail, kayjs-cms, kayjs-ai) share with kay for their server code, such as the sanitizer's lists, sealing, locale matching, escaping and the user a library names for a request (`nameUser(request, () => id)`, read back by `userOf(request)`: kayjs-auth names the signed-in user and kayjs-ai counts them) and `configError(option, value, takes)`, the `config-invalid` `KayError` a library throws for a setting it refuses at boot, so neither keeps a copy: not API either, free to change with any minor, never imported by an app. The libraries are released in lockstep with kay, each one's peer range on kay's minor, so the same holds for what a library imports from it.
|
|
129
135
|
|
|
130
136
|
### Reserved paths
|
|
131
137
|
|
|
132
|
-
- Naming rule: a file kay reads for one thing is singular (`server.ts`, `auth.ts`, `mail.ts`, `ui.ts`, `context.ts`, `env.ts`, `theme.ts`); a folder with one file per page, plugin, template, matcher or catalog is plural (`routes/`, `plugins/`, `mails/`, `messages/`, `params/`); a mass noun or acronym stays as is (`api/`, `content/`, `db/`); a file inside a plural folder is named after what it holds (`plugins/
|
|
138
|
+
- Naming rule: a file kay reads for one thing is singular (`server.ts`, `auth.ts`, `mail.ts`, `ui.ts`, `context.ts`, `env.ts`, `theme.ts`); a folder with one file per page, plugin, template, matcher or catalog is plural (`routes/`, `plugins/`, `mails/`, `messages/`, `params/`); a mass noun or acronym stays as is (`api/`, `content/`, `db/`); a file inside a plural folder is named after what it holds (`plugins/metrics.ts`). A route is `/_kay/<noun>` for an endpoint and `/_kay/<nouns>/` for files; the image resizer shares its variants' prefix, `/_kay/images` and `/_kay/images/<file>`.
|
|
133
139
|
- At the root: `kay.config.ts`, `public/` (served as is), `data/` (default SQLite and file stores, ignored by git and docker).
|
|
134
|
-
- Under `src/`: `routes/` (pages, layouts, endpoints, `_guard.ts`), `api/`, `plugins/` (server plugins
|
|
135
|
-
- Under `/_kay/`: `assets/` (browser build, imported files), `images` and `images/` (resizer, variants), `card`, `files/`, `action/`, `live`, `health`, `jobs` (with `jobs: {
|
|
136
|
-
|
|
137
|
-
### Commands
|
|
138
|
-
|
|
139
|
-
- `kay new`, `kay add` and `kay generate` are in [Scaffold with kay new and kay add](project-new-and-add.md).
|
|
140
|
-
|
|
141
|
-
- The other commands: `kay dev` is in [The dev server](dev-server.md), `kay build` and `kay start` in [Building and starting](build-and-start.md), and `kay check`, `kay render`, `kay screenshot`, `kay a11y`, `kay routes`, `kay env`, `kay doctor`, `kay completion`, `kay i18n`, `kay upgrade`, `kay explain`, `kay fmt`, `kay lint`, `kay types`, `kay lsp`, `kay mcp` and `kay docs` in [Check, inspect and tool commands](check-and-tools.md).
|
|
142
|
-
- `kay migrate astro [dir] [--outdir <dir>] [--dry-run] [--format text|json] [--quiet]`:
|
|
143
|
-
- Translate an Astro project's `.astro` files into `.kay` ones, `src/pages` into `src/routes` (`404` as `_404`, `500` as `_error`), components and layouts kept in their folder with kebab-case names and the imports of them rewritten, and `src/content.config.ts` into kay's, its zod schemas written in `s`.
|
|
144
|
-
- The frontmatter becomes the fence, a page's `--- server` with `Astro.url`, `params`, `cookies` and `redirect` read from `ctx`, `Astro.props` becomes `props<Props>()`, and the markup the indented template: static classes as the `.class` shorthand, `class:list` as `class`, `&&`, ternaries and `.map` as `if` and `for`, slots as `slot` and `@name` blocks, `client:idle` and `client:visible` as `hydrate`, `set:html` as `innerHTML` through `trustHtml`, a layout's `head` as a `head` block.
|
|
145
|
-
- It writes into the project, or into `--outdir`, never over a file that exists, formats what it writes, and lists what it could not translate at its line in the Astro file: a script Astro bundles, an `await` or `Astro.url` in a component, an endpoint, markup written another way, each commented out under a `// kay migrate:` line where it stays in the code, and Tailwind 3, as kay builds with Tailwind 4.
|
|
146
|
-
- An `--outdir` directory with no `package.json` gets the kay project around the pages, as `kay new` writes it without its home page, layout and stylesheet: a `package.json` with kay's scripts and the Astro project's packages, Astro's own left out, a `kay.config.ts` with the `site` and `base` of the Astro config and the layout's `<html lang>`, without `seo` defaults since the pages write their own head, a `tsconfig.json` keeping its `paths`, a server entry when the Astro config renders on demand (`output: 'server'` or an `adapter`), a static site otherwise, and Tailwind, ESLint, the Forgejo workflow and the Dockerfile when the Astro project had them;
|
|
147
|
-
- Its other files under `src` and `public` are copied as they are, but for `src/env.d.ts`, which only Astro reads, those beside the pages moving with them into `src/routes`, where kay routes only `.kay` and endpoint files.
|
|
148
|
-
- Beyond the `.astro` files: a script or markup after the layout's `</html>` is kept, `<Icon name="set:name" />` from astro-icon becomes the icon imported from `~icons/set/name`, a `?raw` import takes `with { type: 'text' }`, and the Fontsource stylesheets a file imports become `fonts` entries in the `kay.config.ts` it writes (listed instead when migrated in place); `Astro.self`, `import.meta.env` (in `.astro` files and in `src` modules), a script from another host (kay's Content-Security-Policy blocks it until `security.csp` allows it) and UnoCSS (its packages are left out, its classes pass through) are listed. The `.gitignore` it writes keeps the Astro project's own entries, its ESLint packages are left out for `@kaynooo/eslint`, and a carried `@kaynooo/*` range is listed, as the registry may hold no version in it.
|
|
149
|
-
- A Markdown page in `src/pages` is listed, to become a content collection's entry, and so is a `site` or `base` written as anything but a string.
|
|
150
|
-
- Migrated in place, the Astro project's `package.json` stays as it is, listed with the Astro packages to remove, and the `lang`, `site`, `base` and tsconfig `paths` are listed to carry over by hand.
|
|
151
|
-
- `kay migrate content [dir] [--dry-run]`: rewrites the files of folder collections whose `migrations` carried entries over ([details](content-cms.md#loaded-collections)).
|
|
152
|
-
- Every command prints its usage and options for `--help` or `-h`, and `kay --help` lists every command; `kay --version` prints the version, `--plain` or `--color never|always` set the colour of any command but `lint` and `test`, which pass every argument on, `kay` alone prints the help, and `kay __complete <words>` answers a shell's completion, which `kay completion bash|zsh|fish` wires up (`source <(kay completion bash)` in ~/.bashrc, `kay completion fish > ~/.config/fish/completions/kay.fish`, `source <(kay completion zsh)` in ~/.zshrc after `compinit`).
|
|
153
|
-
- A usage error, an unknown command, an option or argument a command does not take or a `refuse(reason)` from a command, prints `error: kay <command>: <reason>` with a `hint:` line (the nearest command or option for a typo, else where `--help` is) and exits 2; a command that ran and failed exits 1.
|
|
154
|
-
- Every command takes `--quiet`, `--format json` and `--dry-run`, or refuses it for a reason `SHARED_REFUSALS` in `src/commands/command.ts` lists, and `tests/command-options.test.ts` holds both: `--quiet` prints the problems and one summary line, without the size report, the files one by one or the next step; `--format json` prints one JSON document on one line; `--dry-run` lists what the command would write and writes nothing. A command refuses what it has nothing to do with: `kay lint` and `kay test` pass every argument on but `--format json`, and refuse `--quiet` and `--dry-run`, `kay lsp` and `kay mcp` speak a protocol, `kay types`, `kay build` and `kay dev` write generated output only, `--quiet` of `kay doctor`, `kay env` and `kay i18n missing` leaves out what passes, and `kay fmt --check` stays the verify-only form and refuses `--dry-run` beside it. `kay <command> --help` lists the options it takes.
|
|
155
|
-
- Colour only goes to a terminal, never under `NO_COLOR` or `TERM=dumb`, and `FORCE_COLOR` brings it back to a pipe; a redrawn line or a cleared screen only ever goes to a terminal.
|
|
156
|
-
- `kay build`, `kay routes`, `kay env`, `kay doctor`, `kay i18n missing`, `kay explain`, `kay fmt`, `kay migrate`, `kay not-found`, `kay screenshot` and `kay a11y` take `--format json`, as `kay check` does: stdout holds one JSON document on one line, what the app's own code prints through the console or `process.stdout` going to stderr (a write straight to file descriptor 1 is not caught), and the exit code is the text output's.
|
|
157
|
-
- `kay build`: `{ errors, warnings, problems }` as `kay check` prints them, a template that does not compile at its place and any other failure as one problem with `code: null`, then `failed: { stage }` when a stage stopped it, `built: { islands, stylesheets, prerendered, entries, ms, sizes, routes, stages, caches }` (`sizes` the entry's and each island's `raw` and `gzip` bytes, `modules` under `--analyze`, and per island `why` it is one, and its `cause` (`kind`, `name`, `line`); `routes` each route's `js` and `css` gzip bytes, the `islands` its pages render, `pages` prerendered, `kept` pages the build kept on its own and for a route rendered per request the `stop` that decided it and whether the scripts are an `estimated` reach; `stages` `{ name, ms }`; `caches` `{ name, cached, made }`), `exported: { pages, files, dir, ms }` and `compiled: { executable, ms }`; code that ends the process mid-build leaves the problems so far, one saying it ended and the stage, and exit code 1 for its `process.exit(0)`; `--format github` annotates the check's problems as `kay check` does, and a template that does not compile or a failed stage too.
|
|
158
|
-
- `kay routes`: `{ routes, unlisted }`, each route's `methods`, `path`, `kind`, `by`, and `file`, `notes`, `layouts`, `guards` when it has them, every locale's copy with its chains.
|
|
159
|
-
- `kay doctor`: `{ checks }`, each check's `name`, `ok`, `message`, `warning` (ok, but worth a look: no browser) and, on a failure, `fix`.
|
|
160
|
-
- `kay env`: `{ variables, unread }`, and `findings` (problems, as `kay check` prints them) with `--compose`, `--example` or `env` in the config, each variable's `name`, `source`, `type`, `required` (`'always'`, `'production'` or `false`), and `default`, `description` and `secret: true` when it has them; `unread` the `file` and `error` of each module that failed to load.
|
|
161
|
-
- `kay explain`: `{ groups, lints, errorGroups, errors }` with each lint's `name`, `group`, `level`, `since` when it has one and whole `summary`, and each error code's `name`, `group`, `summary` and `fix`; the errors only without a lint group named; or one lint's fields, its `wrong` and `right` examples included.
|
|
162
|
-
- `kay fmt`: `{ errors, warnings, problems, written, changed }`, what does not parse as problems.
|
|
163
|
-
- `kay migrate`: `{ written, kept, copied, notes }`, each note's `file`, `line`, `target` and `message`.
|
|
164
|
-
- A command that cannot run, options that do not go together included, prints `{ errors: 1, warnings: 0, problems: [{ severity, code: null, message }] }`.
|
|
140
|
+
- Under `src/`: `routes/` (pages, layouts, endpoints, `_guard.ts`), `api/`, `plugins/` (server plugins), `jobs/` (queues, workflows and schedules, each export mounted), `messages/<locale>.ts`, `params/<name>.ts`, `content/` with `content.config.ts`, `mails/<name>.kay` with `<name>.preview.ts` beside it and `mail.ts` for the mailer, `db/index.ts` and `tables.ts`, `server.ts`, `auth.ts`, `ui.ts`, `context.ts`, `env.ts`, `theme.ts`, `app.css`, `logo.svg` (the card logo, where `card.logo` names it).
|
|
141
|
+
- Under `/_kay/`: `assets/` (browser build, imported files), `images` and `images/` (resizer, variants), `card`, `files/`, `action/`, `live`, `health`, `mcp`, `metrics`, `jobs` (with `ops: { jobs: { guards } }`), `error`, `csp`, `vitals`, `analytics`, `push`, `search.json` and `search/`, `preview`, `draft`, `env.js`.
|
|
@@ -71,7 +71,7 @@ export default defineConfig({
|
|
|
71
71
|
})
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
- `proxy: false` is none, as left out; `proxy: true` is one proxy in front, `
|
|
74
|
+
- `proxy: false` is none, as left out; `proxy: true` is one proxy in front, `{ hops: 2 }` two; a bare `proxy: 2` still works until 1.108, `deprecated-config-switch` rewriting it.
|
|
75
75
|
- `hops` is the number of proxies in front, each appending the address it was reached from to `X-Forwarded-For`, so the visitor is the entry `hops` from its end: 1 for nginx or Caddy alone, 2 for Cloudflare then nginx.
|
|
76
76
|
- A request with fewer entries skipped an outer proxy, and its first entry is who reached the inner one.
|
|
77
77
|
- `header` names a header a proxy sets to the visitor's address, read instead: `{ header: 'cf-connecting-ip' }`, or `{ header: 'x-real-ip' }` for nginx's `proxy_set_header X-Real-IP $remote_addr`.
|
|
@@ -82,9 +82,9 @@ export default defineConfig({
|
|
|
82
82
|
- A forwarded entry that is no IP address (a port is dropped, `[v6]:port` too) is ignored, and the client counts by the address it reached the server from.
|
|
83
83
|
- A request from a public address outside them that carries the header warns once, as such a CDN setup misses its `trusted`, and counts by its own address.
|
|
84
84
|
- A setting holding both `hops` and `header` stops the server, and so does one holding neither without a `key`.
|
|
85
|
-
- `key` names a header the proxy sets to a key shared with the server, `proxy: { key: 'x-upstream-key' }
|
|
86
|
-
- The key is read from `KAY_PROXY_KEY`, else from the trimmed file `KAY_PROXY_KEY_FILE` names (a container secret), at boot, and compared in constant time. A production server with `key` and neither, or an empty one, does not boot. Off under `kay dev`, in `kay build --static`, and outside production when none is given (a warning says so, except in a test run, where an unset key is expected); `testSite({
|
|
87
|
-
- The health route (`health
|
|
85
|
+
- `key` names a header the proxy sets to a key shared with the server, `proxy: { key: { header: 'x-upstream-key' } }` (a bare string is the 1.104 form, which `kay upgrade` rewrites): a request without it, or with another value, answers 403 with the security headers before anything else runs (the refusal is logged with its request id, never the key), so a process or container reaching the port directly skips nothing the proxy does. The proxy sends the key (nginx: `proxy_set_header X-Upstream-Key $upstream_key`). `key` alone counts as one proxy in front.
|
|
86
|
+
- The key is read from `KAY_PROXY_KEY`, else from the trimmed file `KAY_PROXY_KEY_FILE` names (a container secret), or from `key: { header, secret }` where `secret` is a string, `{ env: 'NAME' }` or `{ file: 'path' }` (the same shape as `mcp.token` and `metrics.token`, a relative `{ file }` read from the project folder), at boot, and compared in constant time. A production server with `key` and neither, or an empty one, does not boot. Off under `kay dev`, in `kay build --static`, and outside production when none is given (a warning says so, except in a test run, where an unset key is expected); `testSite({ config: { proxy: { key: { secret } } } })` turns it on for one test site without touching the environment, sending the header by default ([Testing](testing.md)). `kay build --compile --verify` stands in a throwaway key for any secret of the config that gives nothing on the build host (a variable unset, a `{ file }` only the deploy host holds), as the health route it asks is open. The server's own requests (an MCP tool call, a CMS edit-URL probe) pass.
|
|
87
|
+
- The health route (`endpoints.health`) is open, as the container asks it without the key, and so is the `metrics` route, which answers by its own rule (see [Metrics for a collector](metrics.md)). `open: ['/api/push']` lists more paths, each open with what is under it; they are read after the `base` is taken off, whether the proxy did or not, and a path that merely starts like one (`/api/pushy`) stays closed. The MCP endpoint is open to this check too while `mcp.token` guards it with a bearer, its path alone ([API routes](mcp.md)).
|
|
88
88
|
- The proxy passes `X-Forwarded-Proto` on every location, websockets included (nginx: `proxy_set_header X-Forwarded-Proto $scheme`), as kay's cookies are `Secure` and the session's named `__Host-kay_session` over https: a request that says `http` reads no session.
|
|
89
89
|
- A request without the header counts as https in production when `site` is https; with no `site`, production warns once that cookies go out without `Secure`.
|
|
90
90
|
- A post goes back to its page as a path and never reads a forwarded header for it, so the swap works behind a proxy that ends TLS with nothing declared for it.
|
|
@@ -163,7 +163,7 @@ export default defineConfig({
|
|
|
163
163
|
- A static export has no server to send them: `kay build --static` writes the page without its `security` and `reload`, which the host's own headers stand in for.
|
|
164
164
|
- `inlineScriptHashes({ prefetch, dev, base, offline })` from `kay/server` gives the hashes, for a policy written elsewhere, such as by a proxy.
|
|
165
165
|
- Whatever the policy, a URL with any scheme but `http`, `https`, `mailto`, `tel`, `sms` and `blob` (and `data:` image, audio and video but not SVG, which passes only on `src` and `poster`, plain text, CSV, PDF and JSON), such as `javascript:`, bound to an `href`, `src`, `action`, `formaction`, `xlink:href`, `poster` or `data`, as a user-supplied link would be, goes out prefixed with `unsafe:`, on the server and in islands, so following it does nothing. A relative URL has no scheme and is kept.
|
|
166
|
-
- `links: { schemes: ['webcal', 'geo'] }` in `kay.config.ts` lists the other schemes the app trusts in a bound URL (`whatsapp`, `webcal`, `geo`, `spotify`, its own `myapp`), on the server and in islands, which read the list from a `kay-link-schemes` meta; a name is lowercase with no colon, and `javascript`, `vbscript` and `data` are refused when the config loads. A literal `a(href="webcal://...")` was never rewritten. `kay dev` logs, once per attribute, URL and page, each bound URL rewritten to `unsafe:`, naming the scheme and this option; an island's own rewrite is not logged.
|
|
166
|
+
- `client: { links: { schemes: ['webcal', 'geo'] } }` in `kay.config.ts` lists the other schemes the app trusts in a bound URL (`whatsapp`, `webcal`, `geo`, `spotify`, its own `myapp`), on the server and in islands, which read the list from a `kay-link-schemes` meta; a name is lowercase with no colon, and `javascript`, `vbscript` and `data` are refused when the config loads. A literal `a(href="webcal://...")` was never rewritten. `kay dev` logs, once per attribute, URL and page, each bound URL rewritten to `unsafe:`, naming the scheme and this option; an island's own rewrite is not logged.
|
|
167
167
|
- One written out as text in the template is left as it is.
|
|
168
168
|
|
|
169
169
|
### Compression
|