@kayjs/kay 1.108.0 → 1.110.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 +2093 -3774
- package/editors/zed/extension.toml +2 -2
- package/llms/action-protection.md +1 -1
- package/llms/actions-from-islands.md +5 -5
- package/llms/actions-refused-fields.md +4 -4
- package/llms/api-from-islands.md +6 -6
- package/llms/browser-only.md +2 -2
- package/llms/cdn-caching.md +1 -1
- package/llms/checks.md +1 -1
- package/llms/code-lints.md +1 -2
- package/llms/component-library-conventions.md +1 -1
- package/llms/components.md +5 -5
- package/llms/deprecated-lints.md +2 -7
- package/llms/effects.md +1 -1
- package/llms/errors.md +2 -2
- package/llms/events.md +1 -1
- package/llms/guards.md +1 -1
- package/llms/head.md +1 -1
- package/llms/hooks.md +2 -2
- package/llms/images.md +1 -1
- package/llms/island-and-form-lints.md +4 -2
- package/llms/island-sources.md +1 -1
- package/llms/islands-state-to-ids.md +2 -2
- package/llms/islands.md +8 -4
- package/llms/lints.md +1 -1
- package/llms/live-values.md +4 -4
- package/llms/local-collections.md +1 -1
- package/llms/locales.md +1 -1
- package/llms/mcp.md +2 -2
- package/llms/metrics.md +1 -1
- package/llms/navigation-from-code.md +7 -7
- package/llms/navigation.md +4 -2
- package/llms/prerendering.md +1 -0
- package/llms/production.md +2 -2
- package/llms/project-new-and-add.md +1 -1
- package/llms/project.md +4 -4
- package/llms/proxy-and-security.md +1 -1
- package/llms/queues.md +1 -1
- package/llms/rate-limits.md +4 -4
- package/llms/rendering.md +1 -1
- package/llms/server-islands.md +2 -2
- package/llms/server.md +1 -1
- package/llms/stores.md +1 -1
- package/llms/styles-and-assets.md +1 -1
- package/llms/templates-elements-slots-snippets.md +2 -2
- package/llms/testing-mount.md +49 -0
- package/llms/testing.md +4 -45
- package/llms/upgrading-1-105-config.md +13 -13
- package/llms/upgrading-archive.md +64 -74
- package/llms/upgrading.md +92 -70
- package/llms/whats-new.md +24 -0
- package/llms.txt +5 -6
- package/package.json +6 -10
- package/src/build/route-sizes.ts +2 -3
- package/src/build/variants.ts +132 -18
- package/src/check/browser-global-reads.ts +2 -2
- package/src/check/config-objects.ts +1 -1
- package/src/check/diagnose.ts +0 -22
- package/src/check/env-types.ts +1 -1
- package/src/check/export-homes.ts +1 -1
- package/src/check/guards.ts +3 -3
- package/src/check/index.ts +2 -7
- package/src/check/moved-keys.ts +1 -1
- package/src/check/project.ts +6 -7
- package/src/check/schema-builders.ts +125 -26
- package/src/check/shadow-types.ts +0 -86
- package/src/commands/check.ts +2 -2
- package/src/commands/env.ts +25 -3
- package/src/commands/upgrade.ts +2 -1
- package/src/compiler/allow-comments.ts +38 -2
- package/src/compiler/ast.ts +21 -19
- package/src/compiler/browser.ts +2 -14
- package/src/compiler/class-items.ts +16 -0
- package/src/compiler/codegen.ts +10 -10
- package/src/compiler/deprecated-library.ts +0 -12
- package/src/compiler/deprecated-lints-1-106.ts +2 -2
- package/src/compiler/deprecated-lints.ts +3 -495
- package/src/compiler/deprecated-ui-props.ts +5 -5
- package/src/compiler/errors.ts +2 -2
- package/src/compiler/fence-checks.ts +2 -121
- package/src/compiler/hand-parts.ts +83 -0
- package/src/compiler/helper-imports.ts +2 -2
- package/src/compiler/image-attributes.ts +1 -3
- package/src/compiler/index.ts +23 -23
- package/src/compiler/island-arguments.ts +17 -95
- package/src/compiler/island-cause.ts +7 -7
- package/src/compiler/island-declaration.ts +2 -8
- package/src/compiler/island-lints.ts +19 -0
- package/src/compiler/island-marker.ts +3 -3
- package/src/compiler/island-problems.ts +25 -0
- package/src/compiler/items.ts +12 -0
- package/src/compiler/jsx-class.ts +1 -25
- package/src/compiler/jsx.ts +7 -6
- package/src/compiler/kay-exports.ts +0 -2
- package/src/compiler/link-flags.ts +9 -38
- package/src/compiler/lints.ts +10 -18
- package/src/compiler/markup.ts +33 -41
- package/src/compiler/module-signals.ts +2 -2
- package/src/compiler/names.ts +1 -1
- package/src/compiler/page-settings.ts +11 -0
- package/src/compiler/parser.ts +6 -8
- package/src/compiler/plan.ts +1 -3
- package/src/compiler/removed-lints.ts +90 -0
- package/src/compiler/rewrite.ts +3 -18
- package/src/compiler/script-server.ts +8 -3
- package/src/compiler/signal-from-prop.ts +141 -0
- package/src/compiler/template-reads.ts +16 -0
- package/src/compiler/validate.ts +3 -8
- package/src/config-loader.ts +14 -4
- package/src/config-resolve.ts +18 -142
- package/src/config-shape.ts +44 -34
- package/src/config.ts +10 -114
- package/src/dev/preload.ts +4 -1
- package/src/lsp/server.ts +4 -0
- package/src/migrate/markup.ts +4 -1
- package/src/runtime/action-call.ts +0 -8
- package/src/runtime/action-encode.ts +26 -0
- package/src/runtime/action-error.ts +3 -11
- package/src/runtime/action-protection.ts +2 -2
- package/src/runtime/action-run.ts +2 -27
- package/src/runtime/action-shared.ts +14 -37
- package/src/runtime/action-stream.ts +0 -1
- package/src/runtime/action.ts +1 -1
- package/src/runtime/call-result.ts +2 -10
- package/src/runtime/checks.ts +25 -13
- package/src/runtime/client.ts +7 -11
- package/src/runtime/core.ts +5 -23
- package/src/runtime/dom.ts +1 -1
- package/src/runtime/html.ts +1 -1
- package/src/runtime/i18n.client.ts +1 -4
- package/src/runtime/i18n.server.ts +1 -4
- package/src/runtime/i18n.ts +3 -3
- package/src/runtime/image.ts +2 -19
- package/src/runtime/index.ts +3 -3
- package/src/runtime/island.server.ts +56 -13
- package/src/runtime/live-resource.server.ts +0 -1
- package/src/runtime/live-value.server.ts +2 -2
- package/src/runtime/live-value.shared.ts +7 -20
- package/src/runtime/live.ts +1 -12
- package/src/runtime/local-types.ts +1 -11
- package/src/runtime/local.ts +4 -14
- package/src/runtime/navigate-api.ts +2 -5
- package/src/runtime/navigate.ts +9 -0
- package/src/runtime/navigation-state.ts +0 -12
- package/src/runtime/navigation.ts +5 -1
- package/src/runtime/page-swap.ts +8 -8
- package/src/runtime/persist.ts +11 -3
- package/src/runtime/persisted.ts +4 -30
- package/src/runtime/presence.ts +6 -7
- package/src/runtime/query-param.ts +20 -12
- package/src/runtime/reactive.ts +3 -1
- package/src/runtime/refuse.ts +3 -17
- package/src/runtime/store-base.ts +4 -6
- package/src/runtime/swap-fetch.ts +1 -1
- package/src/runtime/swap-flight.ts +10 -10
- package/src/runtime/swap-kept.ts +69 -29
- package/src/runtime/swap-morph.ts +49 -9
- package/src/runtime/text-hash.ts +17 -0
- package/src/runtime/uid.server.ts +6 -4
- package/src/runtime/values.ts +52 -23
- package/src/runtime/with-query.ts +9 -0
- package/src/server/action-hooks.ts +8 -8
- package/src/server/actions.ts +13 -14
- package/src/server/api-modules.ts +2 -3
- package/src/server/app-stages.ts +15 -33
- package/src/server/app.ts +10 -5
- package/src/server/auth-mails.ts +0 -2
- package/src/server/env-state.ts +40 -10
- package/src/server/flash.ts +1 -1
- package/src/server/guard-requirement.ts +4 -4
- package/src/server/image.ts +2 -2
- package/src/server/index.ts +0 -2
- package/src/server/job-context.ts +3 -3
- package/src/server/jobs-page.ts +1 -1
- package/src/server/jobs.ts +5 -9
- package/src/server/kept-exports.ts +0 -2
- package/src/server/kv.ts +11 -14
- package/src/server/library.ts +1 -3
- package/src/server/live.ts +2 -2
- package/src/server/mcp.ts +3 -9
- package/src/server/metrics.ts +2 -4
- package/src/server/page-settings.ts +10 -19
- package/src/server/prerender.ts +19 -2
- package/src/server/protection.ts +15 -18
- package/src/server/queue.ts +3 -6
- package/src/server/rate-limit.ts +0 -3
- package/src/server/render-document.ts +9 -7
- package/src/server/render.ts +1 -1
- package/src/server/routes.ts +7 -3
- package/src/server/scope.ts +3 -2
- package/src/server/session.ts +5 -6
- package/src/server/setup.ts +1 -1
- package/src/server/signals.ts +17 -7
- package/src/server/signed.ts +1 -3
- package/src/server/source.ts +20 -4
- package/src/server/speculation.ts +1 -1
- package/src/server/storage.ts +3 -8
- package/src/server/validate.ts +1 -1
- package/src/server/vitals.ts +1 -3
- package/src/server/work-scope.ts +2 -4
- package/src/server/work.ts +1 -1
- package/src/server/workflow.ts +1 -1
- package/src/test/index.ts +2 -1
- package/src/test/site-actions.ts +16 -6
- package/src/test/site-keys.ts +10 -15
- package/src/test/site-socket.ts +1 -2
- package/src/test/site-types.ts +0 -8
- package/types/build/route-sizes.d.ts.map +1 -1
- package/types/build/variants.d.ts +9 -1
- package/types/build/variants.d.ts.map +1 -1
- package/types/check/diagnose.d.ts.map +1 -1
- package/types/check/index.d.ts +1 -2
- package/types/check/index.d.ts.map +1 -1
- package/types/check/project.d.ts.map +1 -1
- package/types/check/schema-builders.d.ts.map +1 -1
- package/types/check/shadow-types.d.ts.map +1 -1
- package/types/commands/env.d.ts.map +1 -1
- package/types/commands/upgrade.d.ts.map +1 -1
- package/types/compiler/allow-comments.d.ts +2 -0
- package/types/compiler/allow-comments.d.ts.map +1 -1
- package/types/compiler/ast.d.ts +1 -2
- package/types/compiler/ast.d.ts.map +1 -1
- package/types/compiler/browser.d.ts.map +1 -1
- package/types/compiler/class-items.d.ts +7 -0
- package/types/compiler/class-items.d.ts.map +1 -0
- package/types/compiler/deprecated-library.d.ts.map +1 -1
- package/types/compiler/deprecated-lints-1-106.d.ts +2 -2
- package/types/compiler/deprecated-lints-1-106.d.ts.map +1 -1
- package/types/compiler/deprecated-lints.d.ts +2 -553
- package/types/compiler/deprecated-lints.d.ts.map +1 -1
- package/types/compiler/deprecated-ui-props.d.ts +1 -8
- package/types/compiler/deprecated-ui-props.d.ts.map +1 -1
- package/types/compiler/errors.d.ts +2 -2
- package/types/compiler/errors.d.ts.map +1 -1
- package/types/compiler/fence-checks.d.ts +0 -1
- package/types/compiler/fence-checks.d.ts.map +1 -1
- package/types/compiler/hand-parts.d.ts +10 -0
- package/types/compiler/hand-parts.d.ts.map +1 -0
- package/types/compiler/image-attributes.d.ts +0 -1
- package/types/compiler/image-attributes.d.ts.map +1 -1
- package/types/compiler/index.d.ts.map +1 -1
- package/types/compiler/island-arguments.d.ts +7 -11
- 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 +1 -3
- package/types/compiler/island-declaration.d.ts.map +1 -1
- package/types/compiler/island-lints.d.ts +17 -0
- package/types/compiler/island-lints.d.ts.map +1 -0
- package/types/compiler/island-problems.d.ts +7 -0
- package/types/compiler/island-problems.d.ts.map +1 -0
- package/types/compiler/items.d.ts +1 -0
- package/types/compiler/items.d.ts.map +1 -1
- package/types/compiler/jsx-class.d.ts +1 -2
- package/types/compiler/jsx-class.d.ts.map +1 -1
- 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 +0 -6
- package/types/compiler/link-flags.d.ts.map +1 -1
- package/types/compiler/lints.d.ts +21 -566
- package/types/compiler/lints.d.ts.map +1 -1
- package/types/compiler/markup.d.ts +1 -1
- 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.map +1 -1
- package/types/compiler/page-settings.d.ts +4 -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.map +1 -1
- package/types/compiler/removed-lints.d.ts +3 -0
- package/types/compiler/removed-lints.d.ts.map +1 -0
- package/types/compiler/script-server.d.ts.map +1 -1
- package/types/compiler/signal-from-prop.d.ts +4 -0
- package/types/compiler/signal-from-prop.d.ts.map +1 -0
- package/types/compiler/template-reads.d.ts +1 -0
- package/types/compiler/template-reads.d.ts.map +1 -1
- package/types/compiler/validate.d.ts.map +1 -1
- package/types/config-loader.d.ts.map +1 -1
- package/types/config-resolve.d.ts.map +1 -1
- package/types/config-shape.d.ts +1 -1
- package/types/config-shape.d.ts.map +1 -1
- package/types/config.d.ts +5 -105
- package/types/config.d.ts.map +1 -1
- package/types/dev/preload.d.ts.map +1 -1
- package/types/lsp/server.d.ts.map +1 -1
- package/types/migrate/markup.d.ts.map +1 -1
- package/types/runtime/action-call.d.ts.map +1 -1
- package/types/runtime/action-encode.d.ts +1 -0
- package/types/runtime/action-encode.d.ts.map +1 -1
- package/types/runtime/action-error.d.ts +1 -2
- package/types/runtime/action-error.d.ts.map +1 -1
- package/types/runtime/action-run.d.ts.map +1 -1
- package/types/runtime/action-shared.d.ts +1 -27
- package/types/runtime/action-shared.d.ts.map +1 -1
- package/types/runtime/action-stream.d.ts.map +1 -1
- package/types/runtime/action.d.ts +1 -1
- package/types/runtime/action.d.ts.map +1 -1
- package/types/runtime/call-result.d.ts +0 -10
- package/types/runtime/call-result.d.ts.map +1 -1
- package/types/runtime/checks.d.ts +14 -11
- package/types/runtime/checks.d.ts.map +1 -1
- package/types/runtime/client.d.ts.map +1 -1
- package/types/runtime/core.d.ts +2 -20
- package/types/runtime/core.d.ts.map +1 -1
- package/types/runtime/dom.d.ts +1 -1
- package/types/runtime/dom.d.ts.map +1 -1
- package/types/runtime/html.d.ts +1 -1
- package/types/runtime/html.d.ts.map +1 -1
- package/types/runtime/i18n.client.d.ts +0 -1
- package/types/runtime/i18n.client.d.ts.map +1 -1
- package/types/runtime/i18n.d.ts +1 -1
- package/types/runtime/i18n.d.ts.map +1 -1
- package/types/runtime/i18n.server.d.ts +0 -1
- package/types/runtime/i18n.server.d.ts.map +1 -1
- package/types/runtime/image.d.ts.map +1 -1
- package/types/runtime/index.d.ts +3 -3
- package/types/runtime/index.d.ts.map +1 -1
- package/types/runtime/island.server.d.ts +2 -0
- package/types/runtime/island.server.d.ts.map +1 -1
- package/types/runtime/live-resource.server.d.ts.map +1 -1
- package/types/runtime/live-value.shared.d.ts +7 -15
- package/types/runtime/live-value.shared.d.ts.map +1 -1
- package/types/runtime/live.d.ts +0 -11
- package/types/runtime/live.d.ts.map +1 -1
- package/types/runtime/local-types.d.ts +0 -14
- package/types/runtime/local-types.d.ts.map +1 -1
- package/types/runtime/navigate-api.d.ts +0 -4
- package/types/runtime/navigate-api.d.ts.map +1 -1
- package/types/runtime/navigate.d.ts.map +1 -1
- package/types/runtime/navigation-state.d.ts +0 -4
- package/types/runtime/navigation-state.d.ts.map +1 -1
- package/types/runtime/navigation.d.ts +2 -0
- package/types/runtime/navigation.d.ts.map +1 -1
- package/types/runtime/page-swap.d.ts.map +1 -1
- package/types/runtime/persist.d.ts +1 -0
- package/types/runtime/persist.d.ts.map +1 -1
- package/types/runtime/persisted.d.ts +0 -15
- package/types/runtime/persisted.d.ts.map +1 -1
- package/types/runtime/presence.d.ts +0 -2
- package/types/runtime/presence.d.ts.map +1 -1
- package/types/runtime/query-param.d.ts.map +1 -1
- package/types/runtime/reactive.d.ts +2 -1
- package/types/runtime/reactive.d.ts.map +1 -1
- package/types/runtime/refuse.d.ts +0 -7
- package/types/runtime/refuse.d.ts.map +1 -1
- package/types/runtime/store-base.d.ts +1 -2
- package/types/runtime/store-base.d.ts.map +1 -1
- package/types/runtime/swap-flight.d.ts +1 -1
- package/types/runtime/swap-flight.d.ts.map +1 -1
- package/types/runtime/swap-kept.d.ts.map +1 -1
- package/types/runtime/swap-morph.d.ts.map +1 -1
- package/types/runtime/text-hash.d.ts +2 -0
- package/types/runtime/text-hash.d.ts.map +1 -0
- package/types/runtime/uid.server.d.ts.map +1 -1
- package/types/runtime/values.d.ts +6 -1
- package/types/runtime/values.d.ts.map +1 -1
- package/types/runtime/with-query.d.ts +2 -0
- package/types/runtime/with-query.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/actions.d.ts.map +1 -1
- package/types/server/api-modules.d.ts +0 -1
- package/types/server/api-modules.d.ts.map +1 -1
- package/types/server/app-stages.d.ts +5 -13
- package/types/server/app-stages.d.ts.map +1 -1
- package/types/server/app.d.ts +3 -8
- package/types/server/app.d.ts.map +1 -1
- package/types/server/auth-mails.d.ts +0 -5
- package/types/server/auth-mails.d.ts.map +1 -1
- package/types/server/env-state.d.ts +1 -0
- package/types/server/env-state.d.ts.map +1 -1
- package/types/server/guard-requirement.d.ts +0 -1
- package/types/server/guard-requirement.d.ts.map +1 -1
- package/types/server/image.d.ts +0 -1
- package/types/server/image.d.ts.map +1 -1
- package/types/server/index.d.ts +0 -2
- package/types/server/index.d.ts.map +1 -1
- package/types/server/job-context.d.ts +1 -1
- package/types/server/job-context.d.ts.map +1 -1
- package/types/server/jobs.d.ts +0 -4
- package/types/server/jobs.d.ts.map +1 -1
- package/types/server/kept-exports.d.ts.map +1 -1
- package/types/server/kv.d.ts +4 -4
- package/types/server/kv.d.ts.map +1 -1
- package/types/server/library.d.ts +1 -3
- package/types/server/library.d.ts.map +1 -1
- package/types/server/mcp.d.ts +0 -1
- package/types/server/mcp.d.ts.map +1 -1
- package/types/server/metrics.d.ts +0 -5
- package/types/server/metrics.d.ts.map +1 -1
- package/types/server/page-settings.d.ts +3 -3
- package/types/server/page-settings.d.ts.map +1 -1
- package/types/server/prerender.d.ts.map +1 -1
- package/types/server/protection.d.ts +6 -6
- package/types/server/protection.d.ts.map +1 -1
- package/types/server/queue.d.ts +1 -3
- package/types/server/queue.d.ts.map +1 -1
- package/types/server/rate-limit.d.ts +0 -2
- package/types/server/rate-limit.d.ts.map +1 -1
- package/types/server/render-document.d.ts +1 -1
- package/types/server/render-document.d.ts.map +1 -1
- package/types/server/routes.d.ts +1 -1
- package/types/server/routes.d.ts.map +1 -1
- package/types/server/scope.d.ts.map +1 -1
- package/types/server/session.d.ts +1 -1
- package/types/server/session.d.ts.map +1 -1
- package/types/server/signals.d.ts.map +1 -1
- package/types/server/signed.d.ts +0 -2
- package/types/server/signed.d.ts.map +1 -1
- package/types/server/source.d.ts +1 -1
- package/types/server/source.d.ts.map +1 -1
- package/types/server/storage.d.ts +0 -4
- package/types/server/storage.d.ts.map +1 -1
- package/types/server/vitals.d.ts +0 -1
- package/types/server/vitals.d.ts.map +1 -1
- package/types/server/work-scope.d.ts +0 -2
- package/types/server/work-scope.d.ts.map +1 -1
- package/types/server/workflow.d.ts +1 -1
- package/types/server/workflow.d.ts.map +1 -1
- package/types/test/index.d.ts.map +1 -1
- package/types/test/site-actions.d.ts +1 -1
- package/types/test/site-actions.d.ts.map +1 -1
- package/types/test/site-keys.d.ts +1 -1
- package/types/test/site-keys.d.ts.map +1 -1
- package/types/test/site-socket.d.ts +1 -1
- package/types/test/site-socket.d.ts.map +1 -1
- package/types/test/site-types.d.ts +0 -8
- package/types/test/site-types.d.ts.map +1 -1
- package/llms/deprecated-lints-1-105-libraries.md +0 -32
- package/llms/deprecated-lints-1-105.md +0 -58
- package/src/check/action-readers.ts +0 -115
- package/src/check/action-type.ts +0 -44
- package/src/check/ai-language.ts +0 -56
- package/src/check/app-hooks.ts +0 -90
- package/src/check/auth-methods.ts +0 -85
- package/src/check/auth-rate-limits.ts +0 -99
- package/src/check/call-result.ts +0 -242
- package/src/check/client-keys.ts +0 -10
- package/src/check/cms-options.ts +0 -81
- package/src/check/config-groups.ts +0 -22
- package/src/check/config-switches.ts +0 -38
- package/src/check/context-import.ts +0 -51
- package/src/check/env-files.ts +0 -31
- package/src/check/format-duration.ts +0 -75
- package/src/check/guard-options.ts +0 -58
- package/src/check/handler-events.ts +0 -149
- package/src/check/hook-context.ts +0 -94
- package/src/check/hook-names.ts +0 -104
- package/src/check/i18n-keys.ts +0 -50
- package/src/check/images-keys.ts +0 -54
- package/src/check/job-shapes.ts +0 -273
- package/src/check/link-flag-tests.ts +0 -130
- package/src/check/live-api.ts +0 -137
- package/src/check/mail-api.ts +0 -67
- package/src/check/one-state-api.ts +0 -357
- package/src/check/pages-options.ts +0 -35
- package/src/check/rate-enforce.ts +0 -53
- package/src/check/refusal-calls.ts +0 -185
- package/src/check/retired-lints.ts +0 -49
- package/src/check/route-keys.ts +0 -166
- package/src/check/secret-keys.ts +0 -83
- package/src/check/socket-frames.ts +0 -102
- package/src/check/source-readers.ts +0 -257
- package/src/check/store-ms.ts +0 -72
- package/src/check/store-names.ts +0 -88
- package/src/check/test-helpers.ts +0 -98
- package/src/check/ttl-names.ts +0 -142
- package/src/compiler/deprecated-ai-labels.ts +0 -97
- package/src/compiler/deprecated-ai-links.ts +0 -63
- package/src/compiler/deprecated-allow.ts +0 -50
- package/src/compiler/deprecated-auth-lints.ts +0 -14
- package/src/compiler/deprecated-auth-signed.ts +0 -29
- package/src/compiler/deprecated-children.ts +0 -66
- package/src/compiler/deprecated-image.ts +0 -116
- package/src/compiler/deprecated-island.ts +0 -155
- package/src/compiler/deprecated-lints-1-105.ts +0 -41
- package/src/compiler/deprecated-page.ts +0 -125
- package/src/compiler/deprecated-parts.ts +0 -22
- package/src/compiler/deprecated-typed-lints.ts +0 -23
- package/src/compiler/deprecated-ui-callbacks.ts +0 -66
- package/src/compiler/deprecated-ui-input.ts +0 -97
- package/src/compiler/deprecated-ui-items.ts +0 -47
- package/src/compiler/old-parts.ts +0 -84
- package/src/runtime/mount.compat.ts +0 -8
- package/src/server/moved-exports.ts +0 -17
- package/types/check/action-readers.d.ts +0 -3
- package/types/check/action-readers.d.ts.map +0 -1
- package/types/check/action-type.d.ts +0 -3
- package/types/check/action-type.d.ts.map +0 -1
- package/types/check/ai-language.d.ts +0 -3
- package/types/check/ai-language.d.ts.map +0 -1
- package/types/check/app-hooks.d.ts +0 -3
- package/types/check/app-hooks.d.ts.map +0 -1
- package/types/check/auth-methods.d.ts +0 -3
- package/types/check/auth-methods.d.ts.map +0 -1
- package/types/check/auth-rate-limits.d.ts +0 -3
- package/types/check/auth-rate-limits.d.ts.map +0 -1
- package/types/check/call-result.d.ts +0 -7
- package/types/check/call-result.d.ts.map +0 -1
- package/types/check/client-keys.d.ts +0 -3
- package/types/check/client-keys.d.ts.map +0 -1
- package/types/check/cms-options.d.ts +0 -3
- package/types/check/cms-options.d.ts.map +0 -1
- package/types/check/config-groups.d.ts +0 -3
- package/types/check/config-groups.d.ts.map +0 -1
- package/types/check/config-switches.d.ts +0 -3
- package/types/check/config-switches.d.ts.map +0 -1
- package/types/check/context-import.d.ts +0 -3
- package/types/check/context-import.d.ts.map +0 -1
- package/types/check/env-files.d.ts +0 -3
- package/types/check/env-files.d.ts.map +0 -1
- package/types/check/format-duration.d.ts +0 -5
- package/types/check/format-duration.d.ts.map +0 -1
- package/types/check/guard-options.d.ts +0 -3
- package/types/check/guard-options.d.ts.map +0 -1
- package/types/check/handler-events.d.ts +0 -9
- package/types/check/handler-events.d.ts.map +0 -1
- package/types/check/hook-context.d.ts +0 -3
- package/types/check/hook-context.d.ts.map +0 -1
- package/types/check/hook-names.d.ts +0 -3
- package/types/check/hook-names.d.ts.map +0 -1
- package/types/check/i18n-keys.d.ts +0 -3
- package/types/check/i18n-keys.d.ts.map +0 -1
- package/types/check/images-keys.d.ts +0 -3
- package/types/check/images-keys.d.ts.map +0 -1
- package/types/check/job-shapes.d.ts +0 -6
- package/types/check/job-shapes.d.ts.map +0 -1
- package/types/check/link-flag-tests.d.ts +0 -4
- package/types/check/link-flag-tests.d.ts.map +0 -1
- package/types/check/live-api.d.ts +0 -3
- package/types/check/live-api.d.ts.map +0 -1
- package/types/check/mail-api.d.ts +0 -3
- package/types/check/mail-api.d.ts.map +0 -1
- package/types/check/one-state-api.d.ts +0 -9
- package/types/check/one-state-api.d.ts.map +0 -1
- package/types/check/pages-options.d.ts +0 -3
- package/types/check/pages-options.d.ts.map +0 -1
- package/types/check/rate-enforce.d.ts +0 -3
- package/types/check/rate-enforce.d.ts.map +0 -1
- package/types/check/refusal-calls.d.ts +0 -3
- package/types/check/refusal-calls.d.ts.map +0 -1
- package/types/check/retired-lints.d.ts +0 -3
- package/types/check/retired-lints.d.ts.map +0 -1
- package/types/check/route-keys.d.ts +0 -3
- package/types/check/route-keys.d.ts.map +0 -1
- package/types/check/secret-keys.d.ts +0 -3
- package/types/check/secret-keys.d.ts.map +0 -1
- package/types/check/socket-frames.d.ts +0 -3
- package/types/check/socket-frames.d.ts.map +0 -1
- package/types/check/source-readers.d.ts +0 -3
- package/types/check/source-readers.d.ts.map +0 -1
- package/types/check/store-ms.d.ts +0 -3
- package/types/check/store-ms.d.ts.map +0 -1
- package/types/check/store-names.d.ts +0 -3
- package/types/check/store-names.d.ts.map +0 -1
- package/types/check/test-helpers.d.ts +0 -3
- package/types/check/test-helpers.d.ts.map +0 -1
- package/types/check/ttl-names.d.ts +0 -3
- package/types/check/ttl-names.d.ts.map +0 -1
- package/types/compiler/deprecated-ai-labels.d.ts +0 -5
- package/types/compiler/deprecated-ai-labels.d.ts.map +0 -1
- package/types/compiler/deprecated-ai-links.d.ts +0 -5
- package/types/compiler/deprecated-ai-links.d.ts.map +0 -1
- package/types/compiler/deprecated-allow.d.ts +0 -5
- package/types/compiler/deprecated-allow.d.ts.map +0 -1
- package/types/compiler/deprecated-auth-lints.d.ts +0 -12
- package/types/compiler/deprecated-auth-lints.d.ts.map +0 -1
- package/types/compiler/deprecated-auth-signed.d.ts +0 -5
- package/types/compiler/deprecated-auth-signed.d.ts.map +0 -1
- package/types/compiler/deprecated-children.d.ts +0 -4
- package/types/compiler/deprecated-children.d.ts.map +0 -1
- package/types/compiler/deprecated-image.d.ts +0 -5
- package/types/compiler/deprecated-image.d.ts.map +0 -1
- package/types/compiler/deprecated-island.d.ts +0 -9
- package/types/compiler/deprecated-island.d.ts.map +0 -1
- package/types/compiler/deprecated-lints-1-105.d.ts +0 -39
- package/types/compiler/deprecated-lints-1-105.d.ts.map +0 -1
- package/types/compiler/deprecated-page.d.ts +0 -4
- package/types/compiler/deprecated-page.d.ts.map +0 -1
- package/types/compiler/deprecated-parts.d.ts +0 -3
- package/types/compiler/deprecated-parts.d.ts.map +0 -1
- package/types/compiler/deprecated-typed-lints.d.ts +0 -21
- package/types/compiler/deprecated-typed-lints.d.ts.map +0 -1
- package/types/compiler/deprecated-ui-callbacks.d.ts +0 -5
- package/types/compiler/deprecated-ui-callbacks.d.ts.map +0 -1
- package/types/compiler/deprecated-ui-input.d.ts +0 -5
- package/types/compiler/deprecated-ui-input.d.ts.map +0 -1
- package/types/compiler/deprecated-ui-items.d.ts +0 -5
- package/types/compiler/deprecated-ui-items.d.ts.map +0 -1
- package/types/compiler/old-parts.d.ts +0 -9
- package/types/compiler/old-parts.d.ts.map +0 -1
- package/types/runtime/mount.compat.d.ts +0 -7
- package/types/runtime/mount.compat.d.ts.map +0 -1
- package/types/server/moved-exports.d.ts +0 -12
- package/types/server/moved-exports.d.ts.map +0 -1
package/src/build/variants.ts
CHANGED
|
@@ -5,10 +5,13 @@ import { dirname, join } from 'node:path'
|
|
|
5
5
|
import { elementsIn } from '../compiler/ast'
|
|
6
6
|
import { changeName } from '../compiler/bound-props'
|
|
7
7
|
import { parseExpanded } from '../compiler/markdown-block'
|
|
8
|
+
import { analyzeScript } from '../compiler/script'
|
|
8
9
|
|
|
9
10
|
// A component names the features an app may leave out with `uses('selectable')`, the `uses` it imports from kayjs-ui's marker module: a call that is true while the prop is there to be written, and that a browser build replaces with `true` or `false` once it has read the props the files of the project write at their call sites. See `specializedSource`.
|
|
10
11
|
const USES_CALL = /\buses\(\s*'(\w+)'(\s*,\s*true)?\s*\)/y
|
|
11
12
|
const KAY_IMPORT = /^import\s+(\w+)\s+from\s+(["'])([^"'\n]+\.kay)\2/gm
|
|
13
|
+
// Whether a file imports a `.kay` component, one that may hand its rest props on to a component with features.
|
|
14
|
+
const HAS_KAY_IMPORT = /^import\s+\w+\s+from\s+(["'])[^"'\n]+\.kay\1/m
|
|
12
15
|
// A component the compiler imports lazily, `KayLazy(key, () => import("./it.kay"))`.
|
|
13
16
|
const LAZY_IMPORT = /\bimport\(\s*(["'])([^"'\n]+\.kay)\1\s*\)/g
|
|
14
17
|
const USES_IMPORT = /^import\s*\{[^}]*\buses\b[^}]*\}\s*from\s*(["'])([^"'\n]+)\1/m
|
|
@@ -20,6 +23,7 @@ const FENCE = /^---(?:\s|$)/
|
|
|
20
23
|
const USES_IF = /^([ \t]*)((?:else )?if) (.*\buses\(.*)$/
|
|
21
24
|
const IDENTIFIER_CHAR = /[\w$.]/
|
|
22
25
|
const BACKSLASH = /\\/g
|
|
26
|
+
const COMMENT_LINE = /^[ \t]*\/\/.*$/gm
|
|
23
27
|
|
|
24
28
|
// The suffix an import of a variant carries: the features, joined by dashes (a dot would end the stem of the file name the bundler gives an entry), the call sites of the project use.
|
|
25
29
|
// `~` and the props the call sites write follow when the project reads them all: the props a spread may carry are not known.
|
|
@@ -176,14 +180,18 @@ function replaceCalls(text: string, answer: (feature: string, onByDefault: boole
|
|
|
176
180
|
interface Declared {
|
|
177
181
|
names: string[]
|
|
178
182
|
defaults: ReadonlySet<string>
|
|
183
|
+
// Whether the file imports a `.kay` component, so its callers' props may reach a feature through it.
|
|
184
|
+
imports?: boolean
|
|
179
185
|
}
|
|
180
186
|
|
|
181
187
|
const NONE: Declared = { names: [], defaults: new Set() }
|
|
182
188
|
const featuresOf = new Map<string, { stamp: number, declared: Promise<Declared> }>()
|
|
183
189
|
|
|
184
190
|
function usesIn(source: string, file: string): Declared {
|
|
191
|
+
const imports = HAS_KAY_IMPORT.test(source)
|
|
192
|
+
|
|
185
193
|
if (file !== '' && !importsMarker(source, file))
|
|
186
|
-
return NONE
|
|
194
|
+
return imports ? { ...NONE, imports } : NONE
|
|
187
195
|
|
|
188
196
|
const found = new Set<string>()
|
|
189
197
|
const defaults = new Set<string>()
|
|
@@ -197,7 +205,7 @@ function usesIn(source: string, file: string): Declared {
|
|
|
197
205
|
return ''
|
|
198
206
|
})
|
|
199
207
|
|
|
200
|
-
return { names: [...found], defaults }
|
|
208
|
+
return { names: [...found], defaults, imports }
|
|
201
209
|
}
|
|
202
210
|
|
|
203
211
|
// The features a text names: the `uses('x')` of a file importing the marker, none otherwise.
|
|
@@ -466,12 +474,18 @@ export function specializedSource(source: string, present: ReadonlySet<string>,
|
|
|
466
474
|
// Stands for every prop of a component: it is called with a spread or read as a value, so any may be written.
|
|
467
475
|
export const ANY = Symbol('any')
|
|
468
476
|
|
|
477
|
+
// Stands in a call's props for a spread of the file's own rest props: what the file's callers write reaches the component, minus the props the file takes by name.
|
|
478
|
+
const PASSED = '...'
|
|
479
|
+
// Starts what stands in the props for `name={prop}`, `prop` a prop the file takes by name with no default: `name` is written when the file's callers write `prop`.
|
|
480
|
+
const FORWARDED = '>'
|
|
481
|
+
|
|
469
482
|
// What stands for a call that leaves a feature on by default (`uses('x', true)`) on: the prop left out or written with anything but a literal `false`.
|
|
470
483
|
const ON_PREFIX = '+'
|
|
471
484
|
const PROP_NAME = /^\w+$/
|
|
472
485
|
|
|
473
486
|
// The props the call sites of each `.kay` component a file imports write, by the name the file gives it; `defaults` names, by local, the features on when the prop is left out, which a call keeps on by adding `+name`.
|
|
474
|
-
|
|
487
|
+
// A spread of `rest.name`, the file's own rest props, hands its callers' props on instead of any: `PASSED` stands in the props for it. An attribute written as a prop `rest.forwards` names is written when that prop is.
|
|
488
|
+
export function propsWritten(source: string, locals: readonly string[], defaults: ReadonlyMap<string, ReadonlySet<string>> = new Map(), rest?: Pick<Rest, 'name' | 'forwards'>): Map<string, Set<string> | typeof ANY> {
|
|
475
489
|
const { file } = parseExpanded(source)
|
|
476
490
|
const written = new Map<string, Set<string>>()
|
|
477
491
|
const calls = new Map<string, number>()
|
|
@@ -488,10 +502,17 @@ export function propsWritten(source: string, locals: readonly string[], defaults
|
|
|
488
502
|
written.set(element.name, props)
|
|
489
503
|
|
|
490
504
|
const off = new Set<string>()
|
|
505
|
+
let passed = false
|
|
491
506
|
|
|
492
507
|
for (const attribute of element.attributes) {
|
|
493
508
|
if (attribute.kind === 'spread') {
|
|
494
|
-
|
|
509
|
+
if (rest !== undefined && source.slice(attribute.expression.start, attribute.expression.end).trim() === rest.name) {
|
|
510
|
+
props.add(PASSED)
|
|
511
|
+
passed = true
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
open.delete(element.name)
|
|
515
|
+
}
|
|
495
516
|
|
|
496
517
|
continue
|
|
497
518
|
}
|
|
@@ -506,14 +527,18 @@ export function propsWritten(source: string, locals: readonly string[], defaults
|
|
|
506
527
|
continue
|
|
507
528
|
}
|
|
508
529
|
|
|
509
|
-
|
|
530
|
+
const value = attribute.kind === 'expression' ? source.slice(attribute.expression.start, attribute.expression.end).trim() : undefined
|
|
531
|
+
const forwarded = value === undefined ? undefined : rest?.forwards.get(value)
|
|
532
|
+
|
|
533
|
+
props.add(forwarded === undefined ? name : `${FORWARDED}${name}=${forwarded}`)
|
|
510
534
|
|
|
511
|
-
if (
|
|
535
|
+
if (value === 'false')
|
|
512
536
|
off.add(name)
|
|
513
537
|
}
|
|
514
538
|
|
|
515
539
|
for (const feature of defaults.get(element.name) ?? []) {
|
|
516
|
-
|
|
540
|
+
// A spread may bring the prop back on, whatever was written before it.
|
|
541
|
+
if (passed || !off.has(feature))
|
|
517
542
|
props.add(ON_PREFIX + feature)
|
|
518
543
|
}
|
|
519
544
|
|
|
@@ -522,15 +547,42 @@ export function propsWritten(source: string, locals: readonly string[], defaults
|
|
|
522
547
|
}
|
|
523
548
|
}
|
|
524
549
|
|
|
550
|
+
// A comment line naming the component is no read of it.
|
|
551
|
+
const code = source.replace(COMMENT_LINE, '')
|
|
552
|
+
|
|
525
553
|
for (const local of locals) {
|
|
526
554
|
// The import names it once, each call once more.
|
|
527
|
-
if ((
|
|
555
|
+
if ((code.match(new RegExp(`\\b${local}\\b`, 'g'))?.length ?? 0) !== 1 + (calls.get(local) ?? 0))
|
|
528
556
|
open.delete(local)
|
|
529
557
|
}
|
|
530
558
|
|
|
531
559
|
return new Map(locals.map(local => [local, open.has(local) ? written.get(local) ?? new Set<string>() : ANY]))
|
|
532
560
|
}
|
|
533
561
|
|
|
562
|
+
// The name of a file's rest props (none when it has none), the props it takes by name (which its spread of the rest does not hand on) and, of those with no default, the key by the name the file reads it as.
|
|
563
|
+
interface Rest {
|
|
564
|
+
name: string
|
|
565
|
+
taken: Set<string>
|
|
566
|
+
forwards: Map<string, string>
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function restOf(source: string): Rest | undefined {
|
|
570
|
+
try {
|
|
571
|
+
const { file } = parseExpanded(source)
|
|
572
|
+
const { props } = analyzeScript(file.source, file.script, [], file.module)
|
|
573
|
+
|
|
574
|
+
if (props === undefined)
|
|
575
|
+
return undefined
|
|
576
|
+
|
|
577
|
+
const forwards = new Map(props.bindings.filter(binding => binding.fallback === undefined).map(binding => [file.source.slice(binding.local.start, binding.local.end), binding.key]))
|
|
578
|
+
|
|
579
|
+
return { name: props.rest === undefined ? '' : file.source.slice(props.rest.start, props.rest.end), taken: new Set(props.bindings.map(binding => binding.key)), forwards }
|
|
580
|
+
}
|
|
581
|
+
catch {
|
|
582
|
+
return undefined
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
534
586
|
interface Candidate {
|
|
535
587
|
local: string
|
|
536
588
|
specifier: string
|
|
@@ -539,8 +591,8 @@ interface Candidate {
|
|
|
539
591
|
defaults: ReadonlySet<string>
|
|
540
592
|
}
|
|
541
593
|
|
|
542
|
-
// The `.kay` components a file imports that name features.
|
|
543
|
-
async function candidatesOf(code: string, file: string): Promise<Candidate[]> {
|
|
594
|
+
// The `.kay` components a file imports that name features, and with `passing` those importing a component too, whose callers may reach a feature through them.
|
|
595
|
+
async function candidatesOf(code: string, file: string, passing = false): Promise<Candidate[]> {
|
|
544
596
|
const found: Candidate[] = []
|
|
545
597
|
|
|
546
598
|
for (const [local, specifier] of [...code.matchAll(KAY_IMPORT).map(([, name, , from]) => [name!, from!] as const), ...code.matchAll(LAZY_IMPORT).map(([, , from]) => ['', from!] as const)]) {
|
|
@@ -553,9 +605,9 @@ async function candidatesOf(code: string, file: string): Promise<Candidate[]> {
|
|
|
553
605
|
continue
|
|
554
606
|
}
|
|
555
607
|
|
|
556
|
-
const { names: features, defaults } = await declaredFeatures(path)
|
|
608
|
+
const { names: features, defaults, imports } = await declaredFeatures(path)
|
|
557
609
|
|
|
558
|
-
if (features.length > 0)
|
|
610
|
+
if (features.length > 0 || (passing && imports === true))
|
|
559
611
|
found.push({ local, specifier, path, features, defaults })
|
|
560
612
|
}
|
|
561
613
|
|
|
@@ -565,6 +617,8 @@ async function candidatesOf(code: string, file: string): Promise<Candidate[]> {
|
|
|
565
617
|
// What the `.kay` files of a project write of each component with features, all of them together: a component has one variant, so the chunks of two islands using a Table share it.
|
|
566
618
|
export class VariantIndex {
|
|
567
619
|
private readonly union = new Map<string, Set<string> | typeof ANY>()
|
|
620
|
+
// The files handing their rest props on to a component, by its path: what their own callers write reaches it.
|
|
621
|
+
private readonly through = new Map<string, { from: string, taken: ReadonlySet<string>, forwards: [name: string, key: string][] }[]>()
|
|
568
622
|
private readonly indexed = new Map<string, Promise<void>>()
|
|
569
623
|
private scan: Promise<void> | undefined
|
|
570
624
|
|
|
@@ -594,15 +648,16 @@ export class VariantIndex {
|
|
|
594
648
|
}
|
|
595
649
|
|
|
596
650
|
private async read(file: string, source: string): Promise<void> {
|
|
597
|
-
const candidates = (await candidatesOf(source, file)).filter(candidate => candidate.local !== '')
|
|
651
|
+
const candidates = (await candidatesOf(source, file, true)).filter(candidate => candidate.local !== '')
|
|
598
652
|
|
|
599
653
|
if (candidates.length === 0)
|
|
600
654
|
return
|
|
601
655
|
|
|
602
656
|
let written: ReturnType<typeof propsWritten>
|
|
657
|
+
const rest = restOf(source)
|
|
603
658
|
|
|
604
659
|
try {
|
|
605
|
-
written = propsWritten(source, candidates.map(candidate => candidate.local), new Map(candidates.map(candidate => [candidate.local, candidate.defaults])))
|
|
660
|
+
written = propsWritten(source, candidates.map(candidate => candidate.local), new Map(candidates.map(candidate => [candidate.local, candidate.defaults])), rest)
|
|
606
661
|
}
|
|
607
662
|
catch {
|
|
608
663
|
written = new Map(candidates.map(candidate => [candidate.local, ANY]))
|
|
@@ -612,13 +667,62 @@ export class VariantIndex {
|
|
|
612
667
|
const props = written.get(local) ?? new Set<string>()
|
|
613
668
|
const before = this.union.get(path)
|
|
614
669
|
|
|
670
|
+
if (props !== ANY && rest !== undefined) {
|
|
671
|
+
const forwards = [...props].filter(name => name.startsWith(FORWARDED)).map(name => name.slice(1).split('=') as [string, string])
|
|
672
|
+
|
|
673
|
+
for (const name of [...props].filter(name => name.startsWith(FORWARDED)))
|
|
674
|
+
props.delete(name)
|
|
675
|
+
|
|
676
|
+
if (props.delete(PASSED) || forwards.length > 0)
|
|
677
|
+
this.through.set(path, [...this.through.get(path) ?? [], { from: realFile(file), taken: rest.taken, forwards }])
|
|
678
|
+
}
|
|
679
|
+
|
|
615
680
|
this.union.set(path, before === ANY || props === ANY ? ANY : new Set([...before ?? [], ...props]))
|
|
616
681
|
}
|
|
617
682
|
}
|
|
618
683
|
|
|
684
|
+
// What the call sites of a component write, the ones handing their rest props on counted by what their own callers write.
|
|
685
|
+
private writtenOf(path: string, seen = new Set<string>()): Set<string> | typeof ANY {
|
|
686
|
+
const own = this.union.get(path)
|
|
687
|
+
|
|
688
|
+
if (own === ANY)
|
|
689
|
+
return ANY
|
|
690
|
+
|
|
691
|
+
const links = this.through.get(path)
|
|
692
|
+
|
|
693
|
+
if (links === undefined || seen.has(path))
|
|
694
|
+
return own ?? new Set<string>()
|
|
695
|
+
|
|
696
|
+
const all = new Set(own)
|
|
697
|
+
|
|
698
|
+
seen.add(path)
|
|
699
|
+
|
|
700
|
+
for (const { from, taken, forwards } of links) {
|
|
701
|
+
// A file no scanned call site writes is called from where the scan does not look (a route, a layout, a `.ts` module, a package), so what reaches it is unknown.
|
|
702
|
+
const outer = this.union.has(from) || this.through.has(from) ? this.writtenOf(from, seen) : ANY
|
|
703
|
+
|
|
704
|
+
if (outer === ANY)
|
|
705
|
+
return ANY
|
|
706
|
+
|
|
707
|
+
for (const [name, key] of forwards) {
|
|
708
|
+
if (outer.has(key))
|
|
709
|
+
all.add(name)
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
for (const name of outer) {
|
|
713
|
+
if (!name.startsWith(ON_PREFIX) && !taken.has(name))
|
|
714
|
+
all.add(name)
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
seen.delete(path)
|
|
719
|
+
|
|
720
|
+
return all
|
|
721
|
+
}
|
|
722
|
+
|
|
619
723
|
// The query of a variant: its features, then the props written.
|
|
620
724
|
private usedOf(path: string, features: string[], defaults: ReadonlySet<string>): string {
|
|
621
|
-
const props = this.
|
|
725
|
+
const props = this.writtenOf(path)
|
|
622
726
|
|
|
623
727
|
if (props === ANY)
|
|
624
728
|
return [...features].sort().join('-')
|
|
@@ -642,12 +746,12 @@ export class VariantIndex {
|
|
|
642
746
|
async variantImports(code: string, file: string, source: string): Promise<string> {
|
|
643
747
|
const candidates = await candidatesOf(code, file)
|
|
644
748
|
|
|
645
|
-
if (candidates.length === 0)
|
|
646
|
-
return code
|
|
647
|
-
|
|
648
749
|
await this.scanned()
|
|
649
750
|
await this.add(file, source)
|
|
650
751
|
|
|
752
|
+
if (candidates.length === 0)
|
|
753
|
+
return code
|
|
754
|
+
|
|
651
755
|
let result = code
|
|
652
756
|
|
|
653
757
|
for (const { specifier, path, features, defaults } of candidates) {
|
|
@@ -661,6 +765,16 @@ export class VariantIndex {
|
|
|
661
765
|
}
|
|
662
766
|
}
|
|
663
767
|
|
|
768
|
+
// A file by the path its importers resolve it to.
|
|
769
|
+
function realFile(file: string): string {
|
|
770
|
+
try {
|
|
771
|
+
return Bun.resolveSync(file, dirname(file))
|
|
772
|
+
}
|
|
773
|
+
catch {
|
|
774
|
+
return file
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
664
778
|
// The `.kay` files under a directory, leaving out what a project installs and builds.
|
|
665
779
|
export function kayFiles(dir: string): string[] {
|
|
666
780
|
const found: string[] = []
|
|
@@ -33,7 +33,7 @@ export interface LoadTimeBrowserRead {
|
|
|
33
33
|
diagnostic: Diagnostic
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
// A module of the project that touches a browser-only global as it loads and that a server render imports: a page, a layout or a component they render, which is not
|
|
36
|
+
// A module of the project that touches a browser-only global as it loads and that a server render imports: a page, a layout or a component they render, which is not client-only, and the modules they pull in. It throws on the server the first time the page is rendered, as the module is evaluated.
|
|
37
37
|
// A read inside a function is left out, as only a call decides whether it runs, and so is one a `typeof` or a `try` guards.
|
|
38
38
|
// Reported at the read, naming the first component reaching the module. What the server never renders is left out: a component used only with `render="client"`, and an island the build demotes to the browser for a package it imports, asked as the build asks.
|
|
39
39
|
export async function browserGlobalAtLoad(root: string, components: Map<string, string>, routes: string, cacheDir?: string): Promise<LoadTimeBrowserRead[]> {
|
|
@@ -101,7 +101,7 @@ function clientOnlyImports(source: string): Set<string> {
|
|
|
101
101
|
|
|
102
102
|
visitNodes(file.template, (node) => {
|
|
103
103
|
if (node.kind === 'element' && node.component) {
|
|
104
|
-
const client = node.attributes.some(attribute => attribute.kind === 'static' &&
|
|
104
|
+
const client = node.attributes.some(attribute => attribute.kind === 'static' && source.slice(attribute.name.start, attribute.name.end) === 'render' && attribute.text === 'client')
|
|
105
105
|
|
|
106
106
|
uses.set(node.name, (uses.get(node.name) ?? true) && client)
|
|
107
107
|
}
|
|
@@ -9,7 +9,7 @@ type ObjectExpression = NodeOfType<'ObjectExpression'>
|
|
|
9
9
|
|
|
10
10
|
// The options of `pages()` and `testSite()` that are no config key.
|
|
11
11
|
const PAGES_OPTIONS = ['root', 'dev', 'prebuilt', 'config']
|
|
12
|
-
const TEST_OPTIONS = [...PAGES_OPTIONS, 'outgoing', 'headers', 'use', 'locals', '
|
|
12
|
+
const TEST_OPTIONS = [...PAGES_OPTIONS, 'outgoing', 'headers', 'use', 'locals', 'browser', 'islands', 'styles']
|
|
13
13
|
|
|
14
14
|
const FROM_SERVER = (source: string): boolean => source === 'kay/server' || source === 'kay'
|
|
15
15
|
const FROM_TEST = (source: string): boolean => source === 'kay/test'
|
package/src/check/diagnose.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { Fix, Span } from '../compiler/ast'
|
|
|
4
4
|
import type { LintLevel, LintName } from '../compiler/lints'
|
|
5
5
|
import type { I18nConfig } from '../config'
|
|
6
6
|
import type { RouteMount } from '../server/routes'
|
|
7
|
-
import type { OldFormLint } from './handler-events'
|
|
8
7
|
import type { ShadowFile } from './shadow'
|
|
9
8
|
import { existsSync, realpathSync } from 'node:fs'
|
|
10
9
|
import { basename, dirname, relative, resolve, sep } from 'node:path'
|
|
@@ -18,9 +17,7 @@ import { WRITABLE } from '../compiler/names'
|
|
|
18
17
|
import { parseKay } from '../compiler/parser'
|
|
19
18
|
import { UNSERVED_MESSAGE } from '../runtime/checks'
|
|
20
19
|
import { localePrefixes, localeSettings } from '../server/i18n'
|
|
21
|
-
import { callResultLint } from './call-result'
|
|
22
20
|
import { unknownNameHelp } from './export-homes'
|
|
23
|
-
import { handlerEventLint } from './handler-events'
|
|
24
21
|
import { loopIndexFix, positionalKeyFix } from './loop-index-fix'
|
|
25
22
|
import { sourceSpan } from './shadow'
|
|
26
23
|
import { lastOverload, richCallHint, templateHint } from './template-hints'
|
|
@@ -131,18 +128,6 @@ function blockWithoutParameters(diagnostic: TsgoDiagnostic, source: string, span
|
|
|
131
128
|
return `the component calls \`@${name}\` with (${parameters}): write it with them, as \`@${name}(${[...parameters.matchAll(PARAMETER_NAME)].map(match => `${match[1] ?? ''}${match[2]}`).join(', ')})\``
|
|
132
129
|
}
|
|
133
130
|
|
|
134
|
-
// What the types say of a callback given a function written for its arguments before 1.105, or of an island's call read as data: the deprecated lint that names it, with its fix.
|
|
135
|
-
function oldForm(message: string, source: string, span: Span | undefined): (OldFormLint & { code: LintName }) | undefined {
|
|
136
|
-
const handler = handlerEventLint(message, source, span)
|
|
137
|
-
|
|
138
|
-
if (handler !== undefined)
|
|
139
|
-
return { code: 'deprecated-callback-handler', ...handler }
|
|
140
|
-
|
|
141
|
-
const result = callResultLint(message, source, span, true)
|
|
142
|
-
|
|
143
|
-
return result && { code: 'deprecated-call-result', ...result }
|
|
144
|
-
}
|
|
145
|
-
|
|
146
131
|
// A diagnostic in a .kay file's shadow TSX, read at the levels its source gives the lints.
|
|
147
132
|
export function diagnoseShadow(shadow: ShadowFile, reported: TsgoDiagnostic, levelAt: (lint: LintName, offset: number) => LintLevel, messageKeys: readonly string[] = []): Diagnosed | undefined {
|
|
148
133
|
const span = sourceSpan(shadow, reported.start, reported.end, 'loose')
|
|
@@ -164,13 +149,6 @@ export function diagnoseShadow(shadow: ShadowFile, reported: TsgoDiagnostic, lev
|
|
|
164
149
|
return level === 'allow' ? undefined : { ...lint, severity: severityOf(level), span, ...offered }
|
|
165
150
|
}
|
|
166
151
|
|
|
167
|
-
// A type error that is an old form of before 1.105, with the fix that writes the new one.
|
|
168
|
-
const old = oldForm(diagnostic.message, shadow.source, span)
|
|
169
|
-
const oldLevel = old === undefined ? 'allow' : levelAt(old.code, offset)
|
|
170
|
-
|
|
171
|
-
if (old !== undefined && oldLevel !== 'allow')
|
|
172
|
-
return { ...old, severity: severityOf(oldLevel) }
|
|
173
|
-
|
|
174
152
|
// Unread code is the `unread-name` lint; a name kay generated, which the template reads in a way it does not spell out, is no code of the user's.
|
|
175
153
|
if (diagnostic.code !== undefined && UNUSED_CODES.has(diagnostic.code)) {
|
|
176
154
|
const level = shadow.map.isExact(diagnostic.start) ? levelAt('unread-name', offset) : 'allow'
|
package/src/check/env-types.ts
CHANGED
|
@@ -182,7 +182,7 @@ function environment(patterns: string[], files: string[], api: { mount: string,
|
|
|
182
182
|
' function KayFormError<Target extends string | Action>(target: Target, field?: FieldName<Target>): null',
|
|
183
183
|
' function KayProp<Component>(component: Component): <Value>(value: Value & IslandProp<Component, Value>) => Value',
|
|
184
184
|
' function KayPlainProp<Component>(component: Component): <Value>(value: Value & PlainIslandProp<Component, Value>) => Value',
|
|
185
|
-
' function KayFunctionProp<Component
|
|
185
|
+
' function KayFunctionProp<Component, Names extends object = Record<string, unknown>>(component: Component, names?: Names): (attribute: FunctionProp<Component, Names>) => Record<never, never>',
|
|
186
186
|
' function KayHandsPart<Component>(component: Component): <Name extends string>(name: Name & HandsPart<Component, Name>) => Record<never, never>',
|
|
187
187
|
' function KayBound<Component>(component: Component): <Key extends string, Value>(key: Key & BoundProp<Component, Key>, value: Value, write: (value: BoundValue<Component, Key>) => unknown) => Value',
|
|
188
188
|
' function KayList<Each extends Iterable<any> | null | undefined | false>(each: Each): Each',
|
|
@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs'
|
|
|
2
2
|
import { dirname, resolve } from 'node:path'
|
|
3
3
|
|
|
4
4
|
// The entries an app imports from, in the order a name found in several is attributed: `kay` first, as its values need no import in a component.
|
|
5
|
-
const ENTRIES = ['kay', 'kay/server', 'kay/cache', 'kay/i18n', 'kay/words', 'kay/content', 'kay/seo', 'kay/image', 'kay/icons', 'kay/markdown', 'kay/params', 'kay/edit', 'kay/island', 'kay/await', 'kay/html', 'kay/test', 'kay/dev-tool', 'kay/analytics', 'kay/pg-orm', 'kay/
|
|
5
|
+
const ENTRIES = ['kay', 'kay/server', 'kay/cache', 'kay/i18n', 'kay/words', 'kay/content', 'kay/seo', 'kay/image', 'kay/icons', 'kay/markdown', 'kay/params', 'kay/edit', 'kay/island', 'kay/await', 'kay/html', 'kay/test', 'kay/dev-tool', 'kay/analytics', 'kay/pg-orm', 'kay/compiler', 'kay/bun', 'kay/library']
|
|
6
6
|
const EXPORT_ALL = /^export\s*\*\s*from\s*['"](\.[^'"]+)['"]/gm
|
|
7
7
|
const UNKNOWN_NAME = /^Cannot find name '([\w$]+)'/
|
|
8
8
|
const EXTENSIONS = ['', '.ts', '/index.ts']
|
package/src/check/guards.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { guardRequirement, requiredBy } from '../server/guard-requirement'
|
|
|
7
7
|
|
|
8
8
|
const HELP = 'add a `_guard.ts` to its directory or one above it, or, if anyone may reach it, set `guards: false`'
|
|
9
9
|
|
|
10
|
-
// On a site with `
|
|
11
|
-
// A site that leaves `
|
|
10
|
+
// On a site with `guards: { default: 'closed' }`, what the server answers 403 for: each page, layout with actions, endpoint and API module of the app no guard covers that does not set `guards: false`.
|
|
11
|
+
// A site that leaves `guards.default` unset but guards some route of its own is held to it for its routes alone (not layouts or action modules), as its start refuses them; `guards: { default: 'open' }` keeps it open.
|
|
12
12
|
export async function unguardedRoutes(options: CheckOptions, { routes, endpoints, apiModules }: ServedProject): Promise<CheckDiagnostic[]> {
|
|
13
13
|
const level = lintLevel('unguarded-route', options.lints)
|
|
14
14
|
|
|
@@ -50,7 +50,7 @@ export async function unguardedRoutes(options: CheckOptions, { routes, endpoints
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
// Layouts and action modules are not routes: a site that leaves `
|
|
53
|
+
// Layouts and action modules are not routes: a site that leaves `guards.default` unset is told of its routes alone.
|
|
54
54
|
for (const [layout, guarded] of required === 'routes' ? [] : layouts) {
|
|
55
55
|
const source = guarded ? '' : await Bun.file(layout).text()
|
|
56
56
|
const actions = guarded ? [] : analyzeServer(source, parseKay(source).server)?.actionNames ?? []
|
package/src/check/index.ts
CHANGED
|
@@ -14,7 +14,6 @@ import { lintLevels } from '../compiler/lints'
|
|
|
14
14
|
import { offsetAt, positionAt } from '../compiler/mapping'
|
|
15
15
|
import { nativeExe } from '../compiler/native-typescript'
|
|
16
16
|
import { pickConfig } from '../config'
|
|
17
|
-
import { moduleCallResult } from './call-result'
|
|
18
17
|
import { diagnoseShadow, reportsTypeErrors, servedByTheApp, shownOutsideKay, unusedCodesOf } from './diagnose'
|
|
19
18
|
import { unknownNameHelp } from './export-homes'
|
|
20
19
|
import { generatedProblem } from './generated'
|
|
@@ -69,7 +68,6 @@ export const CHECK_CONFIG = [
|
|
|
69
68
|
'seo',
|
|
70
69
|
'assets',
|
|
71
70
|
// Reports each route of the app no guard covers, which the server refuses.
|
|
72
|
-
'requireGuards',
|
|
73
71
|
'guards',
|
|
74
72
|
// Reports the actions offered as tools that bot protection alone stands before.
|
|
75
73
|
'mcp',
|
|
@@ -89,8 +87,6 @@ export interface CheckOptions extends Omit<Pick<KayConfig, (typeof CHECK_CONFIG)
|
|
|
89
87
|
launch?: boolean | undefined
|
|
90
88
|
// Set by `kay build --static`: a static host reads no `SITE_URL` once built, so a missing site is reported.
|
|
91
89
|
exported?: boolean | undefined
|
|
92
|
-
// The header `proxy.key` names, which the fix of `testSite({ proxyKey })` writes beside the secret.
|
|
93
|
-
proxyHeader?: string | undefined
|
|
94
90
|
}
|
|
95
91
|
|
|
96
92
|
export interface CheckDiagnostic extends Pick<Diagnostic, 'label' | 'related' | 'note' | 'help' | 'severity' | 'fixes'> {
|
|
@@ -116,9 +112,8 @@ function helped({ message, help }: CheckDiagnostic): Pick<CheckDiagnostic, 'help
|
|
|
116
112
|
export function configCheckOptions(config: LoadedConfig): CheckOptions {
|
|
117
113
|
const { ops, ...picked } = pickConfig(config, CHECK_CONFIG)
|
|
118
114
|
const { observe } = ops ?? {}
|
|
119
|
-
const proxyHeader = typeof config.proxy === 'object' ? config.proxy.key?.header : undefined
|
|
120
115
|
|
|
121
|
-
return { ...picked, ...
|
|
116
|
+
return { ...picked, ...config.store?.database !== undefined && { storeDatabase: config.store.database }, ...ops !== undefined && { ops: { health: ops.health, ...observe !== undefined && { observe: { requestIdHeader: observe.requestIdHeader, loadBudget: observe.loadBudget } } } }, ...config.publicEnv !== undefined && { publicEnv: config.publicEnv } }
|
|
122
117
|
}
|
|
123
118
|
|
|
124
119
|
// Type-checks a project, .kay components included, and reports every error at the line and column the user wrote.
|
|
@@ -211,7 +206,7 @@ async function runCheck(root: string, given: CheckOptions, probes?: ProbeMemory)
|
|
|
211
206
|
|
|
212
207
|
const mapped: CheckDiagnostic = shadow && diagnosed
|
|
213
208
|
? { ...diagnostic, file: shadow.file, ...positionAt(shadow.source, diagnosed.span?.start ?? 0), code: diagnosed.code ?? diagnostic.code, severity: diagnosed.severity, message: diagnosed.message, note: diagnosed.note, help: diagnosed.help ?? (shadow.route === true ? helped(diagnostic).help : undefined), ...diagnosed.fixes && { fixes: diagnosed.fixes } }
|
|
214
|
-
: { ...diagnostic, ...helped(diagnostic)
|
|
209
|
+
: { ...diagnostic, ...helped(diagnostic) }
|
|
215
210
|
const generated = generatedProblem(root, mapped, types, content)
|
|
216
211
|
|
|
217
212
|
// A guard file imported for two lines of the exports check is reported once.
|
package/src/check/moved-keys.ts
CHANGED
|
@@ -31,7 +31,7 @@ export async function movedKeys(root: string, options: CheckOptions, { lint, nee
|
|
|
31
31
|
return scan(root, options, lint, needle, ({ file, parsed, report }) => {
|
|
32
32
|
for (const { ast, base, text } of parsed) {
|
|
33
33
|
for (const { object, call } of configObjects(file, ast)) {
|
|
34
|
-
// The options of a call are
|
|
34
|
+
// The options of a call are written in `config`.
|
|
35
35
|
if (call !== undefined)
|
|
36
36
|
continue
|
|
37
37
|
|
package/src/check/project.ts
CHANGED
|
@@ -17,9 +17,9 @@ import { isPageFile, pageDirs } from '../build/page-dirs'
|
|
|
17
17
|
import { mentionsServerOnly } from '../build/server-only'
|
|
18
18
|
import { importedSignals } from '../build/signals'
|
|
19
19
|
import { browserRole, onceReadChecks } from '../compiler'
|
|
20
|
-
import { RETIRED_LINTS } from '../compiler/deprecated-allow'
|
|
21
20
|
import { moduleChecks, turnsCaptchaOff } from '../compiler/fence-checks'
|
|
22
21
|
import { isLaunchLint, isLint, isLintGroup, LEVELS, lintLevel, lintLevels } from '../compiler/lints'
|
|
22
|
+
import { REMOVED_LINTS } from '../compiler/removed-lints'
|
|
23
23
|
import { CONFIG_FILE } from '../config'
|
|
24
24
|
import { EXTENSIONS_MARKER, FEEDS_MARKER, PROBLEMS_MARKER, ROUTES_MARKER, USES_MARKER } from '../content/claims'
|
|
25
25
|
import { projectPaths } from '../project'
|
|
@@ -32,7 +32,6 @@ import { dockerfileProblems } from './dockerfile'
|
|
|
32
32
|
import { CONTENT_CHECK, contentPropsCheck } from './generated'
|
|
33
33
|
import { browserModules, islandEdges } from './island-modules'
|
|
34
34
|
import { componentImporters, islandOnlyComponents, renderedInIslands } from './island-only'
|
|
35
|
-
import { linkFlagTests } from './link-flag-tests'
|
|
36
35
|
import { FILES_MARKER, stampOf } from './loaded'
|
|
37
36
|
|
|
38
37
|
import { configSeoLints } from './seo'
|
|
@@ -106,13 +105,13 @@ export function configProblems(root: string, options: CheckOptions, types: Shado
|
|
|
106
105
|
// The collections may still be read, which only the feeds and their own problems wait for.
|
|
107
106
|
export async function projectProblems(root: string, options: CheckOptions, collections: ContentChecks | Promise<ContentChecks>, memory?: ProbeMemory, scanned?: ServedProject): Promise<CheckDiagnostic[]> {
|
|
108
107
|
return inWalkScope(async () => {
|
|
109
|
-
const [content, messages, boot, modules
|
|
108
|
+
const [content, messages, boot, modules] = await Promise.all([collections, checkMessages(root, options, memory), (async () => {
|
|
110
109
|
const read = await collections
|
|
111
110
|
|
|
112
111
|
return bootProblems(resolve(root), options, read.feeds, scanned, read.routes)
|
|
113
|
-
})(), moduleLints(root, options)
|
|
112
|
+
})(), moduleLints(root, options)])
|
|
114
113
|
|
|
115
|
-
return [...content.problems, ...messages, ...boot, ...modules, ...
|
|
114
|
+
return [...content.problems, ...messages, ...boot, ...modules, ...uiProblems(root), ...contextModuleProblems(root)]
|
|
116
115
|
})
|
|
117
116
|
}
|
|
118
117
|
|
|
@@ -297,8 +296,8 @@ function lintConfigProblems(root: string, lints: LintLevels = {}): CheckDiagnost
|
|
|
297
296
|
return levelEntries(lints).flatMap(([name, level]) => {
|
|
298
297
|
const at = { file, ...locate(['lints', name]) }
|
|
299
298
|
|
|
300
|
-
if (
|
|
301
|
-
return []
|
|
299
|
+
if ((REMOVED_LINTS as readonly string[]).includes(name))
|
|
300
|
+
return [{ ...at, severity: 'warning' as const, message: `\`lints\` names \`${name}\`, a lint kay has removed with the form it reported`, help: 'remove the entry: it changes nothing' }]
|
|
302
301
|
|
|
303
302
|
if (!isLint(name) && !isLintGroup(name))
|
|
304
303
|
return [{ ...at, message: `\`lints\` names \`${name}\`, which is no lint or group`, help: '`kay explain` lists them' }]
|