@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
|
@@ -164,16 +164,10 @@ export function declaredIsland(source: string, script: Span): IslandDeclaration
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
// The role the
|
|
168
|
-
export function rolesOf(source: string, script: Span | undefined
|
|
167
|
+
// The role the `island()` call gives the component, which `client` and `pin` of the parsed file carry.
|
|
168
|
+
export function rolesOf(source: string, script: Span | undefined): { island: IslandDeclaration | undefined, client: Span | undefined, pin: (Span & { kind: 'island' | 'static' }) | undefined } {
|
|
169
169
|
const island = script === undefined ? undefined : declaredIsland(source, script)
|
|
170
170
|
|
|
171
|
-
if (fence?.word === 'client')
|
|
172
|
-
return { island, client: fence, pin: undefined }
|
|
173
|
-
|
|
174
|
-
if (fence?.word === 'island' || fence?.word === 'static')
|
|
175
|
-
return { island, client: undefined, pin: { kind: fence.word, start: fence.start, end: fence.end } }
|
|
176
|
-
|
|
177
171
|
if (island === undefined)
|
|
178
172
|
return { island, client: undefined, pin: undefined }
|
|
179
173
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Lint } from './lints'
|
|
2
|
+
|
|
3
|
+
// The lints of the `islands` group that sit apart from the rest, with the other lints in `LINTS`.
|
|
4
|
+
export const ISLAND_LINTS = {
|
|
5
|
+
'page-island': {
|
|
6
|
+
level: 'deny',
|
|
7
|
+
group: 'islands',
|
|
8
|
+
summary: 'A page without a `--- server` fence that needs the browser: an `on*`, `bind:` or `ref` in it, a browser value of `kay` such as `signal`, or a live or persisted import. A page renders once on the server and is never an island, so what needs the browser belongs in a component the page renders. Found in the pages of the project, at the thing that makes the page an island; a layout or a page with a `--- server` fence is not reported. It has no fix: moving the code into a component is not an edit that is safe to apply.',
|
|
9
|
+
wrong: '---\nimport { signal } from \'kay\'\n\nconst count = signal(0)\n---\nbutton(onClick={() => count.set(count() + 1)}) {count()}',
|
|
10
|
+
right: '---\nimport Counter from \'../components/counter.kay\'\n---\nCounter',
|
|
11
|
+
},
|
|
12
|
+
'signal-from-prop': {
|
|
13
|
+
level: 'warn',
|
|
14
|
+
group: 'islands',
|
|
15
|
+
summary: 'A `signal` seeded from a destructured prop at the top of an island\'s script, `signal(light)` or `signal(todo.title)`, that the island never writes: an island stays when the page gives it new props, as after an action or a refresh, so the signal keeps the first value. `linked(() => light)` follows the prop; `kay check --fix` writes it. A signal the island writes, as a counter starting from a prop, is its own state and is left alone, as is a prop named `initial...` or `default...` or a comment `// kay-allow signal-from-prop`.',
|
|
16
|
+
wrong: '---\nimport { signal } from \'kay\'\n\nconst { light } = props<{ light: string }>()\nconst picked = signal(light)\n---\np {picked()}',
|
|
17
|
+
right: '---\nimport { linked } from \'kay\'\n\nconst { light } = props<{ light: string }>()\nconst picked = linked(() => light)\n---\np {picked()}',
|
|
18
|
+
},
|
|
19
|
+
} as const satisfies Record<string, Lint>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Diagnostic, Fix, KayFile } from './ast'
|
|
2
|
-
import { eolOf
|
|
2
|
+
import { eolOf } from './island-problems'
|
|
3
3
|
|
|
4
4
|
const STATIC_RENDER = /render\s*:\s*(['"])static\1\s*,?\s*/
|
|
5
5
|
const EMPTY_SETTINGS = /\(\s*\{\s*\}\s*\)/
|
|
@@ -11,8 +11,8 @@ export function islandFence(file: KayFile): Fix | undefined {
|
|
|
11
11
|
if (file.server !== undefined || file.client !== undefined || file.pin?.kind === 'island')
|
|
12
12
|
return undefined
|
|
13
13
|
|
|
14
|
-
if (file.pin !== undefined)
|
|
15
|
-
return { title, edits:
|
|
14
|
+
if (file.pin !== undefined && file.island !== undefined)
|
|
15
|
+
return { title, edits: [{ start: file.island.span.start, end: file.island.span.end, text: file.source.slice(file.island.span.start, file.island.span.end).replace(STATIC_RENDER, '').replace(EMPTY_SETTINGS, '()') }] }
|
|
16
16
|
|
|
17
17
|
if (file.scriptLine === undefined || file.script === undefined)
|
|
18
18
|
return { title, edits: [{ start: 0, end: 0, text: ['---', 'island()', '---', ''].join(eolOf(file.source)) }] }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Diagnostic, KayFile } from './ast'
|
|
2
|
+
import { declaredIsland } from './island-declaration'
|
|
3
|
+
|
|
4
|
+
const MEDIA_HYDRATE = /^media\(\s*\S.*\)$/s
|
|
5
|
+
|
|
6
|
+
// What is wrong with a static `hydrate` value on a use: `client` is `render="client"` since 1.105, and `media(...)` needs a query.
|
|
7
|
+
export function hydrateProblem(text: string): [message: string, details: { help: string }] | undefined {
|
|
8
|
+
if (text === 'client')
|
|
9
|
+
return ['`hydrate="client"` is `render="client"`', { help: 'write `render="client"` to render the component in the browser only' }]
|
|
10
|
+
|
|
11
|
+
if (text.startsWith('media(') && !MEDIA_HYDRATE.test(text))
|
|
12
|
+
return ['`hydrate="media(...)"` needs a media query', { help: 'write the query in the brackets: `hydrate="media(max-width: 40rem)"`' }]
|
|
13
|
+
|
|
14
|
+
return undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// The line ending a file writes, which what a fix inserts follows.
|
|
18
|
+
export const eolOf = (source: string): string => source.includes('\r\n') ? '\r\n' : '\n'
|
|
19
|
+
|
|
20
|
+
// An `island()` call in a `--- module` fence, which declares nothing there: the call belongs to the component's script.
|
|
21
|
+
export function islandProblems(file: KayFile): Diagnostic[] {
|
|
22
|
+
const declared = file.module === undefined ? undefined : declaredIsland(file.source, file.module)
|
|
23
|
+
|
|
24
|
+
return declared === undefined ? [] : [{ ...declared.span, code: 'fence-invalid', message: '`island()` goes in the component\'s script, not its `--- module` fence', help: 'move it to the top of the script fence' }]
|
|
25
|
+
}
|
package/src/compiler/items.ts
CHANGED
|
@@ -248,3 +248,15 @@ export function fixedSource(element: ElementNode): string {
|
|
|
248
248
|
export function ambientHelpers(facts: { ambientForm: boolean, snippet: boolean, forms: ReadonlyMap<unknown, unknown> }, mode: string): ('formHere' | 'formError' | 'issueScope')[] {
|
|
249
249
|
return [...facts.ambientForm ? ['formHere' as const, 'formError' as const] : [], ...mode === 'dom' && facts.snippet && facts.forms.size > 0 ? ['issueScope' as const] : []]
|
|
250
250
|
}
|
|
251
|
+
|
|
252
|
+
const BOUND = /^bind:/
|
|
253
|
+
|
|
254
|
+
// The props a use writes, as the object type `KayFunctionProp` takes after the component; none for a use with a spread, which may carry any.
|
|
255
|
+
export function usedProps(element: ElementNode, text: (span: Span) => string): string {
|
|
256
|
+
if (element.attributes.some(attribute => attribute.kind === 'spread'))
|
|
257
|
+
return ''
|
|
258
|
+
|
|
259
|
+
const names = [...element.attributes.flatMap(attribute => attribute.kind === 'spread' ? [] : [attribute.name]), ...element.children.flatMap(child => child.kind === 'slot' ? [child.name] : [])]
|
|
260
|
+
|
|
261
|
+
return `, { ${names.map(name => `${JSON.stringify(text(name).replace(BOUND, ''))}: 0`).join(', ')} }`
|
|
262
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ElementNode, NamedAttribute } from './ast'
|
|
2
2
|
import type { CodeBuilder } from './mapping'
|
|
3
3
|
import type { ClassMerge } from './plan'
|
|
4
4
|
import { helperName } from './markup'
|
|
5
|
-
import { oldPartsClass } from './old-parts'
|
|
6
5
|
import { shorthandClass } from './plan'
|
|
7
6
|
|
|
8
7
|
// What wraps a merged class list: an array on an element, the class of `componentClass` on a component, or its spread when the merge can be empty.
|
|
@@ -83,26 +82,3 @@ export function addMergedClass(b: CodeBuilder, element: ElementNode, { attribute
|
|
|
83
82
|
|
|
84
83
|
b.add(close)
|
|
85
84
|
}
|
|
86
|
-
|
|
87
|
-
// The `class` of a component call that is its `parts` before 1.105, written as the `parts` prop, left out when a `parts` is written beside it, which the type check reads alone. Whether the attribute is that `class`.
|
|
88
|
-
export function addOldParts(b: CodeBuilder, element: ElementNode, src: string, attribute: Attribute): boolean {
|
|
89
|
-
const old = oldPartsClass(element, src)
|
|
90
|
-
|
|
91
|
-
if (old === undefined)
|
|
92
|
-
return false
|
|
93
|
-
|
|
94
|
-
const hand = element.attributes.find((one): one is Extract<NamedAttribute, { kind: 'expression' }> => one.kind === 'expression' && src.slice(one.name.start, one.name.end) === 'parts')
|
|
95
|
-
|
|
96
|
-
if (attribute === old) {
|
|
97
|
-
b.add(' ').wrap(old.name, () => b.add('parts')).add('={')
|
|
98
|
-
|
|
99
|
-
if (hand === undefined)
|
|
100
|
-
b.addSource(old.expression)
|
|
101
|
-
else
|
|
102
|
-
b.add('{ ...(').addSource(hand.expression).add('), ...(').addSource(old.expression).add(') }')
|
|
103
|
-
|
|
104
|
-
b.add('}')
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return attribute === old || attribute === hand
|
|
108
|
-
}
|
package/src/compiler/jsx.ts
CHANGED
|
@@ -4,8 +4,8 @@ import type { ElementShape } from './plan'
|
|
|
4
4
|
import type { Sites } from './rewrite-types'
|
|
5
5
|
import { bindsOwnProp, failedBlockOf, handedParts, isSlot, partAttribute, serverIslandOf } from './ast'
|
|
6
6
|
import { isFunctionAt, sentParts } from './expression'
|
|
7
|
-
import { addConstValue, addKeyParameters, addRowItem, contentOf, rowKeying, slotValue } from './items'
|
|
8
|
-
import { addMergedClass,
|
|
7
|
+
import { addConstValue, addKeyParameters, addRowItem, contentOf, rowKeying, slotValue, usedProps } from './items'
|
|
8
|
+
import { addMergedClass, addShorthandClass, quoteAttribute } from './jsx-class'
|
|
9
9
|
import { addFieldName, addInheritedName, addWrittenField } from './jsx-field'
|
|
10
10
|
import { DYNAMIC_TAG } from './mapping'
|
|
11
11
|
import { addBindWrite, bindRead, helperName, RAW_ELEMENTS } from './markup'
|
|
@@ -679,7 +679,7 @@ export class JsxTemplate {
|
|
|
679
679
|
const part = partAttribute(element, this.src)
|
|
680
680
|
|
|
681
681
|
for (const attribute of element.attributes) {
|
|
682
|
-
if (
|
|
682
|
+
if ((merge.shorthand || merge.last) && attribute === merge.attribute)
|
|
683
683
|
continue
|
|
684
684
|
|
|
685
685
|
// Not a prop of the element or the component: it names a part, whose class the component's own `class` type takes.
|
|
@@ -879,7 +879,7 @@ export class JsxTemplate {
|
|
|
879
879
|
let at = start
|
|
880
880
|
|
|
881
881
|
if (sent.functions) {
|
|
882
|
-
this.emitFunctionPropCheck(element, attribute.name)
|
|
882
|
+
this.emitFunctionPropCheck(element, attribute.name, false)
|
|
883
883
|
b.add(' ')
|
|
884
884
|
}
|
|
885
885
|
|
|
@@ -904,8 +904,9 @@ export class JsxTemplate {
|
|
|
904
904
|
}
|
|
905
905
|
|
|
906
906
|
// Reports a function passed to an island, `0` standing for the prop.
|
|
907
|
-
|
|
908
|
-
|
|
907
|
+
// The props the use writes go along, as an object type, so an island that lists its interactive props takes a function from a use turning none of them on; a spread may carry any, so it sends none, and a function inside a literal value sends none either, as it is never sent.
|
|
908
|
+
private emitFunctionPropCheck(element: ElementNode, name: Span, whole = true) {
|
|
909
|
+
this.b.add('{...KayFunctionProp(').addSource(element.tag).add(whole ? usedProps(element, span => this.text(span)) : '').add(')(').wrap(name, () => this.b.add('0')).add(')}')
|
|
909
910
|
}
|
|
910
911
|
|
|
911
912
|
// `bind:value={name}` reads the signal and writes it back from the matching input event.
|
|
@@ -51,10 +51,8 @@ export const KAY_ROLES: Readonly<Record<string, KayRole>> = {
|
|
|
51
51
|
mount: 'browser',
|
|
52
52
|
navigate: 'browser',
|
|
53
53
|
navigation: 'browser',
|
|
54
|
-
onBeforeNavigate: 'browser',
|
|
55
54
|
onCleanup: 'browser',
|
|
56
55
|
onMount: 'browser',
|
|
57
|
-
onNavigate: 'browser',
|
|
58
56
|
online: 'browser',
|
|
59
57
|
optimistic: 'browser',
|
|
60
58
|
pageVisible: 'browser',
|
|
@@ -3,13 +3,6 @@ import type { Lint } from './lints'
|
|
|
3
3
|
import { editDistance } from './aria'
|
|
4
4
|
import { elementsIn } from './ast'
|
|
5
5
|
|
|
6
|
-
export interface Renamed {
|
|
7
|
-
name: string
|
|
8
|
-
value: string
|
|
9
|
-
// What a `false` value of the old name becomes, for a flag that was off by that word.
|
|
10
|
-
off?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
6
|
// The lint of this file, with the other lints in `LINTS`.
|
|
14
7
|
export const LINK_LINTS = {
|
|
15
8
|
'unknown-link-flag': {
|
|
@@ -24,13 +17,8 @@ export const LINK_LINTS = {
|
|
|
24
17
|
// The attributes a link, or an element around links, takes to say how the swap follows it, named as the options of `navigate()` are: `scroll`, `transition`, `prefetch`, and `reload` for a full load.
|
|
25
18
|
const FLAGS = new Set(['data-scroll', 'data-transition', 'data-prefetch', 'data-reload'])
|
|
26
19
|
|
|
27
|
-
// The names before 1.105
|
|
28
|
-
|
|
29
|
-
'data-keep-scroll': { name: 'data-scroll', value: 'keep', off: 'top' },
|
|
30
|
-
'data-no-transition': { name: 'data-transition', value: 'false' },
|
|
31
|
-
'data-no-prefetch': { name: 'data-prefetch', value: 'false' },
|
|
32
|
-
}
|
|
33
|
-
const NEARBY = [...FLAGS, ...Object.keys(OLD_LINK_FLAGS)]
|
|
20
|
+
// The names before 1.105, which nothing reads any more: a link using one would follow as a plain link, a sign-out link prefetched included.
|
|
21
|
+
const REMOVED: Record<string, string> = { 'data-keep-scroll': 'data-scroll="keep"', 'data-no-transition': 'data-transition="false"', 'data-no-prefetch': 'data-prefetch="false"' }
|
|
34
22
|
|
|
35
23
|
// The name an attribute is written with, none for a spread or a `{name}` shorthand.
|
|
36
24
|
function nameOf(attribute: Attribute): Span | undefined {
|
|
@@ -41,7 +29,7 @@ function nameOf(attribute: Attribute): Span | undefined {
|
|
|
41
29
|
function nearest(name: string): string | undefined {
|
|
42
30
|
const word = name.slice(5)
|
|
43
31
|
|
|
44
|
-
return
|
|
32
|
+
return [...FLAGS].find((flag) => {
|
|
45
33
|
const meant = flag.slice(5)
|
|
46
34
|
|
|
47
35
|
return !word.startsWith(meant) && (editDistance(word, meant) <= 1 || swapped(word, meant))
|
|
@@ -55,7 +43,7 @@ function swapped(a: string, b: string): boolean {
|
|
|
55
43
|
return a.length === b.length && at >= 0 && a[at] === b[at + 1] && a[at + 1] === b[at] && a.slice(at + 2) === b.slice(at + 2)
|
|
56
44
|
}
|
|
57
45
|
|
|
58
|
-
// The navigation flags of links, on an element or on a component call that forwards them to its link:
|
|
46
|
+
// The navigation flags of links, on an element or on a component call that forwards them to its link: a `data-` name that is only a misspelling of one of the family is `unknown-link-flag`, as it would do nothing and no type knows a `data-` attribute.
|
|
59
47
|
export function linkFlags(file: KayFile): Diagnostic[] {
|
|
60
48
|
const found: Diagnostic[] = []
|
|
61
49
|
|
|
@@ -67,10 +55,10 @@ export function linkFlags(file: KayFile): Diagnostic[] {
|
|
|
67
55
|
continue
|
|
68
56
|
|
|
69
57
|
const name = file.source.slice(at.start, at.end)
|
|
70
|
-
const
|
|
58
|
+
const removed = REMOVED[name]
|
|
71
59
|
|
|
72
|
-
if (
|
|
73
|
-
found.push(
|
|
60
|
+
if (removed !== undefined) {
|
|
61
|
+
found.push({ ...at, code: 'unknown-link-flag', message: `\`${name}\` is no navigation flag of a link any more`, note: 'nothing reads it since 1.109, so the link follows as a plain one', help: `write \`${removed}\``, checkOnly: true })
|
|
74
62
|
|
|
75
63
|
continue
|
|
76
64
|
}
|
|
@@ -80,28 +68,11 @@ export function linkFlags(file: KayFile): Diagnostic[] {
|
|
|
80
68
|
if (meant === undefined)
|
|
81
69
|
continue
|
|
82
70
|
|
|
83
|
-
const
|
|
84
|
-
const to = renamed === undefined ? meant : `${renamed.name}="${renamed.value}"`
|
|
85
|
-
// An old name written with a value keeps that value after the name, so writing `name="value"` there would leave two: that case gets the help alone.
|
|
86
|
-
const fixes = renamed !== undefined && attribute.kind !== 'boolean' ? [] : [{ title: `Write \`${to}\``, safe: false, edits: [{ ...at, text: to }] }]
|
|
71
|
+
const fixes = [{ title: `Write \`${meant}\``, safe: false, edits: [{ ...at, text: meant }] }]
|
|
87
72
|
|
|
88
|
-
found.push({ ...at, code: 'unknown-link-flag', message: `\`${name}\` is no navigation flag of a link`, note: 'a link is followed with `data-scroll`, `data-transition`, `data-prefetch` and `data-reload`, and this name does nothing', help: `did you mean \`${
|
|
73
|
+
found.push({ ...at, code: 'unknown-link-flag', message: `\`${name}\` is no navigation flag of a link`, note: 'a link is followed with `data-scroll`, `data-transition`, `data-prefetch` and `data-reload`, and this name does nothing', help: `did you mean \`${meant}\`?`, fixes, checkOnly: true })
|
|
89
74
|
}
|
|
90
75
|
}
|
|
91
76
|
|
|
92
77
|
return found
|
|
93
78
|
}
|
|
94
|
-
|
|
95
|
-
function oldFlag(source: string, attribute: Attribute, at: Span, name: string, old: Renamed): Diagnostic {
|
|
96
|
-
const base = { ...at, code: 'deprecated-link-flags', checkOnly: true, message: `\`${name}\` is \`${old.name}="${old.value}"\`, deprecated since 1.105`, help: `write \`${old.name}="${old.value}"\`, named as the option of \`navigate()\`` }
|
|
97
|
-
|
|
98
|
-
if (attribute.kind === 'expression') {
|
|
99
|
-
// The keep flag's value is read as before, but the new name types its words, so the rename is not safe; the other two were set by being present, which no value of the new name says.
|
|
100
|
-
return old.off === undefined ? base : { ...base, fixes: [{ title: `Write \`${old.name}\``, safe: false, edits: [{ ...at, text: old.name }] }] }
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const written = old.off !== undefined && attribute.kind === 'static' && attribute.text === 'false' ? old.off : old.value
|
|
104
|
-
const end = attribute.kind === 'static' ? attribute.value.end + ('"\''.includes(source[attribute.value.end] ?? '') ? 1 : 0) : at.end
|
|
105
|
-
|
|
106
|
-
return { ...base, fixes: [{ title: `Write \`${old.name}="${written}"\``, safe: true, edits: [{ start: at.start, end, text: `${old.name}="${written}"` }] }] }
|
|
107
|
-
}
|
package/src/compiler/lints.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { AllowRules } from './allow-comments'
|
|
2
2
|
import type { Diagnostic, ElementNode, ForNode, KayFile, TextChunk } from './ast'
|
|
3
|
-
import type {
|
|
3
|
+
import type { RemovedLintName } from './removed-lints'
|
|
4
4
|
import type { Scope } from './template-scopes'
|
|
5
5
|
import { accessibilityLints, MARKUP_LINTS } from './a11y'
|
|
6
|
-
import { allowComments, honoured, refusedComments } from './allow-comments'
|
|
6
|
+
import { allowComments, honoured, refusedComments, unknownNames } from './allow-comments'
|
|
7
7
|
import { keyedByPosition, walkNodes } from './ast'
|
|
8
|
-
import { RETIRED_LINTS } from './deprecated-allow'
|
|
9
8
|
import { DEPRECATED_LINTS } from './deprecated-lints'
|
|
10
9
|
import { I18N_LINTS } from './i18n-lints'
|
|
10
|
+
import { ISLAND_LINTS } from './island-lints'
|
|
11
11
|
import { positionAt } from './mapping'
|
|
12
12
|
import { VOID_ELEMENTS } from './markup'
|
|
13
13
|
import { nestingLints } from './nesting'
|
|
@@ -312,13 +312,6 @@ export const LINTS = {
|
|
|
312
312
|
wrong: '--- server\nimport { ask } from \'@kayjs/ai\'\nimport { action, s } from \'kay\'\n\nexport const reply = action(s.object({ messages: s.list(s.string()) }), async ({ messages }) => ask(messages))\n---\np x',
|
|
313
313
|
right: '--- server\nimport { ask } from \'@kayjs/ai\'\nimport { action, s } from \'kay\'\n\nexport const reply = action(s.object({ messages: s.list(s.string()) }), ({ messages }) => ask(messages))\n---\np x',
|
|
314
314
|
},
|
|
315
|
-
'unreturned-fail': {
|
|
316
|
-
level: 'deny',
|
|
317
|
-
group: 'code',
|
|
318
|
-
summary: 'A `ctx.fail(...)` statement in an action\'s handler (or `fail(...)` destructured from the context) that is not returned: `fail` returns the failure the action answers with, where `deny`, `notFound` and `redirect` throw, so the statement does nothing and the handler carries on. An arrow function with an expression body already returns, and a nested function is left alone. The fix prepends `return`. Found in `.kay` fences and `.ts` modules alike.',
|
|
319
|
-
wrong: '--- server\nexport const rename = action(s.object({ name: s.string() }), ({ name }, ctx) => {\n if (name === \'admin\')\n ctx.fail(409, \'That name is taken\')\n\n return name\n})\n---\np x',
|
|
320
|
-
right: '--- server\nexport const rename = action(s.object({ name: s.string() }), ({ name }, ctx) => {\n if (name === \'admin\')\n return ctx.fail(409, \'That name is taken\')\n\n return name\n})\n---\np x',
|
|
321
|
-
},
|
|
322
315
|
'missing-captcha': {
|
|
323
316
|
level: 'warn',
|
|
324
317
|
group: 'forms',
|
|
@@ -372,7 +365,7 @@ export const LINTS = {
|
|
|
372
365
|
'once-read-prop': {
|
|
373
366
|
level: 'deny',
|
|
374
367
|
group: 'code',
|
|
375
|
-
summary: 'A destructured prop read into a top-level `let`, a destructured `const`, one that awaits or a declaration nested in a block, that a function or the template reads later, in a component that runs in the browser: the declaration runs once, when the component is created, so the value keeps the prop\'s first value after the parent changes it. A top-level `const` naming one value (`const last = items.length - 1`) is computed by a memo and follows the prop, so it is no case. A prop read as the test of an `if` or a ternary, as an argument of a call or `new`, as a write target or in a class, one inside `signal(...)`, `persisted(...)` or `posted...(...)`, `id ?? uid()`, a callback prop (`onChange`) and a prop named `initial*` or `default*` are choices made once and left alone; for another, compute the value where it is used or in a `memo`, or allow it with `// kay-allow once-read-prop: why the first value is meant`.',
|
|
368
|
+
summary: 'A destructured prop read into a top-level `let`, a destructured `const`, one that awaits or a declaration nested in a block, that a function or the template reads later, in a component that runs in the browser: the declaration runs once, when the component is created, so the value keeps the prop\'s first value after the parent changes it. A top-level `const` naming one value (`const last = items.length - 1`) is computed by a memo and follows the prop, so it is no case. A prop read as the test of an `if` or a ternary, as an argument of a call or `new`, as a write target or in a class, one inside `signal(...)`, `persisted.cookie(...)` or `posted...(...)`, `id ?? uid()`, a callback prop (`onChange`) and a prop named `initial*` or `default*` are choices made once and left alone; for another, compute the value where it is used or in a `memo`, or allow it with `// kay-allow once-read-prop: why the first value is meant`.',
|
|
376
369
|
wrong: '---\nimport { signal } from \'kay\'\n\nconst { items } = props<{ items: string[] }>()\nlet last = items.length - 1\nconst open = signal(false)\n---\nbutton(onClick={() => open = !open()}) {last}',
|
|
377
370
|
right: '---\nimport { memo, signal } from \'kay\'\n\nconst { items } = props<{ items: string[] }>()\nconst last = memo(() => items.length - 1)\nconst open = signal(false)\n---\nbutton(onClick={() => open = !open()}) {last()}',
|
|
378
371
|
},
|
|
@@ -432,10 +425,11 @@ export const LINTS = {
|
|
|
432
425
|
'island-marker': {
|
|
433
426
|
level: 'deny',
|
|
434
427
|
group: 'islands',
|
|
435
|
-
summary: 'An `island()` declaration
|
|
428
|
+
summary: 'An `island()` declaration on a page, a layout or a special page: they render on the server and are never islands. Move what needs the browser to a component of its own.',
|
|
436
429
|
wrong: '--- server\nconst title = \'Home\'\n--- script\nisland()\n---\nh1 {title}',
|
|
437
430
|
right: '--- server\nconst title = \'Home\'\n---\nh1 {title}',
|
|
438
431
|
},
|
|
432
|
+
...ISLAND_LINTS,
|
|
439
433
|
'island-prop': {
|
|
440
434
|
level: 'deny',
|
|
441
435
|
group: 'islands',
|
|
@@ -618,7 +612,7 @@ export const LINTS = {
|
|
|
618
612
|
group: 'seo',
|
|
619
613
|
site: true,
|
|
620
614
|
summary: 'A prerendered page that no other page links to and the sitemap does not list, which a crawler cannot find. Reported by `kay build` on a site with `site` set when every page of the app is prerendered, as a page of the app rendered per request may link to anything (the pages a library mounts link within the library and do not count); the home page, a locale\'s root, `noindex` pages and pages behind a guard are left out.',
|
|
621
|
-
wrong: '--- server\nexport const page = { prerender: true, sitemap: false }\n---\nh1 Spring sale',
|
|
615
|
+
wrong: '--- server\nexport const page = { prerender: true, seo: { sitemap: false } }\n---\nh1 Spring sale',
|
|
622
616
|
right: '--- server\nexport const page = { prerender: true }\n---\nh1 Spring sale',
|
|
623
617
|
},
|
|
624
618
|
'broken-canonical': {
|
|
@@ -693,8 +687,8 @@ export const LINTS = {
|
|
|
693
687
|
export type LintName = keyof typeof LINTS
|
|
694
688
|
|
|
695
689
|
// `satisfied` is set by kay from the extensions' `satisfies`, never written in `kay.config.ts`: the lints an extension answers for a place it fills in by itself.
|
|
696
|
-
// `comments` is no lint's level: it sets what a `// kay-allow` comment must hold to count.
|
|
697
|
-
export type LintLevels = Partial<Record<LintName | LintGroup |
|
|
690
|
+
// `comments` is no lint's level: it sets what a `// kay-allow` comment must hold to count. A removed lint is still accepted, warned about by `kay check`.
|
|
691
|
+
export type LintLevels = Partial<Record<LintName | LintGroup | RemovedLintName, LintLevel>> & { satisfied?: LintName[] | undefined, comments?: AllowRules | undefined }
|
|
698
692
|
|
|
699
693
|
export const LEVELS: ReadonlySet<string> = new Set<LintLevel>(['allow', 'warn', 'deny'])
|
|
700
694
|
|
|
@@ -724,8 +718,6 @@ export const UPGRADE_FROM = 'KAY_UPGRADE_FROM'
|
|
|
724
718
|
|
|
725
719
|
export { DEPRECATION_MINORS } from './deprecated-lints'
|
|
726
720
|
|
|
727
|
-
export { minorAfter, minorOf } from './minor'
|
|
728
|
-
|
|
729
721
|
export function isLintGroup(name: string | undefined): name is LintGroup {
|
|
730
722
|
return name !== undefined && Object.hasOwn(LINT_GROUPS, name)
|
|
731
723
|
}
|
|
@@ -783,7 +775,7 @@ export function applyLints(diagnostics: Diagnostic[], source: string, levels: Li
|
|
|
783
775
|
}
|
|
784
776
|
|
|
785
777
|
function unknownLints(source: string): Diagnostic[] {
|
|
786
|
-
return allowComments(source).flatMap(comment => comment
|
|
778
|
+
return allowComments(source).flatMap(comment => unknownNames(comment, source, isLint, `the lints are ${Object.keys(LINTS).map(lint => `\`${lint}\``).join(', ')}`))
|
|
787
779
|
}
|
|
788
780
|
|
|
789
781
|
// The template's own lints: what it can say from the markup alone.
|
package/src/compiler/markup.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ClassTable } from '../runtime/class-table'
|
|
2
2
|
import type { Attribute, ElementNode, ErrorMessages, FormField, NamedAttribute, Node, SlotNode, SnippetNode, Span, TemplateFacts, TextNode } from './ast'
|
|
3
|
+
import type { ClassItem } from './class-items'
|
|
3
4
|
import type { FormInfo } from './form-info'
|
|
4
5
|
import type { ImageOptionAttributes } from './image-attributes'
|
|
5
6
|
import type { CodeBuilder } from './mapping'
|
|
@@ -9,13 +10,14 @@ import { PART_END, PART_START } from '../runtime/markers'
|
|
|
9
10
|
import { URL_ATTRIBUTES } from '../runtime/url-attributes'
|
|
10
11
|
import { actionOf, bindsOwnProp, componentAction, describedByOf, FIELD_ATTRIBUTE, formFieldOf, handedParts, modifiersOf, partAttribute, partNames, partsOf, sectionOf, uiHasVariants, uiPartClasses } from './ast'
|
|
11
12
|
import { addBoundWrites, calledByBinds, changeOf } from './bound-props'
|
|
13
|
+
import { joinTexts } from './class-items'
|
|
12
14
|
import { addHandler } from './event-modifiers'
|
|
13
15
|
import { decodeEntities, isFunctionAt } from './expression'
|
|
14
|
-
import {
|
|
16
|
+
import { closeHandParts, handedItem, handsEntry, openClassList, writesTogether, writtenParts } from './hand-parts'
|
|
17
|
+
import { IMAGE_OPTIONS, imageDefaults as imageDefaultsOf, imageOptions, placeholderOff, writeImageArguments } from './image-attributes'
|
|
15
18
|
import { contentOf } from './items'
|
|
16
19
|
import { controlId, fieldAttribute, inheritedAttributes, inheritedField } from './markup-fields'
|
|
17
20
|
import { PROPS } from './names'
|
|
18
|
-
import { oldPartsEntry } from './old-parts'
|
|
19
21
|
import { addGroupChecked, bindingOf, classMergeOf, formDefaultsOf, groupValue, shapeOf, shorthandClass, staticAttributeText, valueBoundBy, writesAttribute } from './plan'
|
|
20
22
|
import { bindEvent } from './validate'
|
|
21
23
|
|
|
@@ -252,7 +254,7 @@ export abstract class TemplateWriter {
|
|
|
252
254
|
continue
|
|
253
255
|
|
|
254
256
|
// Read below with the image's source, and never written.
|
|
255
|
-
if (name === 'img' &&
|
|
257
|
+
if (name === 'img' && IMAGE_OPTIONS.has(attributeName))
|
|
256
258
|
continue
|
|
257
259
|
|
|
258
260
|
// Read by `currentLink` on the server, and never written, a repeat of it included.
|
|
@@ -360,7 +362,7 @@ export abstract class TemplateWriter {
|
|
|
360
362
|
// `except` is a slot that is no prop, as a server island's `@failed`.
|
|
361
363
|
protected componentProps(element: ElementNode, getters: boolean, except?: SlotNode): void {
|
|
362
364
|
const { b } = this
|
|
363
|
-
const spreads = element.attributes.some(attribute => attribute.kind === 'spread')
|
|
365
|
+
const spreads = element.attributes.some(attribute => attribute.kind === 'spread') || writesTogether(element, this.src, this.facts.parts)
|
|
364
366
|
|
|
365
367
|
if (spreads)
|
|
366
368
|
b.add(`${helperName('merge')}(`)
|
|
@@ -512,15 +514,15 @@ export abstract class TemplateWriter {
|
|
|
512
514
|
continue
|
|
513
515
|
}
|
|
514
516
|
|
|
515
|
-
// The `
|
|
516
|
-
if (
|
|
517
|
+
// The `parts` and spreads of a call handing parts on are written with its own.
|
|
518
|
+
if (handsEntry(element, this.src, attribute, element.component && parts.length > 0))
|
|
517
519
|
continue
|
|
518
520
|
|
|
519
521
|
const name = this.source(attribute.name)
|
|
520
522
|
|
|
521
|
-
if (element.name === 'img' &&
|
|
523
|
+
if (element.name === 'img' && IMAGE_OPTIONS.has(name)) {
|
|
522
524
|
// Takes the color a spread brings off the image, which the attributes after it cannot unset.
|
|
523
|
-
if (
|
|
525
|
+
if (placeholderOff(attribute, span => this.source(span)))
|
|
524
526
|
entry('style', () => b.add('undefined'), false)
|
|
525
527
|
|
|
526
528
|
continue
|
|
@@ -553,8 +555,21 @@ export abstract class TemplateWriter {
|
|
|
553
555
|
if (element.name === 'img' && ownStyle !== undefined && element.attributes.lastIndexOf(ownStyle) < lastSpread)
|
|
554
556
|
namedEntry(ownStyle, 'style')
|
|
555
557
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
+
// A call that hands a part on always holds parts in its list, which carry the classes as their root: its `class` is the one a spread would bring, left off.
|
|
559
|
+
const hands = element.component && handedParts(element, this.src, this.facts.parts).length > 0
|
|
560
|
+
const together = writesTogether(element, this.src, this.facts.parts)
|
|
561
|
+
|
|
562
|
+
if (together) {
|
|
563
|
+
closeObject()
|
|
564
|
+
b.add(objects++ > 0 ? ', ' : '')
|
|
565
|
+
this.mergedClass(element, classAttribute, spreads, writtenParts(element, this.src), true)
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (!together && (hands ? spreads : mergedClass))
|
|
569
|
+
entry('class', () => hands ? b.add('undefined') : this.mergedClass(element, classAttribute, spreads), !hands)
|
|
570
|
+
|
|
571
|
+
if (!together && element.component && parts.length > 0)
|
|
572
|
+
entry('parts', () => this.mergedClass(element, classAttribute, spreads, writtenParts(element, this.src)), true)
|
|
558
573
|
|
|
559
574
|
if (!keepOpen)
|
|
560
575
|
close()
|
|
@@ -688,8 +703,8 @@ export abstract class TemplateWriter {
|
|
|
688
703
|
this.b.add(`, { ${defaults.map(([name, value]) => `${JSON.stringify(name)}: ${JSON.stringify(value)}`).join(', ')} }`)
|
|
689
704
|
}
|
|
690
705
|
|
|
691
|
-
// `class` as written: the shorthand alone or merged with a static attribute is a string; with an expression or spreads, an array of every source, which a component gets merged into one string, as its `class?: string` prop takes it.
|
|
692
|
-
protected mergedClass(element: ElementNode, classAttribute: NamedAttribute | undefined, spreads: boolean): void {
|
|
706
|
+
// `class` as written: the shorthand alone or merged with a static attribute is a string; with an expression or spreads, an array of every source, which a component gets merged into one string, as its `class?: string` prop takes it. With `handing`, the `parts` a component call that hands parts on gets in its place, laid over the `parts` it writes.
|
|
707
|
+
protected mergedClass(element: ElementNode, classAttribute: NamedAttribute | undefined, spreads: boolean, handing?: readonly Attribute[], together = false): void {
|
|
693
708
|
const { b } = this
|
|
694
709
|
const shorthand = element.classes.length > 0 ? this.shorthand(element) : undefined
|
|
695
710
|
const parts = partsOf(element, this.src, this.facts.parts)
|
|
@@ -703,7 +718,7 @@ export abstract class TemplateWriter {
|
|
|
703
718
|
}
|
|
704
719
|
|
|
705
720
|
// A literal is kept as text, so the ones side by side resolve together.
|
|
706
|
-
const items:
|
|
721
|
+
const items: ClassItem[] = []
|
|
707
722
|
|
|
708
723
|
if (shorthand !== undefined)
|
|
709
724
|
items.push({ text: shorthand })
|
|
@@ -718,38 +733,15 @@ export abstract class TemplateWriter {
|
|
|
718
733
|
}
|
|
719
734
|
|
|
720
735
|
// The parts handed on come before the call's own, so the entry the caller gives the called component's root is the last word.
|
|
721
|
-
for (const part of handed)
|
|
722
|
-
items.push(
|
|
723
|
-
emit: () => {
|
|
724
|
-
b.add(`${helperName('partHanded')}(${JSON.stringify(part)}, [`)
|
|
725
|
-
|
|
726
|
-
for (const emit of this.recipeItem(part)) {
|
|
727
|
-
emit()
|
|
728
|
-
b.add(', ')
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
b.add(`${helperName('partClass')}(${PROPS}, ${JSON.stringify(part)})])`)
|
|
732
|
-
},
|
|
733
|
-
})
|
|
734
|
-
}
|
|
736
|
+
for (const part of handed)
|
|
737
|
+
items.push(handedItem(b, part, this.recipeItem(part)))
|
|
735
738
|
|
|
736
739
|
for (const part of parts)
|
|
737
740
|
items.push(...this.recipeItem(part).map(emit => ({ emit })), { emit: () => b.add(`${helperName('partClass')}(${PROPS}, ${JSON.stringify(part)})`) })
|
|
738
741
|
|
|
739
|
-
const written = this.classTable === undefined
|
|
740
|
-
? items
|
|
741
|
-
: items.reduce<typeof items>((merged, item) => {
|
|
742
|
-
const last = merged.at(-1)
|
|
743
|
-
|
|
744
|
-
if ('text' in item && last !== undefined && 'text' in last)
|
|
745
|
-
merged[merged.length - 1] = { text: this.joinLiterals([last.text, item.text]) }
|
|
746
|
-
else
|
|
747
|
-
merged.push(item)
|
|
748
|
-
|
|
749
|
-
return merged
|
|
750
|
-
}, [])
|
|
742
|
+
const written = this.classTable === undefined ? items : joinTexts(items, texts => this.joinLiterals(texts))
|
|
751
743
|
|
|
752
|
-
b
|
|
744
|
+
openClassList(b, element.component, handing, together)
|
|
753
745
|
for (const [index, item] of written.entries()) {
|
|
754
746
|
if (index > 0)
|
|
755
747
|
b.add(', ')
|
|
@@ -759,7 +751,7 @@ export abstract class TemplateWriter {
|
|
|
759
751
|
else
|
|
760
752
|
item.emit()
|
|
761
753
|
}
|
|
762
|
-
b
|
|
754
|
+
closeHandParts(b, element.component, handing, together)
|
|
763
755
|
}
|
|
764
756
|
|
|
765
757
|
// What a component receives as `children` or a slot: a lone line of text as its string or values, as JSX passes it, anything else rendered.
|
|
@@ -12,7 +12,7 @@ const NAMES_KAY = /["']kay["']/
|
|
|
12
12
|
const EXPORT = /\bexport\b/
|
|
13
13
|
|
|
14
14
|
// The entries `persisted` carries, one per storage.
|
|
15
|
-
export const PERSISTED_ENTRIES = new Set(['cookie', 'local', 'session'
|
|
15
|
+
export const PERSISTED_ENTRIES = new Set(['cookie', 'local', 'session'])
|
|
16
16
|
|
|
17
17
|
// The names a module exports as `export const name = signal(...)`, or `persisted`, `linked`, `queryParam`, `memo`, `debounced`, `throttled` or `live`, called as imported from `kay`: what a component importing them writes by assigning, and reads by calling.
|
|
18
18
|
export function moduleSignals(source: string, jsx = false): Record<string, SignalKind> {
|
|
@@ -56,7 +56,7 @@ function allTypes(specifiers: Node[]): boolean {
|
|
|
56
56
|
return specifiers.length > 0 && specifiers.every(specifier => (specifier.type === 'ImportSpecifier' && specifier.importKind === 'type') || (specifier.type === 'ExportSpecifier' && specifier.exportKind === 'type'))
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// The local name a call's callee makes a signal by: `signal` of `signal(...)`, and `persisted` of `persisted.local(...)`, `.session`,
|
|
59
|
+
// The local name a call's callee makes a signal by: `signal` of `signal(...)`, and `persisted` of `persisted.local(...)`, `.session`, and `.cookie`, which make one.
|
|
60
60
|
function madeBy(callee: Node, persisted: Set<string>): string | undefined {
|
|
61
61
|
if (callee.type === 'Identifier')
|
|
62
62
|
return callee.name
|
package/src/compiler/names.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function defaultName(index: number): string {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// What the editor leaves out of completions: the names above a completion can reach, and what the generated code imports or declares.
|
|
39
|
-
export const GENERATED_NAME = new RegExp(`^(?:${[PROPS, VALUES, CURRENT, 'kayEvent', 'kayMatched', 'kayAwaited', 'kayEach'].join('|')}|${DEFAULT_PREFIX}\\d+|Kay(?:Default|LoopFor|StaticFor|Show|Omit|ComponentClass|PartClass|PartsClass|PartOf|HandedPart|Dynamic|TemplateHelpers|Island|IslandBrand|HydrateWhen|Href|Html|ComputedHtml|Field|FormValues|FormError|Prop|PlainProp|FunctionProp|PromotedProp|PromotedFunctionProp|HandsPart|Children|Row|List|Truthy|Unmatched|Keyed|Radio|Writable|WriteTo|UpdateTo|WriteBack|UpdateBack|Bound|Bindable|Handed|PageContext|PrerenderedContext|PageSettings|QueryOf|PageData|JSX|FormAction|RegisterActions|ActionStub|ReviveActions|UseHead|Await|Awaited|Try))$`)
|
|
39
|
+
export const GENERATED_NAME = new RegExp(`^(?:${[PROPS, VALUES, CURRENT, 'kayEvent', 'kayMatched', 'kayAwaited', 'kayEach'].join('|')}|${DEFAULT_PREFIX}\\d+|Kay(?:Default|LoopFor|StaticFor|Show|Omit|ComponentClass|PartClass|PartsClass|PartProps|HandParts|PartOf|HandedPart|Dynamic|TemplateHelpers|Island|IslandBrand|IslandAsked|IslandExport|HydrateWhen|Href|Html|ComputedHtml|Field|FormValues|FormError|Prop|PlainProp|FunctionProp|PromotedProp|PromotedFunctionProp|HandsPart|Children|Row|List|Truthy|Unmatched|Keyed|Radio|Writable|WriteTo|UpdateTo|WriteBack|UpdateBack|Bound|Bindable|Handed|PageContext|PrerenderedContext|PageSettings|QueryOf|PageData|JSX|FormAction|RegisterActions|ActionStub|ReviveActions|UseHead|Await|Awaited|Try))$`)
|
|
40
40
|
|
|
41
41
|
// The app's `src/await-failed.kay`, and the message keys it words.
|
|
42
42
|
export interface AwaitAlert {
|
|
@@ -5,6 +5,17 @@ export const PAGE = 'page'
|
|
|
5
5
|
// The settings that moved from `page` into its `seo` group in 1.105.
|
|
6
6
|
export const SEO_SETTINGS: readonly string[] = ['noindex', 'sitemap', 'lastmod', 'search', 'feed']
|
|
7
7
|
|
|
8
|
+
// The report for a key `page` held before 1.105 and no longer reads, which fails the build naming where it is written now.
|
|
9
|
+
export function movedSettingReport(key: string): { message: string, help: string } | undefined {
|
|
10
|
+
if (SEO_SETTINGS.includes(key))
|
|
11
|
+
return { message: `\`${key}\` is a setting of \`seo\`, not of \`page\`, since 1.105`, help: `write \`page = { seo: { ${key}: ... } }\`` }
|
|
12
|
+
|
|
13
|
+
if (key === 'ttl' || key === 'cacheControl')
|
|
14
|
+
return { message: `\`${key}\` is \`cache\` since 1.105, which sets the lifetime and the \`cache-control\` of the page in one place`, help: 'write `cache: \'1h\'`, `cache: { browser, shared, swr }`, `cache: \'private\'` or `cache: false`' }
|
|
15
|
+
|
|
16
|
+
return undefined
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
// The report for a `guards` or `layouts` setting the server cannot read, shared by the compiler and `kay check` so both say it alike.
|
|
9
20
|
export function unreadSettingReport(key: string): { message: string, help: string } {
|
|
10
21
|
return {
|