@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
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { Details, ElementNode, Span } from './ast'
|
|
2
|
-
import type { Named } from './deprecated-ui-props'
|
|
3
|
-
|
|
4
|
-
// The keys of `labels` a `Chat` takes, as its messages (`ai.chat.<key>`) are keyed.
|
|
5
|
-
const CHAT_KEYS = ['field', 'started', 'send', 'stop', 'retry', 'thinking', 'error', 'sources', 'stopped', 'table', 'reasoning', 'running', 'done', 'failed', 'arguments', 'result', 'approval', 'allow', 'deny', 'allowed', 'denied', 'new', 'attach', 'remove', 'attachRefused', 'attachTooBig', 'attachFull', 'regenerate', 'edit', 'save', 'cancel', 'editEmpty', 'editBusy', 'record', 'transcribing', 'unheard', 'transcribeFailed', 'conversations', 'untitled', 'rename', 'delete', 'deleteConfirm', 'conflict', 'loadFailed', 'changeFailed', 'signedOut']
|
|
6
|
-
const LAUNCHER_KEYS = ['open', 'close', 'expand', 'collapse']
|
|
7
|
-
|
|
8
|
-
const IDENTIFIER = /^[A-Z_$][\w$]*$/i
|
|
9
|
-
const WHITESPACE = /\s/
|
|
10
|
-
|
|
11
|
-
// The two keys whose flat prop was named for what it said rather than for its message.
|
|
12
|
-
const RENAMED: Record<string, string> = { waitingLabel: 'thinking', failureLabel: 'error' }
|
|
13
|
-
|
|
14
|
-
// The flat props of each component, by the library's file, and the key of `labels` each is.
|
|
15
|
-
const FLAT: Record<string, ReadonlyMap<string, string>> = {
|
|
16
|
-
'ai/chat': flat(CHAT_KEYS),
|
|
17
|
-
'ai/chat-launcher': flat([...CHAT_KEYS, ...LAUNCHER_KEYS]),
|
|
18
|
-
'ai/chat-panel': flat(['open', 'close', 'new', 'expand', 'collapse']),
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function flat(keys: readonly string[]): ReadonlyMap<string, string> {
|
|
22
|
-
const props = new Map(keys.map(key => [`${key}Label`, key]))
|
|
23
|
-
|
|
24
|
-
for (const [prop, key] of Object.entries(RENAMED)) {
|
|
25
|
-
if (props.delete(`${key}Label`))
|
|
26
|
-
props.set(prop, key)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return props
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
type Report = (span: Span, message: string, details: Details) => void
|
|
33
|
-
|
|
34
|
-
// The `<key>Label` props of a kayjs-ai chat component, `labels={{ key: ... }}` since 1.105: one object keyed as the messages are, in place of up to 45 props that each held one text. Found on a component bound to the library's file; the fix writes the first of them as `labels` holding every one, and offers none beside a `labels` already written or a bare `sendLabel` with no value.
|
|
35
|
-
export function deprecatedAiLabels(element: ElementNode, file: string, text: (span: Span) => string, report: Report): void {
|
|
36
|
-
const props = FLAT[file]
|
|
37
|
-
|
|
38
|
-
if (props === undefined)
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
const attributes = element.attributes.filter((attribute): attribute is Named => attribute.kind !== 'spread')
|
|
42
|
-
const old = attributes.filter(attribute => props.has(text(attribute.name)))
|
|
43
|
-
const first = old[0]
|
|
44
|
-
|
|
45
|
-
if (first === undefined)
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
const written = attributes.some(attribute => text(attribute.name) === 'labels')
|
|
49
|
-
const entries = old.map((attribute) => {
|
|
50
|
-
const key = props.get(text(attribute.name))!
|
|
51
|
-
const name = IDENTIFIER.test(key) ? key : JSON.stringify(key)
|
|
52
|
-
|
|
53
|
-
if (attribute.kind === 'static')
|
|
54
|
-
return { attribute, entry: `${name}: ${JSON.stringify(attribute.text)}`, end: attribute.value.end + 1 }
|
|
55
|
-
|
|
56
|
-
if (attribute.kind === 'expression') {
|
|
57
|
-
return attribute.shorthand
|
|
58
|
-
? { attribute, entry: `${name}: ${text(attribute.name)}`, end: attribute.shorthand.end }
|
|
59
|
-
: { attribute, entry: `${name}: ${text(attribute.expression).trim()}`, end: attribute.expression.end + 1 }
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return undefined
|
|
63
|
-
})
|
|
64
|
-
const found = entries.filter(one => one !== undefined)
|
|
65
|
-
const message = `The \`<key>Label\` props of \`${element.name}\` are one \`labels\` object since 1.105, keyed as its messages are: \`labels={{ send: ... }}\``
|
|
66
|
-
|
|
67
|
-
if (written || found.length < entries.length)
|
|
68
|
-
report(first.name, message, { help: 'Move each into `labels`' })
|
|
69
|
-
else
|
|
70
|
-
report(first.name, message, { help: 'Write `labels`', fixes: [{ title: 'Write `labels`', safe: true, edits: edits(found, text) }] })
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// The first prop becomes `labels={{ ... }}` and each other one goes, with the blank before it.
|
|
74
|
-
function edits(entries: { attribute: Named, entry: string, end: number }[], text: (span: Span) => string): { start: number, end: number, text: string }[] {
|
|
75
|
-
const [first, ...rest] = entries
|
|
76
|
-
const object = `labels={{ ${entries.map(({ entry }) => entry).join(', ')} }}`
|
|
77
|
-
|
|
78
|
-
return [
|
|
79
|
-
{ start: start(first!.attribute), end: first!.end, text: object },
|
|
80
|
-
...rest.map(({ attribute, end }) => ({ start: blank(attribute, text), end, text: '' })),
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function start(attribute: Named): number {
|
|
85
|
-
return attribute.kind === 'expression' && attribute.shorthand ? attribute.shorthand.start : attribute.name.start
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Where the blank before an attribute begins, found in the text of its own line so a removal leaves the others as they were.
|
|
89
|
-
function blank(attribute: Named, text: (span: Span) => string): number {
|
|
90
|
-
const at = start(attribute)
|
|
91
|
-
let from = at
|
|
92
|
-
|
|
93
|
-
while (from > 0 && WHITESPACE.test(text({ start: from - 1, end: from })))
|
|
94
|
-
from--
|
|
95
|
-
|
|
96
|
-
return from
|
|
97
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { Details, ElementNode, Span } from './ast'
|
|
2
|
-
import type { Named } from './deprecated-ui-props'
|
|
3
|
-
|
|
4
|
-
type Report = (span: Span, message: string, details: Details) => void
|
|
5
|
-
|
|
6
|
-
const PLAIN_PATH = /^[\w$]+(?:\.[\w$]+)*$/
|
|
7
|
-
|
|
8
|
-
const MESSAGE = 'Which links open in a new tab is `newTab` since 1.105, as the links of kayjs-ui take it: `true`, `false` or `\'auto\'`, which opens a link to a page of this site in place'
|
|
9
|
-
|
|
10
|
-
// `Chat`'s `links` and `Sources`' `here`, `newTab` since 1.105: `links="apart"` is `newTab={true}`, `links="here"` and `here` are `newTab="auto"`. Found on a component bound to the library's file; the fix offers none beside a `newTab` already written, or a value it cannot read.
|
|
11
|
-
export function deprecatedAiLinks(element: ElementNode, file: string, text: (span: Span) => string, report: Report): void {
|
|
12
|
-
if (file !== 'ai/chat' && file !== 'ai/chat-sources')
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
const attributes = element.attributes.filter((attribute): attribute is Named => attribute.kind !== 'spread')
|
|
16
|
-
const old = attributes.find(attribute => text(attribute.name) === (file === 'ai/chat' ? 'links' : 'here'))
|
|
17
|
-
|
|
18
|
-
if (old === undefined)
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
const replacement = file === 'ai/chat' ? links(old) : here(old, text)
|
|
22
|
-
|
|
23
|
-
if (attributes.some(attribute => text(attribute.name) === 'newTab') || replacement === undefined) {
|
|
24
|
-
report(old.name, MESSAGE, { help: 'Write `newTab` and drop the old prop' })
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const start = old.kind === 'expression' && old.shorthand ? old.shorthand.start : old.name.start
|
|
30
|
-
const end = endOf(old)
|
|
31
|
-
|
|
32
|
-
report(old.name, MESSAGE, { help: 'Write `newTab`', fixes: [{ title: 'Write `newTab`', safe: true, edits: [{ start, end, text: replacement }] }] })
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function endOf(attribute: Named): number {
|
|
36
|
-
if (attribute.kind === 'static')
|
|
37
|
-
return attribute.value.end + 1
|
|
38
|
-
|
|
39
|
-
if (attribute.kind === 'expression')
|
|
40
|
-
return (attribute.shorthand ?? { end: attribute.expression.end + 1 }).end
|
|
41
|
-
|
|
42
|
-
return attribute.name.end
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const LINKS: Record<string, string> = { apart: 'newTab={true}', here: 'newTab="auto"' }
|
|
46
|
-
|
|
47
|
-
function links(attribute: Named): string | undefined {
|
|
48
|
-
return attribute.kind === 'static' ? LINKS[attribute.text] : undefined
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function here(attribute: Named, text: (span: Span) => string): string | undefined {
|
|
52
|
-
if (attribute.kind === 'boolean')
|
|
53
|
-
return 'newTab="auto"'
|
|
54
|
-
|
|
55
|
-
if (attribute.kind === 'expression') {
|
|
56
|
-
const value = attribute.shorthand ? text(attribute.name) : text(attribute.expression).trim()
|
|
57
|
-
|
|
58
|
-
// Anything but a name or a member path is parenthesised, so a conditional keeps its meaning under the new one.
|
|
59
|
-
return `newTab={${PLAIN_PATH.test(value) ? value : `(${value})`} ? 'auto' : true}`
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return undefined
|
|
63
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { Diagnostic } from './ast'
|
|
2
|
-
import { allowComments } from './allow-comments'
|
|
3
|
-
import { positionAt } from './mapping'
|
|
4
|
-
|
|
5
|
-
// Lints that no longer exist, whose `// kay-allow` comment and `lints` entry are reported by their deprecation instead of as an unknown lint. They go with `deprecated-uncaught-await`, in 1.108.
|
|
6
|
-
export type RetiredLint = 'uncaught-await'
|
|
7
|
-
export const RETIRED_LINTS: ReadonlySet<string> = new Set<RetiredLint>(['uncaught-await'])
|
|
8
|
-
|
|
9
|
-
// A `// kay-allow uncaught-await` comment: an `await` with no `catch` renders the nearest `try`'s `catch`, or an alert, since 1.105, so there is nothing left to allow.
|
|
10
|
-
export function retiredAllowComments(source: string): Diagnostic[] {
|
|
11
|
-
const found: Diagnostic[] = []
|
|
12
|
-
|
|
13
|
-
for (const comment of allowComments(source)) {
|
|
14
|
-
const index = comment.names.findIndex(({ name }) => name === 'uncaught-await')
|
|
15
|
-
|
|
16
|
-
if (index === -1)
|
|
17
|
-
continue
|
|
18
|
-
|
|
19
|
-
const { name, start } = comment.names[index]!
|
|
20
|
-
const lineStart = source.lastIndexOf('\n', comment.start - 1) + 1
|
|
21
|
-
const newline = source.indexOf('\n', comment.start)
|
|
22
|
-
const lineEnd = newline === -1 ? source.length : newline
|
|
23
|
-
let edit: { start: number, end: number }
|
|
24
|
-
|
|
25
|
-
if (comment.names.length > 1) {
|
|
26
|
-
const next = comment.names[index + 1]
|
|
27
|
-
|
|
28
|
-
// The comma after the name goes with it, or the one before the last name.
|
|
29
|
-
edit = next ? { start, end: next.start } : { start: source.lastIndexOf(',', start), end: start + name.length }
|
|
30
|
-
}
|
|
31
|
-
else if (source.slice(lineStart, comment.start).trim() === '') {
|
|
32
|
-
edit = { start: lineStart, end: newline === -1 ? lineEnd : lineEnd + 1 }
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
edit = { start: lineStart + source.slice(lineStart, comment.start).trimEnd().length, end: lineEnd }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
found.push({
|
|
39
|
-
start,
|
|
40
|
-
end: start + name.length,
|
|
41
|
-
code: 'deprecated-uncaught-await',
|
|
42
|
-
checkOnly: true,
|
|
43
|
-
message: `\`uncaught-await\` is gone since 1.105 (line ${positionAt(source, start).line})`,
|
|
44
|
-
help: 'an `await` with no `catch` renders the `catch` of the `try` around it, or an alert, so the comment allows nothing: remove it',
|
|
45
|
-
fixes: [{ title: 'Remove the comment', safe: true, edits: [{ ...edit, text: '' }] }],
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return found
|
|
50
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Lint } from './lints'
|
|
2
|
-
|
|
3
|
-
// The deprecated lints of kayjs-auth's methods, apart from the others to keep the file short.
|
|
4
|
-
export const AUTH_LINTS = {
|
|
5
|
-
'deprecated-auth-methods': {
|
|
6
|
-
level: 'warn',
|
|
7
|
-
group: 'deprecated',
|
|
8
|
-
since: '1.105',
|
|
9
|
-
site: true,
|
|
10
|
-
summary: 'kayjs-auth\'s methods under the names they had before 1.105, when the verbs of a group differed and some methods sat on `auth` itself: every group lists with `list`, reads with `get`, writes with `create` and `update`, removes with `delete` and takes back with `revoke`. `organizations.members`, `invitations`, `myInvitations` and `invitation` are `listMembers`, `listInvitations`, `listMyInvitations` and `getInvitation`, `setMemberRoles` and `removeMember` are `updateMemberRoles` and `deleteMember`; `admin.roles` and `admin.auditLog` are `listRoles` and `listAuditLog`; `oauthServer.clients` is `listClients`; `passkeys.rename` is `passkeys.update`; `account.changeUsername`, `profile` and `saveProfile` are `updateUsername`, `getProfile` and `updateProfile`; `oauth.identities` and `providerToken` are `listIdentities` and `getProviderToken`; `magicLink.signInWithCode` is `email.signInWithCode`, the code being the email\'s. The methods on `auth` went into the group they belong to: `requireAdmin()` is `admin.require()`, `captchaRequired()` and `captchaChallenge()` are `captcha.required()` and `captcha.challenge()`, `provedLately()` and `reprove()` are `proof.recent()` and `proof.renew()`, `scopes()` and `hasScope()` are `tokens.scopes()` and `tokens.hasScope()`, and `oauthResource()`, `oauthOrigin()` and `oauthFixed()` are `oauthServer.resource()`, `origin()` and `fixed()`. The old names work until 1.108. Found on a call whose receiver is named `auth` (`ctx.locals.auth`, `locals.auth`), in the TypeScript files and `.kay` files of the project, a template expression excluded; the fix writes the new name.',
|
|
11
|
-
wrong: '// src/admin.ts\nexport async function members(auth: Auth, org: string) {\n await auth.requireAdmin()\n\n return auth.organizations.members(org)\n}',
|
|
12
|
-
right: '// src/admin.ts\nexport async function members(auth: Auth, org: string) {\n await auth.admin.require()\n\n return auth.organizations.listMembers(org)\n}',
|
|
13
|
-
},
|
|
14
|
-
} as const satisfies Record<string, Lint>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Details, ElementNode, Span } from './ast'
|
|
2
|
-
import type { Named } from './deprecated-ui-props'
|
|
3
|
-
import { rename } from './deprecated-ui-props'
|
|
4
|
-
|
|
5
|
-
type Report = (span: Span, message: string, details: Details) => void
|
|
6
|
-
|
|
7
|
-
// kayjs-auth's `SignedIn(role=...)`, `require` since 1.105 as the guard's option is, and `SignedOut`, the `@else` block of `SignedIn` since 1.105. Found on a component bound to the library's file; `role` is renamed unless `require` is written beside it, and `SignedOut` is reported with no fix, as it joins the `SignedIn` beside it by hand.
|
|
8
|
-
export function deprecatedAuthSigned(element: ElementNode, file: string, text: (span: Span) => string, report: Report): void {
|
|
9
|
-
if (file === 'auth/signed-out') {
|
|
10
|
-
report(element.tag, '`SignedOut` is the `@else` block of `SignedIn` since 1.105: `SignedIn` with its children for a signed-in user and an `@else` block for a visitor, one component for the one check', { help: 'Write the children as an `@else` block of a `SignedIn`' })
|
|
11
|
-
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (file !== 'auth/signed-in')
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
const attributes = element.attributes.filter((attribute): attribute is Named => attribute.kind !== 'spread')
|
|
19
|
-
const role = attributes.find(attribute => text(attribute.name) === 'role')
|
|
20
|
-
|
|
21
|
-
if (role === undefined)
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
const message = '`role` of `SignedIn` is `require` since 1.105, which takes what `auth.guard({ require })` does: a role, a list of which any one passes, or a predicate'
|
|
25
|
-
|
|
26
|
-
report(role.name, message, attributes.some(attribute => text(attribute.name) === 'require')
|
|
27
|
-
? { help: 'Drop `role`, `require` is there' }
|
|
28
|
-
: { help: 'Write `require`', fixes: [{ title: 'Write `require`', edits: [rename(role, 'role', 'require')], safe: true }] })
|
|
29
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { Diagnostic, KayFile, Span } from './ast'
|
|
2
|
-
import type { ScriptAnalysis } from './script-shared'
|
|
3
|
-
import { templateFacts } from './ast'
|
|
4
|
-
|
|
5
|
-
const SEPARATOR = /[,;]/
|
|
6
|
-
const AFTER_COMMA = /^\s*,\s*/
|
|
7
|
-
const BEFORE_COMMA = /,\s*$/
|
|
8
|
-
const SNIPPET_WORD = /\bSnippet\b/g
|
|
9
|
-
const SNIPPET_ONLY = /^import\s+(?:type\s*)?\{\s*(?:type\s+)?Snippet\s*(?:,\s*)?\}/
|
|
10
|
-
|
|
11
|
-
// What leaves the props type: the member and the separator after it, or the one before the last member, or the whole type when it is the only one.
|
|
12
|
-
function removal(own: Span, previous: Span | undefined, next: Span | undefined, type: Span | undefined): { start: number, end: number, text: string } {
|
|
13
|
-
if (next)
|
|
14
|
-
return { start: own.start, end: next.start, text: '' }
|
|
15
|
-
|
|
16
|
-
return previous ? { start: previous.end, end: own.end, text: '' } : { ...type ?? own, text: '{}' }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// The `Snippet` import the removed member leaves unused, when the member was its only use: the whole line, or its specifier.
|
|
20
|
-
function unusedSnippet(source: string, script: ScriptAnalysis): { start: number, end: number, text: string }[] {
|
|
21
|
-
const binding = script.imports.find(({ local, source: from }) => local === 'Snippet' && from === 'kay')
|
|
22
|
-
|
|
23
|
-
if (!binding || source.match(SNIPPET_WORD)!.length > 2)
|
|
24
|
-
return []
|
|
25
|
-
|
|
26
|
-
const line = source.slice(binding.declaration.start, binding.declaration.end)
|
|
27
|
-
|
|
28
|
-
if (SNIPPET_ONLY.test(line)) {
|
|
29
|
-
const end = source[binding.declaration.end] === '\n' ? binding.declaration.end + 1 : binding.declaration.end
|
|
30
|
-
|
|
31
|
-
return [{ start: binding.declaration.start, end: source[end] === '\n' ? end + 1 : end, text: '' }]
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const after = AFTER_COMMA.exec(source.slice(binding.span.end))
|
|
35
|
-
|
|
36
|
-
if (after)
|
|
37
|
-
return [{ start: binding.span.start, end: binding.span.end + after[0].length, text: '' }]
|
|
38
|
-
|
|
39
|
-
const before = BEFORE_COMMA.exec(source.slice(0, binding.span.start))
|
|
40
|
-
|
|
41
|
-
return before ? [{ start: binding.span.start - before[0].length, end: binding.span.end, text: '' }] : []
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// A component taking `children?: Snippet` beside a bare `slot`, which the template says already: the props type declares the children only to require them (`children: Snippet`) or to type what a block gets.
|
|
45
|
-
// The fix drops the member, when nothing reads `children` as a prop.
|
|
46
|
-
export function deprecatedChildrenProp(file: KayFile, script: ScriptAnalysis): Diagnostic[] {
|
|
47
|
-
const props = script.props
|
|
48
|
-
const member = props?.children
|
|
49
|
-
|
|
50
|
-
if (!props || !member || props.name || props.rest || props.bindings.some(binding => binding.key === 'children') || !templateFacts(file).childrenSlot)
|
|
51
|
-
return []
|
|
52
|
-
|
|
53
|
-
// A member's span takes its separator along.
|
|
54
|
-
const bare = (span: Span) => ({ start: span.start, end: span.end - (SEPARATOR.test(file.source[span.end - 1] ?? '') ? 1 : 0) })
|
|
55
|
-
const own = bare(member.span)
|
|
56
|
-
const edits = [removal(own, member.previous && bare(member.previous), member.next, props.type), ...unusedSnippet(file.source, script)]
|
|
57
|
-
|
|
58
|
-
return [{
|
|
59
|
-
...own,
|
|
60
|
-
code: 'deprecated-children-prop',
|
|
61
|
-
checkOnly: true,
|
|
62
|
-
message: '`children?: Snippet` is declared by the template since 1.105: a `slot` takes children with no declaration',
|
|
63
|
-
help: 'remove it from the props type; write `children: Snippet` to require them',
|
|
64
|
-
fixes: [{ title: 'Remove `children`', safe: true, edits }],
|
|
65
|
-
}]
|
|
66
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type { Details, ElementNode, Span } from './ast'
|
|
2
|
-
|
|
3
|
-
type Report = (span: Span, message: string, details: Details) => void
|
|
4
|
-
|
|
5
|
-
// `image(hero)` or `image(hero, { sizes: '100vw', aspect: '1/1' })`: a name or a member path, then an object written as `key: value` pairs.
|
|
6
|
-
const IMAGE_CALL = /^image\(\s*([\w$.]+)\s*(?:,\s*(?:\{([^{}]*)\}\s*(?:,\s*)?)?)?\)$/
|
|
7
|
-
const SIZED = /\b(?:width|height)\b/
|
|
8
|
-
// The options of `image()` an `img` takes as attributes since 1.105.
|
|
9
|
-
const OPTIONS = new Set(['sizes', 'aspect', 'quality', 'placeholder', 'width', 'height'])
|
|
10
|
-
const PAIR = /^([A-Z]+)\s*:\s*(\S[\s\S]*)$/i
|
|
11
|
-
const STRING_VALUE = /^(?:'([^'\\"{}]*)'|"([^'\\"{}]*)")$/
|
|
12
|
-
|
|
13
|
-
// The `key: value` pairs of an object body, split at the commas outside quotes, brackets and braces; undefined when a pair is not that shape.
|
|
14
|
-
function pairsOf(body: string): [string, string][] | undefined {
|
|
15
|
-
const parts: string[] = []
|
|
16
|
-
let depth = 0
|
|
17
|
-
let quote = ''
|
|
18
|
-
let from = 0
|
|
19
|
-
|
|
20
|
-
for (let at = 0; at < body.length; at++) {
|
|
21
|
-
const char = body[at]!
|
|
22
|
-
|
|
23
|
-
if (quote !== '') {
|
|
24
|
-
if (char === '\\')
|
|
25
|
-
at++
|
|
26
|
-
else if (char === quote)
|
|
27
|
-
quote = ''
|
|
28
|
-
}
|
|
29
|
-
else if (char === '\'' || char === '"' || char === '`') {
|
|
30
|
-
quote = char
|
|
31
|
-
}
|
|
32
|
-
else if ('([{'.includes(char)) {
|
|
33
|
-
depth++
|
|
34
|
-
}
|
|
35
|
-
else if (')]}'.includes(char)) {
|
|
36
|
-
depth--
|
|
37
|
-
}
|
|
38
|
-
else if (char === ',' && depth === 0) {
|
|
39
|
-
parts.push(body.slice(from, at))
|
|
40
|
-
from = at + 1
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
parts.push(body.slice(from))
|
|
45
|
-
|
|
46
|
-
const pairs: [string, string][] = []
|
|
47
|
-
|
|
48
|
-
for (const part of parts.map(each => each.trim()).filter(each => each !== '')) {
|
|
49
|
-
const pair = PAIR.exec(part)
|
|
50
|
-
|
|
51
|
-
if (!pair || !OPTIONS.has(pair[1]!))
|
|
52
|
-
return undefined
|
|
53
|
-
|
|
54
|
-
pairs.push([pair[1]!, pair[2]!.trim()])
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return pairs
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// The attribute an option becomes: a string as it is written, anything else as an expression.
|
|
61
|
-
function attributeOf(name: string, value: string): string {
|
|
62
|
-
const text = STRING_VALUE.exec(value)
|
|
63
|
-
|
|
64
|
-
return text ? `${name}="${text[1] ?? text[2]}"` : `${name}={${value}}`
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// What an `img` wrote before 1.105 for the options of the image it shows: `no-placeholder` is `placeholder={false}`, and `{...image(hero, { aspect: '1/1' })}` is `src={hero} aspect="1/1"`.
|
|
68
|
-
export function deprecatedImage(element: ElementNode, text: (span: Span) => string, report: Report): void {
|
|
69
|
-
const writes = (name: string) => element.attributes.some(attribute => attribute.kind !== 'spread' && text(attribute.name) === name)
|
|
70
|
-
|
|
71
|
-
for (const attribute of element.attributes) {
|
|
72
|
-
if (attribute.kind === 'boolean' && text(attribute.name) === 'no-placeholder') {
|
|
73
|
-
report(attribute.name, '`no-placeholder` is `placeholder={false}` since 1.105, as every other option of an image is an attribute', writes('placeholder')
|
|
74
|
-
? { help: 'Drop `no-placeholder`, `placeholder` is there' }
|
|
75
|
-
: { help: 'Write `placeholder={false}`', fixes: [{ title: 'Write `placeholder={false}`', edits: [{ start: attribute.name.start, end: attribute.name.end, text: 'placeholder={false}' }], safe: true }] })
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (attribute.kind !== 'spread')
|
|
79
|
-
continue
|
|
80
|
-
|
|
81
|
-
const written = text(attribute.expression).trim()
|
|
82
|
-
const call = IMAGE_CALL.exec(written)
|
|
83
|
-
|
|
84
|
-
if (!call) {
|
|
85
|
-
if (written.startsWith('image(') && !SIZED.test(written))
|
|
86
|
-
report(attribute.expression, '`image()` is for an element that is no `img` since 1.105: `img(src={hero} aspect="1/1")` takes its options as attributes', { help: 'Write the image as `src={hero}` with the options as attributes' })
|
|
87
|
-
|
|
88
|
-
continue
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const pairs = call[2] === undefined ? [] : pairsOf(call[2])
|
|
92
|
-
|
|
93
|
-
// A size given to `image()` is for a source kay did not import, which an `img` leaves as it is: `image()` stays how those are written.
|
|
94
|
-
if (pairs?.some(([name]) => name === 'width' || name === 'height'))
|
|
95
|
-
continue
|
|
96
|
-
|
|
97
|
-
const clash = pairs?.some(([name]) => writes(name)) === true || writes('src')
|
|
98
|
-
const others = element.attributes.filter(other => other.kind === 'spread').length > 1
|
|
99
|
-
const message = '`image()` is for an element that is no `img` since 1.105: `img(src={hero} aspect="1/1")` takes its options as attributes'
|
|
100
|
-
|
|
101
|
-
if (!pairs || clash || others) {
|
|
102
|
-
report(attribute.expression, message, { help: 'Write the image as `src={hero}` with the options as attributes' })
|
|
103
|
-
|
|
104
|
-
continue
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const attributes = [`src={${call[1]}}`, ...pairs.map(([name, value]) => attributeOf(name, value))]
|
|
108
|
-
// The span of the whole `{ ...image(hero) }`: the expression has neither its braces nor its dots.
|
|
109
|
-
const reach = 40
|
|
110
|
-
const before = Math.max(0, attribute.expression.start - reach)
|
|
111
|
-
const start = before + text({ start: before, end: attribute.expression.start }).lastIndexOf('{')
|
|
112
|
-
const end = attribute.expression.end + text({ start: attribute.expression.end, end: attribute.expression.end + reach }).indexOf('}') + 1
|
|
113
|
-
|
|
114
|
-
report(attribute.expression, message, { help: 'Write the image as `src={hero}` with the options as attributes', fixes: [{ title: 'Write the options as attributes', edits: [{ start, end, text: attributes.join(' ') }], safe: true }] })
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import type { Diagnostic, Fix, KayFile, Span } from './ast'
|
|
2
|
-
import type { ScriptAnalysis } from './script'
|
|
3
|
-
import { elementsIn } from './ast'
|
|
4
|
-
import { islandExport } from './island-arguments'
|
|
5
|
-
import { declaredIsland, readableCall } from './island-declaration'
|
|
6
|
-
|
|
7
|
-
const FENCE_WORD = /^---([ \t]+)(client|island|static)\b/
|
|
8
|
-
const LABELED_LINE = /^---[ \t]*[a-z<]/
|
|
9
|
-
const TRAILING_COMMA = /,$/
|
|
10
|
-
// Text holding line comments alone, which a dropped module fence hands to the call.
|
|
11
|
-
const onlyComments = (text: string): boolean => text.split('\n').every(line => line.trim() === '' || line.trimStart().startsWith('//'))
|
|
12
|
-
|
|
13
|
-
// The line ending a file writes, which what a fix inserts follows.
|
|
14
|
-
export const eolOf = (source: string): string => source.includes('\r\n') ? '\r\n' : '\n'
|
|
15
|
-
// A `//` comment closing the text, which would swallow what a call writes after it on the same line.
|
|
16
|
-
const LINE_COMMENT_END = /\/\/[^\n]*$/
|
|
17
|
-
|
|
18
|
-
// The object an `export const island = { ... }` of the module fence gives, without its `as const`: its properties as written, and the statement to take out.
|
|
19
|
-
function exportedObject(script: ScriptAnalysis): { properties: string, statement: { start: number, end: number } } | undefined {
|
|
20
|
-
const asked = islandExport(script)
|
|
21
|
-
const fence = script.moduleFence
|
|
22
|
-
|
|
23
|
-
if (asked?.form !== 'const' || fence === undefined)
|
|
24
|
-
return undefined
|
|
25
|
-
|
|
26
|
-
for (const statement of fence.ast.body) {
|
|
27
|
-
if (statement.type !== 'ExportNamedDeclaration' || statement.declaration?.type !== 'VariableDeclaration')
|
|
28
|
-
continue
|
|
29
|
-
|
|
30
|
-
const init = statement.declaration.declarations.find(declarator => declarator.id.type === 'Identifier' && declarator.id.name === 'island')?.init
|
|
31
|
-
const object = init?.type === 'TSAsExpression' || init?.type === 'TSSatisfiesExpression' ? init.expression : init
|
|
32
|
-
|
|
33
|
-
if (object?.type !== 'ObjectExpression')
|
|
34
|
-
return undefined
|
|
35
|
-
|
|
36
|
-
const inner = fence.code.slice(object.start + 1, object.end - 1).trim().replace(TRAILING_COMMA, '')
|
|
37
|
-
|
|
38
|
-
return { properties: inner, statement: asked.span }
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return undefined
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// The edit taking the word `island`, `static` or `client` off a script fence line: a bare `---` opens the script only as the first fence of the file, so after a named fence the line keeps `script`. `before` is the text above the line that stays.
|
|
45
|
-
export function wordEdit(line: Span, wordEnd: number, before: string): Fix['edits'][number] {
|
|
46
|
-
return before.trim() === '' ? { start: line.start + 3, end: wordEnd, text: '' } : { start: line.start + 4, end: wordEnd, text: 'script' }
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// An `island()` call in a `--- module` fence, which declares nothing there: the call belongs to the component's script.
|
|
50
|
-
function islandInModule(file: KayFile): Diagnostic[] {
|
|
51
|
-
const declared = file.module === undefined ? undefined : declaredIsland(file.source, file.module)
|
|
52
|
-
|
|
53
|
-
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' }]
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// What a fence or a module fence says wrongly beside an `island()` call.
|
|
57
|
-
export const islandProblems = (file: KayFile): Diagnostic[] => [...fenceBesideCall(file), ...islandInModule(file)]
|
|
58
|
-
|
|
59
|
-
// A fence line naming a role beside an `island()` call: the two say it twice, and the fence line would win over the call. The fix drops the word, which may change the role the call says.
|
|
60
|
-
export function fenceBesideCall(file: KayFile): Diagnostic[] {
|
|
61
|
-
const island = file.island
|
|
62
|
-
const line = file.scriptLine
|
|
63
|
-
const fence = [file.client !== island?.span ? file.client : undefined, file.pin?.start !== island?.span.start ? file.pin : undefined].find(span => span !== undefined)
|
|
64
|
-
|
|
65
|
-
if (island === undefined || line === undefined || fence === undefined)
|
|
66
|
-
return []
|
|
67
|
-
|
|
68
|
-
return [{ ...fence, code: 'fence-invalid', message: 'A fence line and `island()` both say how the component renders', help: 'keep `island()` and write `---` for the fence line', fixes: [{ title: 'Drop the fence word', safe: false, edits: [wordEdit(line, fence.end, file.source.slice(0, line.start))] }] }]
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// The `--- island`, `--- static` and `--- client` fence lines, and `export const island = { ... }` in a `--- module` fence, since 1.105: the script declares `island({ render, hydrate, persist })` as it declares `props<T>()`, one place for what a component says of its role. The fix moves each into the call; none when the file has no script fence line to put it in.
|
|
72
|
-
export function deprecatedIslandForms(file: KayFile, script: ScriptAnalysis): Diagnostic[] {
|
|
73
|
-
const line = file.scriptLine
|
|
74
|
-
const word = line === undefined ? null : FENCE_WORD.exec(file.source.slice(line.start, line.end))
|
|
75
|
-
const exported = exportedObject(script)
|
|
76
|
-
|
|
77
|
-
// A file that declares `island()` already says the rest there, and `ignoredIslandExport` reports the export.
|
|
78
|
-
if (line === undefined || file.script === undefined || file.island !== undefined || (word === null && exported === undefined))
|
|
79
|
-
return []
|
|
80
|
-
|
|
81
|
-
const render = word?.[2] === 'client' || word?.[2] === 'static' ? word[2] : undefined
|
|
82
|
-
const edits: Fix['edits'] = []
|
|
83
|
-
// What stays above the script's fence line.
|
|
84
|
-
let before = file.source.slice(0, line.start)
|
|
85
|
-
// The comments of a module fence that goes, written above the call.
|
|
86
|
-
let carried = ''
|
|
87
|
-
|
|
88
|
-
if (exported !== undefined) {
|
|
89
|
-
const module = file.module!
|
|
90
|
-
const rest = file.source.slice(module.start, exported.statement.start) + file.source.slice(exported.statement.end, module.end)
|
|
91
|
-
const labeled = LABELED_LINE.test(file.source.slice(module.end, module.end + 8))
|
|
92
|
-
const header = file.source.lastIndexOf('\n', module.start - 2) + 1
|
|
93
|
-
const own = file.source.startsWith('\r\n', exported.statement.end) ? 2 : Number(file.source[exported.statement.end] === '\n')
|
|
94
|
-
|
|
95
|
-
// A fence holding nothing else but comments goes with its line, when a labeled line closes it and the next fence does not need it.
|
|
96
|
-
if (onlyComments(rest) && labeled && file.source.slice(header, module.start).trim() === '--- module') {
|
|
97
|
-
edits.push({ start: header, end: module.end, text: '' })
|
|
98
|
-
carried = rest.trim()
|
|
99
|
-
// A module fence below the script line changes nothing above it.
|
|
100
|
-
before = header < line.start ? file.source.slice(0, header) + file.source.slice(module.end, line.start) : before
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
edits.push({ start: exported.statement.start, end: exported.statement.end + own, text: '' })
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (word !== null)
|
|
108
|
-
edits.push(wordEdit(line, line.start + 3 + word[1]!.length + word[2]!.length, before))
|
|
109
|
-
|
|
110
|
-
const eol = eolOf(file.source)
|
|
111
|
-
const properties = [render === undefined ? '' : `render: '${render}'`, exported?.properties ?? ''].filter(each => each !== '')
|
|
112
|
-
|
|
113
|
-
// The call goes first in the script, which a `--- client` or `--- island` fence line no longer opens.
|
|
114
|
-
edits.push({ start: file.script.start, end: file.script.start, text: `${carried === '' ? '' : `${carried}${eol}`}island(${properties.length === 0 ? '' : `{ ${properties.join(', ')}${LINE_COMMENT_END.test(properties.at(-1)!) ? eol : ' '}}`})${eol}` })
|
|
115
|
-
|
|
116
|
-
const at = word === null ? exported!.statement : { start: line.start + 3 + word[1]!.length, end: line.start + 3 + word[1]!.length + word[2]!.length }
|
|
117
|
-
|
|
118
|
-
return [{
|
|
119
|
-
...at,
|
|
120
|
-
code: 'deprecated-island-fence',
|
|
121
|
-
checkOnly: true,
|
|
122
|
-
message: word === null ? '`export const island` in a `--- module` fence is `island({ ... })` in the script, deprecated since 1.105' : `\`--- ${word[2]}\` is \`island(${render === undefined ? '' : `{ render: '${render}' }`})\` in the script, deprecated since 1.105`,
|
|
123
|
-
help: 'write `island({ render: \'client\' | \'static\', hydrate, persist, interactive })` at the top of the script, and `---` for its fence line',
|
|
124
|
-
// A value the call cannot read, a variable of the module fence, would fail in the script: the author decides.
|
|
125
|
-
...(exported === undefined || readableCall(`island({ ${exported.properties}\n})`)) && { fixes: [{ title: 'Write `island()` in the script', safe: true, edits }] },
|
|
126
|
-
}]
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// `hydrate="client"` and `server="defer"` on a component call, since 1.105: `render="client"` says how a use renders, and `hydrate` is only when it hydrates; a deferred server island is `defer` beside `server`.
|
|
130
|
-
export function deprecatedIslandAttributes(file: KayFile): Diagnostic[] {
|
|
131
|
-
const found: Diagnostic[] = []
|
|
132
|
-
|
|
133
|
-
for (const element of elementsIn(file.template)) {
|
|
134
|
-
if (!element.component)
|
|
135
|
-
continue
|
|
136
|
-
|
|
137
|
-
for (const attribute of element.attributes) {
|
|
138
|
-
if (attribute.kind !== 'static')
|
|
139
|
-
continue
|
|
140
|
-
|
|
141
|
-
const name = file.source.slice(attribute.name.start, attribute.name.end)
|
|
142
|
-
|
|
143
|
-
if (name === 'hydrate' && attribute.text === 'client')
|
|
144
|
-
found.push({ ...attribute.name, code: 'deprecated-island-attributes', checkOnly: true, message: '`hydrate="client"` is `render="client"`, deprecated since 1.105', help: 'write `render="client"`: `hydrate` is only when an island hydrates', fixes: [{ title: 'Write `render="client"`', safe: true, edits: [{ ...attribute.name, text: 'render' }] }] })
|
|
145
|
-
|
|
146
|
-
if (name === 'server' && attribute.text === 'defer') {
|
|
147
|
-
const quoted = '"\''.includes(file.source[attribute.value.end] ?? '')
|
|
148
|
-
|
|
149
|
-
found.push({ ...attribute.name, code: 'deprecated-island-attributes', checkOnly: true, message: '`server="defer"` is `server defer`, deprecated since 1.105', help: 'write `server defer`', fixes: [{ title: 'Write `server defer`', safe: true, edits: [{ start: attribute.name.start, end: attribute.value.end + (quoted ? 1 : 0), text: 'server defer' }] }] })
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return found
|
|
155
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Lint } from './lints'
|
|
2
|
-
|
|
3
|
-
// The lints of the `deprecated` group for how an island read its sources and actions before 1.105, with the others in `DEPRECATED_LINTS`.
|
|
4
|
-
export const SOURCE_READERS = {
|
|
5
|
-
'deprecated-source-readers': {
|
|
6
|
-
level: 'warn',
|
|
7
|
-
group: 'deprecated',
|
|
8
|
-
since: '1.105',
|
|
9
|
-
site: true,
|
|
10
|
-
summary: 'The readers and hooks of an island\'s sources before 1.105, which every source reads alike since: `data()` in place of `value()` (a `resource`), `last()` (a `stream` or `socket`) and `rows()` (a `local` collection), `onData` in place of `onSuccess` (a `track()` handle) and `onSync` (a collection), whose event hands `value` where they handed `data` and `rows`, an action\'s `data()` and `status()` in place of `succeeded()`, and a collection\'s `sync.queued()` and `sync.status()` in place of `unsynced()` and `syncStatus()`. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `resource`, `stream`, `socket` or `local` from `kay` or to a `.track()` call, as `kay check` reads no types: a source reached through a property, a prop or another file is not found; `succeeded()` is found on any receiver. The fix renames the member, and the `data` or `rows` of a hook\'s inline handler to `value`; `succeeded()?.data` becomes `data()` and `succeeded() !== undefined` becomes `status() === \'ready\'`. A `succeeded()` read in any other way, a handler that is no inline function and a shorthand hook are reported with no fix.',
|
|
11
|
-
wrong: '---\nimport { local, resource } from \'kay\'\nimport notesApi from \'../api/notes\'\nimport { save } from \'./notes\'\n\nconst list = resource(notesApi, \'/\')\nconst notes = local({ key: \'id\', read: () => [], put: save })\n---\np {list.value()?.length} on the server, {notes.rows().length} here, {notes.unsynced()} waiting',
|
|
12
|
-
right: '---\nimport { local, resource } from \'kay\'\nimport notesApi from \'../api/notes\'\nimport { save } from \'./notes\'\n\nconst list = resource(notesApi, \'/\')\nconst notes = local({ key: \'id\', read: () => [], put: save })\n---\np {list.data()?.length} on the server, {notes.data().length} here, {notes.sync.queued()} waiting',
|
|
13
|
-
},
|
|
14
|
-
'deprecated-live-api': {
|
|
15
|
-
level: 'warn',
|
|
16
|
-
group: 'deprecated',
|
|
17
|
-
since: '1.105',
|
|
18
|
-
site: true,
|
|
19
|
-
summary: 'The forms of `set` and `presence` before 1.105, which write every live value and every room alike since: `set(next, { key })` of a value per key and `set(next, { user })` of a value per user in place of `set(key, next)` and `set(user, next)`, and `presence({ room, member })` in place of `presence(room, member)`. The old forms work until 1.108. Found in the TypeScript files and `.kay` files of the project, on a name bound once to a `live()` call from `kay`, or imported under the name of a declaration every file of the project agrees on (a value per key is one declared with a function of the key or `key: true`, per user with `user: true`), as `kay check` reads no types: a value reached through a namespace import or a property is not found. `presence` is the one imported from `kay`. The fix reorders the arguments of `set`, and writes the arguments of `presence` as one object, its options object spread into it; a `presence` given options that are no object written there is reported with no fix.',
|
|
20
|
-
wrong: '// src/live.ts\nimport { live } from \'kay\'\n\nexport const room = live((id: string) => ({ id, users: 0 }))\n\nroom.set(\'lobby\', { id: \'lobby\', users: 3 })',
|
|
21
|
-
right: '// src/live.ts\nimport { live } from \'kay\'\n\nexport const room = live((id: string) => ({ id, users: 0 }))\n\nroom.set({ id: \'lobby\', users: 3 }, { key: \'lobby\' })',
|
|
22
|
-
},
|
|
23
|
-
'deprecated-action-type': {
|
|
24
|
-
level: 'warn',
|
|
25
|
-
group: 'deprecated',
|
|
26
|
-
since: '1.105',
|
|
27
|
-
site: true,
|
|
28
|
-
summary: '`Action<never, unknown>` before 1.105, the type a prop takes to accept any action: `Action` since, whose two parameters default to it. `Action<{ name: string }, string>` keeps its input and output types, and a `.with()` action crosses into an island as any other does. The old form works until 1.108. Found on the `Action` a file imports from `kay`, under any local name, in the TypeScript files and the fences of `.kay` files. The fix drops the type arguments.',
|
|
29
|
-
wrong: '---\nimport type { Action } from \'kay\'\n\nconst { run } = props<{ run: Action<never, unknown> }>()\n---\nform(action={run})\n button Go',
|
|
30
|
-
right: '---\nimport type { Action } from \'kay\'\n\nconst { run } = props<{ run: Action }>()\n---\nform(action={run})\n button Go',
|
|
31
|
-
},
|
|
32
|
-
'deprecated-action-readers': {
|
|
33
|
-
level: 'warn',
|
|
34
|
-
group: 'deprecated',
|
|
35
|
-
since: '1.105',
|
|
36
|
-
site: true,
|
|
37
|
-
summary: 'An action\'s `failed()`, `error(field)` and `validate(form, field)` before 1.105, which a form shows and now reads from `form`: `form.failed()`, `form.error(field)` and `form.validate(form, field)`, the call state (`pending()`, `status()`, `data()`) staying on the action. The old names work until 1.108. Found in the TypeScript files and `.kay` files of the project, templates included, on a name bound once to a call of `action` from `kay`, to the `.with()` of one, or imported in lowercase from a `.kay` file, as `kay check` reads no types: an action reached through a property or a prop is not found. The fix writes `form.` before the name.',
|
|
38
|
-
wrong: '---\nimport { add } from \'./notes.kay\'\n---\nform(action={add})\n input(name="title" aria-invalid={add.error(\'title\') ? \'true\' : undefined})\n if add.failed()\n p Not saved',
|
|
39
|
-
right: '---\nimport { add } from \'./notes.kay\'\n---\nform(action={add})\n input(name="title" aria-invalid={add.form.error(\'title\') ? \'true\' : undefined})\n if add.form.failed()\n p Not saved',
|
|
40
|
-
},
|
|
41
|
-
} as const satisfies Record<string, Lint>
|